| 32 | set my_universal_archs {i386 ppc} |
| 33 | set first_arch [lindex ${my_universal_archs} 0] |
| 34 | |
| 35 | set my_worksrcpaths ${worksrcpath} |
| 36 | |
| 37 | variant 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 | } |
| 83 | } |
| 84 | |