# -*- 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
PortGroup           perl5 1.0

name                guestfs-tools
version             1.54.0
revision            3
categories          sysutils
license             LGPL-2+ GPL-2+
maintainers         {makr @mohd-akram} openmaintainer

description         tools for accessing and modifying VM disk images

long_description    libguestfs is a set of tools for accessing and modifying \
                    virtual machine (VM) disk images. You can use this for \
                    viewing and editing files inside guests, scripting changes \
                    to VMs, monitoring disk used/free statistics, creating \
                    guests, P2V, V2V, performing backups, cloning VMs, building \
                    VMs, formatting disks, resizing disks, and much more.

homepage            https://libguestfs.org

set branch          [join [lrange [split ${version} .] 0 1] .]

master_sites        https://download.libguestfs.org/guestfs-tools/${branch}-stable

checksums           rmd160  d7d8fc4dc13cb2f83a70a0a33377123845d8c1b3 \
                    sha256  9b6efbe365f7afe44649ed983bb4564985b523f88b41abb8c2b0de1598868fa2 \
                    size    16243507

depends_build       path:bin/pkg-config:pkgconfig \
                    port:bash-completion \
                    port:gettext \
                    port:ocaml \
                    port:ocaml-findlib \
                    port:xorriso \
                    port:coreutils

depends_lib         port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:hivex \
                    port:json-c \
                    port:libguestfs \
                    port:libosinfo \
                    port:libvirt \
                    port:libxml2 \
                    port:ncurses \
                    port:p${perl5.major}-libintl-perl \
                    port:pcre2 \
                    port:xz

depends_run         port:hwdata

patchfiles          patch-fix-build.diff

post-patch {
    reinplace "s|#!/usr/bin/env perl|#!${perl5.bin}|" \
        ${worksrcpath}/win-reg/virt-win-reg.in
    reinplace "s|\"/etc\"|\"${prefix}/etc\"|" ${worksrcpath}/builder/paths.ml
    reinplace "s|\"/usr/share/osinfo\"|\"${prefix}/share/osinfo\"|" \
        ${worksrcpath}/builder/osinfo.ml
}

configure.perl      ${perl5.bin}
