# -*- 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           github 1.0

github.setup        jun7 rox-filer c5de8d8356fd0eaeff5a34b67387704422b8c010
version             20230718
revision            1
categories          x11 sysutils
platforms           darwin freebsd linux
license             GPL-2+
maintainers         nomaintainer
description         Fast and powerful file manager
long_description    ROX-Filer is a fast and powerful graphical file manager. It has full \
                    drag-and-drop support and background file operations, and is highly \
                    configurable. It can also act as a pinboard, allowing you to pin \
                    frequently used files to the desktop background.
homepage            http://rox.sourceforge.net/desktop/ROX-Filer
checksums           rmd160  a3611acf7e2fbb5a9e58a4588e5af818ae55e2cc \
                    sha256  99577d2d848060e412e81e8c3483c3816c8b2ed895353e687408a66e9997a453 \
                    size    1875721
github.tarball_from archive

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:libxslt \
                    path:bin/pkg-config:pkgconfig
depends_lib-append  path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                    port:libxml2 \
                    port:xorg-libice \
                    port:xorg-libsm \
                    port:xorg-libX11
depends_lib-append  port:shared-mime-info

patchfiles          patch-rox.sh.diff

post-patch {
    reinplace "s,@PREFIX@,${prefix}," ${worksrcpath}/rox.sh
}

configure.args-append \
                    --x-include=${prefix}/include \
                    --x-lib=${prefix}/lib

use_configure       no

build       { system "cd ${worksrcpath}; CC=${configure.cc} CPPFLAGS=\"${configure.cppflags}\" LDFLAGS=\"${configure.ldflags}\" ./ROX-Filer/AppRun --compile ${configure.args}" }

# Man fails to generate.
destroot {
	xinstall -d ${destroot}${prefix}/etc/xdg/rox.sourceforge.net
	copy ${worksrcpath}/Choices/MIME-types ${destroot}${prefix}/etc/xdg/rox.sourceforge.net/
	delete -force ${worksrcpath}/ROX-Filer/build
	delete -force ${worksrcpath}/ROX-Filer/src
	xinstall -d ${destroot}${prefix}/apps
	copy ${worksrcpath}/ROX-Filer ${destroot}${prefix}/apps/
	xinstall -m 755 ${worksrcpath}/rox.sh ${destroot}${prefix}/bin/rox
	xinstall -d ${destroot}${prefix}/share/applications
	xinstall -m 644 ${worksrcpath}/rox.desktop ${destroot}${prefix}/share/applications/
	xinstall -d ${destroot}${prefix}/share/mime/packages
	xinstall -m 644 ${worksrcpath}/rox.xml ${destroot}${prefix}/share/mime/packages/
	xinstall -d ${destroot}${prefix}/share/mime/pixmaps
	xinstall -m 644 ${worksrcpath}/rox.svg ${destroot}${prefix}/share/mime/pixmaps/
}

# not in mtree: ${prefix}/apps
destroot.violate_mtree	yes
