1 # Build recipe for coreutils.
3 # Copyright (c) 2016-2019 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.
21 # Define a category for the output of the package name
24 tarname=${program}-${version}.tar.xz
27 fetch=http://ftpmirror.gnu.org/coreutils/$tarname
30 The GNU core utilities.
32 The GNU core utilities are the basic file, shell and text manipulation
33 utilities of the GNU operating system. These are the core utilities
34 which are expected to exist on every operating system.
37 homepage=http://www.gnu.org/software/coreutils
40 # Source documentation
41 docs="AUTHORS COPYING ChangeLog NEWS README THANKS THANKS-to-translators TODO"
42 docsdir="${docdir}/${program}"
44 # Limit package name to the program name
51 unpack "${tardir}/$tarname"
55 # Set sane permissions
56 chmod -R u+w,go-w,a+rX-s .
58 ./configure FORCE_UNSAFE_CONFIGURE="1" DEFAULT_POSIX2_VERSION="199209" \
59 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
61 --libdir=/usr/lib${libSuffix} \
65 --enable-install-program=arch \
66 --enable-no-install-program=kill,uptime,hostname \
67 --with-tty-group=tty \
69 --build="$(cc -dumpmachine)"
72 make -j${jobs} DESTDIR="$destdir" install
74 # Create link to "ginstall", since many sources relies on it
75 ( cd "${destdir}/usr/bin" && ln -sf install ginstall )
77 # Remove generated charset.alias
78 rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
79 rmdir "${destdir}/usr/lib${libSuffix}" || true
81 # Add "DIR_COLORS" file
82 mkdir -p "${destdir}/etc/profile.d"
83 cat src/dircolors.hin > "${destdir}/etc/DIR_COLORS"
85 # Include our custom dircolors file for profile.d
86 cat "${worktree}/archive/coreutils/etc/profile.d/dircolors.sh" \
87 > "${destdir}/etc/profile.d/dircolors.sh"
89 # To handle config file(s)
90 touch "${destdir}/etc/profile.d/.graft-config" \
91 "${destdir}/etc/.graft-config"
93 # Compress info documents deleting index file for the package
94 if test -d "${destdir}/$infodir"
96 rm -f "${destdir}/${infodir}/dir"
97 lzip -9 "${destdir}/${infodir}"/*
100 # Compress and link man pages (if needed)
101 if test -d "${destdir}/$mandir"
104 cd "${destdir}/$mandir"
105 find . -type f -exec lzip -9 '{}' +
106 find . -type l | while read -r file
108 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
115 mkdir -p "${destdir}${docsdir}"
116 cp -p $docs "${destdir}${docsdir}"