recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / boot / grub / recipe
blobcdfc2925d42a4ff1ce2e0034a08a19c5dce86049
1 # Build recipe for grub.
3 # Copyright (c) 2017-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
18 set -e
20 program=grub
21 version=2.06
22 release=3
24 # Define a category for the output of the package name
25 pkgcategory=boot
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=https://ftp.gnu.org/gnu/grub/$tarname
32 description="
33 A multiboot boot loader.
35 GNU GRUB is a Multiboot boot loader.  It was derived from GRUB,
36 the GRand Unified Bootloader, which was originally designed and
37 implemented by Erich Stefan Boleyn.
40 homepage=https://www.gnu.org/software/grub
41 license=GPLv3+
43 # Source documentation
44 docs="AUTHORS BUGS COPYING NEWS README THANKS TODO"
45 docsdir="${docdir}/${program}-${version}"
47 build()
49     unpack "${tardir}/$tarname"
51     cd "$srcdir"
53     # Add support to detect "/boot/initrd.gz" or "/boot/initrd.lz" images
54     patch -Np1 -i "${worktree}/patches/grub/initrd_naming.diff"
56     # Force enabling os-prober to detect other operating systems
57     patch -Np1 -i "${worktree}/patches/grub/grub-mkconfig-enable-os-prober.diff"
59     # Set sane permissions
60     chmod -R u+w,go-w,a+rX-s .
62     ./configure \
63      $configure_args \
64      --libdir=/usr/lib${libSuffix} \
65      --infodir=$infodir \
66      --mandir=$mandir \
67      --docdir=$docsdir \
68      --enable-device-mapper \
69      --enable-grub-mount \
70      --disable-grub-mkfont \
71      --disable-werror \
72      --disable-liblzma \
73      --disable-efiemu \
74      --build="$(gcc -dumpmachine)"
76     make -j${jobs} V=1
77     make -j${jobs} DESTDIR="$destdir" \
78      bashcompletiondir=/usr/share/bash-completion/completions \
79      install-strip
81     # Remove generated charset.alias
82     rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
84     # Make required directories
85     mkdir -p "${destdir}/boot/grub/" "${destdir}/etc/default"
87     # Insert file for default settings
88     cp -p "${worktree}/archive/grub/etc/default/grub" "${destdir}/etc/default/"
89     chmod 644 "${destdir}/etc/default/grub"
91     # Manage config (.new) file(s)
92     touch "${destdir}/etc/default/.graft-config" \
93           "${destdir}/etc/grub.d/.graft-config" \
94           "${destdir}/usr/share/bash-completion/completions/.graft-config"
96     # Compress info documents deleting index file for the package
97     if test -d "${destdir}/$infodir"
98     then
99         rm -f "${destdir}/${infodir}/dir"
100         lzip -9 "${destdir}/${infodir}"/*
101     fi
103     # Compress and link man pages (if needed)
104     if test -d "${destdir}/$mandir"
105     then
106         (
107             cd "${destdir}/$mandir"
108             find . -type f -exec lzip -9 {} +
109             find . -type l | while read -r file
110             do
111                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
112                 rm -- "$file"
113             done
114         )
115     fi
117     # Copy documentation
118     mkdir -p "${destdir}/$docsdir"
119     cp -p $docs "${destdir}/$docsdir"