# $Id: Portfile 54372 2009-07-25 17:59:21Z mcalhoun@macports.org $

PortSystem	1.0

name		jpeg
version     	6b
revision	3
categories	graphics
maintainers	waqar
description	Library for manipulating JPEG images
long_description	\
	This distribution contains the sixth public release of the 	\
	Independent JPEG Group's free JPEG software. You are welcome 	\
	to redistribute this software and to use it for any purpose, 	\
	subject to the conditions under LEGAL ISSUES, below. 		\
	Serious users of this software (particularly those 		\
	incorporating it into larger programs) should contact IJG at 	\
	jpeg-info@uunet.uu.net to be added to our electronic mailing 	\
	list.  Mailing list members are notified of updates and have 	\
	a chance to participate in technical discussions, etc.

homepage        http://www.ijg.org/
platforms       darwin freebsd sunos
master_sites    http://www.ijg.org/files \
                ftp://ftp.uu.net/graphics/jpeg \
                http://sylvana.net/jpegcrop/:drop

distname        ${name}src.v${version}
worksrcdir      ${name}-${version}
set jpegmain    ${distname}${extract.suffix}
distfiles       ${jpegmain} \
                droppatch.tar.gz:drop
                
checksums       ${jpegmain} md5 dbd5f3b47ed13132f04c685d608a7547 \
                droppatch.tar.gz md5 511c39779ac96cd41ca1e0a87b239287
extract.only    ${jpegmain}

patchfiles      patch-config.sub patch-config.guess patch-ltmain.sh \
                patch-ltconfig patch-makefile.cfg patch-jpeglib.h
post-patch {
    system "cd ${worksrcpath} &&
        tar zxf ${distpath}/droppatch.tar.gz"

    # Reorder link flags so that so that local -L options come first (especially before -L${prefix}/lib)
    #     (see http://trac.macports.org/ticket/16411).
    reinplace {s|\(.*\)\($(LDFLAGS)\)\(.*\)\($(LDLIBS)\)\(.*\)|\1\4\3\2\5|} ${worksrcpath}/makefile.cfg

    # As in the case of -L, CPPFLAGS come before -I. during compilation.
    configure.cppflags-append -isystem${prefix}/include
    configure.cppflags-delete -I${prefix}/include
}

configure.args      --enable-shared --enable-static

use_parallel_build  yes

destroot.destdir    prefix=${destroot}${prefix}
pre-destroot {
    xinstall -d ${destroot}${prefix}/bin
    xinstall -d ${destroot}${prefix}/share/man/man1
    xinstall -d ${destroot}${prefix}/include
    xinstall -d ${destroot}${prefix}/lib
}


livecheck.check regex
livecheck.url   [lindex $master_sites 0]/?M=D
livecheck.regex [suffix ${name}src.v(.*?)]
