source: trunk/dports/graphics/netpbm/Portfile

Last change on this file was 153550, checked in by ryandesign@…, 14 months ago

netpbm: Update to 10.76.00

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.6 KB
RevLine 
[131239]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
[20312]2# $Id: Portfile 153550 2016-10-04 09:50:53Z ryandesign@macports.org $
[27904]3
[131239]4PortSystem          1.0
[27904]5
[131239]6name                netpbm
[153550]7version             10.76.00
8svn.revision        2830
[131239]9categories          graphics
10platforms           darwin freebsd linux
11maintainers         ryandesign openmaintainer
12license             {BSD GPL-2 IJG Permissive}
[12726]13
[131239]14description         Image manipulation
[12726]15
[131239]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.
[43004]21
[131239]22homepage            http://netpbm.sourceforge.net/
[11723]23
[131239]24fetch.type          svn
25svn.url             https://svn.code.sf.net/p/netpbm/code/advanced/
26worksrcdir          advanced
27
[135102]28patchfiles          patch-converter-other-giftopnm.c-strcaseeq.diff \
29                    patch-lib-Makefile.diff \
[138107]30                    patch-other-pamx-Makefile.diff
[11723]31
[115650]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
[131363]43set want_x11 N
[115650]44
[50420]45configure {
[115650]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}
[123653]56JBIGHDR_DIR = ${prefix}/include
57JBIGLIB = -ljbig
[115650]58JPEGLIB = -ljpeg
59LDFLAGS = ${configure.ldflags} [get_canonical_archflags ld]
60LDRELOC = ${ldreloc}
61LDSHLIB = ${ldshlib}
62LINKER_CAN_DO_EXPLICIT_LIBRARY = ${linker_can_do_explicit_library}
[138022]63NETPBMLIB_RUNTIME_PATH = ${prefix}/lib
[115650]64NETPBMLIBTYPE = ${netpbmlibtype}
65NETPBMLIBSUFFIX = ${netpbmlibsuffix}
[135732]66PKGMANDIR = share/man
[115650]67PNGLIB = -lpng
[138022]68RGB_DB_PATH = ${prefix}/share/${name}/rgb.txt
[115650]69TIFFLIB = -ltiff
70WANT_SSE = ${want_sse}
[131363]71WANT_X11 = ${want_x11}
[115650]72ZLIB = -lz
73"
74    close ${configmk}
[3274]75}
[11723]76
[43004]77platform darwin {
[138022]78    set ldshlib {$(LDFLAGS) -dynamiclib -install_name $(NETPBMLIB_RUNTIME_PATH)/libnetpbm.$(MAJ).$(NETPBMLIBSUFFIX) -compatibility_version $(MAJ) -current_version $(MAJ).$(MIN).$(NETPBM_POINT_RELEASE)}
[115650]79    set netpbmlibtype dylib
80    set netpbmlibsuffix dylib
[43004]81}
82
[138022]83# Non-Darwin platforms are untested.
[43004]84platform linux {
[115650]85    set ldreloc {ld --reloc}
86    set linker_can_do_explicit_library Y
[43004]87}
88
89platform freebsd {
[115650]90    depends_build-append port:libtool
91
[43004]92    patchfiles-append patch-libopt.c.diff
[115650]93
94    set jasperlib ${prefix}/lib/libjasper.la
95    set ldshlib "${prefix}/lib/glibtool --mode=link gcc"
[43004]96}
97
[123653]98build.args          messages=yes
[131239]99build.type          gnu
[11723]100
[138022]101set pkgtargets      {}
[43004]102
[138022]103# The tests can only be run after things have been destrooted ("packaged").
[135102]104post-build {
[138022]105    system -W ${worksrcpath} "${build.cmd} ${pkgtargets} pkgdir=${destroot}${prefix}"
[43004]106}
107
[135102]108destroot {
[138022]109    move ${destroot}${prefix}/misc ${destroot}${prefix}/share/${name}
[135102]110
[138022]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}
[43004]115
[138022]116if {${subport} eq ${name}} {
117    installs_libs       no
[43004]118
[138022]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}
[33002]169    }
[134734]170
[138022]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
[3274]185}
[14750]186
[138022]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
[14750]268# work around bug in Apple's gcc build 4061
269platform darwin 8 {
[133871]270    depends_build-append port:gmake
271    build.cmd ${prefix}/bin/gmake
[66658]272    pre-configure {
273        set fl [open "| ${configure.cc} --version"]
274        set data [read $fl]
275        close $fl
276        if {[regexp "build 4061" ${data}]} {
[138022]277            ui_msg "On Mac OS X ${macosx_version}, ${name} @${version} does not work with gcc version \"${data}\"."
[66658]278            return -code error "incompatible gcc version"
279        }
[14750]280    }
281}
Note: See TracBrowser for help on using the repository browser.