From 14d9c0cdde204d8d7a9faae96340ee43e468acdf Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 28 Jun 2012 00:27:28 +0100 Subject: [PATCH 1/4] Don't build the deploy in debug mode. Debug mode turns off all optimisations. This make PhantomJS considerably slower. Instead, we build in 'release' mode, but generate debugging symbols at the same time. This may present some problems analysing crashes, if the optimisations make that difficult. However, in my testing I was able to get useful debug output even with optimisations enabled. So we should see how we go - if it becomes a problem we can produce seperate debug binaries with no optimisations. https://code.google.com/p/phantomjs/issues/detail?id=599 --- deploy/build-and-package.sh | 6 ++++-- src/qt/preconfig.sh | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh index 12ea3d29..551d9622 100755 --- a/deploy/build-and-package.sh +++ b/deploy/build-and-package.sh @@ -8,8 +8,10 @@ echo echo " $ make clean && cd src/qt && make clean && cd ../.." echo -# Build the project -./build.sh --qt-config "-debug -webkit-debug" --qmake-args "CONFIG-=release CONFIG+=debug" || exit 1 +# This incantation will cause Qt and WebKit and PhantomJS to all build in "release" +# mode, with compiler optimisations, but also with debug symbols. (We will strip the +# symbols in package.sh.) +CFLAGS=-g CXXFLAGS=-g ./build.sh --qt-config '-webkit-debug' --qmake-args "QMAKE_CFLAGS=-g QMAKE_CXXFLAGS=-g" || exit 1 # Package the release tarball rm deploy/*.tar.bz2 2>/dev/null diff --git a/src/qt/preconfig.sh b/src/qt/preconfig.sh index 4f3dd1a8..58ddbb12 100755 --- a/src/qt/preconfig.sh +++ b/src/qt/preconfig.sh @@ -109,10 +109,10 @@ export MAKEFLAGS=-j$COMPILE_JOBS ./configure -prefix $PWD $QT_CFG make -j$COMPILE_JOBS -if [[ $QT_CFG =~ "-webkit-debug" ]]; then - DEBUG_OR_RELEASE=debug -else +if [[ $QT_CFG =~ "-release" ]]; then DEBUG_OR_RELEASE=release +else + DEBUG_OR_RELEASE=debug fi # Extra step to ensure the static libraries are found From cffc41174cb4a7a52cbbab94ccdc9626be2aab2e Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 29 Jun 2012 14:31:53 +0100 Subject: [PATCH 2/4] Fix symbols generation on Linux We are linking against e.g. libQtCore.so.4 rather than libQtCore.so.4.8.2, and this affects symbol generation. (I am not sure if this changed at some point, but this change should make it generate the correct symbol files regardless.) Also makes it less dependent on the Qt version. --- tools/dump-symbols.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/dump-symbols.sh b/tools/dump-symbols.sh index 0b20bb60..dcc39138 100755 --- a/tools/dump-symbols.sh +++ b/tools/dump-symbols.sh @@ -21,10 +21,7 @@ if [[ $OSTYPE = darwin* ]]; then # To compile this program, run ../src/qt/bin/qmake dump-syms-mac.pro && make from tools/ dump_syms="tools/dump_syms.app/Contents/MacOS/dump_syms" else - files+="src/qt/lib/libQtCore.so.4.8.2 " - files+="src/qt/lib/libQtWebKit.so.4.9.2 " - files+="src/qt/lib/libQtGui.so.4.8.2 " - files+="src/qt/lib/libQtNetwork.so.4.8.2" + files+=`ldd bin/phantomjs | grep Qt | cut -d ' ' -f 3 | xargs` # To compile this program, run ./configure && make from src/breakpad/ dump_syms="src/breakpad/src/tools/linux/dump_syms/dump_syms" From 24f53636a073241264f3e91423cbbb20c47c5add Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 29 Jun 2012 14:44:10 +0100 Subject: [PATCH 3/4] Fix the top-level folder name in the packaged symbol tarball. --- deploy/build-and-package.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh index 551d9622..16e5deda 100755 --- a/deploy/build-and-package.sh +++ b/deploy/build-and-package.sh @@ -32,13 +32,22 @@ fi ./tools/dump-symbols.sh +version=$(bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g') +if [[ $OSTYPE = darwin* ]]; then + symbols="phantomjs-$version-macosx-static-symbols" +else + symbols="phantomjs-$version-linux-$(uname -m)-dynamic-symbols" +fi + +cp -r symbols/ $symbols + # The minidump_stackwalk program is architecture-specific, so copy the # binary for later use. This means that e.g. a developer on x86_64 can # analyse a crash dump produced by a i686 user. # # We don't yet have a process for building minidump_stackwalk on OS X if [[ $OSTYPE != darwin* ]]; then - cp src/breakpad/src/processor/minidump_stackwalk symbols/ + cp src/breakpad/src/processor/minidump_stackwalk $symbols read -r -d '' README < symbols/README + echo "$README" > $symbols/README fi -tar -cjf $(ls deploy/*.bz2 | sed 's/\.tar\.bz2/-symbols.tar.bz2/') symbols/ +tar -cjf deploy/$symbols.tar.bz2 $symbols +rm -r $symbols echo "PhantomJS built and packaged:" echo From d3e4c14b6d4e1a0af0ac2b8e7da0a1b383023933 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 29 Jun 2012 14:54:39 +0100 Subject: [PATCH 4/4] Use zip for the OS X package Requested by @ariya, who was concerned that .tar.bz2 might be confusing to OS X users who are not well-versed in UNIX. --- deploy/package.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/deploy/package.sh b/deploy/package.sh index bd1b5d3c..7d7b498a 100755 --- a/deploy/package.sh +++ b/deploy/package.sh @@ -101,9 +101,11 @@ if [[ $OSTYPE != darwin* ]]; then echo fi -echo -n "creating tarball..." -tar -cjf $dest{.tar.bz2,} +echo -n "creating archive..." +if [[ $OSTYPE != darwin* ]]; then + zip -r $dest.zip $dest +else + tar -cjf $dest{.tar.bz2,} +fi echo "done" echo - -echo "you can now deploy $dest or $dest.tar.bz2"