recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / boot / sysvinit / recipe
blobe90323fac0705bd95a2ce920811a70152a4478bb
1 # Build recipe for sysvinit.
3 # Copyright (c) 2018-2022 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
18 set -e
20 program=sysvinit
21 version=3.01
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=boot
27 tarname=${program}-${version}.tar.xz
29 # Remote source(s)
30 fetch=https://download.savannah.nongnu.org/releases/sysvinit/$tarname
32 description="
33 The System V init (version $version).
35 The sysvinit package contains programs for controlling the startup,
36 running, and shutdown of the system.
38 System V init was originally written by Miquel van Smoorenburg.
41 homepage=https://savannah.nongnu.org/projects/sysvinit
42 license=GPLv2+
44 # Source documentation
45 docs="COPYING COPYRIGHT README doc/Changelog doc/Propaganda"
46 docsdir="${docdir}/${program}"
48 # Limit package name to the program name
49 full_pkgname="${program}@${pkgcategory}"
51 build()
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
57     # Set sane permissions
58     chmod -R u+w,go-w,a+rX-s .
60     # Adjust some (rc) script paths for Dragora 3+
61     patch -p0 < "${worktree}/patches/sysvinit/sysvinit-adjust_paths.h.diff"
63     # Remove several programs installed by other packages
64     patch -p1 < "${worktree}/patches/sysvinit/sysvinit-2.98-dragora_consolidated-1.patch"
66     make -j${jobs} CPPFLAGS="$QICPPFLAGS -D_FORTIFY_SOURCE=1" CFLAGS="$QICFLAGS" STATIC="-static"
67     make -j${jobs} ROOT="$destdir" install
69     strip --strip-unneeded "${destdir}/sbin"/* 2> /dev/null || true
71     # Remove empty directories
72     rmdir "${destdir}/bin" "${destdir}/usr/bin" || true
74     # Compress and link man pages (if needed)
75     if test -d "${destdir}/$mandir"
76     then
77         (
78             cd "${destdir}/$mandir"
79             find . -type f -exec lzip -9 {} +
80             find . -type l | while read -r file
81             do
82                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
83                 rm -- "$file"
84             done
85         )
86     fi
88     # Copy documentation
89     mkdir -p "${destdir}/$docsdir"
90     cp -p $docs "${destdir}/$docsdir"