Ticket #15995: Portfile

File Portfile, 3.4 KB (added by hvdwolf@…, 16 years ago)

Update Portfile for universal build of lame 3.98

Line 
1# $Id: Portfile 38059 2008-07-04 20:13:54Z ram@macports.org $
2
3PortSystem        1.0
4
5name              lame
6set major         3
7set minor         98
8version           ${major}.${minor}
9categories        audio
10platforms         darwin freebsd
11maintainers       ram openmaintainer
12
13description       Lame Ain't an MP3 Encoder
14long_description  LAME is an educational tool to be used for learning \
15  about MP3 encoding. The goal of the LAME project is to use the open \
16  source model to improve the psycho acoustics, noise shaping and speed \
17  of MP3. LAME is not for everyone - it is distributed as source code \
18  only and requires the ability to use a C compiler.
19
20homepage          http://lame.sourceforge.net/
21master_sites      sourceforge:lame
22distname          ${name}-${major}${minor}
23
24depends_lib       port:ncurses
25
26checksums         md5 f44b9f8e1b5d8835d0a77f9cc9cedd1c \
27                  sha1 287979d076834882c99d0cc01ddbd9b3697ceaae \
28                  rmd160 754343791ac80d2403291c63f99eb409bca6b62f
29
30configure.args    --mandir=${prefix}/share/man
31
32set my_universal_archs {i386 ppc}
33set first_arch [lindex ${my_universal_archs} 0]
34
35set my_worksrcpaths ${worksrcpath}
36
37variant universal {
38    set my_worksrcpaths {}
39    foreach arch ${my_universal_archs} {
40        lappend my_worksrcpaths ${workpath}/${arch}
41    }
42
43    post-patch {
44        foreach arch ${my_universal_archs} {
45            if {[string equal ${arch} ${first_arch}]} {
46                move ${worksrcpath} ${workpath}/${first_arch}
47            } else {
48                copy ${workpath}/${first_arch} ${workpath}/${arch}
49            }
50        }
51    }
52
53    configure {
54        foreach arch ${my_universal_archs} {
55            set my_arch_flag "-arch ${arch}"
56            set my_cflags "${configure.cflags} -isysroot ${sysroot} ${my_arch_flag} -I${prefix}/include -L${prefix}/lib"
57            set my_ldflags "${configure.ldflags} ${my_arch_flag}"
58            set pcp "{prefix}/lib/pkgconfig"
59            set my_configure_args "CC=\"gcc -arch ${arch}\""
60            system "cd ${workpath}/${arch} && CFLAGS=\"${my_cflags}\" CXXFLAGS=\"${my_cflags}\" LDFLAGS=\"${my_ldflags}\" PKG_CONFIG_PATH=\"${pcp}\" ${configure.cmd} ${configure.pre_args} ${configure.args} ${my_configure_args}"
61        }
62    }
63
64    build {
65        foreach arch ${my_universal_archs} {
66            system "cd ${workpath}/${arch} && ${build.cmd} ${build.pre_args}"
67        }
68    }
69
70    destroot {
71        system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}"
72        foreach lib [list [file readlink ${workpath}/${first_arch}/libmp3lame/.libs/libmp3lame.dylib] libmp3lame.a] {
73            set output_lib ${destroot}${prefix}/lib/${lib}
74            set lipo_args {}
75            foreach arch ${my_universal_archs} {
76                lappend lipo_args -arch ${arch} ${workpath}/${arch}/libmp3lame/.libs/${lib}
77            }
78            lappend lipo_args -create -output ${output_lib}
79            delete ${output_lib}
80            system "lipo ${lipo_args}"
81        }
82        set output_bin ${destroot}${prefix}/bin/lame
83        set lipo_args {}
84        foreach arch ${my_universal_archs} {
85            lappend lipo_args -arch ${arch} ${workpath}/${arch}/frontend/lame
86        }
87        lappend lipo_args -create -output ${output_bin}
88        delete ${output_bin}
89        system "lipo ${lipo_args}"
90
91    }
92}
93
94livecheck.check   regex
95livecheck.url     ${homepage}download.php
96livecheck.regex   {The current release version of LAME is ([0-9]+\.[0-9]+)}