forked from VoiSmart/pjsip-android-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·80 lines (66 loc) · 3.14 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash -e
#@author Aleksandar Gotev ([email protected])
. config.conf
BASE_FOLDER=$(pwd)
PJSIP_BASE_PATH="${BASE_FOLDER}/${PJSIP_DIR_NAME}"
PJSIP_TMP_PATH="/tmp/pjsip"
CONFIG_SITE_PATH="${PJSIP_BASE_PATH}/pjlib/include/pj/config_site.h"
PJSUA_BASE_DIR="${PJSIP_TMP_PATH}/pjsip-apps/src/swig"
PJSUA_GENERATED_SRC_DIR="${PJSUA_BASE_DIR}/java/android/src"
PJSUA_GENERATED_SO_PATH="${PJSUA_BASE_DIR}/java/android/libs/armeabi/libpjsua2.so"
FINAL_BUILD_DIR="${BASE_FOLDER}/pjsip-build"
FINAL_BUILD_LIB="${FINAL_BUILD_DIR}/lib"
FINAL_BUILD_LOGS="${FINAL_BUILD_DIR}/logs"
export ANDROID_NDK_ROOT="${BASE_FOLDER}/${NDK_DIR_NAME}"
export PATH="$ANDROID_NDK_ROOT:$PATH"
echo "Clear final build folder ..."
rm -rf "${FINAL_BUILD_DIR}"
mkdir -p "${FINAL_BUILD_LIB}"
mkdir -p "${FINAL_BUILD_LOGS}"
echo "Creating config site file for Android ..."
cat <<EOF > "$CONFIG_SITE_PATH"
#define PJ_CONFIG_ANDROID 1
#define PJMEDIA_HAS_G7221_CODEC 1
#include <pj/config_site_sample.h>
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_AUDIO_DEV_HAS_ANDROID_JNI 0
#define PJMEDIA_AUDIO_DEV_HAS_OPENSL 1
#define PJSIP_AUTH_AUTO_SEND_NEXT 0
EOF
for arch in "${TARGET_ARCHS[@]}"
do
echo "Compile PJSIP for arch $arch ..."
rm -rf "${PJSIP_TMP_PATH}"
mkdir -p "${PJSIP_TMP_PATH}"
cd "${PJSIP_BASE_PATH}"
cp -r * "${PJSIP_TMP_PATH}"
cd "${PJSIP_TMP_PATH}"
#following instructions from here: http://trac.pjsip.org/repos/ticket/1776
YUV_RELEASE_FOLDER="${BASE_FOLDER}/${LIBYUV_REPO_DIR_NAME}/jni/out/Release"
rm -rf "${YUV_RELEASE_FOLDER}"
mkdir -p "${YUV_RELEASE_FOLDER}"
cp "${BASE_FOLDER}/${LIBYUV_REPO_DIR_NAME}/libs/${arch}/libyuv.so" ${YUV_RELEASE_FOLDER}
APP_PLATFORM=android-${TARGET_ANDROID_API} TARGET_ABI=$arch ./configure-android --use-ndk-cflags \
--with-ssl="${OPENSSL_BUILD_OUT_PATH}/libs/${arch}" \
--with-openh264="${OPENH264_BUILD_OUT_PATH}/libs/${arch}" \
--with-libyuv="${BASE_FOLDER}/${LIBYUV_REPO_DIR_NAME}/jni" \
>>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1
make dep >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1
make >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1
echo "Compile PJSUA for arch $arch ..."
cd "${PJSUA_BASE_DIR}"
make >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1
echo "Copying PJSUA .so library to final build directory ..."
mkdir -p "${FINAL_BUILD_LIB}/${arch}"
mv "${PJSUA_GENERATED_SO_PATH}" "${FINAL_BUILD_LIB}/${arch}/"
if [ -f ${OPENH264_BUILD_OUT_PATH}/libs/${arch}/lib/libopenh264.so ]; then
echo "Copying OpenH264 .so library to final build directory ..."
cp ${OPENH264_BUILD_OUT_PATH}/libs/${arch}/lib/libopenh264.so ${FINAL_BUILD_LIB}/${arch}/
fi
echo "Copying libyuv .so library to final build directory ..."
cp "${BASE_FOLDER}/${LIBYUV_REPO_DIR_NAME}/libs/${arch}/libyuv.so" ${FINAL_BUILD_LIB}/${arch}/
done
echo "Copying PJSUA2 java bindings to final build directory ..."
cp -r "${PJSUA_GENERATED_SRC_DIR}" "${FINAL_BUILD_DIR}"
rm -rf "${PJSIP_TMP_PATH}"
echo "Finished! Check the generated output in ${FINAL_BUILD_DIR}"