1 ################################################################################
5 ################################################################################
7 UTIL_LINUX_VERSION_MAJOR
= 2.29
8 UTIL_LINUX_VERSION
= $(UTIL_LINUX_VERSION_MAJOR
).2
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 # 0001-build-sys-use-lm-for-scriptreplay-if-necessary.patch
13 UTIL_LINUX_AUTORECONF
= YES
15 # README.licensing claims that some files are GPLv2-only, but this is not true.
16 # Some files are GPLv3+ but only in tests.
17 UTIL_LINUX_LICENSE
= GPLv2
+, BSD-4c
, LGPLv2.1
+ (libblkid
, libfdisk
, libmount
), BSD-3c
(libuuid
)
18 UTIL_LINUX_LICENSE_FILES
= README.licensing Documentation
/licenses
/COPYING.GPLv2 Documentation
/licenses
/COPYING.UCB Documentation
/licenses
/COPYING.LGPLv2.1 Documentation
/licenses
/COPYING.BSD-3
19 UTIL_LINUX_INSTALL_STAGING
= YES
20 UTIL_LINUX_DEPENDENCIES
= host-pkgconf
21 # uClibc needs NTP_LEGACY for sys/timex.h -> ntp_gettime() support
22 # (used in logger.c), and the common default is N.
23 UTIL_LINUX_CONF_ENV
= scanf_cv_type_modifier
=no \
24 $(if
$(BR2_TOOLCHAIN_USES_UCLIBC
),ac_cv_header_sys_timex_h
=no
)
25 UTIL_LINUX_CONF_OPTS
+= \
27 --disable-makeinstall-chown
29 # system depends on util-linux so we enable systemd support
30 # (which needs systemd to be installed)
31 UTIL_LINUX_CONF_OPTS
+= \
33 --with-systemdsystemunitdir
=no
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
47 ifeq ($(BR2_PACKAGE_NCURSES
),y
)
48 UTIL_LINUX_DEPENDENCIES
+= ncurses
49 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR
),y
)
50 UTIL_LINUX_CONF_OPTS
+= --with-ncursesw
51 UTIL_LINUX_CONF_ENV
+= NCURSESW5_CONFIG
=$(STAGING_DIR
)/usr
/bin
/$(NCURSES_CONFIG_SCRIPTS
)
53 UTIL_LINUX_CONF_OPTS
+= --without-ncursesw
--with-ncurses
--disable-widechar
54 UTIL_LINUX_CONF_ENV
+= NCURSES5_CONFIG
=$(STAGING_DIR
)/usr
/bin
/$(NCURSES_CONFIG_SCRIPTS
)
57 ifeq ($(BR2_USE_WCHAR
),y
)
58 UTIL_LINUX_CONF_OPTS
+= --enable-widechar
60 UTIL_LINUX_CONF_OPTS
+= --disable-widechar
62 UTIL_LINUX_CONF_OPTS
+= --without-ncursesw
--without-ncurses
65 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE
),y
)
66 UTIL_LINUX_DEPENDENCIES
+= gettext
67 UTIL_LINUX_LIBS
+= -lintl
70 ifeq ($(BR2_PACKAGE_LIBCAP_NG
),y
)
71 UTIL_LINUX_DEPENDENCIES
+= libcap-ng
74 # Unfortunately, the util-linux does LIBS="" at the end of its
75 # configure script. So we have to pass the proper LIBS value when
76 # calling the configure script to make configure tests pass properly,
77 # and then pass it again at build time.
78 UTIL_LINUX_CONF_ENV
+= LIBS
="$(UTIL_LINUX_LIBS)"
79 UTIL_LINUX_MAKE_OPTS
+= LIBS
="$(UTIL_LINUX_LIBS)"
81 ifeq ($(BR2_PACKAGE_LIBSELINUX
),y
)
82 UTIL_LINUX_DEPENDENCIES
+= libselinux
83 UTIL_LINUX_CONF_OPTS
+= --with-selinux
84 define UTIL_LINUX_SELINUX_PAMFILES_TWEAK
86 $(SED
) 's/^# \(.*pam_selinux.so.*\)$$/\1/' \
87 $(TARGET_DIR
)/etc
/pam.d
/$(f
)
91 UTIL_LINUX_CONF_OPTS
+= --without-selinux
94 # Used by cramfs utils
95 UTIL_LINUX_DEPENDENCIES
+= $(if
$(BR2_PACKAGE_ZLIB
),zlib
)
98 UTIL_LINUX_DEPENDENCIES
+= $(if
$(BR2_PACKAGE_LINUX_PAM
),linux-pam
)
100 # Disable/Enable utilities
101 UTIL_LINUX_CONF_OPTS
+= \
102 $(if
$(BR2_PACKAGE_UTIL_LINUX_BINARIES
),--enable-all-programs
,--disable-all-programs
) \
103 $(if
$(BR2_PACKAGE_UTIL_LINUX_AGETTY
),--enable-agetty
,--disable-agetty
) \
104 $(if
$(BR2_PACKAGE_UTIL_LINUX_BFS
),--enable-bfs
,--disable-bfs
) \
105 $(if
$(BR2_PACKAGE_UTIL_LINUX_CAL
),--enable-cal
,--disable-cal
) \
106 $(if
$(BR2_PACKAGE_UTIL_LINUX_CHFN_CHSH
),--enable-chfn-chsh
,--disable-chfn-chsh
) \
107 $(if
$(BR2_PACKAGE_UTIL_LINUX_CRAMFS
),--enable-cramfs
,--disable-cramfs
) \
108 $(if
$(BR2_PACKAGE_UTIL_LINUX_EJECT
),--enable-eject
,--disable-eject
) \
109 $(if
$(BR2_PACKAGE_UTIL_LINUX_FALLOCATE
),--enable-fallocate
,--disable-fallocate
) \
110 $(if
$(BR2_PACKAGE_UTIL_LINUX_FDFORMAT
),--enable-fdformat
,--disable-fdformat
) \
111 $(if
$(BR2_PACKAGE_UTIL_LINUX_FSCK
),--enable-fsck
,--disable-fsck
) \
112 $(if
$(BR2_PACKAGE_UTIL_LINUX_HWCLOCK
),--enable-hwclock
,--disable-hwclock
) \
113 $(if
$(BR2_PACKAGE_UTIL_LINUX_IPCRM
),--enable-ipcrm
,--disable-ipcrm
) \
114 $(if
$(BR2_PACKAGE_UTIL_LINUX_IPCS
),--enable-ipcs
,--disable-ipcs
) \
115 $(if
$(BR2_PACKAGE_UTIL_LINUX_KILL
),--enable-kill
,--disable-kill
) \
116 $(if
$(BR2_PACKAGE_UTIL_LINUX_LAST
),--enable-last
,--disable-last
) \
117 $(if
$(BR2_PACKAGE_UTIL_LINUX_LIBBLKID
),--enable-libblkid
,--disable-libblkid
) \
118 $(if
$(BR2_PACKAGE_UTIL_LINUX_LIBFDISK
),--enable-libfdisk
,--disable-libfdisk
) \
119 $(if
$(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
),--enable-libmount
,--disable-libmount
) \
120 $(if
$(BR2_PACKAGE_UTIL_LINUX_LIBSMARTCOLS
),--enable-libsmartcols
,--disable-libsmartcols
) \
121 $(if
$(BR2_PACKAGE_UTIL_LINUX_LIBUUID
),--enable-libuuid
,--disable-libuuid
) \
122 $(if
$(BR2_PACKAGE_UTIL_LINUX_LINE
),--enable-line
,--disable-line
) \
123 $(if
$(BR2_PACKAGE_UTIL_LINUX_LOGGER
),--enable-logger
,--disable-logger
) \
124 $(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
) \
125 $(if
$(BR2_PACKAGE_UTIL_LINUX_LOSETUP
),--enable-losetup
,--disable-losetup
) \
126 $(if
$(BR2_PACKAGE_UTIL_LINUX_LSLOGINS
),--enable-lslogins
,--disable-lslogins
) \
127 $(if
$(BR2_PACKAGE_UTIL_LINUX_MESG
),--enable-mesg
,--disable-mesg
) \
128 $(if
$(BR2_PACKAGE_UTIL_LINUX_MINIX
),--enable-minix
,--disable-minix
) \
129 $(if
$(BR2_PACKAGE_UTIL_LINUX_MORE
),--enable-more
,--disable-more
) \
130 $(if
$(BR2_PACKAGE_UTIL_LINUX_MOUNT
),--enable-mount
,--disable-mount
) \
131 $(if
$(BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT
),--enable-mountpoint
,--disable-mountpoint
) \
132 $(if
$(BR2_PACKAGE_UTIL_LINUX_NEWGRP
),--enable-newgrp
,--disable-newgrp
) \
133 $(if
$(BR2_PACKAGE_UTIL_LINUX_NOLOGIN
),--enable-nologin
,--disable-nologin
) \
134 $(if
$(BR2_PACKAGE_UTIL_LINUX_NSENTER
),--enable-nsenter
,--disable-nsenter
) \
135 $(if
$(BR2_PACKAGE_UTIL_LINUX_PARTX
),--enable-partx
,--disable-partx
) \
136 $(if
$(BR2_PACKAGE_UTIL_LINUX_PG
),--enable-pg
,--disable-pg
) \
137 $(if
$(BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT
),--enable-pivot_root
,--disable-pivot_root
) \
138 $(if
$(BR2_PACKAGE_UTIL_LINUX_RAW
),--enable-raw
,--disable-raw
) \
139 $(if
$(BR2_PACKAGE_UTIL_LINUX_RENAME
),--enable-rename
,--disable-rename
) \
140 $(if
$(BR2_PACKAGE_UTIL_LINUX_RESET
),--enable-reset
,--disable-reset
) \
141 $(if
$(BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS
),--enable-schedutils
,--disable-schedutils
) \
142 $(if
$(BR2_PACKAGE_UTIL_LINUX_SETPRIV
),--enable-setpriv
,--disable-setpriv
) \
143 $(if
$(BR2_PACKAGE_UTIL_LINUX_SETTERM
),--enable-setterm
,--disable-setterm
) \
144 $(if
$(BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT
),--enable-switch_root
,--disable-switch_root
) \
145 $(if
$(BR2_PACKAGE_UTIL_LINUX_TUNELP
),--enable-tunelp
,--disable-tunelp
) \
146 $(if
$(BR2_PACKAGE_UTIL_LINUX_UL
),--enable-ul
,--disable-ul
) \
147 $(if
$(BR2_PACKAGE_UTIL_LINUX_UNSHARE
),--enable-unshare
,--disable-unshare
) \
148 $(if
$(BR2_PACKAGE_UTIL_LINUX_UTMPDUMP
),--enable-utmpdump
,--disable-utmpdump
) \
149 $(if
$(BR2_PACKAGE_UTIL_LINUX_UUIDD
),--enable-uuidd
,--disable-uuidd
) \
150 $(if
$(BR2_PACKAGE_UTIL_LINUX_VIPW
),--enable-vipw
,--disable-vipw
) \
151 $(if
$(BR2_PACKAGE_UTIL_LINUX_WALL
),--enable-wall
,--disable-wall
) \
152 $(if
$(BR2_PACKAGE_UTIL_LINUX_WDCTL
),--enable-wdctl
,--disable-wdctl
) \
153 $(if
$(BR2_PACKAGE_UTIL_LINUX_WRITE
),--enable-write
,--disable-write
) \
154 $(if
$(BR2_PACKAGE_UTIL_LINUX_ZRAMCTL
),--enable-zramctl
,--disable-zramctl
)
156 # In the host version of util-linux, we only require libuuid and
157 # libmount (plus libblkid as an indirect dependency of libmount).
158 # So disable all of the programs, unless BR2_PACKAGE_HOST_UTIL_LINUX is set
160 HOST_UTIL_LINUX_CONF_OPTS
+= \
168 ifeq ($(BR2_PACKAGE_HOST_UTIL_LINUX
),y
)
169 HOST_UTIL_LINUX_CONF_OPTS
+= --disable-makeinstall-chown
170 # disable more command because of ncurses dependency
171 HOST_UTIL_LINUX_CONF_OPTS
+= --disable-more
173 HOST_UTIL_LINUX_CONF_OPTS
+= --disable-all-programs
176 # Install libmount Python bindings
177 ifeq ($(BR2_PACKAGE_PYTHON
)$(BR2_PACKAGE_PYTHON3
),y
)
178 UTIL_LINUX_CONF_OPTS
+= --with-python
179 UTIL_LINUX_DEPENDENCIES
+= $(if
$(BR2_PACKAGE_PYTHON
),python
,python3
)
180 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
),y
)
181 UTIL_LINUX_CONF_OPTS
+= --enable-pylibmount
183 UTIL_LINUX_CONF_OPTS
+= --disable-pylibmount
186 UTIL_LINUX_CONF_OPTS
+= --without-python
189 ifeq ($(BR2_PACKAGE_READLINE
),y
)
190 UTIL_LINUX_CONF_OPTS
+= --with-readline
191 UTIL_LINUX_LIBS
+= $(if
$(BR2_STATIC_LIBS
),-lcurses
)
192 UTIL_LINUX_DEPENDENCIES
+= readline
194 UTIL_LINUX_CONF_OPTS
+= --without-readline
197 ifeq ($(BR2_PACKAGE_AUDIT
),y
)
198 UTIL_LINUX_CONF_OPTS
+= --with-audit
199 UTIL_LINUX_DEPENDENCIES
+= audit
201 UTIL_LINUX_CONF_OPTS
+= --without-audit
204 # Install PAM configuration files
205 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS
),y
)
206 define UTIL_LINUX_INSTALL_PAMFILES
207 $(INSTALL
) -m
0644 package
/util-linux
/su.pam \
208 $(TARGET_DIR
)/etc
/pam.d
/su
209 $(INSTALL
) -m
0644 package
/util-linux
/su.pam \
210 $(TARGET_DIR
)/etc
/pam.d
/su-l
211 $(UTIL_LINUX_SELINUX_PAMFILES_TWEAK
)
215 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS
+= UTIL_LINUX_INSTALL_PAMFILES
217 # Install agetty->getty symlink to avoid breakage when there's no busybox
218 ifeq ($(BR2_PACKAGE_UTIL_LINUX_AGETTY
),y
)
219 ifeq ($(BR2_PACKAGE_BUSYBOX
),)
220 define UTIL_LINUX_GETTY_SYMLINK
221 ln
-sf agetty
$(TARGET_DIR
)/sbin
/getty
226 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS
+= UTIL_LINUX_GETTY_SYMLINK
228 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE
)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID
),yy
)
229 define UTIL_LINUX_TWEAK_UUID_PC
230 $(SED
) '/Libs\.private: .*/d' $(STAGING_DIR
)/usr
/lib
/pkgconfig
/uuid.
pc
231 printf
"Libs.private: -lintl\n" >>$(STAGING_DIR
)/usr
/lib
/pkgconfig
/uuid.
pc
233 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS
+= UTIL_LINUX_TWEAK_UUID_PC
236 $(eval
$(autotools-package
))
237 $(eval
$(host-autotools-package
))