Ticket #17274: Portfile

File Portfile, 2.9 KB (added by illogic-al@…, 15 years ago)

universal Portfile for exiv2

Line 
1# $Id: Portfile 40023 2008-09-17 21:07:58Z eridius@macports.org $
2
3PortSystem 1.0
4
5name             exiv2
6version          0.17.1
7homepage         http://www.exiv2.org/
8description      EXIF and IPTC metadata manipulation library and tools
9categories       graphics
10platforms        darwin
11maintainers      vafer.org:tcurdt openmaintainer
12
13master_sites     http://www.exiv2.org/
14checksums        md5 52a602f4f0d9e89b7084ac795b7547ac
15
16long_description Exiv2 comprises of a C++ library and a command line utility \
17                 which allows you to manipulate EXIF and IPTC image metadata.
18
19depends_lib      port:gettext port:libiconv \
20                 port:expat port:zlib
21
22configure.args  --with-expat=${prefix}
23
24if {![info exists universal_archs]} {
25    set universal_archs {i386 ppc}
26}
27set first_arch [lindex ${universal_archs} 0]
28
29set my_worksrcpaths ${worksrcpath}
30
31#make 4-way universal build ready
32variant universal {
33        post-patch {
34#               foreach arch {i386 x86_64 ppc ppc64}
35                foreach arch {i386 ppc} {
36                        file copy ${worksrcpath} ${workpath}/${arch}
37                }
38        }
39
40        configure {
41                system "cd ${workpath}/i386 && CC=/usr/bin/i686-apple-darwin9-gcc-4.2.1 CXX=/usr/bin/i686-apple-darwin9-g++-4.2.1 \
42                ${configure.cmd} ${configure.pre_args} ${configure.args}"
43#               system "cd ${workpath}/x86_64 && ./configure darwin64-x86_64-cc ${configure.pre_args} ${configure.args}"
44                system "cd ${workpath}/ppc && CC=/usr/bin/powerpc-apple-darwin9-gcc-4.2.1 CXX=/usr/bin/powerpc-apple-darwin9-g++-4.2.1 \
45                ${configure.cmd} ${configure.pre_args} ${configure.args}"
46#               system "cd ${workpath}/ppc64 && ./configure darwin64-ppc-cc ${configure.pre_args} ${configure.args}"
47        }
48
49        post-configure {
50        foreach arch ${universal_archs} {
51                        reinplace "s|-all_load||g" ${workpath}/${arch}/libtool
52                }
53        }
54
55        build {
56#               foreach arch {i386 x86_64 ppc ppc64}
57                foreach arch {i386 ppc} {
58                        system "cd ${workpath}/${arch} && make all"
59                }
60        }
61   
62    destroot {
63        system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}"
64        foreach bin {exiv2} {
65            set output_lib ${destroot}${prefix}/bin/${bin}
66            set lipo_args {}
67            foreach arch ${universal_archs} {
68                lappend lipo_args -arch ${arch} ${workpath}/${arch}/src/.libs/${bin}
69            }
70            lappend lipo_args -create -output ${output_lib}
71            delete ${output_lib}
72            system "lipo ${lipo_args}"
73        }
74        foreach lib [list [file readlink ${workpath}/${first_arch}/src/.libs/libexiv2.dylib] libexiv2.a] {
75            set output_lib ${destroot}${prefix}/lib/${lib}
76            set lipo_args {}
77            foreach arch ${universal_archs} {
78                lappend lipo_args -arch ${arch} ${workpath}/${arch}/src/.libs/${lib}
79            }
80            lappend lipo_args -create -output ${output_lib}
81            delete ${output_lib}
82            system "lipo ${lipo_args}"
83        }
84    }
85}
86
87destroot.destdir prefix=${destroot}${prefix}