From: Pierre d'Herbemont Date: Tue, 16 Feb 2010 00:49:18 +0000 (+0100) Subject: macosx/framework: Build a fat framework (x86_64 and i386) in Release mode. X-Git-Tag: 1.1.0-pre1~901 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=0539e7e1a3b52230ffe7f2c74a98d035d8db6a44;p=vlc macosx/framework: Build a fat framework (x86_64 and i386) in Release mode. The current contrib bin for i386 seems to be a bit broken here and most modules are x86_64 only. --- diff --git a/projects/macosx/framework/Configure.sh b/projects/macosx/framework/Configure.sh index 5e560927d8..798ce6ddb8 100644 --- a/projects/macosx/framework/Configure.sh +++ b/projects/macosx/framework/Configure.sh @@ -54,9 +54,6 @@ args="--disable-sdl $args" args="--disable-sdl-image $args" args="--disable-visual $args" -# where to install -args="--prefix=$SYMROOT/vlc_build_dir/vlc_install_dir $args" - if test "x$SDKROOT" != "x" then args="--with-macosx-sdk=$SDKROOT $args" @@ -73,10 +70,15 @@ top_srcdir="$SRCROOT/../../.." # 64 bits switches for arch in $ARCHS; do + this_args="$args" + + # where to install + this_args="--prefix=$SYMROOT/vlc_build_dir/vlc_install_dir $this_args" input="$top_srcdir/configure" output="$arch/Makefile" if test -e ${output} && test ${output} -nt ${input}; then + echo "No need to re-run configure for $arch" continue; fi @@ -85,10 +87,10 @@ for arch in $ARCHS; do cd $arch if test $arch = "x86_64"; then - args="--build=x86_64-apple-darwin10 $args" + this_args="--build=x86_64-apple-darwin10 $this_args" fi echo "Running[$arch] configure $args" - CFLAGS="-arch $arch" CXXFLAGS="-arch $arch" CPPFLAGS="-arch $arch" OBJCFLAGS="-arch $arch" exec $top_srcdir/configure $args + CFLAGS="-arch $arch" CXXFLAGS="-arch $arch" CPPFLAGS="-arch $arch" OBJCFLAGS="-arch $arch" exec $top_srcdir/configure $this_args cd .. done diff --git a/projects/macosx/framework/Pre-Compile.sh b/projects/macosx/framework/Pre-Compile.sh index 04121a9602..cff7197336 100644 --- a/projects/macosx/framework/Pre-Compile.sh +++ b/projects/macosx/framework/Pre-Compile.sh @@ -30,6 +30,7 @@ if test "${ACTION}" = "release-makefile"; then else use_archs="yes" main_build_dir="${VLC_BUILD_DIR}/x86_64" + echo "Building for $ARCHS" fi if test "${ACTION}" != "build"; then @@ -52,17 +53,18 @@ suffix="dylib" ########################## -# @function vlc_install(src_lib, dest_dir, type, lib_install_prefix, destination_name) +# @function vlc_install_object(src_lib, dest_dir, type, lib_install_prefix, destination_name) # @description Installs the specified library into the destination folder, automatically changes the references to dependencies # @param src_lib source library to copy to the destination directory # @param dest_dir destination directory where the src_lib should be copied to -vlc_install() { +vlc_install_object() { local src_lib=${1} local dest_dir=${2} local type=${3} local lib_install_prefix=${4} local destination_name=${5} + local suffix=${6} if [ $type = "library" ]; then local install_name="@loader_path/lib" @@ -70,9 +72,9 @@ vlc_install() { local install_name="@loader_path/modules" fi if [ "$destination_name" != "" ]; then - local lib_dest="$dest_dir/$destination_name" + local lib_dest="$dest_dir/$destination_name$suffix" else - local lib_dest="$dest_dir/`basename $src_lib`" + local lib_dest="$dest_dir/`basename $src_lib`$suffix" fi if [ "$lib_install_prefix" != "" ]; then @@ -81,7 +83,10 @@ vlc_install() { local lib_install_prefix="@loader_path/../lib" fi - if test -e ${src_lib} && ((! test -e ${lib_dest}) || test ${src_lib} -nt ${lib_dest} ); then + if ! test -e ${src_lib}; then + return + fi + if ((! test -e ${lib_dest}) || test ${src_lib} -nt ${lib_dest} ); then mkdir -p ${dest_dir} @@ -109,7 +114,7 @@ vlc_install() { if test -e ${linked_lib}; then install_name_tool -change "$linked_lib" "${lib_install_prefix}/${name}" "${lib_dest}" linked_libs="${linked_libs} ${ref_lib}" - vlc_install ${linked_lib} ${target_lib} "library" + vlc_install_object ${linked_lib} ${target_lib} "library" fi ;; esac @@ -120,34 +125,76 @@ vlc_install() { # @function vlc_install ########################## +########################## +# @function vlc_install(src_lib_dir, src_lib_name, dest_dir, type, lib_install_prefix) +# @description Installs the specified library into the destination folder, automatically changes the references to dependencies +# @param src_lib source library to copy to the destination directory +# @param dest_dir destination directory where the src_lib should be copied to +vlc_install() { + local dest_dir=$3 + local type=$4 + + if test "$use_archs" = "no"; then + vlc_install_object "$VLC_BUILD_DIR/$1/$2" "$dest_dir" "$type" $5 + else + if test $type = "data"; then + vlc_install_object "$main_build_dir/$1/$2" "$dest_dir" "$type" $5 + else + objects="" + mkdir -p "tmp/$1" + newinstall="no" + for arch in $ARCHS; do + vlc_install_object "$VLC_BUILD_DIR/$arch/$1/$2" "tmp/$1" "$type" "$5" "$2.$arch" + local dest="tmp/$1/$2.$arch" + if test -e ${dest}; then + if test "$VLC_BUILD_DIR/$arch/$1/$2" -nt "${dest}"; then + echo "$VLC_BUILD_DIR/$arch/$1/$2 newer than ${dest}" + newinstall="yes" + fi + objects="${dest} $objects" + else + echo "Warning: building $2 without $arch" + fi + done; + if test "$newinstall" = "yes"; then + echo "Creating fat $type $2" + lipo $objects -output "${dest}" -create + fi + fi + fi +} +# @function vlc_install +########################## + ########################## # Hack for VLC-release.app if [ "$FULL_PRODUCT_NAME" = "VLC-release.app" ] ; then - vlc_install "${main_build_dir}/bin/${prefix}vlc" "${target}" "bin" "@loader_path/lib" + vlc_install "bin/${prefix}" "vlc" "${target}" "bin" "@loader_path/lib" mv ${target}/vlc ${target}/VLC chmod +x ${target}/VLC elif [ "$FULL_PRODUCT_NAME" = "VLC-Plugin.plugin" ] ; then # install Safari webplugin - vlc_install "${main_build_dir}/projects/mozilla/${prefix}npvlc.${suffix}" "${target}" "library" "@loader_path/lib" + vlc_install "projects/mozilla/${prefix}" "npvlc.${suffix}" "${target}" "library" "@loader_path/lib" mv ${target}/npvlc.${suffix} "${target}/VLC Plugin" chmod +x "${target}/VLC Plugin" else - vlc_install "${main_build_dir}/bin/${prefix}vlc" "${target}/bin" "bin" "@loader_path/../lib" + vlc_install "bin/${prefix}" "vlc" "${target}/bin" "bin" "@loader_path/../lib" fi ########################## # Build the modules folder (Same as VLCKit.framework/modules in Makefile) echo "Building modules folder..." # Figure out what modules are available to install -for module in `find ${main_build_dir}/modules -name *.${suffix}` ; do +for module in `find ${main_build_dir}/modules -path "*dylib.dSYM*" -prune -o -name "lib*_plugin.dylib" -print | sed -e s:${main_build_dir}/::` ; do # Check to see that the reported module actually exists if test -n ${module}; then - vlc_install ${module} ${target_modules} "module" + vlc_install `dirname ${module}` `basename ${module}` ${target_modules} "module" fi done # Install the module cache -vlc_install `ls ${main_build_dir}/modules/plugins-*.dat` ${target_modules} "data" +cache=`ls ${main_build_dir}/modules/plugins-*.dat | sed -e s:${main_build_dir}/::` +vlc_install `dirname ${cache}` `basename ${cache}` ${target_modules} "data" # Build the modules folder ########################## @@ -172,21 +219,8 @@ if [ "$RELEASE_MAKEFILE" != "yes" ] ; then popd > /dev/null fi -########################## -# Build the library folder -echo "Building library folder... ${linked_libs}" -for linked_lib in ${linked_libs} ; do - case "${linked_lib}" in - */extras/contrib/lib/*.dylib|*/vlc_install_dir/lib/*.dylib) - if test -e ${linked_lib}; then - vlc_install ${linked_lib} ${target_lib} "library" - fi - ;; - esac -done - -vlc_install "${main_build_dir}/src/${prefix}libvlc.5.dylib" "${target_lib}" "library" -vlc_install "${main_build_dir}/src/${prefix}libvlccore.4.dylib" "${target_lib}" "library" +vlc_install "src/${prefix}" "libvlc.5.dylib" "${target_lib}" "library" +vlc_install "src/${prefix}" "libvlccore.4.dylib" "${target_lib}" "library" pushd `pwd` > /dev/null cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}/lib ln -sf libvlc.5.dylib libvlc.dylib diff --git a/projects/macosx/framework/VLCKit.xcodeproj/project.pbxproj b/projects/macosx/framework/VLCKit.xcodeproj/project.pbxproj index 7b0f2709d3..5f22a67c78 100644 --- a/projects/macosx/framework/VLCKit.xcodeproj/project.pbxproj +++ b/projects/macosx/framework/VLCKit.xcodeproj/project.pbxproj @@ -441,9 +441,11 @@ files = ( ); inputPaths = ( + "$(SRCROOT)/../../../bootstrap", ); name = bootstrap; outputPaths = ( + "$(SRCROOT)/../../../configure", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -507,12 +509,9 @@ files = ( ); inputPaths = ( - "$(SRCROOT)/Configure.sh", - "$(SRCROOT)/../../../configure", ); name = configure; outputPaths = ( - "$(SYMROOT)/vlc_build_dir/Makefile", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -610,7 +609,6 @@ LD_FLAGS_LIBVLC = "-dylib_file @loader_path/lib/libvlc.dylib:$(VLC_FRAMEWORK)/lib/libvlc.dylib"; LD_FLAGS_LIBVLC_CONTROL = "-dylib_file @loader_path/lib/libvlc-control.dylib:$(VLC_FRAMEWORK)/lib/libvlc-control.dylib"; LIBRARY_SEARCH_PATHS = "$(VLC_FRAMEWORK)/lib"; - ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-lvlccore", "-single_module", @@ -651,7 +649,6 @@ LD_FLAGS_LIBVLC = "-dylib_file @loader_path/lib/libvlc.dylib:$(VLC_FRAMEWORK)/lib/libvlc.dylib -dylib_file @loader_path/../lib/libvlc.dylib:$(VLC_FRAMEWORK)/lib/libvlc.dylib"; LD_FLAGS_LIBVLC_CONTROL = "-dylib_file @loader_path/lib/libvlc-control.dylib:$(VLC_FRAMEWORK)/lib/libvlc-control.dylib"; LIBRARY_SEARCH_PATHS = "$(VLC_FRAMEWORK)/lib"; - ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-lvlccore", "-single_module", @@ -673,7 +670,10 @@ 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ARCHS = ( + x86_64, + i386, + ); GCC_C_LANGUAGE_STANDARD = c99; GCC_ENABLE_OBJC_GC = supported; GCC_VERSION = com.apple.compilers.llvmgcc42; @@ -688,13 +688,16 @@ 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ARCHS = ( + x86_64, + i386, + ); GCC_C_LANGUAGE_STANDARD = c99; GCC_ENABLE_OBJC_GC = supported; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; + ONLY_ACTIVE_ARCH = NO; PREBINDING = NO; SDKROOT = macosx10.5; };