logrotate: fix build with gcc 6
[buildroot-gz.git] / package / util-linux / util-linux.mk
blob9c7bd871261535aac67839c25557f9e6082c810a
1 ################################################################################
3 # util-linux
5 ################################################################################
7 UTIL_LINUX_VERSION = 2.28
8 UTIL_LINUX_SOURCE = util-linux-$(UTIL_LINUX_VERSION).tar.xz
9 UTIL_LINUX_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/util-linux/v$(UTIL_LINUX_VERSION)
11 # README.licensing claims that some files are GPLv2-only, but this is not true.
12 # Some files are GPLv3+ but only in tests.
13 UTIL_LINUX_LICENSE = GPLv2+, BSD-4c, libblkid and libmount LGPLv2.1+, libuuid BSD-3c
14 UTIL_LINUX_LICENSE_FILES = README.licensing Documentation/licenses/COPYING.GPLv2 Documentation/licenses/COPYING.UCB Documentation/licenses/COPYING.LGPLv2.1 Documentation/licenses/COPYING.BSD-3
15 # For 0001-build-sys-fix-uClibc-ng-scanf-check.patch
16 UTIL_LINUX_AUTORECONF = YES
17 UTIL_LINUX_INSTALL_STAGING = YES
18 UTIL_LINUX_DEPENDENCIES = host-pkgconf
19 # uClibc needs NTP_LEGACY for sys/timex.h -> ntp_gettime() support
20 # (used in logger.c), and the common default is N.
21 UTIL_LINUX_CONF_ENV = scanf_cv_type_modifier=no \
22 $(if $(BR2_TOOLCHAIN_USES_UCLIBC),ac_cv_header_sys_timex_h=no)
23 UTIL_LINUX_CONF_OPTS += \
24 --disable-rpath \
25 --disable-makeinstall-chown
27 # system depends on util-linux so we enable systemd support
28 # (which needs systemd to be installed)
29 UTIL_LINUX_CONF_OPTS += \
30 --without-systemd \
31 --with-systemdsystemunitdir=no
33 # We don't want the host-busybox dependency to be added automatically
34 HOST_UTIL_LINUX_DEPENDENCIES = host-pkgconf
36 # We also don't want the host-python dependency
37 HOST_UTIL_LINUX_CONF_OPTS = --without-python
39 # If both util-linux and busybox are selected, make certain util-linux
40 # wins the fight over who gets to have their utils actually installed
41 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
42 UTIL_LINUX_DEPENDENCIES += busybox
43 endif
45 ifeq ($(BR2_PACKAGE_NCURSES),y)
46 UTIL_LINUX_DEPENDENCIES += ncurses
47 else
48 UTIL_LINUX_CONF_OPTS += --without-ncurses
49 endif
51 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
52 UTIL_LINUX_DEPENDENCIES += gettext
53 UTIL_LINUX_MAKE_OPTS += LIBS=-lintl
54 endif
56 ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
57 UTIL_LINUX_DEPENDENCIES += libcap-ng
58 endif
60 # Used by cramfs utils
61 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_ZLIB),zlib)
63 # Used by login-utils
64 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_LINUX_PAM),linux-pam)
66 # Disable/Enable utilities
67 UTIL_LINUX_CONF_OPTS += \
68 $(if $(BR2_PACKAGE_UTIL_LINUX_AGETTY),--enable-agetty,--disable-agetty) \
69 $(if $(BR2_PACKAGE_UTIL_LINUX_BFS),--enable-bfs,--disable-bfs) \
70 $(if $(BR2_PACKAGE_UTIL_LINUX_CHFN_CHSH),--enable-chfn-chsh,--disable-chfn-chsh) \
71 $(if $(BR2_PACKAGE_UTIL_LINUX_CRAMFS),--enable-cramfs,--disable-cramfs) \
72 $(if $(BR2_PACKAGE_UTIL_LINUX_EJECT),--enable-eject,--disable-eject) \
73 $(if $(BR2_PACKAGE_UTIL_LINUX_FALLOCATE),--enable-fallocate,--disable-fallocate) \
74 $(if $(BR2_PACKAGE_UTIL_LINUX_FDFORMAT),--enable-fdformat,--disable-fdformat) \
75 $(if $(BR2_PACKAGE_UTIL_LINUX_FINDFS),--enable-findfs,--disable-findfs) \
76 $(if $(BR2_PACKAGE_UTIL_LINUX_FSCK),--enable-fsck,--disable-fsck) \
77 $(if $(BR2_PACKAGE_UTIL_LINUX_HWCLOCK),--enable-hwclock,--disable-hwclock) \
78 $(if $(BR2_PACKAGE_UTIL_LINUX_KILL),--enable-kill,--disable-kill) \
79 $(if $(BR2_PACKAGE_UTIL_LINUX_LAST),--enable-last,--disable-last) \
80 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),--enable-libblkid,--disable-libblkid) \
81 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),--enable-libmount,--disable-libmount) \
82 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBSMARTCOLS),--enable-libsmartcols,--disable-libsmartcols) \
83 $(if $(BR2_PACKAGE_UTIL_LINUX_LIBUUID),--enable-libuuid,--disable-libuuid) \
84 $(if $(BR2_PACKAGE_UTIL_LINUX_LINE),--enable-line,--disable-line) \
85 $(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) \
86 $(if $(BR2_PACKAGE_UTIL_LINUX_LOSETUP),--enable-losetup,--disable-losetup) \
87 $(if $(BR2_PACKAGE_UTIL_LINUX_LSBLK),--enable-lsblk,--disable-lsblk) \
88 $(if $(BR2_PACKAGE_UTIL_LINUX_MESG),--enable-mesg,--disable-mesg) \
89 $(if $(BR2_PACKAGE_UTIL_LINUX_MINIX),--enable-minix,--disable-minix) \
90 $(if $(BR2_PACKAGE_UTIL_LINUX_MORE),--enable-more,--disable-more) \
91 $(if $(BR2_PACKAGE_UTIL_LINUX_MOUNT),--enable-mount,--disable-mount) \
92 $(if $(BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT),--enable-mountpoint,--disable-mountpoint) \
93 $(if $(BR2_PACKAGE_UTIL_LINUX_NEWGRP),--enable-newgrp,--disable-newgrp) \
94 $(if $(BR2_PACKAGE_UTIL_LINUX_NOLOGIN),--enable-nologin,--disable-nologin) \
95 $(if $(BR2_PACKAGE_UTIL_LINUX_NSENTER),--enable-nsenter,--disable-nsenter) \
96 $(if $(BR2_PACKAGE_UTIL_LINUX_PARTX),--enable-partx,--disable-partx) \
97 $(if $(BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT),--enable-pivot_root,--disable-pivot_root) \
98 $(if $(BR2_PACKAGE_UTIL_LINUX_RAW),--enable-raw,--disable-raw) \
99 $(if $(BR2_PACKAGE_UTIL_LINUX_RENAME),--enable-rename,--disable-rename) \
100 $(if $(BR2_PACKAGE_UTIL_LINUX_RESET),--enable-reset,--disable-reset) \
101 $(if $(BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS),--enable-schedutils,--disable-schedutils) \
102 $(if $(BR2_PACKAGE_UTIL_LINUX_SETPRIV),--enable-setpriv,--disable-setpriv) \
103 $(if $(BR2_PACKAGE_UTIL_LINUX_SETTERM),--enable-setterm,--disable-setterm) \
104 $(if $(BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT),--enable-switch_root,--disable-switch_root) \
105 $(if $(BR2_PACKAGE_UTIL_LINUX_TUNELP),--enable-tunelp,--disable-tunelp) \
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 libmount Python bindings
140 ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),y)
141 UTIL_LINUX_CONF_OPTS += --with-python
142 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_PYTHON),python,python3)
143 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),y)
144 UTIL_LINUX_CONF_OPTS += --enable-pylibmount
145 else
146 UTIL_LINUX_CONF_OPTS += --disable-pylibmount
147 endif
148 else
149 UTIL_LINUX_CONF_OPTS += --without-python
150 endif
152 # Install PAM configuration files
153 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),y)
154 define UTIL_LINUX_INSTALL_PAMFILES
155 $(INSTALL) -m 0644 package/util-linux/su.pam \
156 $(TARGET_DIR)/etc/pam.d/su
157 $(INSTALL) -m 0644 package/util-linux/su.pam \
158 $(TARGET_DIR)/etc/pam.d/su-l
159 endef
160 endif
162 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_INSTALL_PAMFILES
164 # Install agetty->getty symlink to avoid breakage when there's no busybox
165 ifeq ($(BR2_PACKAGE_UTIL_LINUX_AGETTY),y)
166 ifeq ($(BR2_PACKAGE_BUSYBOX),)
167 define UTIL_LINUX_GETTY_SYMLINK
168 ln -sf agetty $(TARGET_DIR)/sbin/getty
169 endef
170 endif
171 endif
173 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
175 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
176 define UTIL_LINUX_TWEAK_UUID_PC
177 $(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
178 printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
179 endef
180 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
181 endif
183 $(eval $(autotools-package))
184 $(eval $(host-autotools-package))
186 # MKINSTALLDIRS comes from tweaked m4/nls.m4, but autoreconf uses staging
187 # one, so it disappears
188 UTIL_LINUX_INSTALL_STAGING_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs
189 UTIL_LINUX_INSTALL_TARGET_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs
190 HOST_UTIL_LINUX_INSTALL_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs