source: trunk/dports/graphics/netpbm/Portfile @ 152293

Last change on this file since 152293 was 152293, checked in by ryandesign@…, 15 months ago

netpbm: update to 10.75.03

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.6 KB
Line 
1# -*- 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
2# $Id: Portfile 152293 2016-09-02 21:58:40Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                netpbm
7version             10.75.03
8svn.revision        2818
9categories          graphics
10platforms           darwin freebsd linux
11maintainers         ryandesign openmaintainer
12license             {BSD GPL-2 IJG Permissive}
13
14description         Image manipulation
15
16long_description    A whole bunch of utilities for primitive manipulation \
17                    of graphic images. Wide array of converters from one \
18                    graphics format to another, e.g. from g3 fax format to \
19                    jpeg. Many basic graphics editing tools such as \
20                    magnifying and cropping.
21
22homepage            http://netpbm.sourceforge.net/
23
24fetch.type          svn
25svn.url             https://svn.code.sf.net/p/netpbm/code/advanced/
26worksrcdir          advanced
27
28patchfiles          patch-converter-other-giftopnm.c-strcaseeq.diff \
29                    patch-lib-Makefile.diff \
30                    patch-other-pamx-Makefile.diff
31
32variant universal {}
33
34configure.cflags-append -fno-common
35
36set jasperlib -ljasper
37set ldreloc NONE
38set ldshlib {-shared -Wl,-soname,$(SONAME)}
39set linker_can_do_explicit_library N
40set netpbmlibtype unixshared
41set netpbmlibsuffix so
42set want_sse N
43set want_x11 N
44
45configure {
46    # The netpbm configure script is interactive, and appends its results to
47    # the config.mk file; doc/INSTALL recommends packagers do that manually.
48    copy -force ${worksrcpath}/config.mk.in ${worksrcpath}/config.mk
49    set configmk [open ${worksrcpath}/config.mk a]
50    puts ${configmk} "
51CC = ${configure.cc}
52CFLAGS = ${configure.cflags} ${configure.cppflags} [get_canonical_archflags cc]
53CFLAGS_CONFIG = \$(CFLAGS)
54JASPERHDR_DIR = ${prefix}/include
55JASPERLIB = ${jasperlib}
56JBIGHDR_DIR = ${prefix}/include
57JBIGLIB = -ljbig
58JPEGLIB = -ljpeg
59LDFLAGS = ${configure.ldflags} [get_canonical_archflags ld]
60LDRELOC = ${ldreloc}
61LDSHLIB = ${ldshlib}
62LINKER_CAN_DO_EXPLICIT_LIBRARY = ${linker_can_do_explicit_library}
63NETPBMLIB_RUNTIME_PATH = ${prefix}/lib
64NETPBMLIBTYPE = ${netpbmlibtype}
65NETPBMLIBSUFFIX = ${netpbmlibsuffix}
66PKGMANDIR = share/man
67PNGLIB = -lpng
68RGB_DB_PATH = ${prefix}/share/${name}/rgb.txt
69TIFFLIB = -ltiff
70WANT_SSE = ${want_sse}
71WANT_X11 = ${want_x11}
72ZLIB = -lz
73"
74    close ${configmk}
75}
76
77platform darwin {
78    set ldshlib {$(LDFLAGS) -dynamiclib -install_name $(NETPBMLIB_RUNTIME_PATH)/libnetpbm.$(MAJ).$(NETPBMLIBSUFFIX) -compatibility_version $(MAJ) -current_version $(MAJ).$(MIN).$(NETPBM_POINT_RELEASE)}
79    set netpbmlibtype dylib
80    set netpbmlibsuffix dylib
81}
82
83# Non-Darwin platforms are untested.
84platform linux {
85    set ldreloc {ld --reloc}
86    set linker_can_do_explicit_library Y
87}
88
89platform freebsd {
90    depends_build-append port:libtool
91
92    patchfiles-append patch-libopt.c.diff
93
94    set jasperlib ${prefix}/lib/libjasper.la
95    set ldshlib "${prefix}/lib/glibtool --mode=link gcc"
96}
97
98build.args          messages=yes
99build.type          gnu
100
101set pkgtargets      {}
102
103# The tests can only be run after things have been destrooted ("packaged").
104post-build {
105    system -W ${worksrcpath} "${build.cmd} ${pkgtargets} pkgdir=${destroot}${prefix}"
106}
107
108destroot {
109    move ${destroot}${prefix}/misc ${destroot}${prefix}/share/${name}
110
111    # Fix ownership of files installed during the build phase.
112    # Not using fs-traverse with file attributes, because that doesn't handle symlinks.
113    exec chown -R ${install.user}:${install.group} ${destroot}
114}
115
116if {${subport} eq ${name}} {
117    installs_libs       no
118
119    # TODO: Don't build libnetpbm again in netpbm subport.
120    # TODO: Replace pointer manpages with real manpages. See doc/USERDOC.
121
122    depends_lib-append  port:jasper \
123                        port:jbigkit \
124                        port:jpeg \
125                        port:libnetpbm \
126                        port:libpng \
127                        port:libxml2 \
128                        port:tiff \
129                        port:zlib
130
131    # Remove library from subdirs, leaving only the programs.
132    #patchfiles-append   patch-${subport}-GNUmakefile.diff
133
134    # GNUmakefile warns that parallel build dependencies are only declared correctly
135    # when using the "all" target, but the above patch is enough to change that.
136    #use_parallel_build  no
137
138    # Install programs.
139    lappend pkgtargets  install.bin
140    # Install data files.
141    lappend pkgtargets  install.data
142    # Install manpages.
143    lappend pkgtargets  install.man
144
145    test.run            yes
146    test.target         check
147    test.args           pkgdir=${destroot}${prefix} \
148                        resultdir=${workpath}/test \
149                        tmpdir=${workpath}/.tmp
150
151    post-destroot {
152        # Delete manweb files and files installed by the libnetpbm subport.
153        delete {*}[glob -directory ${destroot}${prefix} bin/manweb share/man/man1/manweb.1 share/man/man3/libnetpbm.3 share/man/man5/*.5 share/${name}/rgb.txt]
154
155        # Install documentation.
156        set docdir ${prefix}/share/doc/${subport}
157        xinstall -d ${destroot}${docdir}
158        xinstall -m 644 -W ${worksrcpath} \
159            README \
160            doc/COPYRIGHT.PATENT \
161            doc/GPL_LICENSE.txt \
162            doc/HISTORY \
163            doc/Netpbm.programming \
164            doc/USERDOC \
165            doc/copyright_summary \
166            doc/lgpl_v21.txt \
167            doc/patent_summary \
168            ${destroot}${docdir}
169    }
170
171    variant x11 description {Build the pamx image viewer} {
172        global want_x11
173        set want_x11            Y
174        depends_build-append    port:pkgconfig
175        depends_lib-append      port:xorg-libX11
176    }
177
178    default_variants    +x11
179
180    livecheck.type      regex
181    livecheck.url       https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced/version.mk&limit=1
182    livecheck.regex     {(\d+(\.\d+)+)}
183} else {
184    livecheck.type      none
185}
186
187subport libnetpbm {
188    # TODO: descriptions
189
190    license             Permissive
191
192    # Remove programs from subdirs, leaving only the library.
193    #patchfiles-append   patch-${subport}-GNUmakefile.diff
194
195    # Look for manweb.conf in ${prefix}/etc instead of /etc.
196    #patchfiles-append   patch-manweb.diff
197    #post-patch {
198    #    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/manweb
199    #}
200
201    build.target        lib/all
202
203    # Install libraries and headers.
204    lappend pkgtargets  install-dev
205    # Install manweb program.
206    #lappend pkgtargets  install.bin
207    # Install rgb.txt data file.
208    lappend pkgtargets  lib/install.data
209    # Install manpage for manweb.
210    #lappend pkgtargets  install.man1
211    # Install manpages for libnetpbm and file formats.
212    lappend pkgtargets  lib/install.man
213    # Install manweb URL file for manweb.
214    #lappend pkgtargets  install.manweb
215    # Install manweb URL file for netpbm (and "doc" which gets deleted later).
216    #lappend pkgtargets  install.manwebmain
217
218    post-build {
219        # Build manweb.conf like installnetpbm.pl would.
220        #copy ${filespath}/manweb.conf.in ${build.dir}/manweb.conf
221        #reinplace "s|@PREFIX@|${prefix}|g" ${build.dir}/manweb.conf
222
223        # Build netpbm-config and netpbm.pc like installnetpbm.pl would.
224        copy ${worksrcpath}/buildtools/config_template ${build.dir}/netpbm-config
225        copy ${worksrcpath}/buildtools/pkgconfig_template ${build.dir}/netpbm.pc
226        set files [list ${build.dir}/netpbm-config ${build.dir}/netpbm.pc]
227        reinplace "/^@/d" {*}${files}
228        reinplace "s|@BINDIR@|${prefix}/bin|g" {*}${files}
229        reinplace "s|@DATADIR@|${prefix}/share/${name}|g" {*}${files}
230        reinplace "s|@INCLUDEDIR@|${prefix}/include|g" {*}${files}
231        reinplace "s|@LIBDIR@|${prefix}/lib|g" {*}${files}
232        reinplace "s|@LINKDIR@|${prefix}/lib|g" {*}${files}
233        reinplace "s|@MANDIR@|${prefix}/share/man|g" {*}${files}
234        reinplace "s|@VERSION@|${version}|g" {*}${files}
235    }
236
237    post-destroot {
238        # Don't install a data file into ${prefix}/bin; that's weird.
239        #delete ${destroot}${prefix}/bin/doc.url
240
241        # Install manweb.conf.
242        #xinstall -m 644 ${build.dir}/manweb.conf ${destroot}${prefix}/etc/
243
244        # Install netpbm-config and netpbm.pc.
245        xinstall -m 755 ${build.dir}/netpbm-config ${destroot}${prefix}/bin/
246        xinstall -m 644 ${build.dir}/netpbm.pc ${destroot}${prefix}/lib/pkgconfig/
247
248        move {*}[glob ${destroot}${prefix}/link/*] ${destroot}${prefix}/lib/
249
250        # Add symlinks for old library names that some old software still uses.
251        set new_library [file readlink ${destroot}${prefix}/lib/libnetpbm.${netpbmlibsuffix}]
252        foreach old_library {pbm pgm pnm ppm} {
253            ln -s ${new_library} ${destroot}${prefix}/lib/lib${old_library}.${netpbmlibsuffix}
254        }
255    }
256
257    pre-activate {
258        # netpbm < 10.70.07 installed libnetpbm and associated files
259        if {![catch {set installed [lindex [registry_active netpbm] 0]}]} {
260            set installed_version [lindex ${installed} 1]
261            if {[vercmp ${installed_version} 10.70.07] < 0} {
262                registry_deactivate_composite netpbm "" [list ports_nodepcheck 1]
263            }
264        }
265    }
266}
267
268# work around bug in Apple's gcc build 4061
269platform darwin 8 {
270    depends_build-append port:gmake
271    build.cmd ${prefix}/bin/gmake
272    pre-configure {
273        set fl [open "| ${configure.cc} --version"]
274        set data [read $fl]
275        close $fl
276        if {[regexp "build 4061" ${data}]} {
277            ui_msg "On Mac OS X ${macosx_version}, ${name} @${version} does not work with gcc version \"${data}\"."
278            return -code error "incompatible gcc version"
279        }
280    }
281}
Note: See TracBrowser for help on using the repository browser.