adium: allow build without building Adium
[siplcs.git] / src / adium / find_adium_build.sh
blobe358cf43d53a637d078f6078406feb42a3f5d181
1 #!/bin/sh
2 set -e
3 #set -x
5 # remove old symlink setup
6 rm -rf adium-frameworks
8 # create empty directory to keep linker happy
9 mkdir adium-frameworks
11 # if Adium is built as sub-project -> skip
12 if [[ ( -d "${BUILT_PRODUCTS_DIR}/Adium.framework" ) ||
13 ( -d "${BUILT_PRODUCTS_DIR}/AdiumLibPurple.framework" ) ||
14 ( -d "${BUILT_PRODUCTS_DIR}/AIUtilities.framework" ) ]]; then
15 echo 1>&2 "Building Adium within SIPEAdiumPlugin - aborting..."
16 exit 0
19 _sipe_build_dir=$(cd "${BUILT_PRODUCTS_DIR}/../../.."; pwd -P)
20 if [[ ! -d "${_sipe_build_dir}" ]]; then
21 echo 1>&2 "can't detect SIPE build directory from '${BUILT_PRODUCTS_DIR}'"
22 exit 1
25 _build_dir=$(cd "${_sipe_build_dir}/.."; pwd -P)
26 if [[ ! -d "${_build_dir}" ]]; then
27 echo 1>&2 "can't detect common build directory from '${_sipe_build_dir}'"
28 exit 1
31 _adium_build_dir=( $(find "${_build_dir}" -maxdepth 1 -type d -name "Adium-*" ) )
32 if [[ ${#_adium_build_dir[@]} -ne 1 ]]; then
33 echo 1>&2 "can't detect Adium build directory from '${_build_dir}'"
34 exit 1
37 # create symlinks to Adium frameworks
38 _frameworks_dir="${BUILT_PRODUCTS_DIR/#${_sipe_build_dir}/${_adium_build_dir[0]}}"
39 _adium_dirs=(
40 Adium.framework
41 AdiumLibPurple.framework
42 AIUtilities.framework
44 ln -s ${_adium_dirs[@]/#/${_frameworks_dir}/} adium-frameworks/
46 # log result
47 ls -lhtR adium-frameworks
48 exit 0