recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / tools / coreutils / recipe
blob19e6a4b2ae3ace35b10285688ca0881b3d63dc45
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.
17 program=coreutils
18 version=8.31
19 release=1
21 # Define a category for the output of the package name
22 pkgcategory=tools
24 tarname=${program}-${version}.tar.xz
26 # Remote source(s)
27 fetch=http://ftpmirror.gnu.org/coreutils/$tarname
29 description="
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
38 license=GPLv3+
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
45 full_pkgname=$program
47 build()
49     set -e
51     unpack "${tardir}/$tarname"
53     cd "$srcdir"
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" \
60      $configure_args \
61      --libdir=/usr/lib${libSuffix} \
62      --infodir=$infodir \
63      --mandir=$mandir \
64      --docdir=$docsdir \
65      --enable-install-program=arch \
66      --enable-no-install-program=kill,uptime,hostname \
67      --with-tty-group=tty \
68      --without-gmp \
69      --build="$(cc -dumpmachine)"
71     make -j${jobs} V=1
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"
95     then
96         rm -f "${destdir}/${infodir}/dir"
97         lzip -9 "${destdir}/${infodir}"/*
98     fi
100     # Compress and link man pages (if needed)
101     if test -d "${destdir}/$mandir"
102     then
103         (
104             cd "${destdir}/$mandir"
105             find . -type f -exec lzip -9 '{}' +
106             find . -type l | while read -r file
107             do
108                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
109                 rm -- "$file"
110             done
111         )
112     fi
114     # Copy documentation
115     mkdir -p "${destdir}${docsdir}"
116     cp -p $docs "${destdir}${docsdir}"