# -*- 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 PortSystem 1.0 PortGroup github 1.0 # Download distfiles from GitHub mirror because fetching from svn keeps being # problematic. github.setup leahneukirchen netpbm-mirror f729c8566b4622350a1bad2c11eb38cae06c8bc0 name netpbm version 11.08.01 svn.revision 4966 set source_branch advanced distname ${source_branch}-r${svn.revision} set source_distfile ${distfiles} set userguide_commit 16fc707f36b9c7e10d40cea4a6dd3402fa2cbc0d set userguide_revision 4958 set userguide_branch userguide set userguide_distname ${userguide_branch}-r${userguide_revision} set userguide_distfile ${userguide_distname}${extract.suffix} checksums ${source_distfile} \ rmd160 116d357bec433061ba83caf7f2b6b48ce49522f7 \ sha256 a4298f3a0c357c8528bfa774e603fa9312018a4dc1567b327bb6c201a514f95c \ size 3015765 \ ${userguide_distfile} \ rmd160 192dc5ea92ec0e66eccad86efc56583ef23158b2 \ sha256 3fcf78cf2d7896bef2776236d90a54045d31327a06d6520d4ad052e35bef096f \ size 1820753 categories graphics platforms darwin freebsd linux maintainers {ryandesign @ryandesign} openmaintainer license {BSD GPL-2 IJG Permissive} description Image manipulation long_description A whole bunch of utilities for primitive manipulation \ of graphic images. Wide array of converters from one \ graphics format to another, e.g. from g3 fax format to \ jpeg. Many basic graphics editing tools such as \ magnifying and cropping. homepage http://netpbm.sourceforge.net github.tarball_from archive distfiles ${source_distfile}:source \ ${userguide_distfile}:userguide master_sites ${github.master_sites}:source \ ${github.homepage}/archive/${userguide_commit}:userguide if {[exists extract.rename]} { # set by the github portgroup, doesn't work with multiple dirs extract.rename no } post-extract { move ${workpath}/${github.project}-${git.branch} ${workpath}/${distname} move ${workpath}/${github.project}-${userguide_commit} ${workpath}/${userguide_distname} set newest_mtime 0 fs-traverse item ${worksrcpath} { if {[file isfile ${item}]} { set item_mtime [file mtime ${item}] if {${item_mtime} > ${newest_mtime}} { set newest_mtime ${item_mtime} } } } set fp [open ${workpath}/mtime w] puts ${fp} ${newest_mtime} close ${fp} # Delete the manpages that aren't for this subport. set libmanpages {libnetpbm pam pbm pgm pnm ppm} foreach f [glob ${workpath}/${userguide_distname}/*.html] { if {([lsearch -exact ${libmanpages} [file rootname [file tail ${f}]]] == -1) == (${subport} ne ${name})} { delete ${f} } } } patchfiles patch-lib-Makefile.diff \ patch-other-pamx-Makefile.diff variant universal {} configure.cflags-append -fno-common -D_DARWIN_C_SOURCE set jasperlib -ljasper set ldreloc NONE set ldshlib {-shared -Wl,-soname,$(SONAME)} set linker_can_do_explicit_library \ N set netpbmlibtype unixshared set netpbmlibsuffix so set want_sse N set want_x11 N configure { # The netpbm configure script is interactive, and appends its results to # the config.mk file; doc/INSTALL recommends packagers do that manually. copy -force ${worksrcpath}/config.mk.in ${worksrcpath}/config.mk set configmk [open ${worksrcpath}/config.mk a] puts ${configmk} " CC = ${configure.cc} CFLAGS = ${configure.cflags} ${configure.cppflags} [get_canonical_archflags cc] CFLAGS_CONFIG = \$(CFLAGS) JASPERHDR_DIR = ${prefix}/include JASPERLIB = ${jasperlib} JBIGHDR_DIR = ${prefix}/include JBIGLIB = -ljbig JPEGLIB = -ljpeg LDFLAGS = ${configure.ldflags} [get_canonical_archflags ld] LDRELOC = ${ldreloc} LDSHLIB = ${ldshlib} LINKER_CAN_DO_EXPLICIT_LIBRARY = ${linker_can_do_explicit_library} NETPBMLIB_RUNTIME_PATH = ${prefix}/lib NETPBMLIBTYPE = ${netpbmlibtype} NETPBMLIBSUFFIX = ${netpbmlibsuffix} PKGMANDIR = share/man PNGLIB = -lpng RGB_DB_PATH = ${prefix}/share/${name}/rgb.txt TIFFLIB = -ltiff WANT_SSE = ${want_sse} WANT_X11 = ${want_x11} ZLIB = -lz " close ${configmk} } platform darwin { set ldshlib {$(LDFLAGS) -dynamiclib -install_name $(NETPBMLIB_RUNTIME_PATH)/libnetpbm.$(MAJ).$(NETPBMLIBSUFFIX) -compatibility_version $(MAJ) -current_version $(MAJ).$(MIN).$(NETPBM_POINT_RELEASE)} set netpbmlibtype dylib set netpbmlibsuffix dylib } # Non-Darwin platforms are untested. platform linux { set ldreloc {ld --reloc} set linker_can_do_explicit_library Y } platform freebsd { depends_build-append port:libtool patchfiles-append patch-libopt.c.diff set jasperlib ${prefix}/lib/libjasper.la set ldshlib "${prefix}/lib/glibtool --mode=link gcc" } pre-build { set fp [open ${workpath}/mtime r] set mtime [read -nonewline ${fp}] close ${fp} build.env-append SOURCE_DATE_EPOCH=${mtime} } build.args messages=yes build.type gnu set pkgtargets {} post-build { # Build manpages from html files. system -W ${workpath}/${userguide_distname} "${build.cmd} MAKEMAN='${worksrcpath}/buildtools/makeman -v' USERGUIDE=. -f ${worksrcpath}/buildtools/manpage.mk manpages" # The tests can only be run after things have been destrooted ("packaged"). system -W ${worksrcpath} "${build.cmd} ${pkgtargets} pkgdir=${destroot}${prefix}" } destroot { # Install manpages. system -W ${workpath}/${userguide_distname} "${build.cmd} MANDIR=${destroot}${prefix}/share/man USERGUIDE=. -f ${worksrcpath}/buildtools/manpage.mk installman" move ${destroot}${prefix}/misc ${destroot}${prefix}/share/${name} # Fix ownership of files installed during the build phase. # Not using fs-traverse to call file attributes because that doesn't # handle symlinks. Not using chown proc because that doesn't support # changing the group: https://trac.macports.org/ticket/55332 #chown ${destroot} ${install.user} ${install.group} system "chown -R '${install.user}':'${install.group}' ${destroot}" } if {${subport} eq ${name}} { revision 0 installs_libs no # TODO: Don't build libnetpbm again in netpbm subport. depends_lib-append port:jasper \ port:jbigkit \ path:include/turbojpeg.h:libjpeg-turbo \ port:libnetpbm \ port:libpng \ port:libxml2 \ port:tiff \ port:zlib # Remove library from subdirs, leaving only the programs. #patchfiles-append patch-${subport}-GNUmakefile.diff # GNUmakefile warns that parallel build dependencies are only declared correctly # when using the "all" target, but the above patch is enough to change that. #use_parallel_build no # Install programs. lappend pkgtargets install.bin # Install data files. lappend pkgtargets install.data test.run yes test.target check test.args pkgdir=${destroot}${prefix} \ resultdir=${workpath}/test \ tmpdir=${workpath}/.tmp post-destroot { # Delete files installed by the libnetpbm subport. delete ${destroot}${prefix}/share/${name}/rgb.txt # Install documentation. set docdir ${prefix}/share/doc/${subport} xinstall -d ${destroot}${docdir} xinstall -m 0644 -W ${worksrcpath} \ README \ doc/COPYRIGHT.PATENT \ doc/GPL_LICENSE.txt \ doc/HISTORY \ doc/USERDOC \ doc/copyright_summary \ doc/lgpl_v21.txt \ doc/patent_summary \ ${destroot}${docdir} } variant x11 description {Build the pamx image viewer} { global want_x11 set want_x11 Y depends_build-append port:pkgconfig depends_lib-append port:xorg-libX11 } default_variants +x11 github.livecheck.branch ${source_branch} } else { livecheck.type none } subport libnetpbm { revision 0 license Permissive # TODO: descriptions # Remove programs from subdirs, leaving only the library. #patchfiles-append patch-${subport}-GNUmakefile.diff build.target lib/all # Install libraries and headers. lappend pkgtargets install-dev # Install rgb.txt data file. lappend pkgtargets lib/install.data post-build { # Build netpbm-config and netpbm.pc like installnetpbm.pl would. copy ${worksrcpath}/buildtools/config_template ${build.dir}/netpbm-config copy ${worksrcpath}/buildtools/pkgconfig_template ${build.dir}/netpbm.pc set files [list ${build.dir}/netpbm-config ${build.dir}/netpbm.pc] reinplace -q "/^@/d" {*}${files} reinplace -q "s|@BINDIR@|${prefix}/bin|g" {*}${files} reinplace -q "s|@DATADIR@|${prefix}/share/${name}|g" {*}${files} reinplace -q "s|@INCLUDEDIR@|${prefix}/include|g" {*}${files} reinplace -q "s|@LIBDIR@|${prefix}/lib|g" {*}${files} reinplace -q "s|@LINKDIR@|${prefix}/lib|g" {*}${files} reinplace -q "s|@MANDIR@|${prefix}/share/man|g" {*}${files} reinplace -q "s|@VERSION@|${version}|g" {*}${files} } post-destroot { # Install netpbm-config and netpbm.pc. xinstall -m 0755 ${build.dir}/netpbm-config ${destroot}${prefix}/bin/ xinstall -m 0644 ${build.dir}/netpbm.pc ${destroot}${prefix}/lib/pkgconfig/ # Add symlinks for old library names that some old software still uses. set new_library [file readlink ${destroot}${prefix}/lib/libnetpbm.${netpbmlibsuffix}] foreach old_library {pbm pgm pnm ppm} { ln -s ${new_library} ${destroot}${prefix}/lib/lib${old_library}.${netpbmlibsuffix} } } } # work around bug in Apple's gcc build 4061 platform darwin 8 { depends_build-append port:gmake build.cmd ${prefix}/bin/gmake use_parallel_build no pre-configure { set fl [open "| ${configure.cc} --version"] set data [read $fl] close $fl if {[regexp "build 4061" ${data}]} { ui_msg "On Mac OS X ${macos_version}, ${name} @${version} does not work with gcc version \"${data}\"." return -code error "incompatible gcc version" } } } patchfiles-append patch-python.diff set python_branch 3.12 set python_version [string map {. {}} ${python_branch}] configure.python ${prefix}/bin/python${python_branch} depends_build-append port:python${python_version} post-patch { reinplace \ "s|__MACPORTS_PYTHON__|${configure.python}|g" \ ${worksrcpath}/buildtools/makeman \ ${worksrcpath}/buildtools/manpage.mk }