# -*- 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       active_variants 1.1

name            gimp-gap-devel
conflicts       gimp-gap
set git_name    gimp-gap
set git_commit  65c59cdce4073f34e8a5521131531c410bc87bad
set git_date    20191012
version         2.7.0-${git_date}
license         GPL-2+
categories      graphics
maintainers     {devans @dbevans}

description     The Gimp Animation Package.

long_description \
                GIMP-GAP, the GIMP Animation Package, is a collection of plug-ins to \
                extend GIMP with capabilities to edit and create animations as \
                sequences of single frames. This is the unstable development branch \
                leading up to a stable version 2.8.

universal_variant  no
use_parallel_build no
configure.ccache   no

homepage        http://www.gimp.org/
platforms       darwin

master_sites    https://gitlab.gnome.org/GNOME/${git_name}/-/archive/${git_commit}/

distname        ${git_name}-${git_commit}

use_bzip2       yes

checksums       rmd160  7bdb695be132aac92e5bed91c37a87d66109f90f \
                sha256  e1d8bcfee00645ea52d314138605f9110ff645c293211df71cd94f0503c7d671 \
                size    11711665

post-extract    {
                    system "cd ${worksrcpath}/extern_libs && gzip -dc ffmpeg.tar.gz | tar -xf -"
                }

patchfiles      patch-extern_libs-configure_options_ffmpeg.txt.diff \
                patch-automake-1.13.diff \
                patch-gap_colordiff.c.diff

post-patch     {
                   set ffmpeg_extras "--cc=${configure.cc} --arch=${build_arch}"
                   reinplace "s|MP_FFMPEG_EXTRAS|${ffmpeg_extras}|" ${worksrcpath}/extern_libs/configure_options_ffmpeg.txt
               }

depends_build   port:pkgconfig \
                port:autoconf \
                port:automake \
                port:intltool \
                port:gmake \
                port:yasm

depends_lib     path:lib/pkgconfig/gimp-2.0.pc:gimp2 \
                port:libsdl \
                port:lame \
                port:XviD \
                port:bzip2 \
                port:zlib

#
# make mplayer-devel the default as MPlayer doesn't build on Snow Leopard
# sox is required for audio resampling features
# ufraw is required for processing of raw image sequences such as
# .cr2 timelapse sequences shot on a Canon EOS DSLR camera
#

depends_run     path:bin/mplayer:mplayer-devel \
                port:sox \
                port:ufraw

configure.cmd    ./autogen.sh

configure.args  --enable-audio-support-sdl \
                --disable-audio-support-wavplay \
                --disable-libmpeg3 \
                --disable-ff-libfaac \
                --disable-ff-libx264 \
                --enable-gdkpixbuf-pview \
                --with-ffmpegsrcdir=${worksrcpath}/extern_libs/ffmpeg \
                --with-ff-extra-cflags=-I${prefix}/include \
                --with-ff-extra-ldflags=-L${prefix}/lib

post-destroot {
    foreach dir {howto reference} {
        xinstall -d ${destroot}${prefix}/share/${name}/$dir
        foreach txt [glob -d ${worksrcpath}/docs/$dir/txt *.txt] {
            xinstall -m 644 $txt ${destroot}${prefix}/share/${name}/$dir
        }
    }
}

variant quartz {}

if {[variant_isset quartz]} {
    require_active_variants gimp2 quartz
} else {
    require_active_variants gimp2 "" quartz
}

livecheck.type  none