Commit e263d064 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Minimizes Package Size. only copy the libraries that the vlc...

MacOSX/Framework: Minimizes Package Size. only copy the libraries that the vlc modules need. (Patch by Enrique Osuna).
parent 553620b6
if [ ${ACTION} = "" ]; then if test "${ACTION}" = ""; then
# Debug -- # Debug --
TARGET_BUILD_DIR="." TARGET_BUILD_DIR="."
FULL_PRODUCT_NAME="VLC.framework" FULL_PRODUCT_NAME="VLC.framework"
CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Versions/A" CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Versions/A"
VLC_BUILD_DIR="../../.." VLC_BUILD_DIR="../../.."
VLC_SRC_DIR="../../.." VLC_SRC_DIR="../../.."
ACTION="build"
rm -fr ${FULL_PRODUCT_NAME}
# Debug -- # Debug --
fi fi
if [ ${ACTION} = "build" ]; then if test "${ACTION}" = "build"; then
vlc_config="${VLC_SRC_DIR}/vlc-config" vlc_config="${VLC_SRC_DIR}/vlc-config"
lib="lib" lib="lib"
modules="modules" modules="modules"
target="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}" target="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}"
target_lib="${target}/${lib}" # 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_modules="${target}/${modules}" # Should we consider using a different well-known folder like shared resources? target_modules="${target}/${modules}" # Should we consider using a different well-known folder like shared resources?
linked_libs=" "
########################## ##########################
# @function install_library(src_lib, dest_dir) # @function install_library(src_lib, dest_dir)
...@@ -49,61 +52,21 @@ if [ ${ACTION} = "build" ]; then ...@@ -49,61 +52,21 @@ if [ ${ACTION} = "build" ]; then
install_name_tool -id "${install_name}/`basename ${lib_dest}`" ${lib_dest} install_name_tool -id "${install_name}/`basename ${lib_dest}`" ${lib_dest}
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory # Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
for linked_lib in `otool -L "${lib_dest}" | grep @executable_path | sed 's/(\([0-z]*\ *\.*\,*\)*)//g'` ; do for linked_lib in `otool -L ${lib_dest} | grep '(' | sed 's/\((.*)\)//'`; do
ref_lib=`echo "${linked_lib}" | sed 's:executable_path/:loader_path/../:'` ref_lib=`echo "${linked_lib}" | sed 's:executable_path/:loader_path/../:'`
if test "${ref_lib}" != "${linked_lib}"; then
install_name_tool -change ${linked_lib} ${ref_lib} ${lib_dest} install_name_tool -change ${linked_lib} ${ref_lib} ${lib_dest}
fi
if test `echo "${ref_lib}" | grep "^@loader_path"`; then
linked_libs="${linked_libs} ${ref_lib}"
fi;
done done
fi fi
} }
# @function install_library # @function install_library
########################## ##########################
##########################
# Create a symbolic link in the root of the framework
mkdir -p ${target_lib}
mkdir -p ${target_modules}
pushd `pwd` > /dev/null
cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}
ln -sf Versions/Current/${lib} .
ln -sf Versions/Current/${modules} .
popd > /dev/null
# Create a symbolic link in the root of the framework
##########################
##########################
# Build the library folder (Same as VLC.framework/lib in Makefile)
echo "Building library folder..."
# Check to see if there are any vlc libraries available
echo "Copying VLC libraries..."
if test -d ${VLC_BUILD_DIR}/extras/contrib/vlc-lib; then
# Iterate through the dyanmic libraries available
for lib_src in ${VLC_BUILD_DIR}/extras/contrib/vlc-lib/*.dylib ; do
install_library ${lib_src} ${target_lib} "library"
done
fi
# Check to see if there are any core libraries available
echo "Copying core libraries..."
# if test -d ${VLC_BUILD_DIR}/src/.libs; then
# # Iterate through all the core libraries
# for lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do
# # Only install the library if it is not a symbolic link
# if ! test -L ${lib_src}; then
# echo "install_library ${lib_src} ${target_lib} `echo "${lib_src}" | sed 's:(.\d+)+.dylib:.dylib:'`"
# fi
# done
# fi
install_library "${VLC_BUILD_DIR}/src/.libs/libvlc.dylib" ${target_lib} "library"
install_library "${VLC_BUILD_DIR}/src/.libs/libvlc-control.dylib" ${target_lib} "library"
install_library "${VLC_BUILD_DIR}/extras/contrib/vlc-lib/vlc_libintl.dylib" ${target_lib} "library"
# Build the library folder
##########################
########################## ##########################
# Build the modules folder (Same as VLC.framework/modules in Makefile) # Build the modules folder (Same as VLC.framework/modules in Makefile)
echo "Building modules folder..." echo "Building modules folder..."
...@@ -115,69 +78,8 @@ if [ ${ACTION} = "build" ]; then ...@@ -115,69 +78,8 @@ if [ ${ACTION} = "build" ]; then
install_library ${module_src} ${target_modules} "module" install_library ${module_src} ${target_modules} "module"
fi fi
done done
# Build the modules folder # Build the modules folder
########################## ##########################
fi
if [ ${ACTION} = "" ]; then
# Debug --
TARGET_BUILD_DIR="."
FULL_PRODUCT_NAME="VLC.framework"
CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Versions/A"
VLC_BUILD_DIR="../../.."
VLC_SRC_DIR="../../.."
# Debug --
fi
if [ ${ACTION} = "build" ]; then
vlc_config="${VLC_SRC_DIR}/vlc-config"
lib="lib"
modules="modules"
target="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}"
target_lib="${target}/${lib}" # Should we consider using a different well-known folder like shared resources?
target_modules="${target}/${modules}" # Should we consider using a different well-known folder like shared resources?
##########################
# @function install_library(src_lib, dest_dir)
# @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
install_library() {
if [ ${3} = "library" ]; then
install_name="@loader_path/lib"
else
install_name="@loader_path/modules"
fi
if [ "${4}" != "" ]; then
lib_dest="${2}/${4}"
else
lib_dest="${2}/`basename ${1}`"
fi
if test -e ${1} && ! test -e ${lib_dest}; then
mkdir -p ${2}
# Lets copy the library from the source folder to our new destination folder
cp ${1} ${lib_dest}
# Update the dynamic library so it will know where to look for the other libraries
echo "Installing ${3} `basename ${lib_dest}`"
# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
install_name_tool -change /usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib ${lib_dest}
install_name_tool -change @executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib ${lib_dest}
install_name_tool -id "${install_name}/`basename ${lib_dest}`" ${lib_dest}
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
for linked_lib in `otool -L "${lib_dest}" | grep @executable_path | sed 's/(\([0-z]*\ *\.*\,*\)*)//g'` ; do
ref_lib=`echo "${linked_lib}" | sed 's:executable_path/:loader_path/../:'`
install_name_tool -change ${linked_lib} ${ref_lib} ${lib_dest}
done
fi
}
# @function install_library
##########################
########################## ##########################
# Create a symbolic link in the root of the framework # Create a symbolic link in the root of the framework
...@@ -197,46 +99,20 @@ if [ ${ACTION} = "build" ]; then ...@@ -197,46 +99,20 @@ if [ ${ACTION} = "build" ]; then
########################## ##########################
# Build the library folder (Same as VLC.framework/lib in Makefile) # Build the library folder (Same as VLC.framework/lib in Makefile)
echo "Building library folder..." echo "Building library folder..."
for linked_lib in ${linked_libs} ; do
# Check to see if there are any vlc libraries available case "${linked_lib}" in
echo "Copying VLC libraries..." @loader_path/../lib/*)
if test -d ${VLC_BUILD_DIR}/extras/contrib/vlc-lib; then ref_lib=`echo ${linked_lib} | sed 's:@loader_path/../lib/::'`
# Iterate through the dyanmic libraries available if test -e ${VLC_BUILD_DIR}/extras/contrib/vlc-lib/${ref_lib}; then
for lib_src in ${VLC_BUILD_DIR}/extras/contrib/vlc-lib/*.dylib ; do src_lib=${VLC_BUILD_DIR}/extras/contrib/vlc-lib/${ref_lib}
install_library ${lib_src} ${target_lib} "library" elif test -e ${VLC_BUILD_DIR}/src/.libs/${ref_lib}; then
done src_lib=${VLC_BUILD_DIR}/src/.libs/${ref_lib}
fi
# Check to see if there are any core libraries available
echo "Copying core libraries..."
# if test -d ${VLC_BUILD_DIR}/src/.libs; then
# # Iterate through all the core libraries
# for lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do
# # Only install the library if it is not a symbolic link
# if ! test -L ${lib_src}; then
# echo "install_library ${lib_src} ${target_lib} `echo "${lib_src}" | sed 's:(.\d+)+.dylib:.dylib:'`"
# fi
# done
# fi
install_library "${VLC_BUILD_DIR}/src/.libs/libvlc.dylib" ${target_lib} "library"
install_library "${VLC_BUILD_DIR}/src/.libs/libvlc-control.dylib" ${target_lib} "library"
install_library "${VLC_BUILD_DIR}/extras/contrib/vlc-lib/vlc_libintl.dylib" ${target_lib} "library"
# Build the library folder
##########################
##########################
# Build the modules folder (Same as VLC.framework/modules in Makefile)
echo "Building modules folder..."
# Figure out what modules are available to install
for module in `top_builddir="${VLC_BUILD_DIR}" ${vlc_config} --target plugin` ; do
# Check to see that the reported module actually exists
if test -n ${module}; then
module_src="`dirname ${module}`/.libs/`basename ${module}`.dylib"
install_library ${module_src} ${target_modules} "module"
fi fi
install_library ${src_lib} ${target_lib} "library"
;;
esac
done done
# Build the library folder
# Build the modules folder
########################## ##########################
install_library "${VLC_BUILD_DIR}/src/.libs/libvlc-control.dylib" ${target_lib} "library"
fi fi
\ No newline at end of file
...@@ -247,7 +247,6 @@ ...@@ -247,7 +247,6 @@
0867D690FE84028FC02AAC07 /* Project object */ = { 0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "VLC" */; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "VLC" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* VLC */; mainGroup = 0867D691FE84028FC02AAC07 /* VLC */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
...@@ -281,7 +280,7 @@ ...@@ -281,7 +280,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "if [ ${ACTION} = \"\" ]; then\n\t# Debug --\n\tTARGET_BUILD_DIR=\".\"\n\tFULL_PRODUCT_NAME=\"VLC.framework\"\n\tCONTENTS_FOLDER_PATH=\"${FULL_PRODUCT_NAME}/Versions/A\"\n\tVLC_BUILD_DIR=\"../../..\"\n\tVLC_SRC_DIR=\"../../..\"\n\t# Debug --\nfi\n\nif [ ${ACTION} = \"build\" ]; then\t\n\tvlc_config=\"${VLC_SRC_DIR}/vlc-config\"\n\tlib=\"lib\"\n\tmodules=\"modules\"\n\ttarget=\"${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}\"\n\ttarget_lib=\"${target}/${lib}\"\t\t\t# Should we consider using a different well-known folder like shared resources?\n\ttarget_modules=\"${target}/${modules}\"\t# Should we consider using a different well-known folder like shared resources?\n\t\n ##########################\n # @function install_library(src_lib, dest_dir)\n\t# @description Installs the specified library into the destination folder, automatically changes the references to dependencies\n\t# @param src_lib \tsource library to copy to the destination directory\n\t# @param dest_dir\tdestination directory where the src_lib should be copied to\n\tinstall_library() {\t\n\t\tif [ ${3} = \"library\" ]; then\n\t\t\tinstall_name=\"@loader_path/lib\"\n\t\telse\n\t\t\tinstall_name=\"@loader_path/modules\"\n\t\tfi\n\t\t\n\t\tif [ \"${4}\" != \"\" ]; then\n\t\t\tlib_dest=\"${2}/${4}\"\n\t\telse\n\t\t\tlib_dest=\"${2}/`basename ${1}`\"\n\t\tfi\n\t\t\n\t\tif test -e ${1} && ! test -e ${lib_dest}; then\n\t\t\tmkdir -p ${2}\n\t\t\t\n\t\t\t# Lets copy the library from the source folder to our new destination folder\n\t\t\tcp ${1} ${lib_dest}\n\n\t\t\t# Update the dynamic library so it will know where to look for the other libraries\n\t\t\techo \"Installing ${3} `basename ${lib_dest}`\"\n\n\t\t\t# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory\n\t\t\tinstall_name_tool -change /usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib ${lib_dest}\n\t\t\tinstall_name_tool -change @executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib ${lib_dest}\n\t\t\tinstall_name_tool -id \"${install_name}/`basename ${lib_dest}`\" ${lib_dest}\n\n\t\t\t# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory\n\t\t\tfor linked_lib in `otool -L \"${lib_dest}\" | grep @executable_path | sed 's/(\\([0-z]*\\ *\\.*\\,*\\)*)//g'` ; do\n\t\t\t\tref_lib=`echo \"${linked_lib}\" | sed 's:executable_path/:loader_path/../:'`\n\t\t\t\tinstall_name_tool -change ${linked_lib} ${ref_lib} ${lib_dest}\n\t\t\tdone\n\t\tfi\n\t}\n\t# @function install_library\n ##########################\n\n ##########################\n\t# Create a symbolic link in the root of the framework\n\tmkdir -p ${target_lib}\n\tmkdir -p ${target_modules}\n\t\n\tpushd `pwd` > /dev/null \n\tcd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\n\t\n\tln -sf Versions/Current/${lib} .\n\tln -sf Versions/Current/${modules} .\n\t\n\tpopd > /dev/null \n\t# Create a symbolic link in the root of the framework\n ##########################\n\t\n ##########################\n # Build the library folder (Same as VLC.framework/lib in Makefile)\n\techo \"Building library folder...\"\n\n\t# Check to see if there are any vlc libraries available\n\techo \"Copying VLC libraries...\"\n\tif test -d ${VLC_BUILD_DIR}/extras/contrib/vlc-lib; then\n\t\t# Iterate through the dyanmic libraries available\n\t\tfor lib_src in ${VLC_BUILD_DIR}/extras/contrib/vlc-lib/*.dylib ; do\n\t\t\tinstall_library ${lib_src} ${target_lib} \"library\"\n\t\tdone\n\tfi\n\n\t# Check to see if there are any core libraries available\n\techo \"Copying core libraries...\"\n#\tif test -d ${VLC_BUILD_DIR}/src/.libs; then\n#\t\t# Iterate through all the core libraries\n#\t\tfor lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do\n#\t\t\t# Only install the library if it is not a symbolic link\n#\t\t\tif ! test -L ${lib_src}; then\n#\t\t\t\techo \"install_library ${lib_src} ${target_lib} `echo \"${lib_src}\" | sed 's:(.\\d+)+.dylib:.dylib:'`\"\n#\t\t\tfi\n#\t\tdone\n#\tfi\n\n\tinstall_library \"${VLC_BUILD_DIR}/src/.libs/libvlc.dylib\" ${target_lib} \"library\"\n\tinstall_library \"${VLC_BUILD_DIR}/src/.libs/libvlc-control.dylib\" ${target_lib} \"library\"\n\tinstall_library \"${VLC_BUILD_DIR}/extras/contrib/vlc-lib/vlc_libintl.dylib\" ${target_lib} \"library\"\n # Build the library folder\n ##########################\n\n ##########################\n # Build the modules folder (Same as VLC.framework/modules in Makefile)\n\techo \"Building modules folder...\"\n\t# Figure out what modules are available to install\n\tfor module in `top_builddir=\"${VLC_BUILD_DIR}\" ${vlc_config} --target plugin` ; do\n\t\t# Check to see that the reported module actually exists\n\t\tif test -n ${module}; then\n\t\t\tmodule_src=\"`dirname ${module}`/.libs/`basename ${module}`.dylib\"\n\t\t\tinstall_library ${module_src} ${target_modules} \"module\"\n\t\tfi\n done\n\t\n # Build the modules folder\n ##########################\nfi"; shellScript = "if test \"${ACTION}\" = \"\"; then\n # Debug --\n TARGET_BUILD_DIR=\".\"\n FULL_PRODUCT_NAME=\"VLC.framework\"\n CONTENTS_FOLDER_PATH=\"${FULL_PRODUCT_NAME}/Versions/A\"\n VLC_BUILD_DIR=\"../../..\"\n VLC_SRC_DIR=\"../../..\"\n ACTION=\"build\"\n rm -fr ${FULL_PRODUCT_NAME}\n # Debug --\nfi\n\nif test \"${ACTION}\" = \"build\"; then \n vlc_config=\"${VLC_SRC_DIR}/vlc-config\"\n lib=\"lib\"\n modules=\"modules\"\n target=\"${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}\"\n target_lib=\"${target}/${lib}\" # Should we consider using a different well-known folder like shared resources?\n target_modules=\"${target}/${modules}\" # Should we consider using a different well-known folder like shared resources?\n linked_libs=\" \"\n \n ##########################\n # @function install_library(src_lib, dest_dir)\n # @description Installs the specified library into the destination folder, automatically changes the references to dependencies\n # @param src_lib source library to copy to the destination directory\n # @param dest_dir destination directory where the src_lib should be copied to\n install_library() { \n if [ ${3} = \"library\" ]; then\n install_name=\"@loader_path/lib\"\n else\n install_name=\"@loader_path/modules\"\n fi\n \n if [ \"${4}\" != \"\" ]; then\n lib_dest=\"${2}/${4}\"\n else\n lib_dest=\"${2}/`basename ${1}`\"\n fi\n \n if test -e ${1} && ! test -e ${lib_dest}; then\n mkdir -p ${2}\n \n # Lets copy the library from the source folder to our new destination folder\n cp ${1} ${lib_dest}\n\n # Update the dynamic library so it will know where to look for the other libraries\n echo \"Installing ${3} `basename ${lib_dest}`\"\n\n # Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory\n install_name_tool -change /usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib ${lib_dest}\n install_name_tool -change @executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib ${lib_dest}\n install_name_tool -id \"${install_name}/`basename ${lib_dest}`\" ${lib_dest}\n\n # Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory\n for linked_lib in `otool -L ${lib_dest} | grep '(' | sed 's/\\((.*)\\)//'`; do\n ref_lib=`echo \"${linked_lib}\" | sed 's:executable_path/:loader_path/../:'`\n \n if test \"${ref_lib}\" != \"${linked_lib}\"; then\n install_name_tool -change ${linked_lib} ${ref_lib} ${lib_dest}\n fi\n if test `echo \"${ref_lib}\" | grep \"^@loader_path\"`; then\n linked_libs=\"${linked_libs} ${ref_lib}\"\n fi;\n done\n fi\n }\n # @function install_library\n ##########################\n\n ##########################\n # Build the modules folder (Same as VLC.framework/modules in Makefile)\n echo \"Building modules folder...\"\n # Figure out what modules are available to install\n for module in `top_builddir=\"${VLC_BUILD_DIR}\" ${vlc_config} --target plugin` ; do\n # Check to see that the reported module actually exists\n if test -n ${module}; then\n module_src=\"`dirname ${module}`/.libs/`basename ${module}`.dylib\"\n install_library ${module_src} ${target_modules} \"module\"\n fi\n done\n # Build the modules folder\n ##########################\n\n ##########################\n # Create a symbolic link in the root of the framework\n mkdir -p ${target_lib}\n mkdir -p ${target_modules}\n \n pushd `pwd` > /dev/null \n cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\n \n ln -sf Versions/Current/${lib} .\n ln -sf Versions/Current/${modules} .\n \n popd > /dev/null \n # Create a symbolic link in the root of the framework\n ##########################\n \n ##########################\n # Build the library folder (Same as VLC.framework/lib in Makefile)\n echo \"Building library folder...\"\n for linked_lib in ${linked_libs} ; do\n case \"${linked_lib}\" in\n @loader_path/../lib/*)\n ref_lib=`echo ${linked_lib} | sed 's:@loader_path/../lib/::'`\n if test -e ${VLC_BUILD_DIR}/extras/contrib/vlc-lib/${ref_lib}; then\n src_lib=${VLC_BUILD_DIR}/extras/contrib/vlc-lib/${ref_lib}\n elif test -e ${VLC_BUILD_DIR}/src/.libs/${ref_lib}; then\n src_lib=${VLC_BUILD_DIR}/src/.libs/${ref_lib}\n fi\n install_library ${src_lib} ${target_lib} \"library\"\n ;;\n esac\n done\n # Build the library folder\n ##########################\n install_library \"${VLC_BUILD_DIR}/src/.libs/libvlc-control.dylib\" ${target_lib} \"library\"\nfi";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment