recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / tools / gptfdisk / recipe
blob7287a9265bb0af868b5b23112d5b1278f8c0d304
1 # Build recipe for gptfdisk.
3 # Copyright (c) 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=gptfdisk
21 version=1.0.9
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=tools
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=https://sourceforge.net/projects/gptfdisk/files/gptfdisk/${version}/$tarname
32 description="
33 GPT partitioning and MBR repair software.
35 GPT fdisk is a disk partitioning tool loosely modeled on Linux fdisk,
36 but used for modifying GUID Partition Table (GPT) disks.  The related
37 FixParts utility fixes some common problems on Master Boot Record (MBR)
38 disks.
41 homepage=https://www.rodsbooks.com/gdisk/
42 license=GPLv2+
44 # Source documentation
45 docs="COPYING NEWS README"
46 docsdir="${docdir}/${program}-${version}"
48 build()
50     unpack "${tardir}/$tarname"
52     cd "$srcdir"
54     patch -Np1 -i "${worktree}/patches/gptfdisk/util-linux-2.38.patch"
56     # This patch modifies the Makefile file
57     # so that it provides an install target.
58     # Thanks to "Beyond Linux From Scratch"
59     patch -Np1 -i \
60      "${worktree}/patches/gptfdisk/gptfdisk-1.0.9-convenience-1.patch"
62     # Build with ICU support
63     patch -Np1 -i "${worktree}/patches/gptfdisk/Makefile-ICU.diff"
65     # Set sane permissions
66     chmod -R u+w,go-w,a+rX-s .
68     sed -i 's|ncursesw/||' gptcurses.cc
69     sed -i 's|sbin|usr/sbin|' Makefile
71     make -j${jobs} V=1 CPPFLAGS="$QICPPFLAGS" \
72      CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS"
73     make -j${jobs} DESTDIR="$destdir" install
75     # Compress and link man pages (if needed)
76     if test -d "${destdir}/$mandir"
77     then
78         (
79             cd "${destdir}/$mandir"
80             find . -type f -exec lzip -9 {} +
81             find . -type l | while read -r file
82             do
83                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
84                 rm -- "$file"
85             done
86         )
87     fi
89     # Copy documentation
90     mkdir -p "${destdir}/$docsdir"
91     cp -p $docs "${destdir}/$docsdir"