123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- #!/bin/bash
- set -e
- [% c("var/set_default_env") -%]
- [% c("var/setarch") -%]
- distdir=/var/tmp/dist/[% project %]
- [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
- mkdir -p /var/tmp/dist
- [% IF c("var/linux") %]
- tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
- export PATH="/var/tmp/dist/binutils/bin:$PATH"
- [% END -%]
- [% IF c("var/osx") -%]
-
- ln -sf x86_64-apple-darwin11-libtool $cctoolsdir/libtool
- export AR=x86_64-apple-darwin11-ar
-
-
- [% ELSE -%]
- AR=ar
- [% END -%]
- tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/depot_tools') %]
- export PATH="$PATH:/var/tmp/dist/depot_tools"
- export DEPOT_TOOLS_UPDATE=0
- mkdir -p /var/tmp/build
- tar -C /var/tmp/build -xf webrtc-sources-[% c('version') %].tar.gz
- builddir=/var/tmp/build/[% project %]/src
- cd $builddir
- [% IF c("var/linux") -%]
- patch -p1 < $rootdir/webrtc-linux.patch
- [% END -%]
- [% IF c("var/osx") -%]
- patch -p1 < $rootdir/webrtc-mac.patch
- [% END -%]
- [% IF c("var/linux") -%]
-
- cd tools/gn
-
- CXXFLAGS=-D__STDC_FORMAT_MACROS=1 LDFLAGS=-latomic ./bootstrap/bootstrap.py --no-rebuild --no-clean
- cd ../..
-
- GN="$PWD/out_bootstrap/gn"
- [% END -%]
- [% IF c("var/osx") -%]
-
-
-
-
-
- GN="/var/tmp/dist/depot_tools/gn"
-
-
-
- cat <<EOF > build/mac/find_sdk.py
- print("$sysrootdir")
- print("10.11")
- EOF
- cat <<EOF > build/config/mac/sdk_info.py
- print("machine_os_build=\"10.7\"")
- print("sdk_build=\"10.11\"")
- print("sdk_path=\"$sysrootdir\"")
- print("sdk_platform_path=\"$sysrootdir\"")
- print("sdk_version=\"10.11\"")
- print("xcode_build=\"7.3\"")
- print("xcode_version=\"0730\"")
- EOF
- [% END -%]
- [% IF c("var/linux") -%]
- export CC=gcc
- export CXX=g++
- [% END -%]
- [% IF c("var/linux-i686") -%]
- GYP_DEFINES+=" target_arch=ia32"
- export CC='gcc -m32'
- export CXX='g++ -m32'
- export CFLAGS=-m32
- export CXXFLAGS=-m32
- export LDFLAGS=-m32
- [% END -%]
- export GN_ARGS=""
- GN_ARGS+=" is_debug=false"
- GN_ARGS+=" treat_warnings_as_errors=false"
- GN_ARGS+=" is_component_build=false"
- GN_ARGS+=" is_clang=false use_sysroot=false"
- GN_ARGS+=" use_custom_libcxx=false"
- [% IF c("var/linux") -%]
- GN_ARGS+=" target_os=\"linux\" target_cpu=\"[% IF c("var/linux-i686") %]x86[% ELSE %]x64[% END %]\""
- GN_ARGS+=" gold_path=\"$INSTDIR/binutils/bin\""
-
- rm -rf third_party/binutils/Linux_*
-
- GN_ARGS+=" use_ozone=true use_gconf=false"
- GN_ARGS+=" rtc_include_opus=false rtc_include_ilbc=false rtc_include_internal_audio_device=false rtc_include_pulse_audio=false"
-
-
- [% END -%]
- [% IF c("var/osx") -%]
- GN_ARGS+=" target_os=\"mac\" target_cpu=\"x64\" mac_deployment_target=\"10.7\""
- GN_ARGS+=" clang_use_chrome_plugins=false"
- GN_ARGS+=" clang_base_path=\"$clangdir\""
-
- GN_ARGS+=" use_lld=false"
-
- GN_ARGS+=" rtc_include_opus=false rtc_include_ilbc=false rtc_include_internal_audio_device=false"
-
-
- GN_ARGS+=" rtc_include_tests=true"
-
- rm -rf third_party/llvm-build
- rm -rf third_party/binutils
- [% END -%]
- rm -rf out/Release
- "$GN" gen out/Release --args="$GN_ARGS"
- ninja -C out/Release webrtc field_trial metrics_default pc_test_utils
- find out/Release/obj -name '*.o' -print0 | sort -z \
- | [% IF c("var/osx") %]ZERO_AR_DATE=1 [% END %] xargs -0 -- "$AR" crs libwebrtc-magic.a
- mkdir -p $distdir
- cd $distdir
- mkdir -p include lib
- cp -f $builddir/libwebrtc-magic.a [% c("var/webrtc/lib_path") %]
- INCLUDE_DIR="$PWD/include"
- cd $builddir
- find . -type f -name '*.h' -print0 | while IFS= read -r -d '' h;
- do
- mkdir -p "$INCLUDE_DIR/$(dirname "$h")"
- cp -f "$h" "$INCLUDE_DIR/$h"
- done
- cd /var/tmp/dist
- [% c('tar', {
- tar_src => [ project ],
- tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
- }) %]
|