1 if test "${ACTION}" = ""; then
4 FULL_PRODUCT_NAME="VLCKit.framework"
5 CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Versions/A"
6 VLC_BUILD_DIR="../../.."
9 rm -fr ${FULL_PRODUCT_NAME}
11 # Hack to use that script with the current VLC-release.app
12 elif test "${ACTION}" = "release-makefile"; then
13 TARGET_BUILD_DIR="${build_dir}"
14 FULL_PRODUCT_NAME="${PRODUCT}"
15 CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Contents/MacOS"
16 VLC_BUILD_DIR="${build_dir}"
17 VLC_SRC_DIR="${src_dir}"
19 RELEASE_MAKEFILE="yes"
22 if test "${ACTION}" = "build"; then
27 target="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}"
28 target_lib="${target}/${lib}" # Should we consider using a different well-known folder like shared resources?
29 target_modules="${target}/${modules}" # Should we consider using a different well-known folder like shared resources?
30 target_share="${target}/${share}" # Should we consider using a different well-known folder like shared resources?
31 target_include="${target}/${include}" # Should we consider using a different well-known folder like shared resources?
34 ##########################
35 # @function install_library(src_lib, dest_dir, type, lib_install_prefix, destination_name)
36 # @description Installs the specified library into the destination folder, automatically changes the references to dependencies
37 # @param src_lib source library to copy to the destination directory
38 # @param dest_dir destination directory where the src_lib should be copied to
41 if [ ${3} = "library" ]; then
42 local install_name="@loader_path/lib"
43 elif [ ${3} = "module" ]; then
44 local install_name="@loader_path/modules"
46 if [ "${5}" != "" ]; then
47 local lib_dest="${2}/${5}"
49 local lib_dest="${2}/`basename ${1}`"
52 if [ "${4}" != "" ]; then
53 local lib_install_prefix="${4}"
55 local lib_install_prefix="@loader_path/../lib"
58 if test -e ${1} && ((! test -e ${lib_dest}) || test ${1} -nt ${lib_dest} ); then
62 # Lets copy the library from the source folder to our new destination folder
63 install -m 644 ${1} ${lib_dest}
65 # Update the dynamic library so it will know where to look for the other libraries
66 echo "Installing ${3} `basename ${lib_dest}`"
68 if [ "${3}" != "bin" ]; then
69 # Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
70 install_name_tool -id "${install_name}/`basename ${lib_dest}`" ${lib_dest} > /dev/null
73 # Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
74 for linked_lib in `otool -L ${lib_dest} | grep '(' | sed 's/\((.*)\)//'`; do
75 local name=`basename ${linked_lib}`
76 case "${linked_lib}" in
77 */vlc_build_dir/* | *vlc* | */extras/contrib/lib/*)
78 if test -e ${linked_lib}; then
79 install_name_tool -change "$linked_lib" "${lib_install_prefix}/${name}" "${lib_dest}"
80 linked_libs="${linked_libs} ${ref_lib}"
81 install_library ${linked_lib} ${target_lib} "library"
88 # @function install_library
89 ##########################
94 ##########################
95 # Hack for VLC-release.app
96 if [ "$FULL_PRODUCT_NAME" = "VLC-release.app" ] ; then
97 install_library "${VLC_BUILD_DIR}/bin/${prefix}vlc" "${target}" "bin" "@loader_path/lib"
98 mv ${target}/vlc ${target}/VLC
99 chmod +x ${target}/VLC
100 elif [ "$FULL_PRODUCT_NAME" = "VLC-release.app" ] ; then
101 install_library "${VLC_BUILD_DIR}/src/${prefix}npvlc.${suffix}" "${target}" "bin" "@loader_path/lib"
102 mv ${target}/npvlc.${suffix} "${target}/VLC Plugin.plugin"
103 chmod +x "${target}/VLC Plugin.plugin"
106 ##########################
107 # Build the modules folder (Same as VLCKit.framework/modules in Makefile)
108 echo "Building modules folder..."
109 # Figure out what modules are available to install
110 for module in `find ${VLC_BUILD_DIR}/modules -name *.${suffix}` ; do
111 # Check to see that the reported module actually exists
112 if test -n ${module}; then
113 install_library ${module} ${target_modules} "module"
116 # Build the modules folder
117 ##########################
119 ##########################
120 # Create a symbolic link in the root of the framework
121 mkdir -p ${target_lib}
122 mkdir -p ${target_modules}
124 if [ "$RELEASE_MAKEFILE" != "yes" ] ; then
125 pushd `pwd` > /dev/null
126 cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}
128 ln -sf Versions/Current/${lib} .
129 ln -sf Versions/Current/${modules} .
130 ln -sf Versions/Current/${include} .
131 ln -sf Versions/Current/${share} .
136 ##########################
137 # Build the library folder
138 echo "Building library folder... ${linked_libs}"
139 for linked_lib in ${linked_libs} ; do
140 case "${linked_lib}" in
141 */extras/contrib/lib/*.dylib|*/vlc_install_dir/lib/*.dylib)
142 if test -e ${linked_lib}; then
143 install_library ${linked_lib} ${target_lib} "library"
149 install_library "${VLC_BUILD_DIR}/src/${prefix}libvlc.dylib" ${target_lib} "library"
151 ##########################
152 # Build the share folder
153 echo "Building share folder..."
154 pbxcp="/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -resolve-src-symlinks"
155 mkdir -p ${target_share}
156 $pbxcp ${VLC_SRC_DIR}/share/lua ${target_share}
158 ##########################
160 echo "Exporting headers..."
161 mkdir -p ${target_include}/vlc
162 $pbxcp ${VLC_SRC_DIR}/include/vlc/*.h ${target_include}/vlc