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
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tar.gz
30 fetch=https://sourceforge.net/projects/gptfdisk/files/gptfdisk/${version}/$tarname
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)
41 homepage=https://www.rodsbooks.com/gdisk/
44 # Source documentation
45 docs="COPYING NEWS README"
46 docsdir="${docdir}/${program}-${version}"
50 unpack "${tardir}/$tarname"
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"
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"
79 cd "${destdir}/$mandir"
80 find . -type f -exec lzip -9 {} +
81 find . -type l | while read -r file
83 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
90 mkdir -p "${destdir}/$docsdir"
91 cp -p $docs "${destdir}/$docsdir"