util_linux-2.34.recipe revision ab737df3
1SUMMARY="A random collection of Linux utilities"
2DESCRIPTION="Various useful Linux utilities."
3HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/"
4COPYRIGHT="Various Authors"
5LICENSE="GNU GPL v2
6	GNU LGPL v2
7	BSD (4-clause)
8	Public Domain"
9REVISION="1"
10SOURCE_URI="https://www.kernel.org/pub/linux/utils/util-linux/v$portVersion/util-linux-$portVersion.tar.xz"
11CHECKSUM_SHA256="743f9d0c7252b6db246b659c1e1ce0bd45d8d4508b4dfa427bbb4a3e9b9f62b5"
12SOURCE_DIR="util-linux-$portVersion"
13PATCHES="util_linux-$portVersion.patchset"
14
15ARCHITECTURES="!x86_gcc2 x86 x86_64"
16SECONDARY_ARCHITECTURES="x86"
17
18# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
19commandSuffix=$secondaryArchSuffix
20commandBinDir=$binDir
21if [ "$targetArchitecture" = x86_gcc2 ]; then
22	commandSuffix=
23	commandBinDir=$prefix/bin
24fi
25
26util_linuxLibs="libblkid libfdisk libsmartcols libuuid"
27libblkidVersion="1.1.0"
28libfdiskVersion="1.1.0"
29libsmartcolsVersion="1.1.0"
30libuuidVersion="1.3.0"
31portVersionCompat="$portVersion compat >= 2"
32for i in $util_linuxLibs; do
33	eval "${i}VersionCompat=\"\$${i}Version compat >= \${${i}Version%%.*}\""
34done
35
36PROVIDES="
37	util_linux$secondaryArchSuffix = $portVersionCompat
38	cmd:blkid$commandSuffix = $portVersion
39	cmd:col$commandSuffix = $portVersion
40	cmd:colrm$commandSuffix = $portVersion
41	cmd:column$commandSuffix = $portVersion
42	cmd:hexdump$commandSuffix = $portVersion
43	cmd:nologin$commandSuffix = $portVersion
44	cmd:rename$commandSuffix = $portVersion
45	cmd:ul$commandSuffix = $portVersion
46	cmd:uuidgen$commandSuffix = $portVersion
47	lib:libblkid$secondaryArchSuffix = $libblkidVersionCompat
48	lib:libfdisk$secondaryArchSuffix = $libfdiskVersionCompat
49	lib:libsmartcols$secondaryArchSuffix = $libsmartcolsVersionCompat
50	lib:libuuid$secondaryArchSuffix = $libuuidVersionCompat
51	"
52REQUIRES="
53	haiku$secondaryArchSuffix
54	lib:libintl$secondaryArchSuffix
55	lib:libncursesw$secondaryArchSuffix
56	lib:libz$secondaryArchSuffix
57	"
58
59SUMMARY_cal="A random collection of Linux utilities (cal)"
60PROVIDES_cal="
61	util_linux${secondaryArchSuffix}_cal = $portVersionCompat
62	cmd:cal$commandSuffix = $portVersion
63	"
64REQUIRES_cal="
65	haiku$secondaryArchSuffix
66	lib:libintl$secondaryArchSuffix
67	lib:libncursesw$secondaryArchSuffix
68	"
69if [ -z "$commandSuffix" ]; then
70CONFLICTS_cal="
71	cmd:cal
72	"
73fi
74
75SUMMARY_fdisk="A random collection of Linux utilities (fdisk)"
76ARCHITECTURES_fdisk="!x86_gcc2 ?x86 ?x86_64"
77SECONDARY_ARCHITECTURES_fdisk="?x86"
78PROVIDES_fdisk="
79	util_linux${secondaryArchSuffix}_fdisk = $portVersionCompat
80	cmd:fdisk$commandSuffix = $portVersionCompat
81	"
82REQUIRES_fdisk="
83	util_linux$secondaryArchSuffix == $portVersion base
84	haiku$secondaryArchSuffix
85	lib:libintl$secondaryArchSuffix
86	lib:libncursesw$secondaryArchSuffix
87	"
88
89PROVIDES_devel="
90	util_linux${secondaryArchSuffix}_devel = $portVersionCompat
91	devel:libblkid$secondaryArchSuffix = $libblkidVersionCompat
92	devel:libfdisk$secondaryArchSuffix = $libfdiskVersionCompat
93	devel:libsmartcols$secondaryArchSuffix = $libsmartcolsVersionCompat
94	devel:libuuid$secondaryArchSuffix = $libuuidVersionCompat
95	"
96REQUIRES_devel="
97	util_linux$secondaryArchSuffix == $portVersion base
98	"
99
100BUILD_REQUIRES="
101	haiku${secondaryArchSuffix}_devel
102	devel:libintl$secondaryArchSuffix
103	devel:libncursesw$secondaryArchSuffix
104	devel:libz$secondaryArchSuffix
105	"
106BUILD_PREREQUIRES="
107	cmd:aclocal
108	cmd:autoconf
109	cmd:autom4te
110	cmd:automake
111	cmd:bison
112	cmd:gcc$secondaryArchSuffix
113	cmd:gettext$secondaryArchSuffix
114	cmd:libtoolize$secondaryArchSuffix
115	cmd:make
116	cmd:pkg_config$secondaryArchSuffix
117	cmd:sed
118	"
119
120defineDebugInfoPackage util_linux$secondaryArchSuffix \
121	"$commandBinDir"/blkid \
122	"$commandBinDir"/col \
123	"$commandBinDir"/colrm \
124	"$commandBinDir"/column \
125	"${commandBinDir/$portName/${portName}_cal}"/cal \
126	"$commandBinDir"/hexdump \
127	"$commandBinDir"/nologin \
128	"$commandBinDir"/rename \
129	"$commandBinDir"/ul \
130	"$commandBinDir"/uuidgen \
131	"$libDir"/libblkid.so.$libblkidVersion \
132	"$libDir"/libfdisk.so.$libfdiskVersion \
133	"$libDir"/libsmartcols.so.$libsmartcolsVersion \
134	"$libDir"/libuuid.so.$libuuidVersion \
135
136BUILD()
137{
138	CPPFLAGS="-D_BSD_SOURCE -DB_USE_POSITIVE_POSIX_ERRORS"
139	LDFLAGS="-Wl,--as-needed -lnetwork -lbsd -lposix_error_mapper"
140
141	CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" ./autogen.sh
142
143	# Skip some tests in configure to avoid crashes
144	config_opts="
145		scanf_cv_alloc_modifier=no
146		"
147	if [ "$effectiveTargetArchitecture" = x86_64 ]; then
148		config_opts+="
149			ax_cv_have_tls=no
150			"
151	fi
152
153	CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" \
154	runConfigure --omit-dirs "binDir sbinDir" ./configure $config_opts \
155		--bindir="$commandBinDir" --sbindir="$commandBinDir" \
156		--disable-all-programs \
157		--disable-libmount \
158		--disable-makedev \
159		--enable-blkid \
160		--enable-cal \
161		--enable-col \
162		--enable-colrm \
163		--enable-column \
164		--enable-fdisk \
165		--enable-hexdump \
166		--enable-libfdisk \
167		--enable-libsmartcols \
168		--enable-libuuid \
169		--enable-nologin \
170		--enable-rename \
171		--enable-ul \
172		--enable-uuidgen \
173		--without-udev \
174
175	# --disable-all-programs kills several --enable-* switches, so enable them:
176	for i in \
177		BLKID \
178		COL COLRM COLUMN \
179		FDISK \
180		HEXDUMP \
181		LIBBLKID \
182		UUIDGEN \
183		; do
184		sed -i \
185			-e "/BUILD_${i}_TRUE/ s/\"#\"/\"\"/;" \
186			-e "/BUILD_${i}_FALSE/ s/\"\"/\"#\"/;" \
187			config.status
188	done
189	make
190}
191
192INSTALL()
193{
194	make install
195
196	# Cleanup
197	rm -rf $prefix/sbin
198
199	rm -f "$libDir"/lib*.la
200
201	prepareInstalledDevelLibs $util_linuxLibs
202	fixPkgconfig
203
204	packageEntries cal \
205		"$commandBinDir"/cal \
206		"$dataDir"/bash-completion/completions/cal \
207		"$manDir"/man1/cal.1
208
209	# With the fdisk subpackage being marked as untested, haikuporter does not
210	# create the subdirectory for it in $packagingBaseDir when ALLOW_UNTESTED=no
211	# so we need to skip the call to "packageEntries fdisk ..." in that case.
212	if [ -d "$packagingBaseDir"/util_linux${secondaryArchSuffix}_fdisk ]; then
213		maybe_packageEntries_fdisk="packageEntries fdisk"
214	else
215		maybe_packageEntries_fdisk=rm
216	fi
217	$maybe_packageEntries_fdisk \
218		"$commandBinDir"/fdisk \
219		"$dataDir"/bash-completion/completions/fdisk \
220		"$manDir"/man8/fdisk.8
221
222	packageEntries devel \
223		"$developDir" \
224		"$manDir"/man3
225}
226
227TEST()
228{
229	# Set TS_OPTS="" otherwise "--nonroot" is passed to tests/run.sh which
230	# then returns "Ignore util-linux test suite [non-root UID expected]."
231	LIBRARY_PATH="$sourceDir/.libs${LIBRARY_PATH:+:$LIBRARY_PATH}" \
232	make check TS_OPTS=
233}
234