# -*- 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 # $Id$ PortSystem 1.0 name freeimage version 3.17.0 revision 0 set major [lindex [split ${version} .] 0] categories graphics platforms macosx license {FreeImage-1 GPL-2 GPL-3} maintainers nomaintainer description Library for FreeImage, a dependency-less graphics library long_description FreeImage is a library for developers who would like to \ support most popular graphics image formats. Some \ highlights are: extremely simple in use, not limited to \ the local PC (unique FreeImageIO) and Plugin driven! homepage http://freeimage.sourceforge.net/ master_sites sourceforge:project/freeimage/Source%20Distribution/${version} distname FreeImage[strsed ${version} {g/\.//}] use_zip yes worksrcdir FreeImage checksums rmd160 c4e87846098327ee346c49ae81b6036f6d9ab36d \ sha256 fbfc65e39b3d4e2cb108c4ffa8c41fd02c07d4d436c594fff8dab1a6d5297f89 post-patch { # Libraries extension is ".dylib" on Darwin, not ".so" reinplace {s/\.so/.dylib/} ${worksrcpath}/Makefile.gnu \ ${worksrcpath}/Makefile.fip # A dot separates the library name from its version on Darwin reinplace /^SHAREDLIB/s/-/./ ${worksrcpath}/Makefile.gnu \ ${worksrcpath}/Makefile.fip # Use libtool(1) instead of ar(1) reinplace {s/\$(AR) r/libtool -o/} ${worksrcpath}/Makefile.gnu \ ${worksrcpath}/Makefile.fip # Do not force installation as root reinplace {s/-o root -g root//} ${worksrcpath}/Makefile.gnu \ ${worksrcpath}/Makefile.fip # Darwin requires different arguments to build dynamic libraries reinplace "s|-Wl,-soname,\$(VERLIBNAME)|-dynamiclib -install_name \$(PREFIX)/lib/\$(VERLIBNAME) -compatibility_version \$(VER_MAJOR) -current_version \$(VER_MAJOR).\$(VER_MINOR)|g" ${worksrcpath}/Makefile.gnu \ ${worksrcpath}/Makefile.fip # Darwin does not have a command ldconfig reinplace "s|ldconfig||g" ${worksrcpath}/Makefile.gnu # FreeImagePlus doesn't use ldconfig } use_configure no # In the future, implement in the build phase? #configure.pipe no #configure.ccache no #configure.distcc no # FreeImage uses -O3, which is set in the Makefiles configure.optflags-delete -Os variant universal {} # Reimplement parts of portconfigure.tcl if {[string match *clang* ${configure.cxx}]} { configure.cxxflags-append -stdlib=${configure.cxx_stdlib} configure.ldflags-append -stdlib=${configure.cxx_stdlib} } if {${configure.sdkroot} ne ""} { configure.ldflags-append "-Wl,-syslibroot,${configure.sdkroot}" } foreach flags {cflags cxxflags} compiler {cc cxx} { eval configure.${flags}-append [get_canonical_archflags ${compiler}] if {${configure.sdkroot} ne ""} { configure.${flags}-append -isysroot${configure.sdkroot} } if {${configure.march} ne "" } { configure.${flags}-append "-march=${configure.march}" } if {${configure.mtune} ne "" } { configure.${flags}-append "-mtune=${configure.mtune}" } } # running build_main and destroot_main makes use of environmental variables like MACOSX_DEPLOYMENT_TARGET build { foreach makefile {Makefile.gnu Makefile.fip} libname {libfreeimage libfreeimageplus} { # Makefile overrides CFLAGS and CXXFLAGS, so append options to CC and CXX build.args -f ${makefile} \ PREFIX=${prefix} \ VERLIBNAME=${libname}.${major}.dylib \ CC="${configure.cc} ${configure.cflags}" \ CXX="${configure.cxx} ${configure.cxxflags}" \ LDFLAGS="${configure.ldflags}" portbuild::build_main } } destroot { foreach makefile {Makefile.gnu Makefile.fip} libname {libfreeimage libfreeimageplus} { destroot.args -f ${makefile} \ PREFIX="${prefix}" \ VERLIBNAME=${libname}.${major}.dylib \ INCDIR="${destroot}${prefix}/include" \ INSTALLDIR="${destroot}${prefix}/lib" portdestroot::destroot_main } } post-destroot { set docdir ${prefix}/share/doc/${name} xinstall -d ${destroot}${docdir} xinstall -m 644 -W ${worksrcpath} Whatsnew.txt license-fi.txt \ license-gplv2.txt license-gplv3.txt ${destroot}${docdir} copy ${worksrcpath}/Examples ${destroot}${docdir}/examples } test.run yes test.cmd "${build.cmd} && ./testAPI" test.dir ${worksrcpath}/TestAPI test.target post-patch { # Use correct compiler and flags when compiling test reinplace "s:g++:${configure.cxx} ${configure.cxxflags}:" ${test.dir}/Makefile } livecheck.type regex livecheck.regex {FreeImage (\d+(?:\.\d+)*) released}