# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0

name                    gptfdisk
version                 1.0.9
revision                1
checksums               rmd160  658630f10c69b3aade96bcd9b74128079bb821ec \
                        sha256  dafead2693faeb8e8b97832b23407f6ed5b3219bc1784f482dd855774e2d50c2 \
                        size    215065

categories              sysutils
license                 GPL-2+
maintainers             {mail.ru:nano103 @nano103} openmaintainer
description             GUID partition table fdisk (gdisk)
long_description        GPT fdisk (gdisk) is a disk partitioning tool loosely modeled on Linux fdisk, \
                        but used for modifying GUID Partition Table (GPT) disks. \
                        The related FixParts utility fixes some common problems \
                        on Master Boot Record (MBR) disks.

homepage                https://www.rodsbooks.com/gdisk/
master_sites            sourceforge:project/gptfdisk/gptfdisk/${version}

patchfiles              patch-Makefile.mac.diff

post-patch {
    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Makefile.mac
}

depends_lib             port:ncurses \
                        port:popt

use_configure           no

variant universal {}

build.args              -f Makefile.mac \
                        CC="${configure.cc} ${configure.cflags}" \
                        CXX="${configure.cxx} ${configure.cxxflags}" \
                        FATBINFLAGS="[get_canonical_archflags]" \
                        THINBINFLAGS="[get_canonical_archflags]"

destroot {
    xinstall -m 0755 -W ${worksrcpath} cgdisk fixparts gdisk sgdisk ${destroot}${prefix}/bin

    xinstall -m 0755 -d ${destroot}${prefix}/share/man/man8
    xinstall -m 0644 -W ${worksrcpath} cgdisk.8 fixparts.8 gdisk.8 sgdisk.8 ${destroot}${prefix}/share/man/man8
}
