Skip to content

Commit

Permalink
Merge pull request nesterenkodm#35 from serhiySchindler/master
Browse files Browse the repository at this point in the history
pjsip 2.5.5
  • Loading branch information
chebur authored Aug 22, 2016
2 parents 52527d5 + d5b6f5f commit 63b56e2
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 41 deletions.
21 changes: 10 additions & 11 deletions pjsip.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,30 @@ PJSIP may include third party software in its source code distribution. Third Pa
LICENSE
}

s.public_header_files = 'build/pjproject/src/pjsip/include/**',
'build/pjproject/src/pjlib/include/**',
s.public_header_files = 'build/pjproject/src/pjlib/include/**',
'build/pjproject/src/pjlib-util/include/**',
'build/pjproject/src/pjmedia/include/**',
'build/pjproject/src/pjnath/include/**',
'build/pjproject/src/pjmedia/include/**'
'build/pjproject/src/pjsip/include/**'

s.preserve_paths = 'build/pjproject/src/pjsip/include/**/*',
'build/pjproject/src/pjlib/include/**/*',
s.preserve_paths = 'build/pjproject/src/pjlib/include/**/*',
'build/pjproject/src/pjlib-util/include/**/*',
'build/pjproject/src/pjmedia/include/**/*',
'build/pjproject/src/pjnath/include/**/*',
'build/pjproject/src/pjmedia/include/**/*'
'build/pjproject/src/pjsip/include/**/*'

s.vendored_libraries = 'build/openh264/lib/*.a',
'build/pjproject/src/pjsip/lib/*.a',
'build/pjproject/src/pjlib/lib/*.a',
'build/pjproject/src/pjlib-util/lib/*.a',
'build/pjproject/src/pjnath/lib/*.a',
'build/pjproject/src/pjmedia/lib/*.a',
'build/pjproject/src/pjnath/lib/*.a',
'build/pjproject/src/third_party/lib/*.a'

header_search_paths = '"$(PODS_ROOT)/pjsip/build/pjproject/src/pjsip/include"',
'"$(PODS_ROOT)/pjsip/build/pjproject/src/pjlib/include"',
header_search_paths = '"$(PODS_ROOT)/pjsip/build/pjproject/src/pjlib/include"',
'"$(PODS_ROOT)/pjsip/build/pjproject/src/pjlib-util/include"',
'"$(PODS_ROOT)/pjsip/build/pjproject/src/pjmedia/include"',
'"$(PODS_ROOT)/pjsip/build/pjproject/src/pjnath/include"',
'"$(PODS_ROOT)/pjsip/build/pjproject/src/pjmedia/include"'
'"$(PODS_ROOT)/pjsip/build/pjproject/src/pjsip/include"'

s.xcconfig = {'HEADER_SEARCH_PATHS' => header_search_paths.join(' '),
'GCC_PREPROCESSOR_DEFINITIONS' => 'PJ_AUTOCONF=1'}
Expand Down
73 changes: 43 additions & 30 deletions pjsip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ LIB_PATHS=("pjlib/lib" \
"pjlib-util/lib" \
"pjmedia/lib" \
"pjnath/lib" \
"pjsip/lib" \
"third_party/lib")

OPENSSL_PREFIX=
Expand Down Expand Up @@ -54,7 +53,7 @@ function config_site() {
PJSIP_CONFIG_PATH="${SOURCE_DIR}/pjlib/include/pj/config_site.h"
HAS_VIDEO=

echo "Creating config.h..."
echo "Creating config_site.h ..."

if [ -f "${PJSIP_CONFIG_PATH}" ]; then
rm "${PJSIP_CONFIG_PATH}"
Expand All @@ -76,6 +75,21 @@ function config_site() {
echo "#include <pj/config_site_sample.h>" >> "${PJSIP_CONFIG_PATH}"
}

function clean_libs () {
ARCH=${1}
for SRC_DIR in ${LIB_PATHS[*]}; do
DIR="${PJSIP_DIR}/${SRC_DIR}"
if [ -d "${DIR}" ]; then
rm -rf "${DIR}"/*
fi

DIR="${PJSIP_DIR}/${SRC_DIR}-${ARCH}"
if [ -d "${DIR}" ]; then
rm -rf "${DIR}"
fi
done
}

function copy_libs () {
ARCH=${1}

Expand All @@ -86,6 +100,7 @@ function copy_libs () {
rm -rf "${DST_DIR}"
fi
cp -R "${SRC_DIR}" "${DST_DIR}"
rm -rf "${SRC_DIR}"/* # delete files because this directory will be used for the final lipo output
done
}

Expand Down Expand Up @@ -124,6 +139,8 @@ function _build() {

echo "Building for ${ARCH}..."

clean_libs ${ARCH}

make distclean > ${LOG} 2>&1
ARCH="-arch ${ARCH}" ${CONFIGURE} >> ${LOG} 2>&1
make dep >> ${LOG} 2>&1
Expand Down Expand Up @@ -162,41 +179,37 @@ function x86_64() {
}

function lipo() {
echo "Lipo libs..."

TMP=`mktemp -t lipo`
while [ $# -gt 0 ]; do
ARCH=$1
for LIB_DIR in ${LIB_PATHS[*]}; do
ARGS=""
DST_DIR="${PJSIP_DIR}/${LIB_DIR}"
SRC_DIR="${DST_DIR}-${ARCH}"

for FILE in `ls -l1 "${SRC_DIR}"`; do
OPTIONS="-arch ${ARCH} ${SRC_DIR}/${FILE}"
EXISTS=`cat "${TMP}" | grep "${FILE}"`
if [[ ${EXISTS} ]]; then
SED_SRC="${FILE}$"
SED_SRC="${SED_SRC//\//\\/}"
SED_DST="${FILE} ${OPTIONS}"
SED_DST="${SED_DST//\//\\/}"
sed -i.bak "s/${SED_SRC}/${SED_DST}/" "${TMP}"
rm "${TMP}.bak"

else
echo "${OPTIONS}" >> "${TMP}"
echo "Lipo libs... (${TMP})"

for LIB_DIR in ${LIB_PATHS[*]}; do # loop over libs
DST_DIR="${PJSIP_DIR}/${LIB_DIR}"

# use the first architecture to find all libraries
PATTERN_DIR="${DST_DIR}-$1"
for PATTERN_FILE in `ls -l1 "${PATTERN_DIR}"`; do
OPTIONS=""

# loop over all architectures and collect the current library
for ARCH in "$@"; do
FILE="${DST_DIR}-${ARCH}/${PATTERN_FILE/-$1-/-${ARCH}-}"
if [ -e "${FILE}" ]; then
OPTIONS="$OPTIONS -arch ${ARCH} ${FILE}"
fi
done

if [ "$OPTIONS" != "" ]; then
OUTPUT_PREFIX=$(dirname "${DST_DIR}")
OUTPUT="${OUTPUT_PREFIX}/lib/${PATTERN_FILE/-$1-/-}"

OPTIONS="${OPTIONS} -create -output ${OUTPUT}"
echo "$OPTIONS" >> "${TMP}"
fi
done
shift
done

while read LINE; do
COMPONENTS=($LINE)
LAST=${COMPONENTS[@]:(-1)}
PREFIX=$(dirname $(dirname "${LAST}"))
OUTPUT="${PREFIX}/lib/`basename ${LAST}`"
xcrun -sdk iphoneos lipo ${LINE} -create -output ${OUTPUT}
xcrun -sdk iphoneos lipo ${LINE}
done < "${TMP}"
}

Expand Down

0 comments on commit 63b56e2

Please sign in to comment.