blob: 754c82472b7247f1d204d338aa5fb616801e4c34 [file] [log] [blame]
# Copyright 2016 The Fuchsia Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
source $(dirname $BASH_SOURCE)/common.sh
run_after_building=false
debug_options=""
clean_manifest=false
while getopts ":hcurdm" arg; do
case $arg in
c) # Do a clean build
clean_build=true
;;
m) # Rebuild the manifest file
clean_manifest=true
;;
r) # Run after building
run_after_building=true
;;
d) # Run in the debugger
debug_options="-- -s -S"
;;
h | *) # Display help.
usage
exit 0
;;
esac
done
declare -x PKG_CONFIG_PATH=$FUCHSIA_CROSS_ROOT/lib/pkgconfig
WEBKIT_DEBUG_BUILD=$WEBKIT_ROOT/WebKitBuild/Debug
JSC=$WEBKIT_DEBUG_BUILD/bin/jsc
JSC_STRIPPED=$WEBKIT_DEBUG_BUILD/bin/jsc_stripped
JSCFS=$WEBKIT_DEBUG_BUILD/extrajsc.bootfs
cd $WEBKIT_ROOT
maybe_clean_webkit
$WEBKIT_ROOT/Tools/Scripts/build-jsc --debug --fuchsia --cli --cmakeargs="-DENABLE_STATIC_JSC=ON -DICU_FIND_QUIETLY=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_TOOLCHAIN_FILE=$script_dir/FuchsiaClangToolchain.txt"
MANIFEST_FILE=$WEBKIT_DEBUG_BUILD/jsc_manifest.txt
if [ $clean_manifest == true ] ; then
rm $MANIFEST_FILE
fi
if [ ! -f $MANIFEST_FILE ]; then
echo bin/jsc=$WEBKIT_DEBUG_BUILD/bin/jsc_stripped > $MANIFEST_FILE
echo lib/libc++abi.so.1=$FUCHSIA_SYSROOT/lib/libc++abi.so.1 >> $MANIFEST_FILE
echo lib/libc++.so.2=$FUCHSIA_SYSROOT/lib/libc++.so.2 >> $MANIFEST_FILE
echo lib/libunwind.so.1=$FUCHSIA_SYSROOT/lib/libunwind.so.1 >> $MANIFEST_FILE
fi
$ZIRCON_TOOLCHAINS/x86_64-elf-5.3.0-Darwin-x86_64/bin/x86_64-elf-strip $JSC -o $JSC_STRIPPED
$ZIRCON_ROOT/build-x86/tools/mkbootfs -o $JSCFS $MANIFEST_FILE
if [ $run_after_building == true ] ; then
$ZIRCON_ROOT/scripts/run-zircon-x86-64 -x $JSCFS -m 4096 $debug_options
fi