# $Id: Portfile 42170 2008-11-16 16:09:38Z ram@macports.org $ PortSystem 1.0 name lame version 3.98.2 categories audio platforms darwin freebsd maintainers ram openmaintainer description Lame Ain't an MP3 Encoder long_description LAME is an educational tool to be used for learning \ about MP3 encoding. The goal of the LAME project is to use the open \ source model to improve the psycho acoustics, noise shaping and speed \ of MP3. LAME is not for everyone - it is distributed as source code \ only and requires the ability to use a C compiler. homepage http://lame.sourceforge.net/ master_sites sourceforge:lame distname ${name}-398-2 depends_lib port:ncurses checksums md5 719dae0ee675d0c16e0e89952930ed35 \ sha1 b2db41dbc9c0824caa102e8c932b820c79ccd5ec \ rmd160 767dd94271eef221170469535db2bf388149715a configure.args --mandir=${prefix}/share/man set my_universal_archs {i386 ppc} set first_arch [lindex ${my_universal_archs} 0] set my_worksrcpaths ${worksrcpath} variant universal { set my_worksrcpaths {} foreach arch ${my_universal_archs} { lappend my_worksrcpaths ${workpath}/${arch} } post-patch { foreach arch ${my_universal_archs} { if {[string equal ${arch} ${first_arch}]} { move ${worksrcpath} ${workpath}/${first_arch} } else { copy ${workpath}/${first_arch} ${workpath}/${arch} } } } configure { foreach arch ${my_universal_archs} { set my_arch_flag "-arch ${arch}" set my_cflags "${configure.cflags} -isysroot ${sysroot} ${my_arch_flag} -I${prefix}/include -L${prefix}/lib" set my_ldflags "${configure.ldflags} ${my_arch_flag}" set pcp "{prefix}/lib/pkgconfig" set my_configure_args "CC=\"gcc -arch ${arch}\"" 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}" } } build { foreach arch ${my_universal_archs} { system "cd ${workpath}/${arch} && ${build.cmd} ${build.pre_args}" } } destroot { system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}" foreach lib [list [file readlink ${workpath}/${first_arch}/libmp3lame/.libs/libmp3lame.dylib] libmp3lame.a] { set output_lib ${destroot}${prefix}/lib/${lib} set lipo_args {} foreach arch ${my_universal_archs} { lappend lipo_args -arch ${arch} ${workpath}/${arch}/libmp3lame/.libs/${lib} } lappend lipo_args -create -output ${output_lib} delete ${output_lib} system "lipo ${lipo_args}" } set output_bin ${destroot}${prefix}/bin/lame set lipo_args {} foreach arch ${my_universal_archs} { lappend lipo_args -arch ${arch} ${workpath}/${arch}/frontend/lame } lappend lipo_args -create -output ${output_bin} delete ${output_bin} system "lipo ${lipo_args}" } }