summaryrefslogtreecommitdiffstats
path: root/package/sudo/sudo.mk
blob: d36b5319d233a4bf549663a1e0144abbe8843cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#############################################################
#
# sudo
#
#############################################################

SUDO_VERSION:=1.6.8p12
#SUDO_SITE:=ftp://ftp.sudo.ws/pub/sudo/
SUDO_SITE:=$(BR2_ATMEL_MIRROR)

#SUDO_VERSION:=1.7.0
#SUDO_SITE:=http://www.courtesan.com/sudo/dist
# 1.7.0 Needs update Cross-Compiler patches


SUDO_SOURCE:=sudo-$(SUDO_VERSION).tar.gz
SUDO_DIR:=$(BUILD_DIR)/sudo-$(SUDO_VERSION)
SUDO_UNZIP:=$(ZCAT)

$(DL_DIR)/$(SUDO_SOURCE):
	 $(WGET) -P $(DL_DIR) $(SUDO_SITE)/$(SUDO_SOURCE)

sudo-source: $(DL_DIR)/$(SUDO_SOURCE) $(SUDO_CONFIG_FILE)

$(SUDO_DIR)/.unpacked: $(DL_DIR)/$(SUDO_SOURCE)
	$(SUDO_UNZIP) $(DL_DIR)/$(SUDO_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(SUDO_DIR) package/sudo sudo-$(SUDO_VERSION)\*.patch
	$(CONFIG_UPDATE) $(SUDO_DIR)
	touch $@

$(SUDO_DIR)/.configured: $(SUDO_DIR)/.unpacked $(SUDO_CONFIG_FILE)
	(cd $(SUDO_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libdir=/lib \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		$(DISABLE_LARGEFILE) \
		--without-lecture \
		--without-sendmail \
		--without-umask \
		--with-logging=syslog \
		--without-interfaces \
		--disable-authentication \
		$(SUDO_EXTRA_CONFIG) \
	)

	touch $@

$(SUDO_DIR)/sudo: $(SUDO_DIR)/.configured
	$(MAKE) -C $(SUDO_DIR)
	touch -c $@

$(TARGET_DIR)/usr/bin/sudo: $(SUDO_DIR)/sudo
	rm -f $(TARGET_DIR)/usr/bin/sudo
	rm -f $(TARGET_DIR)/usr/sbin/visudo
	rm -f $(TARGET_DIR)/etc/sudoers
	$(INSTALL) -m 0777 -D $(SUDO_DIR)/sudo $(TARGET_DIR)/usr/bin/sudo
	$(INSTALL) -m 0777 -D $(SUDO_DIR)/visudo $(TARGET_DIR)/usr/sbin/visudo
	$(STRIPCMD) $(TARGET_DIR)/usr/bin/sudo $(TARGET_DIR)/usr/sbin/visudo
	chmod 4555  $(TARGET_DIR)/usr/bin/sudo
	chmod 0555  $(TARGET_DIR)/usr/sbin/visudo
	$(INSTALL) -m 0440 -D $(SUDO_DIR)/sudoers $(TARGET_DIR)/etc/sudoers
	touch -c $(TARGET_DIR)/usr/bin/sudo

sudo: uclibc $(TARGET_DIR)/usr/bin/sudo

sudo-unpacked: $(SUDO_DIR)/.unpacked

sudo-clean:
	rm -f $(TARGET_DIR)/usr/bin/sudo $(TARGET_DIR)/etc/sudoers \
		$(TARGET_DIR)/usr/sbin/visudo
	-$(MAKE) -C $(SUDO_DIR) clean

sudo-dirclean:
	rm -rf $(SUDO_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_SUDO),y)
TARGETS+=sudo
endif

ifeq ($(BR2_PACKAGE_LIBPAM),y)
SUDO_EXTRA_CONFIG=--enable-pam
sudo: libpam
endif