source: trunk/dports/graphics/freeimage/Portfile

Last change on this file was 139139, checked in by stromnov@…, 2 years ago

freeimage: update to version 3.17.0

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.9 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 139139 2015-08-03 21:26:02Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                freeimage
7version             3.17.0
8revision            0
9set major           [lindex [split ${version} .] 0]
10categories          graphics
11platforms           macosx
12license             {FreeImage-1 GPL-2 GPL-3}
13
14maintainers         nomaintainer
15
16description         Library for FreeImage, a dependency-less graphics library
17
18long_description    FreeImage is a library for developers who would like to \
19                    support most popular graphics image formats. Some \
20                    highlights are: extremely simple in use, not limited to \
21                    the local PC (unique FreeImageIO) and Plugin driven!
22
23homepage            http://freeimage.sourceforge.net/
24master_sites        sourceforge:project/freeimage/Source%20Distribution/${version}
25
26distname            FreeImage[strsed ${version} {g/\.//}]
27use_zip             yes
28worksrcdir          FreeImage
29
30checksums           rmd160  c4e87846098327ee346c49ae81b6036f6d9ab36d \
31                    sha256  fbfc65e39b3d4e2cb108c4ffa8c41fd02c07d4d436c594fff8dab1a6d5297f89
32
33post-patch {
34    # Libraries extension is ".dylib" on Darwin, not ".so"
35    reinplace {s/\.so/.dylib/} ${worksrcpath}/Makefile.gnu \
36        ${worksrcpath}/Makefile.fip
37
38    # A dot separates the library name from its version on Darwin
39    reinplace /^SHAREDLIB/s/-/./ ${worksrcpath}/Makefile.gnu \
40        ${worksrcpath}/Makefile.fip
41
42    # Use libtool(1) instead of ar(1)
43    reinplace {s/\$(AR) r/libtool -o/} ${worksrcpath}/Makefile.gnu \
44        ${worksrcpath}/Makefile.fip
45
46    # Do not force installation as root
47    reinplace {s/-o root -g root//} ${worksrcpath}/Makefile.gnu \
48        ${worksrcpath}/Makefile.fip
49
50    # Darwin requires different arguments to build dynamic libraries
51    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 \
52        ${worksrcpath}/Makefile.fip
53
54    # Darwin does not have a command ldconfig
55    reinplace "s|ldconfig||g" ${worksrcpath}/Makefile.gnu
56    # FreeImagePlus doesn't use ldconfig
57}
58
59use_configure       no
60
61# In the future, implement in the build phase?
62#configure.pipe      no
63#configure.ccache    no
64#configure.distcc    no
65
66# FreeImage uses -O3, which is set in the Makefiles
67configure.optflags-delete -Os
68
69variant universal {}
70
71# Reimplement parts of portconfigure.tcl
72if {[string match *clang* ${configure.cxx}]} {
73    configure.cxxflags-append -stdlib=${configure.cxx_stdlib}
74    configure.ldflags-append  -stdlib=${configure.cxx_stdlib}
75}
76
77if {${configure.sdkroot} ne ""} {
78    configure.ldflags-append "-Wl,-syslibroot,${configure.sdkroot}"
79}
80
81foreach flags {cflags cxxflags} compiler {cc cxx} {
82    eval configure.${flags}-append [get_canonical_archflags ${compiler}]
83   
84    if {${configure.sdkroot} ne ""} {
85        configure.${flags}-append -isysroot${configure.sdkroot}
86    }
87   
88    if {${configure.march} ne "" } {
89        configure.${flags}-append "-march=${configure.march}"
90    }
91   
92    if {${configure.mtune} ne "" } {
93        configure.${flags}-append "-mtune=${configure.mtune}"
94    }
95}
96
97# running build_main and destroot_main makes use of environmental variables like MACOSX_DEPLOYMENT_TARGET
98
99build {
100    foreach makefile {Makefile.gnu Makefile.fip} libname {libfreeimage libfreeimageplus} {
101        # Makefile overrides CFLAGS and CXXFLAGS, so append options to CC and CXX
102        build.args -f ${makefile} \
103            PREFIX=${prefix} \
104            VERLIBNAME=${libname}.${major}.dylib \
105            CC="${configure.cc} ${configure.cflags}" \
106            CXX="${configure.cxx} ${configure.cxxflags}" \
107            LDFLAGS="${configure.ldflags}"
108       
109        portbuild::build_main
110    }
111}
112
113destroot {
114    foreach makefile {Makefile.gnu Makefile.fip} libname {libfreeimage libfreeimageplus} {
115        destroot.args -f ${makefile} \
116            PREFIX="${prefix}" \
117            VERLIBNAME=${libname}.${major}.dylib \
118            INCDIR="${destroot}${prefix}/include" \
119            INSTALLDIR="${destroot}${prefix}/lib"
120       
121        portdestroot::destroot_main
122    }
123}
124
125post-destroot {
126    set docdir ${prefix}/share/doc/${name}
127    xinstall -d ${destroot}${docdir}
128    xinstall -m 644 -W ${worksrcpath} Whatsnew.txt license-fi.txt \
129        license-gplv2.txt license-gplv3.txt ${destroot}${docdir}
130    copy ${worksrcpath}/Examples ${destroot}${docdir}/examples
131}
132
133test.run            yes
134test.cmd            "${build.cmd} && ./testAPI"
135test.dir            ${worksrcpath}/TestAPI
136test.target
137
138post-patch {
139    # Use correct compiler and flags when compiling test
140    reinplace "s:g++:${configure.cxx} ${configure.cxxflags}:" ${test.dir}/Makefile
141}
142
143livecheck.type      regex
144livecheck.regex     {FreeImage (\d+(?:\.\d+)*) released}
Note: See TracBrowser for help on using the repository browser.