xref: /OK3568_Linux_fs/buildroot/package/coreutils/coreutils.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# coreutils
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunCOREUTILS_VERSION = 9.0
8*4882a593SmuzhiyunCOREUTILS_SITE = $(BR2_GNU_MIRROR)/coreutils
9*4882a593SmuzhiyunCOREUTILS_SOURCE = coreutils-$(COREUTILS_VERSION).tar.xz
10*4882a593SmuzhiyunCOREUTILS_LICENSE = GPL-3.0+
11*4882a593SmuzhiyunCOREUTILS_LICENSE_FILES = COPYING
12*4882a593SmuzhiyunCOREUTILS_CPE_ID_VENDOR = gnu
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunCOREUTILS_CONF_OPTS = --disable-rpath \
15*4882a593Smuzhiyun	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
16*4882a593Smuzhiyun
17*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
18*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --disable-single-binary
19*4882a593Smuzhiyunelse
20*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --enable-single-binary=symlinks
21*4882a593Smuzhiyunendif
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunCOREUTILS_CONF_ENV = ac_cv_c_restrict=no \
24*4882a593Smuzhiyun	ac_cv_func_chown_works=yes \
25*4882a593Smuzhiyun	ac_cv_func_euidaccess=no \
26*4882a593Smuzhiyun	ac_cv_func_fstatat=yes \
27*4882a593Smuzhiyun	ac_cv_func_getdelim=yes \
28*4882a593Smuzhiyun	ac_cv_func_getgroups=yes \
29*4882a593Smuzhiyun	ac_cv_func_getgroups_works=yes \
30*4882a593Smuzhiyun	ac_cv_func_getloadavg=no \
31*4882a593Smuzhiyun	ac_cv_func_lstat_dereferences_slashed_symlink=yes \
32*4882a593Smuzhiyun	ac_cv_func_lstat_empty_string_bug=no \
33*4882a593Smuzhiyun	ac_cv_func_strerror_r_char_p=no \
34*4882a593Smuzhiyun	ac_cv_func_strnlen_working=yes \
35*4882a593Smuzhiyun	ac_cv_func_strtod=yes \
36*4882a593Smuzhiyun	ac_cv_func_working_mktime=yes \
37*4882a593Smuzhiyun	ac_cv_have_decl_strerror_r=yes \
38*4882a593Smuzhiyun	ac_cv_have_decl_strnlen=yes \
39*4882a593Smuzhiyun	ac_cv_lib_getloadavg_getloadavg=no \
40*4882a593Smuzhiyun	ac_cv_lib_util_getloadavg=no \
41*4882a593Smuzhiyun	ac_fsusage_space=yes \
42*4882a593Smuzhiyun	ac_use_included_regex=no \
43*4882a593Smuzhiyun	am_cv_func_working_getline=yes \
44*4882a593Smuzhiyun	fu_cv_sys_stat_statfs2_bsize=yes \
45*4882a593Smuzhiyun	gl_cv_func_getcwd_null=yes \
46*4882a593Smuzhiyun	gl_cv_func_getcwd_path_max=yes \
47*4882a593Smuzhiyun	gl_cv_func_gettimeofday_clobber=no \
48*4882a593Smuzhiyun	gl_cv_func_fstatat_zero_flag=no \
49*4882a593Smuzhiyun	gl_cv_func_link_follows_symlink=no \
50*4882a593Smuzhiyun	gl_cv_func_re_compile_pattern_working=yes \
51*4882a593Smuzhiyun	gl_cv_func_svid_putenv=yes \
52*4882a593Smuzhiyun	gl_cv_func_tzset_clobber=no \
53*4882a593Smuzhiyun	gl_cv_func_working_mkstemp=yes \
54*4882a593Smuzhiyun	gl_cv_func_working_utimes=yes \
55*4882a593Smuzhiyun	gl_getline_needs_run_time_check=no \
56*4882a593Smuzhiyun	gl_cv_have_proc_uptime=yes \
57*4882a593Smuzhiyun	utils_cv_localtime_cache=no \
58*4882a593Smuzhiyun	PERL=missing \
59*4882a593Smuzhiyun	MAKEINFO=true \
60*4882a593Smuzhiyun	INSTALL_PROGRAM=$(INSTALL)
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunCOREUTILS_BIN_PROGS = base64 cat chgrp chmod chown cp date dd df dir echo false \
63*4882a593Smuzhiyun	kill link ln ls mkdir mknod mktemp mv nice printenv pwd rm rmdir \
64*4882a593Smuzhiyun	vdir sleep stty sync touch true uname join
65*4882a593Smuzhiyun
66*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_ACL),y)
67*4882a593SmuzhiyunCOREUTILS_DEPENDENCIES += acl
68*4882a593Smuzhiyunelse
69*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --disable-acl
70*4882a593Smuzhiyunendif
71*4882a593Smuzhiyun
72*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_ATTR),y)
73*4882a593SmuzhiyunCOREUTILS_DEPENDENCIES += attr
74*4882a593Smuzhiyunelse
75*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --disable-xattr
76*4882a593Smuzhiyunendif
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunCOREUTILS_DEPENDENCIES += $(TARGET_NLS_DEPENDENCIES)
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun# It otherwise fails to link properly, not mandatory though
81*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
82*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --with-libintl-prefix=$(STAGING_DIR)/usr
83*4882a593Smuzhiyunendif
84*4882a593Smuzhiyun
85*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GMP),y)
86*4882a593SmuzhiyunCOREUTILS_DEPENDENCIES += gmp
87*4882a593Smuzhiyunelse
88*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --without-gmp
89*4882a593Smuzhiyunendif
90*4882a593Smuzhiyun
91*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBCAP),y)
92*4882a593SmuzhiyunCOREUTILS_DEPENDENCIES += libcap
93*4882a593Smuzhiyunelse
94*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --disable-libcap
95*4882a593Smuzhiyunendif
96*4882a593Smuzhiyun
97*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_OPENSSL),y)
98*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --with-openssl=yes
99*4882a593SmuzhiyunCOREUTILS_DEPENDENCIES += openssl
100*4882a593Smuzhiyunendif
101*4882a593Smuzhiyun
102*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_COREUTILS_UNICODE_BYPASS),y)
103*4882a593Smuzhiyundefine COREUTILS_UNICODE_BYPASS
104*4882a593Smuzhiyun	$(SED) "s%\(printable =\) \(isprint\)%\1 c >= ' '; // \2%" \
105*4882a593Smuzhiyun		$(@D)/lib/quotearg.c || true
106*4882a593Smuzhiyunendef
107*4882a593SmuzhiyunCOREUTILS_PRE_BUILD_HOOKS += COREUTILS_UNICODE_BYPASS
108*4882a593Smuzhiyunendif
109*4882a593Smuzhiyun
110*4882a593Smuzhiyunifeq ($(BR2_ROOTFS_MERGED_USR),)
111*4882a593Smuzhiyun# We want to move a few binaries from /usr/bin to /bin. In the case of
112*4882a593Smuzhiyun# coreutils being built as multi-call binary, we do so by re-creating
113*4882a593Smuzhiyun# the corresponding symlinks. If coreutils is built with individual
114*4882a593Smuzhiyun# binaries, we actually move the binaries.
115*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
116*4882a593Smuzhiyundefine COREUTILS_FIX_BIN_LOCATION
117*4882a593Smuzhiyun	$(foreach f,$(COREUTILS_BIN_PROGS), \
118*4882a593Smuzhiyun		mv $(TARGET_DIR)/usr/bin/$(f) $(TARGET_DIR)/bin
119*4882a593Smuzhiyun	)
120*4882a593Smuzhiyunendef
121*4882a593Smuzhiyunelse
122*4882a593Smuzhiyundefine COREUTILS_FIX_BIN_LOCATION
123*4882a593Smuzhiyun	# some things go in /bin rather than /usr/bin
124*4882a593Smuzhiyun	$(foreach f,$(COREUTILS_BIN_PROGS), \
125*4882a593Smuzhiyun		rm -f $(TARGET_DIR)/usr/bin/$(f) && \
126*4882a593Smuzhiyun		ln -sf ../usr/bin/coreutils $(TARGET_DIR)/bin/$(f)
127*4882a593Smuzhiyun	)
128*4882a593Smuzhiyunendef
129*4882a593Smuzhiyunendif
130*4882a593SmuzhiyunCOREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_FIX_BIN_LOCATION
131*4882a593Smuzhiyunendif
132*4882a593Smuzhiyun
133*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),y)
134*4882a593SmuzhiyunCOREUTILS_CONF_OPTS += --enable-no-install-program=stdbuf
135*4882a593Smuzhiyunendif
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun# link for archaic shells
138*4882a593Smuzhiyundefine COREUTILS_CREATE_TEST_SYMLINK
139*4882a593Smuzhiyun	ln -fs test $(TARGET_DIR)/usr/bin/[
140*4882a593Smuzhiyunendef
141*4882a593SmuzhiyunCOREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_CREATE_TEST_SYMLINK
142*4882a593Smuzhiyun
143*4882a593Smuzhiyun# gnu thinks chroot is in bin, debian thinks it's in sbin
144*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
145*4882a593Smuzhiyundefine COREUTILS_FIX_CHROOT_LOCATION
146*4882a593Smuzhiyun	mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin
147*4882a593Smuzhiyunendef
148*4882a593Smuzhiyunelse
149*4882a593Smuzhiyundefine COREUTILS_FIX_CHROOT_LOCATION
150*4882a593Smuzhiyun	rm -f $(TARGET_DIR)/usr/bin/chroot
151*4882a593Smuzhiyun	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
152*4882a593Smuzhiyunendef
153*4882a593Smuzhiyunendif
154*4882a593SmuzhiyunCOREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_FIX_CHROOT_LOCATION
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun# Explicitly install ln and realpath, which we *are* insterested in.
157*4882a593Smuzhiyun# A lot of other programs still get installed, however, but disabling
158*4882a593Smuzhiyun# them does not gain much at build time, and is a loooong list that is
159*4882a593Smuzhiyun# difficult to maintain... Just avoid overwriting fakedate when creating
160*4882a593Smuzhiyun# a reproducible build
161*4882a593SmuzhiyunHOST_COREUTILS_CONF_OPTS = \
162*4882a593Smuzhiyun	--disable-acl \
163*4882a593Smuzhiyun	--disable-libcap \
164*4882a593Smuzhiyun	--disable-rpath \
165*4882a593Smuzhiyun	--disable-single-binary \
166*4882a593Smuzhiyun	--disable-xattr \
167*4882a593Smuzhiyun	--without-gmp \
168*4882a593Smuzhiyun	--enable-install-program=ln,realpath \
169*4882a593Smuzhiyun	--enable-no-install-program=date
170*4882a593Smuzhiyun
171*4882a593Smuzhiyun$(eval $(autotools-package))
172*4882a593Smuzhiyun$(eval $(host-autotools-package))
173