Ticket #29692: Portfile

File Portfile, 6.0 KB (added by KNIZEK.MILAN@…, 13 years ago)

Working portfile for netpbm

Line 
1# $Id: Portfile 76615 2011-03-02 16:24:50Z mas@macports.org $
2
3PortSystem 1.0
4
5name            netpbm
6version         10.47.26
7revision        0
8svn.revision    1402
9categories      graphics
10maintainers     mas openmaintainer
11description     Image manipulation
12long_description \
13    A whole bunch of utilities for primitive manipulation \
14    of graphic images.  Wide array of converters from one \
15    graphics format to another.  E.g. from g3 fax format to \
16    jpeg.  Many basic graphics editing tools such as \
17    magnifying and cropping.
18
19homepage        http://netpbm.sourceforge.net/
20master_sites    sourceforge:netpbm
21platforms       darwin freebsd linux
22# Parallel building is not reliable in netpbm 10.26.x.
23# This has been fixed for the next major release of netpbm.
24# See http://trac.macports.org/ticket/17516#comment:7
25# If you're thinking about enabling parallel build in the Portfile,
26# please make sure to test it on OS X 10.4 as well!  Thanks!
27use_parallel_build  no
28
29depends_build   path:bin/perl:perl5
30
31depends_lib     port:zlib port:jpeg port:tiff \
32                port:libpng port:jasper \
33                port:libxml2
34
35fetch.type      svn
36svn.url         http://${name}.svn.sourceforge.net/svnroot/${name}/stable
37worksrcdir      stable
38
39patchfiles      patch-pm_config.in.h.diff \
40                patch-lib-Makefile.diff
41
42post-patch {
43    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/pm_config.in.h
44}
45
46configure.optflags -O3
47
48configure {
49    # netpbm uses a "configure" script that simply helps building
50    # config.mk manually.  During automated install using macports,
51    # we do that for our user.
52    file copy ${worksrcpath}/config.mk.in ${worksrcpath}/config.mk
53    reinplace "s|^CC =.*\$|CC = ${configure.cc}|" ${worksrcpath}/config.mk
54    if {[variant_isset universal]} {
55        reinplace "s|^#CFLAGS =.*\$|CFLAGS = ${configure.cppflags} ${configure.cflags} ${configure.universal_cflags}|" ${worksrcpath}/config.mk
56        reinplace "s|^#LDFLAGS +=.*\$|LDFLAGS = ${configure.ldflags} ${configure.universal_ldflags}|g" ${worksrcpath}/config.mk
57    } else {
58        reinplace "s|^#CFLAGS =.*\$|CFLAGS = ${configure.cppflags} ${configure.cflags} ${configure.cc_archflags}|" ${worksrcpath}/config.mk
59        reinplace "s|^#LDFLAGS +=.*\$|LDFLAGS = ${configure.ldflags} ${configure.ld_archflags}|g" ${worksrcpath}/config.mk
60    }
61    reinplace "s|^CFLAGS_SHLIB =.*\$|CFLAGS_SHLIB = -fno-common|" ${worksrcpath}/config.mk
62    reinplace "s|^TIFFLIB =.*\$|TIFFLIB = -ltiff|" ${worksrcpath}/config.mk
63    reinplace "s|^JPEGLIB =.*\$|JPEGLIB = -ljpeg|" ${worksrcpath}/config.mk
64    reinplace "s|^PNGLIB =.*\$|PNGLIB = -lpng|" ${worksrcpath}/config.mk
65    reinplace "s|^ZLIB =.*\$|ZLIB = -lz|" ${worksrcpath}/config.mk
66    reinplace "s|^JASPERHDR_DIR =.*\$|JASPERHDR_DIR = ${prefix}/include|" ${worksrcpath}/config.mk
67}
68
69platform darwin {
70    post-configure {
71        set ldshlib "${configure.ldflags} -dynamiclib -install_name ${prefix}/lib/libnetpbm.\$(MAJ).dylib -compatibility_version \$(MAJ) -current_version ${version}"
72        if {[variant_isset universal]} {
73            set ldshlib "${ldshlib} ${configure.universal_ldflags}"
74        } else {
75            set ldshlib "${ldshlib} ${configure.ld_archflags}"
76        }
77        reinplace "s|^NETPBMLIBTYPE =.*\$|NETPBMLIBTYPE = dylib|" ${worksrcpath}/config.mk
78        reinplace "s|^NETPBMLIBSUFFIX =.*\$|NETPBMLIBSUFFIX = dylib|" ${worksrcpath}/config.mk
79        reinplace "s|^LDSHLIB =.*\$|LDSHLIB = ${ldshlib}|" ${worksrcpath}/config.mk
80        reinplace "s|^JASPERLIB =.*\$|JASPERLIB = -ljasper|" ${worksrcpath}/config.mk
81    }
82}
83
84platform linux {
85    post-configure {
86        set ldshlib {-shared -Wl,-soname,$(SONAME)}
87        reinplace "s|^NETPBMLIBTYPE =.*\$|NETPBMLIBTYPE = unixshared|" ${worksrcpath}/config.mk
88        reinplace "s|^NETPBMLIBSUFFIX =.*\$|NETPBMLIBSUFFIX = so|" ${worksrcpath}/config.mk
89        reinplace "s|^LDSHLIB =.*\$|LDSHLIB = ${ldshlib}|" ${worksrcpath}/config.mk
90        reinplace "s|^JASPERLIB =.*\$|JASPERLIB = -ljasper|" ${worksrcpath}/config.mk
91        reinplace "s|^LDRELOC =.*\$|LDRELOC = ld --reloc|" ${worksrcpath}/config.mk
92        reinplace "s|^LINKER_CAN_DO_EXPLICIT_LIBRARY =.*\$|LINKER_CAN_DO_EXPLICIT_LIBRARY = Y|" ${worksrcpath}/config.mk
93    }
94}
95
96platform freebsd {
97    post-configure {
98        set ldshlib {glibtool --mode=link gcc}
99        reinplace "s|^NETPBMLIBTYPE =.*\$|NETPBMLIBTYPE = unixshared|" ${worksrcpath}/config.mk
100        reinplace "s|^NETPBMLIBSUFFIX =.*\$|NETPBMLIBSUFFIX = so|" ${worksrcpath}/config.mk
101        reinplace "s|^LDSHLIB =.*\$|LDSHLIB = ${ldshlib}|" ${worksrcpath}/config.mk
102        reinplace "s|^JASPERLIB =.*\$|JASPERLIB = ${prefix}/lib/libjasper.la|" ${worksrcpath}/config.mk
103    }
104    patchfiles-append patch-libopt.c.diff
105    depends_build port:libtool
106}
107
108build.args    "messages=yes"
109build.target  ""
110build.type    gnu
111
112destroot.target   package
113destroot.destdir  pkgdir=${destroot}${prefix}
114
115pre-destroot {
116    file delete -force ${destroot}${prefix}
117}
118
119post-destroot {
120    xinstall -m 755 -d ${destroot}${prefix}/share/netpbm
121    eval move ${destroot}${prefix}/bin/doc.url [glob ${destroot}${prefix}/misc/*] ${destroot}${prefix}/share/netpbm
122    move ${destroot}${prefix}/man ${destroot}${prefix}/share/
123     move ${destroot}${prefix}/link/libnetpbm.a ${destroot}${prefix}/lib
124
125    eval delete [glob -type f -directory ${destroot}${prefix} *]
126
127    foreach old_library {pbm pgm pnm ppm} {
128        ln -s libnetpbm.dylib ${destroot}${prefix}/lib/lib${old_library}.dylib
129    }
130}
131
132# work around bug in Apple's gcc build 4061
133platform darwin 8 {
134    pre-configure {
135        set fl [open "| ${configure.cc} --version"]
136        set data [read $fl]
137        close $fl
138        if {[regexp "build 4061" ${data}]} {
139            ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} does not work with gcc version \"${data}\"."
140            return -code error "incompatible gcc version"
141        }
142    }
143}
144
145livecheck.type  regex
146livecheck.url   http://${name}.svn.sourceforge.net/viewvc/${name}/stable/
147livecheck.regex {Release ([0-9.]+)}