# $Id$ PortSystem 1.0 name x264 version 20080724 revision 1 categories multimedia platforms darwin maintainers acho@macports.org description x264 - a free h264/avc encoder long_description x264 is a free library for encoding H264/AVC video streams. \ The code is written by Laurent Aimar, Eric Petit(OS X), Min \ Chen (vfw/nasm), Justin Clay(vfw), Måns Rullgård and Loren \ Merritt from scratch. It is released under the terms of the \ GPL license. homepage http://www.videolan.org/x264.html master_sites ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ distname ${name}-snapshot-${version}-2245 checksums sha1 8f3023d82d06b34a609e8c67ace8328e6c01aacb use_bzip2 yes depends_build bin:svn:subversion port:yasm configure.args \ --enable-pthread --enable-pic configure.cflags-append -fno-common -read_only_relocs suppress destroot.args DIR_INSTALL=${destroot}${prefix} build.target default variant noasm description {disable assembler optimization and remove yasm dep} { depends_build-delete port:yasm configure.args-append --disable-asm } variant G5 description {G5 specific optimizations} { configure.cflags-append "-mcpu=970 -mtune=970 -mpowerpc64 -mpowerpc-gpopt -fast -mabi=altivec -maltivec" } if {![info exists universal_archs]} { set universal_archs {i386 ppc} } set first_arch [lindex ${universal_archs} 0] set my_worksrcpaths ${worksrcpath} variant universal { set my_worksrcpaths {} foreach arch ${universal_archs} { lappend my_worksrcpaths ${workpath}/${arch} } post-patch { foreach arch ${universal_archs} { if {[string equal ${arch} ${first_arch}]} { move ${worksrcpath} ${workpath}/${first_arch} } else { copy ${workpath}/${first_arch} ${workpath}/${arch} } } } configure { foreach arch ${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}" if {[string equal ${arch} i386 ]} { set my_configure_args "CC=\"gcc -arch ${arch}\"" } else { set my_configure_args "CC=\"gcc -arch ${arch}\" --disable-asm" } system "cd ${workpath}/${arch} && CFLAGS=\"${my_cflags}\" CXXFLAGS=\"${my_cflags}\" LDFLAGS=\"${my_ldflags}\" ${configure.cmd} ${configure.pre_args} ${configure.args} ${my_configure_args}" } } build { foreach arch ${universal_archs} { system "cd ${workpath}/${arch} && ${build.cmd} ${build.pre_args}" # This was a first look at dylib. Needs some more investigation as I don't know ins&outs of macports #system "cd ${workpath}/${arch} && gcc -dynamiclib -arch ${arch} -o ${workpath}/${arch}/libx264.dylib common/*.o common/${arch}/*.o encoder/*.o" } } destroot { system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}" # leave .dylib and .a for later. Only .a now #foreach lib [list [file readlink ${workpath}/${first_arch}/libx264.dylib] libx264.a] { # set output_lib ${destroot}${prefix}/lib/${lib} # set lipo_args {} # foreach arch ${universal_archs} { # lappend lipo_args -arch ${arch} ${workpath}/${arch}/${lib} # } # lappend lipo_args -create -output ${output_lib} # delete ${output_lib} # system "lipo ${lipo_args}" #} # Do currently only .a set output_lib ${destroot}${prefix}/lib/libx264.a set lipo_args {} foreach arch ${universal_archs} { lappend lipo_args -arch ${arch} ${workpath}/${arch}/libx264.a } lappend lipo_args -create -output ${output_lib} delete ${output_lib} system "lipo ${lipo_args}" set output_bin ${destroot}${prefix}/bin/x264 set lipo_args {} foreach arch ${universal_archs} { lappend lipo_args -arch ${arch} ${workpath}/${arch}/x264 } lappend lipo_args -create -output ${output_bin} delete ${output_bin} system "lipo ${lipo_args}" } }