Commit 06df9cc6 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx/framework: Try to clean up a little bit the now very messy Pre-Compile.sh script file.

parent 479c4008
...@@ -38,64 +38,72 @@ if test "${ACTION}" = "build"; then ...@@ -38,64 +38,72 @@ if test "${ACTION}" = "build"; then
linked_libs="" linked_libs=""
########################## ##########################
# @function install_library(src_lib, dest_dir, type, lib_install_prefix, destination_name) # @function vlc_install(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 # @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 src_lib source library to copy to the destination directory
# @param dest_dir destination directory where the src_lib should be copied to # @param dest_dir destination directory where the src_lib should be copied to
install_library() { vlc_install() {
if [ ${3} = "library" ]; then local src_lib=${1}
local dest_dir=${2}
local type=${3}
local lib_install_prefix=${4}
local destination_name=${5}
if [ $type = "library" ]; then
local install_name="@loader_path/lib" local install_name="@loader_path/lib"
elif [ ${3} = "module" ]; then elif [ $type = "module" ]; then
local install_name="@loader_path/modules" local install_name="@loader_path/modules"
fi fi
if [ "${5}" != "" ]; then if [ "$destination_name" != "" ]; then
local lib_dest="${2}/${5}" local lib_dest="$dest_dir/$destination_name"
else else
local lib_dest="${2}/`basename ${1}`" local lib_dest="$dest_dir/`basename $src_lib`"
fi fi
if [ "${4}" != "" ]; then if [ "$lib_install_prefix" != "" ]; then
local lib_install_prefix="${4}" local lib_install_prefix="$lib_install_prefix"
else else
local lib_install_prefix="@loader_path/../lib" local lib_install_prefix="@loader_path/../lib"
fi fi
if test -e ${1} && ((! test -e ${lib_dest}) || test ${1} -nt ${lib_dest} ); then if test -e ${src_lib} && ((! test -e ${lib_dest}) || test ${src_lib} -nt ${lib_dest} ); then
mkdir -p ${2} mkdir -p ${dest_dir}
# Lets copy the library from the source folder to our new destination folder # Lets copy the library from the source folder to our new destination folder
if [ "${3}" != "bin" ]; then if [ "${type}" = "bin" ]; then
install -m 644 ${1} ${lib_dest} install -m 755 ${src_lib} ${lib_dest}
else else
install -m 755 ${1} ${lib_dest} install -m 644 ${src_lib} ${lib_dest}
fi fi
# Update the dynamic library so it will know where to look for the other libraries # Update the dynamic library so it will know where to look for the other libraries
echo "Installing ${3} `basename ${lib_dest}`" echo "Installing ${type} `basename ${lib_dest}`"
if [ "${3}" != "bin" ]; then if [ "${type}" = "lib" ]; then
# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory # Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
install_name_tool -id "${install_name}/`basename ${lib_dest}`" ${lib_dest} > /dev/null install_name_tool -id "${install_name}/`basename ${lib_dest}`" ${lib_dest} > /dev/null
fi fi
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory if [ "${type}" != "data" ]; then
for linked_lib in `otool -L ${lib_dest} | grep '(' | sed 's/\((.*)\)//'`; do # Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
local name=`basename ${linked_lib}` for linked_lib in `otool -L ${lib_dest} | grep '(' | sed 's/\((.*)\)//'`; do
case "${linked_lib}" in local name=`basename ${linked_lib}`
*/vlc_build_dir/* | */vlc_install_dir/* | *vlc* | */extras/contrib/lib/*) case "${linked_lib}" in
if test -e ${linked_lib}; then */vlc_build_dir/* | */vlc_install_dir/* | *vlc* | */extras/contrib/lib/*)
install_name_tool -change "$linked_lib" "${lib_install_prefix}/${name}" "${lib_dest}" if test -e ${linked_lib}; then
linked_libs="${linked_libs} ${ref_lib}" install_name_tool -change "$linked_lib" "${lib_install_prefix}/${name}" "${lib_dest}"
install_library ${linked_lib} ${target_lib} "library" linked_libs="${linked_libs} ${ref_lib}"
fi vlc_install ${linked_lib} ${target_lib} "library"
;; fi
esac ;;
done esac
done
fi
fi fi
} }
# @function install_library # @function vlc_install
########################## ##########################
prefix=".libs/" prefix=".libs/"
...@@ -104,16 +112,16 @@ if test "${ACTION}" = "build"; then ...@@ -104,16 +112,16 @@ if test "${ACTION}" = "build"; then
########################## ##########################
# Hack for VLC-release.app # Hack for VLC-release.app
if [ "$FULL_PRODUCT_NAME" = "VLC-release.app" ] ; then if [ "$FULL_PRODUCT_NAME" = "VLC-release.app" ] ; then
install_library "${VLC_BUILD_DIR}/bin/${prefix}vlc" "${target}" "bin" "@loader_path/lib" vlc_install "${VLC_BUILD_DIR}/bin/${prefix}vlc" "${target}" "bin" "@loader_path/lib"
mv ${target}/vlc ${target}/VLC mv ${target}/vlc ${target}/VLC
chmod +x ${target}/VLC chmod +x ${target}/VLC
elif [ "$FULL_PRODUCT_NAME" = "VLC-Plugin.plugin" ] ; then elif [ "$FULL_PRODUCT_NAME" = "VLC-Plugin.plugin" ] ; then
# install Safari webplugin # install Safari webplugin
install_library "${VLC_BUILD_DIR}/projects/mozilla/${prefix}npvlc.${suffix}" "${target}" "library" "@loader_path/lib" vlc_install "${VLC_BUILD_DIR}/projects/mozilla/${prefix}npvlc.${suffix}" "${target}" "library" "@loader_path/lib"
mv ${target}/npvlc.${suffix} "${target}/VLC Plugin" mv ${target}/npvlc.${suffix} "${target}/VLC Plugin"
chmod +x "${target}/VLC Plugin" chmod +x "${target}/VLC Plugin"
else else
install_library "${VLC_BUILD_DIR}/bin/${prefix}vlc" "${target}/bin" "bin" "@loader_path/../lib" vlc_install "${VLC_BUILD_DIR}/bin/${prefix}vlc" "${target}/bin" "bin" "@loader_path/../lib"
fi fi
########################## ##########################
...@@ -123,7 +131,7 @@ if test "${ACTION}" = "build"; then ...@@ -123,7 +131,7 @@ if test "${ACTION}" = "build"; then
for module in `find ${VLC_BUILD_DIR}/modules -name *.${suffix}` ; do for module in `find ${VLC_BUILD_DIR}/modules -name *.${suffix}` ; do
# Check to see that the reported module actually exists # Check to see that the reported module actually exists
if test -n ${module}; then if test -n ${module}; then
install_library ${module} ${target_modules} "module" vlc_install ${module} ${target_modules} "module"
fi fi
done done
# Build the modules folder # Build the modules folder
...@@ -156,14 +164,14 @@ if test "${ACTION}" = "build"; then ...@@ -156,14 +164,14 @@ if test "${ACTION}" = "build"; then
case "${linked_lib}" in case "${linked_lib}" in
*/extras/contrib/lib/*.dylib|*/vlc_install_dir/lib/*.dylib) */extras/contrib/lib/*.dylib|*/vlc_install_dir/lib/*.dylib)
if test -e ${linked_lib}; then if test -e ${linked_lib}; then
install_library ${linked_lib} ${target_lib} "library" vlc_install ${linked_lib} ${target_lib} "library"
fi fi
;; ;;
esac esac
done done
install_library "${VLC_BUILD_DIR}/src/${prefix}libvlc.5.dylib" "${target_lib}" "library" vlc_install "${VLC_BUILD_DIR}/src/${prefix}libvlc.5.dylib" "${target_lib}" "library"
install_library "${VLC_BUILD_DIR}/src/${prefix}libvlccore.4.dylib" "${target_lib}" "library" vlc_install "${VLC_BUILD_DIR}/src/${prefix}libvlccore.4.dylib" "${target_lib}" "library"
pushd `pwd` > /dev/null pushd `pwd` > /dev/null
cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}/lib cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}/lib
ln -sf libvlc.5.dylib libvlc.dylib ln -sf libvlc.5.dylib libvlc.dylib
......
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