[vlc-commits] Simplify the macOS build-package.sh file

Jean-Baptiste Kempf git at videolan.org
Mon Feb 20 00:37:30 CET 2017


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Feb 19 23:59:13 2017 +0100| [140ff94824bb934086e9a68fcce5d99c01f34ae9] | committer: Jean-Baptiste Kempf

Simplify the macOS build-package.sh file

We don't have fat binaries, nor plugins

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=140ff94824bb934086e9a68fcce5d99c01f34ae9
---

 extras/package/macosx/build-package.sh | 162 +++------------------------------
 extras/package/macosx/package.mak      |   2 +-
 2 files changed, 16 insertions(+), 148 deletions(-)

diff --git a/extras/package/macosx/build-package.sh b/extras/package/macosx/build-package.sh
index 446f1da..6ea0250 100644
--- a/extras/package/macosx/build-package.sh
+++ b/extras/package/macosx/build-package.sh
@@ -6,50 +6,21 @@
 
 # We are building VLC.app
 #
-if test "${ACTION}" = "release-makefile"; then
-    echo "running build-package.sh in release-makefile mode"
+echo "running build-package.sh in release-makefile mode"
 
-    FULL_PRODUCT_NAME="${PRODUCT}"
-    TARGET_BUILD_DIR="${build_dir}"
-    CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Contents/MacOS"
-    VLC_BUILD_DIR="${build_dir}"
-    VLC_SRC_DIR="${src_dir}"
-    ACTION="build"
-    RELEASE_MAKEFILE="yes"
-    use_archs="no"
-    main_build_dir="${VLC_BUILD_DIR}"
-else
-    use_archs="yes"
-    main_build_dir="${VLC_BUILD_DIR}/${ARCHS%% *}"
-    echo "Building for $ARCHS"
-fi
+FULL_PRODUCT_NAME="${PRODUCT}"
+VLC_BUILD_DIR="${build_dir}"
 
-if test "${ACTION}" = "clean"; then
-    rm -Rf "${VLC_BUILD_DIR}/tmp"
-    exit 0
-fi
-
-if test "${ACTION}" != "build"; then
-    echo "This script is supposed to run from xcodebuild or Xcode"
-    exit 1
-fi
-
-lib="lib"
-plugins="plugins"
-share="share"
-include="include"
-target="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}"
+target="${build_dir}/${FULL_PRODUCT_NAME}/Contents/MacOS"
 target_bin="${target}/bin"
-target_lib="${target}/${lib}"            # Should we consider using a different well-known folder like shared resources?
-target_plugins="${target}/${plugins}"    # Should we consider using a different well-known folder like shared resources?
-target_share="${target}/${share}"        # Should we consider using a different well-known folder like shared resources?
+target_lib="${target}/lib"            # Should we consider using a different well-known folder like shared resources?
+target_plugins="${target}/plugins"    # Should we consider using a different well-known folder like shared resources?
 linked_libs=""
 prefix=".libs"
 suffix="dylib"
-num_archs=$(echo `echo $ARCHS | wc -w`)
 
 ##########################
-# @function vlc_install_object(src_lib, dest_dir, type, lib_install_prefix, destination_name, suffix)
+# @function vlc_install_object(src_lib, 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
@@ -58,21 +29,15 @@ vlc_install_object() {
     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"
     elif [ $type = "module" ]; then
         local install_name="@loader_path/plugins"
     fi
-    if [ "$destination_name" != "" ]; then
-        local lib_dest="$dest_dir/$destination_name$suffix"
-        local lib_name=`basename $destination_name`
-    else
-        local lib_dest="$dest_dir/`basename $src_lib`$suffix"
-        local lib_name=`basename $src_lib`
-    fi
+
+    local lib_dest="$dest_dir/`basename $src_lib`"
+    local lib_name=`basename $src_lib`
 
     if [ "x$lib_install_prefix" != "x" ]; then
         local lib_install_prefix="$lib_install_prefix"
@@ -134,72 +99,7 @@ vlc_install() {
     local dest_dir=$3
     local type=$4
 
-    if test "$use_archs" = "no"; then
-        vlc_install_object "$VLC_BUILD_DIR/$src_dir/$src" "$dest_dir" "$type" $5
-    else
-        if test $type = "data"; then
-            vlc_install_object "$main_build_dir/$src_dir/$src" "$dest_dir" "$type" $5
-        else
-            local fatdest="$dest_dir/$2"
-            local shouldUpdate="no"
-
-            # Determine what architectures are available in the destination image
-            local fatdest_archs=""
-            if [ -e ${fatdest} ]; then
-                fatdest_archs=`lipo -info "${fatdest}" 2> /dev/null | sed -E -e 's/[[:space:]]+$//' -e 's/.+:[[:space:]]*//' -e 's/[^[:space:]]+/(&)/g'`
-
-                # Check to see if the destination image needs to be reconstructed
-                for arch in $ARCHS; do
-                    # Only install if the new image is newer than the one we have installed or the required arch is missing.
-                    if test $shouldUpdate = "no"  && (! [[ "$fatdest_archs" =~ \($arch\) ]] || test "$VLC_BUILD_DIR/$arch/$src_dir/$src" -nt "${fatdest}"); then
-                        shouldUpdate="yes"
-                    fi
-                    fatdest_archs=${fatdest_archs//\($arch\)/}
-                done
-
-                # Reconstruct the destination image, if the update flag is set or if there are more archs in the desintation then we need
-                fatdest_archs=${fatdest_archs// /}
-            else
-                # If the destination image does not exist, then we have to reconstruct it
-                shouldUpdate="yes"
-            fi
-
-            # If we should update the destination image or if there were unexpected archs in the destination image, then reconstruct it
-            if test "$shouldUpdate" = "yes" || test -n "${fatdest_archs}"; then
-                # If the destination image exists, get rid of it so we can copy over the newly constructed image
-                if test -e ${fatdest}; then
-                    rm "$fatdest"
-                fi
-
-                if test "$num_archs" = "1"; then
-                    echo "Copying $ARCHS $type $fatdest"
-                    local arch_src="$VLC_BUILD_DIR/$ARCHS/$src_dir/$src"
-                    vlc_install_object "$arch_src" "$dest_dir" "$type" "$5" ""
-                else
-                    # Create a temporary destination dir to store each ARCH object file
-                    local tmp_dest_dir="$VLC_BUILD_DIR/tmp/$type"
-                    rm -Rf "${tmp_dest_dir}/*"
-                    mkdir -p "$tmp_dest_dir"
-
-                    # Search for each ARCH object file used to construct a fat image
-                    local objects=""
-                    for arch in $ARCHS; do
-                        local arch_src="$VLC_BUILD_DIR/$arch/$src_dir/$src"
-                        vlc_install_object "$arch_src" "$tmp_dest_dir" "$type" "$5" "" ".$arch"
-                        local dest="$tmp_dest_dir/$src.$arch"
-                        if [ -e ${dest} ]; then
-                            objects="${dest} $objects"
-                        else
-                            echo "Warning: building $arch_src without $arch"
-                        fi
-                    done;
-
-                    echo "Creating fat $type $fatdest"
-                    lipo $objects -output "$fatdest" -create
-                fi
-            fi
-        fi
-    fi
+    vlc_install_object "$VLC_BUILD_DIR/$src_dir/$src" "$dest_dir" "$type" $5
 }
 # @function vlc_install
 ##########################
@@ -210,36 +110,17 @@ mkdir -p ${target_lib}
 mkdir -p ${target_plugins}
 mkdir -p ${target_bin}
 
-if [ "$RELEASE_MAKEFILE" != "yes" ] ; then
-    pushd `pwd` > /dev/null
-    cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}
-
-    ln -sf Versions/Current/${lib} .
-    ln -sf Versions/Current/${plugins} .
-    ln -sf Versions/Current/${include} .
-    ln -sf Versions/Current/${share} .
-    ln -sf Versions/Current/bin .
-    ln -sf ../plugins Versions/Current/bin
-    ln -sf ../share Versions/Current/bin
-
-    popd > /dev/null
-fi
-
 ##########################
 # Hack for VLC.app
-if [ "$FULL_PRODUCT_NAME" = "VLC.app" ] ; then
-    vlc_install "bin/${prefix}" "vlc-osx" "${target}" "bin" "@loader_path/lib"
-    mv "${target}/vlc-osx" "${target}/VLC"
-    chmod +x ${target}/VLC
-else
-    vlc_install "bin/${prefix}" "vlc" "${target}/bin" "bin" "@loader_path/../lib"
-fi
+vlc_install "bin/${prefix}" "vlc-osx" "${target}" "bin" "@loader_path/lib"
+mv "${target}/vlc-osx" "${target}/VLC"
+chmod +x ${target}/VLC
 
 ##########################
 # Build the plugins folder
 echo "Building plugins folder..."
 # Figure out what plugins are available to install
-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
+for module in `find ${VLC_BUILD_DIR}/modules -path "*dylib.dSYM*" -prune -o -name "lib*_plugin.dylib" -print | sed -e s:${VLC_BUILD_DIR}/::` ; do
     # Check to see that the reported module actually exists
     if test -n ${module}; then
         vlc_install `dirname ${module}` `basename ${module}` ${target_plugins} "module"
@@ -254,16 +135,3 @@ vlc_install "src/${prefix}" "libvlccore.*.dylib" "${target_lib}" "library"
 # copy symlinks
 cp -RP "lib/${prefix}/libvlc.dylib" "${target_lib}"
 cp -RP "src/${prefix}/libvlccore.dylib" "${target_lib}"
-
-##########################
-# Build the share folder
-if [ $PRODUCT != "VLC.app" ]; then
-    echo "Building share folder..."
-    pbxcp="/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -resolve-src-symlinks -v -V"
-    mkdir -p ${target_share}
-    if test "$use_archs" = "no"; then
-        $pbxcp ${VLC_BUILD_DIR}/share/lua ${target_share}
-    else
-        $pbxcp ${main_build_dir}/share/lua ${target_share}
-    fi
-fi
diff --git a/extras/package/macosx/package.mak b/extras/package/macosx/package.mak
index ab34168..1d912d7 100644
--- a/extras/package/macosx/package.mak
+++ b/extras/package/macosx/package.mak
@@ -49,7 +49,7 @@ endif
 		$@/Contents/Resources/$${i}.lproj/ ; \
 	done
 	printf "APPLVLC#" >| $@/Contents/PkgInfo
-	PRODUCT="$@" ACTION="release-makefile" src_dir=$(srcdir) build_dir=$(top_builddir) sh $(srcdir)/extras/package/macosx/build-package.sh
+	PRODUCT="$@" build_dir=$(top_builddir) sh $(srcdir)/extras/package/macosx/build-package.sh
 	## Generate plugin cache
 	bin/vlc-cache-gen $@/Contents/MacOS/plugins
 	find $@ -type d -exec chmod ugo+rx '{}' \;



More information about the vlc-commits mailing list