#!/bin/bash
function Build_xcode () {
Echo "* * * Building WebRTC for the ia32 IOS simulator";
Export gyp_generators= "xcode";
Export gyp_defines= "build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 os=ios target_arch=ia32 clang_ Xcode=1 ";
Export gyp_generator_flags= "$GYP _generator_flags output_dir=out_ios_ia32";
Export gyp_crosscompile=1;
Gclient runhooks;
Ninja-c Out_ios_ia32/release-iphonesimulator Iossim apprtcdemo;
}
function Build_iossim_ia32 () {
Echo "* * * Building WebRTC for the ia32 IOS simulator";
Export gyp_generators= "ninja";
Export gyp_defines= "build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 os=ios target_arch=ia32 clang_ Xcode=1 ";
Export gyp_generator_flags= "$GYP _generator_flags output_dir=out_ios_ia32";
Export gyp_crosscompile=1;
pushd src;
Gclient runhooks;
Ninja-c Out_ios_ia32/release-iphonesimulator Iossim apprtcdemo;
Echo "* * * Creating IOS ia32 libraries";
pushd out_ios_ia32/release-iphonesimulator/;
Rm-f libapprtc_signaling.a;
popd
Mkdir-p out_ios_ia32/libs;
Libtool-static-o out_ios_ia32/libs/libwebrtc-ia32.a out_ios_ia32/release-iphonesimulator/lib*.a;
Strip-s-x-o Out_ios_ia32/libs/libwebrtc.a-r out_ios_ia32/libs/libwebrtc-ia32.a;
Rm-f out_ios_ia32/libs/libwebrtc-ia32.a;
Echo "* * * Result: $PWD/out_ios_ia32/libs/libwebrtc.a";
popd
}
function build_iossim_x86_64 () {
Echo "* * * Building WebRTC for the x86_64 IOS simulator";
Export gyp_generators= "ninja";
Export gyp_defines= "build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 os=ios target_arch=x64 target_ Subarch=arm64 clang_xcode=1 ";
Export gyp_generator_flags= "$GYP _generator_flags output_dir=out_ios_x86_64";
Export gyp_crosscompile=1;
pushd src;
Gclient runhooks;
Ninja-c Out_ios_x86_64/release-iphonesimulator Iossim apprtcdemo;
Echo "* * * Creating IOS x86_64 libraries";
pushd out_ios_x86_64/release-iphonesimulator/;
Rm-f libapprtc_signaling.a;
popd
Mkdir-p out_ios_x86_64/libs;
Libtool-static-o out_ios_x86_64/libs/libwebrtc-x86_64.a out_ios_x86_64/release-iphonesimulator/lib*.a;
Strip-s-x-o Out_ios_x86_64/libs/libwebrtc.a-r out_ios_x86_64/libs/libwebrtc-x86_64.a;
Echo "* * * Result: $PWD/out_ios_x86_64/libs/libwebrtc.a";
popd
}
function Build_iosdevice_armv7 () {
Echo "* * * Building WebRTC for armv7 IOS devices";
Export gyp_generators= "ninja";
Export gyp_defines= "build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 os=ios target_arch=armv7 clang_ Xcode=1 ";
Export gyp_generator_flags= "$GYP _generator_flags output_dir=out_ios_armv7";
Export gyp_crosscompile=1;
pushd src;
Gclient runhooks;
Ninja-c Out_ios_armv7/release-iphoneos apprtcdemo;
Echo "* * * Creating IOS armv7 libraries";
pushd out_ios_armv7/release-iphoneos/;
Rm-f libapprtc_signaling.a;
popd
Mkdir-p out_ios_armv7/libs;
Libtool-static-o out_ios_armv7/libs/libwebrtc-armv7.a out_ios_armv7/release-iphoneos/lib*.a;
Strip-s-x-o Out_ios_armv7/libs/libwebrtc.a-r out_ios_armv7/libs/libwebrtc-armv7.a;
Echo "* * * Result: $PWD/out_ios_armv7/libs/libwebrtc.a";
popd
}
function build_iosdevice_arm64 () {
Echo "* * * Building WebRTC for arm64 IOS devices";
Export gyp_generators= "ninja";
Export gyp_defines= "build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 os=ios target_arch=arm64 target_ Subarch=arm64 clang_xcode=1 ";
Export gyp_generator_flags= "$GYP _generator_flags output_dir=out_ios_arm64";
Export gyp_crosscompile=1;
Echo "src/webrtc/build/gyp_webrtc-dclang_xcode=1"
pushd src;
Gclient runhooks;
Ninja-c Out_ios_arm64/release-iphoneos apprtcdemo;
Echo "* * * Creating IOS arm64 libraries";
pushd out_ios_arm64/release-iphoneos/;
Rm-f libapprtc_signaling.a;
popd
Mkdir-p out_ios_arm64/libs;
Libtool-static-o out_ios_arm64/libs/libwebrtc-arm64.a out_ios_arm64/release-iphoneos/lib*.a;
Strip-s-x-o Out_ios_arm64/libs/libwebrtc.a-r out_ios_arm64/libs/libwebrtc-arm64.a;
Echo "* * * Result: $PWD/out_ios_arm64/libs/libwebrtc.a";
popd
}
function Combine_libs ()
{
Echo "* * * Combining libraries";
Lipo-create SRC/OUT_IOS_ARMV7/LIBS/LIBWEBRTC.A \
SRC/OUT_IOS_ARM64/LIBS/LIBWEBRTC.A \
-output libwebrtc.a;
echo "the Public headers is located in $PWD/src/talk/app/webrtc/objc/public/*.h";
}
function Combine_libs_sim ()
{
Echo "* * * Combining libraries";
Lipo-create SRC/OUT_IOS_IA32/LIBS/LIBWEBRTC.A \
SRC/OUT_IOS_X86_64/LIBS/LIBWEBRTC.A \
-output libwebrtc_sim.a;
echo "the Public headers is located in $PWD/src/talk/app/webrtc/objc/public/*.h";
}
function Create_framework () {
Echo "* * * Creating webrtc.framework";
RM-RF webrtc.framework;
Mkdir-p webrtc.framework/versions/a/headers;
Cp./src/talk/app/webrtc/objc/public/*.h webrtc.framework/versions/a/headers;
CP LIBWEBRTC.A webrtc.framework/versions/a/webrtc;
pushd webrtc.framework/versions;
LN-SFH A current;
popd
pushd webrtc.framework;
LN-SFH versions/current/headers Headers;
LN-SFH VERSIONS/CURRENT/WEBRTC WebRTC;
popd
}
function Clean ()
{
Echo "* * * * cleaning";
pushd src;
RM-RF out_ios_arm64;
RM-RF out_ios_armv7;
RM-RF out_ios_ia32;
RM-RF out_ios_x86_64;
popd
Echo "* * * cleaned";
}
Function Update ()
{
Gclient Sync--force
pushd SRC
SVN info | grep Revision >. /svn_rev.txt
popd
}
function Build_all () {
Build_iossim_ia32 && build_iossim_x86_64 && \
Build_iosdevice_armv7 && build_iosdevice_arm64 && \
Combine_libs && combine_libs_sim;
}
function Build_os () {
Build_iosdevice_armv7 combine_libs;
}
function Run_simulator_ia32 () {
Echo "* * * Running WEBRTC appdemo on Ia32 IOS simulator";
Src/out_ios_ia32/release-iphonesimulator/iossim src/out_ios_ia32/release-iphonesimulator/apprtcdemo.app;
}
function run_simulator_x86_64 () {
Echo "* * * Running WEBRTC appdemo on x86_64 IOS simulator";
Src/out_ios_x86_64/release-iphonesimulator/iossim-d ' IPhone 6 '-s ' 8.4 ' src/out_ios_x86_64/release-iphonesimulator/ apprtcdemo.app;
}
function Run_on_device_armv7 () {
Echo "* * * Launching on ARMV7 IOS device";
Ideviceinstaller-i src/out_ios_armv7/release-iphoneos/apprtcdemo.app;
Echo "* * * Launch complete";
}
function run_on_device_arm64 () {
Echo "* * * Launching on arm64 IOS device";
Ideviceinstaller-i src/out_ios_arm64/release-iphoneos/apprtcdemo.app;
Echo "* * * Launch complete";
}
#运行命令行参数中第一个参数所指定的Shell函数
[email protected]
WEBRTC build.sh