1 # Build recipe for coreutils.
3 # Copyright (c) 2016-2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tar.gz
30 fetch=https://ftpmirror.gnu.org/coreutils/$tarname
33 The GNU core utilities.
35 The GNU core utilities are the basic file, shell and text manipulation
36 utilities of the GNU operating system. These are the core utilities
37 which are expected to exist on every operating system.
40 homepage=https://www.gnu.org/software/coreutils
43 # Source documentation
44 docs="AUTHORS COPYING ChangeLog NEWS README THANKS THANKS-to-translators TODO"
45 docsdir="${docdir}/${program}"
47 # Limit package name to the program name
48 full_pkgname="${program}@${pkgcategory}"
52 unpack "${tardir}/$tarname"
56 # Set sane permissions
57 chmod -R u+w,go-w,a+rX-s .
59 ./configure FORCE_UNSAFE_CONFIGURE="1" DEFAULT_POSIX2_VERSION="199209" \
60 CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
62 --libdir=/usr/lib${libSuffix} \
66 --enable-install-program=arch \
67 --enable-no-install-program=kill,uptime,hostname \
68 --with-tty-group=tty \
70 --build="$(gcc -dumpmachine)"
73 make -j${jobs} DESTDIR="$destdir" install
75 # Create link to "ginstall", since many sources relies on it
76 ( cd "${destdir}/usr/bin" && ln -sf install ginstall )
78 # Remove generated charset.alias
79 rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
80 rmdir "${destdir}/usr/lib${libSuffix}" || true
82 # Add "DIR_COLORS" file
83 mkdir -p "${destdir}/etc/profile.d"
84 cat src/dircolors.hin > "${destdir}/etc/DIR_COLORS"
86 # Include our custom dircolors file for profile.d
87 cat "${worktree}/archive/coreutils/etc/profile.d/dircolors.sh" \
88 > "${destdir}/etc/profile.d/dircolors.sh"
90 # To handle config file(s)
91 touch "${destdir}/etc/profile.d/.graft-config" \
92 "${destdir}/etc/.graft-config"
94 # Compress info documents deleting index file for the package
95 if test -d "${destdir}/$infodir"
97 rm -f "${destdir}/${infodir}/dir"
98 lzip -9 "${destdir}/${infodir}"/*
101 # Compress and link man pages (if needed)
102 if test -d "${destdir}/$mandir"
105 cd "${destdir}/$mandir"
106 find . -type f -exec lzip -9 {} +
107 find . -type l | while read -r file
109 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
116 mkdir -p "${destdir}${docsdir}"
117 cp -p $docs "${destdir}${docsdir}"