PortSystem              1.0
PortGroup               conflicts_build 1.0

name                    xv
version                 3.10a
set jumbo_version       20070520
revision                17
# 3.10a was stealth-updated (with no consequential changes); remove this line when updating to next proper version
dist_subdir             ${name}/${version}_1
categories              graphics x11
# ShareWare, modified versions cannot be distributed
license                 Restrictive
maintainers             nomaintainer

description             xv is an interactive image manipulation program for \
                        the X Window System.

long_description        xv is an interactive image manipulation program for \
                        the X Window System. It can operate on images in the \
                        GIF, JPEG, TIFF, PNG, PhotoCD, PBM, PGM, PPM, XPM, \
                        X11 bitmap, Sun Rasterfile, Targa, RLE, RGB, BMP, PCX, \
                        FITS, and PM formats on all known types of X \
                        displays. It can generate PostScript files, and if you \
                        have ghostscript (version 2.6 or above) installed on \
                        your machine, it can also display them. \
                        This port includes 'xv jumbo patches' from http://www.sonic.net/~roelofs/greg_xv.html \
                        Note that this program is shareware except for personal \
                        use only, please read the license agreement.

homepage                http://www.trilon.com/xv/xv.html

master_sites            ftp://ftp.trilon.com/pub/xv/:xv \
                        sourceforge:project/png-mng/XV%20jumbo%20patches/${jumbo_version}:xv-jumbo

distfiles               ${distname}${extract.suffix}:xv \
                        ${distname}-jumbo-patches-${jumbo_version}${extract.suffix}:xv-jumbo

checksums               ${distname}${extract.suffix} \
                        md5     6dca521372685ff89e1e49dc9089ceca \
                        sha1    092f8eb100f16d6b91c88b126c2b2b998eb09b99 \
                        rmd160  d977a403e6118cf72b78bc9aa572b7bba2f6e453 \
                        ${distname}-jumbo-patches-${jumbo_version}${extract.suffix} \
                        md5     9fb2d0ec320498105cafeba38a588472 \
                        sha1    d00308c1687d9d803d26ef40c73d19a0f593c626 \
                        rmd160  23bc07030416ebaca5ce4d223921e33094c37b93

depends_lib             port:xorg-libXt \
                        path:include/turbojpeg.h:libjpeg-turbo \
                        port:tiff \
                        port:libpng \
                        port:jasper2 \
                        port:zlib

pre-patch {
    system -W ${worksrcpath} "patch -p1 < ${workpath}/${distname}-jumbo-fix-enh-patch-${jumbo_version}.txt"
}

patchfiles              patch-Makefile.diff \
                        patch-libpng-1.5.diff \
                        patch-xv.h.diff

# jas_memdump now takes a const
patchfiles-append       patch-xv-jasmemdump-const.diff

use_configure           no

variant universal {}

# Currently requires jasper2, and build fails if jasper is installed
# as headers from both are incorrectly found resulting in definition mismatches.
conflicts_build         jasper

build.post_args         PREFIX='${prefix}' \
                        ZLIBDIR='${prefix}' \
                        JPEGDIR='${prefix}' \
                        JP2KDIR='${prefix}/libexec/jasper2' \
                        TIFFDIR='${prefix}' \
                        PNGDIR='${prefix}' \
                        CC='${configure.cc}' \
                        CCOPTS='${configure.cflags} [get_canonical_archflags cc]'

destroot.post_args      PREFIX='${prefix}' DESTDIR='${destroot}'

livecheck.type          none
