| #!/bin/bash -ex |
| # Download & build breakpad on the local machine |
| # works on Linux, OS X and Windows |
| # leaves output in /tmp/prebuilts/google-breakpad/$OS-x86 |
| |
| build_and_install_MSVC() |
| { |
| solution=$1 |
| project=$2 |
| if [ x"$project" == x ]; then |
| project_switch="" |
| else |
| project_switch="/Project $project" |
| fi |
| |
| $RD/gyp/gyp --no-circular-check --no-duplicate-basename-check $solution.gyp |
| ( |
| export CL="/DBPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR \"$VS120COMNTOOLS\\..\\..\\DIA SDK\\include\"" |
| _CL_="/MDd /WX-" devenv $solution.sln /Build Debug $project_switch |
| _CL_="/MD /WX-" devenv $solution.sln /Build Release $project_switch |
| ) |
| for build in Debug Release; do |
| find $build -name '*.exe' -exec cp -va -t $INSTALL/$build {} + |
| find $build -name '*.lib' -exec cp -va -t $INSTALL/$build {} + |
| done |
| } |
| |
| build_and_install_configure() |
| { |
| mkdir $RD/build |
| cd $RD/build |
| local defines="-DBPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" |
| export CFLAGS="$CFLAGS $defines" |
| export CXXFLAGS="$CXXFLAGS $defines" |
| ../sources/configure --prefix=/ |
| make -j$CORES |
| make install-strip DESTDIR=$INSTALL |
| } |
| |
| install_headers() |
| { |
| mkdir -p $INSTALL/include/breakpad |
| cd $RD/sources/src |
| rsync -av --include '*/' --include '*.h' --exclude '*' --prune-empty-dirs . $INSTALL/include/breakpad |
| } |
| |
| PROJ=google-breakpad |
| VER=f766c4d7 |
| LSS_VER=92920301 |
| GYP_VER=265f495c |
| |
| MSVS=2013 |
| |
| source $(dirname "$0")/build-common.sh "$@" |
| |
| git clone https://chromium.googlesource.com/breakpad/breakpad --no-checkout sources |
| cd sources |
| git checkout $VER |
| |
| # This commit fixes dump_syms on mac. We can't just fast-forward to this commit |
| # yet, one of the later commits breaks "make install" on linux. |
| # TODO(labath): Fix make install upstream, so we can update properly here. |
| git cherry-pick cc7b69a8 |
| |
| # these patches make it possible to build minidump_stackwalk on windows |
| # TODO(labath): Upstream these patches, so that we don't need to patch it locally |
| git am "$SCRIPT_DIR/breakpad.patches" |
| |
| cd src/third_party |
| git clone https://chromium.googlesource.com/linux-syscall-support --no-checkout lss |
| cd lss |
| git checkout $LSS_VER |
| |
| cd $RD |
| git clone https://chromium.googlesource.com/external/gyp --no-checkout gyp |
| cd gyp |
| git checkout $GYP_VER |
| cd .. |
| |
| case "$OS" in |
| linux) |
| build_and_install_configure |
| |
| # make install does not actually install all the headers. Let's finish the job |
| # for him. |
| # TODO: This can be removed when the upstream installation patch lands |
| install_headers |
| ;; |
| darwin) |
| cd $RD/sources/src/tools/mac/dump_syms |
| xcodebuild -project dump_syms.xcodeproj -configuration Release -target dump_syms -sdk macosx10.9 GCC_VERSION= GCC_TREAT_WARNINGS_AS_ERRORS=no |
| mkdir $INSTALL/bin |
| cp build/Release/dump_syms $INSTALL/bin |
| |
| cd $RD/sources/src/client/mac |
| xcodebuild -project Breakpad.xcodeproj -configuration Release -target Breakpad -sdk macosx10.9 GCC_VERSION= |
| install_name_tool -id @executable_path/../Breakpad.framework/Resources/breakpadUtilities.dylib build/Release/breakpadUtilities.dylib |
| install_name_tool -id @executable_path/../Breakpad.framework/Breakpad build/Release/Breakpad.framework/Breakpad |
| install_name_tool -change @executable_path/../Frameworks/Breakpad.framework/Resources/breakpadUtilities.dylib @executable_path/../Breakpad.framework/Resources/breakpadUtilities.dylib build/Release/Breakpad.framework/Breakpad |
| cp -r build/Release/Breakpad.framework $INSTALL |
| |
| # for minidump_stackwalk |
| build_and_install_configure |
| # libbreakpad.a built by configure is unusable |
| rm $INSTALL/lib/libbreakpad.a |
| |
| install_headers |
| ;; |
| windows) |
| mkdir $INSTALL/Release $INSTALL/Debug |
| |
| cd $RD/sources/src/client/windows/handler |
| build_and_install_MSVC exception_handler exception_handler |
| |
| cd $RD/sources/src/client/windows/crash_generation |
| build_and_install_MSVC crash_generation crash_generation_client |
| |
| cd $RD/sources/src/common/windows |
| build_and_install_MSVC common_windows common_windows_lib |
| |
| cd $RD/sources/src/tools/windows/dump_syms |
| build_and_install_MSVC dump_syms dump_syms |
| |
| cd $RD/sources/src/tools/windows/symupload |
| build_and_install_MSVC symupload symupload |
| |
| cd $RD/sources/src/processor |
| build_and_install_MSVC processor minidump_stackwalk |
| |
| install_headers |
| ;; |
| esac |
| |
| finalize_build |