open-plc-utils: new package
[buildroot-gz.git] / package / util-linux / util-linux.mk
blob766f80f2164fe54c9ae4653be2313d82c31e8204
1 ################################################################################
3 # util-linux
5 ################################################################################
7 UTIL_LINUX_VERSION = $(UTIL_LINUX_VERSION_MAJOR).1
8 UTIL_LINUX_VERSION_MAJOR = 2.26
9 UTIL_LINUX_SOURCE = util-linux-$(UTIL_LINUX_VERSION).tar.xz
10 UTIL_LINUX_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/util-linux/v$(UTIL_LINUX_VERSION_MAJOR)
12 # README.licensing claims that some files are GPLv2-only, but this is not true.
13 # Some files are GPLv3+ but only in tests.
14 UTIL_LINUX_LICENSE = GPLv2+, BSD-4c, libblkid and libmount LGPLv2.1+, libuuid BSD-3c
15 UTIL_LINUX_LICENSE_FILES = README.licensing Documentation/licenses/COPYING.GPLv2 Documentation/licenses/COPYING.UCB Documentation/licenses/COPYING.LGPLv2.1 Documentation/licenses/COPYING.BSD-3
17 UTIL_LINUX_AUTORECONF = YES
18 UTIL_LINUX_INSTALL_STAGING = YES
19 UTIL_LINUX_DEPENDENCIES = host-pkgconf
20 # uClibc needs NTP_LEGACY for sys/timex.h -> ntp_gettime() support
21 # (used in logger.c), and the common default is N.
22 UTIL_LINUX_CONF_ENV = scanf_cv_type_modifier=no \
23 $(if $(BR2_TOOLCHAIN_USES_UCLIBC),ac_cv_header_sys_timex_h=no)
24 UTIL_LINUX_CONF_OPTS += \
25 --disable-rpath \
26 --disable-makeinstall-chown \
27 --without-python
29 ifeq ($(BR2_PACKAGE_BASH),)
30 UTIL_LINUX_CONF_OPTS += \
31 --disable-bash-completion \
32 --with-bashcompletiondir=
33 endif
35 # We don't want the host-busybox dependency to be added automatically
36 HOST_UTIL_LINUX_DEPENDENCIES = host-pkgconf
38 # We also don't want the host-python dependency
39 HOST_UTIL_LINUX_CONF_OPTS = --without-python
41 # If both util-linux and busybox are selected, make certain util-linux
42 # wins the fight over who gets to have their utils actually installed
43 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
44 UTIL_LINUX_DEPENDENCIES += busybox
45 endif
47 ifeq ($(BR2_PACKAGE_NCURSES),y)
48 UTIL_LINUX_DEPENDENCIES += ncurses
49 else
50 UTIL_LINUX_CONF_OPTS += --without-ncurses
51 endif
53 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
54 UTIL_LINUX_DEPENDENCIES += gettext
55 UTIL_LINUX_MAKE_OPTS += LIBS=-lintl
56 endif
58 ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
59 UTIL_LINUX_DEPENDENCIES += libcap-ng
60 endif
62 # Used by cramfs utils
63 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_ZLIB),zlib)
65 # Used by login-utils
66 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_LINUX_PAM),linux-pam)
68 # Disable/Enable utilities
69 UTIL_LINUX_CONF_OPTS += \
70 $(if $(BR2_PACKAGE_UTIL_LINUX_AGETTY),--enable-agetty,--disable-agetty) \
71 $(if $(BR2_PACKAGE_UTIL_LINUX_ARCH),--enable-arch,--disable-arch) \
72 $(if $(BR2_PACKAGE_UTIL_LINUX_BFS),--enable-bfs,--disable-bfs) \
73 $(if $(BR2_PACKAGE_UTIL_LINUX_CHFN_CHSH),--enable-chfn-chsh,--disable-chfn-chsh) \
74 $(if $(BR2_PACKAGE_UTIL_LINUX_CRAMFS),--enable-cramfs,--disable-cramfs) \
75 $(if $(BR2_PACKAGE_UTIL_LINUX_DDATE),--enable-ddate,--disable-ddate) \
76 $(if $(BR2_PACKAGE_UTIL_LINUX_EJECT),--enable-eject,--disable-eject) \
77 $(if $(BR2_PACKAGE_UTIL_LINUX_FALLOCATE),--enable-fallocate,--disable-fallocate) \
78 $(if $(BR2_PACKAGE_UTIL_LINUX_FDFORMAT),--enable-fdformat,--disable-fdformat) \
79 $(if $(BR2_PACKAGE_UTIL_LINUX_FSCK),--enable-fsck,--disable-fsck) \
80 $(if $(BR2_PACKAGE_UTIL_LINUX_HWCLOCK),--enable-hwclock,--disable-hwclock) \
81 $(if $(BR2_PACKAGE_UTIL_LINUX_KILL),--enable-kill,--disable-kill) \
82 $(if $(BR2_PACKAGE_UTIL_LINUX_LAST),--enable-last,--disable-last) \
83 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),--enable-libblkid,--disable-libblkid) \
84 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),--enable-libmount,--disable-libmount) \
85 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBSMARTCOLS),--enable-libsmartcols,--disable-libsmartcols) \
86 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBUUID),--enable-libuuid,--disable-libuuid) \
87 $(if $(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),--enable-last --enable-login --enable-runuser --enable-su --enable-sulogin,--disable-last --disable-login --disable-runuser --disable-su --disable-sulogin) \
88 $(if $(BR2_PACKAGE_UTIL_LINUX_LOSETUP),--enable-losetup,--disable-losetup) \
89 $(if $(BR2_PACKAGE_UTIL_LINUX_MESG),--enable-mesg,--disable-mesg) \
90 $(if $(BR2_PACKAGE_UTIL_LINUX_MINIX),--enable-minix,--disable-minix) \
91 $(if $(BR2_PACKAGE_UTIL_LINUX_MORE),--enable-more,--disable-more) \
92 $(if $(BR2_PACKAGE_UTIL_LINUX_MOUNT),--enable-mount,--disable-mount) \
93 $(if $(BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT),--enable-mountpoint,--disable-mountpoint) \
94 $(if $(BR2_PACKAGE_UTIL_LINUX_NEWGRP),--enable-newgrp,--disable-newgrp) \
95 $(if $(BR2_PACKAGE_UTIL_LINUX_NOLOGIN),--enable-nologin,--disable-nologin) \
96 $(if $(BR2_PACKAGE_UTIL_LINUX_NSENTER),--enable-nsenter,--disable-nsenter) \
97 $(if $(BR2_PACKAGE_UTIL_LINUX_PARTX),--enable-partx,--disable-partx) \
98 $(if $(BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT),--enable-pivot_root,--disable-pivot_root) \
99 $(if $(BR2_PACKAGE_UTIL_LINUX_RAW),--enable-raw,--disable-raw) \
100 $(if $(BR2_PACKAGE_UTIL_LINUX_RENAME),--enable-rename,--disable-rename) \
101 $(if $(BR2_PACKAGE_UTIL_LINUX_RESET),--enable-reset,--disable-reset) \
102 $(if $(BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS),--enable-schedutils,--disable-schedutils) \
103 $(if $(BR2_PACKAGE_UTIL_LINUX_SETPRIV),--enable-setpriv,--disable-setpriv) \
104 $(if $(BR2_PACKAGE_UTIL_LINUX_SETTERM),--enable-setterm,--disable-setterm) \
105 $(if $(BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT),--enable-switch_root,--disable-switch_root) \
106 $(if $(BR2_PACKAGE_UTIL_LINUX_UL),--enable-ul,--disable-ul) \
107 $(if $(BR2_PACKAGE_UTIL_LINUX_UNSHARE),--enable-unshare,--disable-unshare) \
108 $(if $(BR2_PACKAGE_UTIL_LINUX_UTMPDUMP),--enable-utmpdump,--disable-utmpdump) \
109 $(if $(BR2_PACKAGE_UTIL_LINUX_UUIDD),--enable-uuidd,--disable-uuidd) \
110 $(if $(BR2_PACKAGE_UTIL_LINUX_VIPW),--enable-vipw,--disable-vipw) \
111 $(if $(BR2_PACKAGE_UTIL_LINUX_WALL),--enable-wall,--disable-wall) \
112 $(if $(BR2_PACKAGE_UTIL_LINUX_WDCTL),--enable-wdctl,--disable-wdctl) \
113 $(if $(BR2_PACKAGE_UTIL_LINUX_WRITE),--enable-write,--disable-write) \
114 $(if $(BR2_PACKAGE_UTIL_LINUX_ZRAMCTL),--enable-zramctl,--disable-zramctl)
116 # In the host version of util-linux, we so far only require libuuid,
117 # and none of the util-linux utilities, so we disable all of them, unless
118 # BR2_PACKAGE_HOST_UTIL_LINUX is set
120 HOST_UTIL_LINUX_CONF_OPTS += \
121 --enable-libuuid \
122 --disable-libblkid --disable-libmount \
123 --without-ncurses
125 ifeq ($(BR2_PACKAGE_HOST_UTIL_LINUX),y)
126 HOST_UTIL_LINUX_CONF_OPTS += --disable-makeinstall-chown
127 # disable more command because of ncurses dependency
128 HOST_UTIL_LINUX_CONF_OPTS += --disable-more
129 else
130 HOST_UTIL_LINUX_CONF_OPTS += --disable-all-programs
131 endif
133 # Avoid building the tools if they are disabled since we can't install on
134 # a per-directory basis.
135 ifeq ($(BR2_PACKAGE_UTIL_LINUX_BINARIES),)
136 UTIL_LINUX_CONF_OPTS += --disable-all-programs
137 endif
139 # Install PAM configuration files
140 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),y)
141 define UTIL_LINUX_INSTALL_PAMFILES
142 $(INSTALL) -m 0644 package/util-linux/login.pam \
143 $(TARGET_DIR)/etc/pam.d/login
144 $(INSTALL) -m 0644 package/util-linux/su.pam \
145 $(TARGET_DIR)/etc/pam.d/su
146 $(INSTALL) -m 0644 package/util-linux/su.pam \
147 $(TARGET_DIR)/etc/pam.d/su-l
148 endef
149 endif
151 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_INSTALL_PAMFILES
153 # Install agetty->getty symlink to avoid breakage when there's no busybox
154 ifeq ($(BR2_PACKAGE_UTIL_LINUX_AGETTY),y)
155 ifeq ($(BR2_PACKAGE_BUSYBOX),)
156 define UTIL_LINUX_GETTY_SYMLINK
157 ln -sf agetty $(TARGET_DIR)/sbin/getty
158 endef
159 endif
160 endif
162 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
164 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
165 define UTIL_LINUX_TWEAK_UUID_PC
166 $(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
167 printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
168 endef
169 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
170 endif
172 $(eval $(autotools-package))
173 $(eval $(host-autotools-package))
175 # MKINSTALLDIRS comes from tweaked m4/nls.m4, but autoreconf uses staging
176 # one, so it disappears
177 UTIL_LINUX_INSTALL_STAGING_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs
178 UTIL_LINUX_INSTALL_TARGET_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs
179 HOST_UTIL_LINUX_INSTALL_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs