diff --git a/ports/geckolib/tools/build_custom_clang.sh b/ports/geckolib/tools/build_custom_clang.sh new file mode 100755 index 00000000000..40b3c86f5aa --- /dev/null +++ b/ports/geckolib/tools/build_custom_clang.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Run in the tools directory. +cd `dirname $0` + +# Don't run twice. +if [ -d llvm ]; then + echo "llvm directory already exists." + exit 1 +fi + +# Download and build a custom llvm +git clone https://github.com/llvm-mirror/llvm +cd llvm +git checkout release_37 +cd tools +git clone https://github.com/llvm-mirror/clang +cd clang +git remote add mwu https://github.com/michaelwu/clang +git fetch mwu +git checkout release_37_smhacks +cd ../.. # llvm root dir +mkdir build +cd build +../configure --enable-optimized +make diff --git a/ports/geckolib/tools/regen_bindings.sh b/ports/geckolib/tools/regen_bindings.sh new file mode 100755 index 00000000000..4795910c70d --- /dev/null +++ b/ports/geckolib/tools/regen_bindings.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Run in the tools directory. +cd `dirname $0` + +if [ $# -ne 1 ]; then + echo "Usage: $0 /path/to/objdir/" + exit 1 +fi + +# Check for rust-bindgen +if [ ! -d rust-bindgen ]; then + echo "rust-bindgen not found. Run setup_bindgen.sh first." + exit 1 +fi + +export RUST_BACKTRACE=1 +export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib +export DYLD_LIBRARY_PATH=`pwd`/llvm/build/Release+Asserts/lib +export DIST_INCLUDE=$1/dist/include + +# Check for the include directory. +if [ ! -d $DIST_INCLUDE ]; then + echo "$DIST_INCLUDE: directory not found" + exit 1 +fi + +# Uncomment the following line to run rust-bindgen in a debugger on mac. +# The absolute path is required to allow launching lldb with an untrusted +# library in DYLD_LIBRARY_PATH. +# +# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -- +./rust-bindgen/target/debug/bindgen -I$DIST_INCLUDE -o ../bindings.rs $DIST_INCLUDE/mozilla/ServoBindings.h diff --git a/ports/geckolib/tools/regen_style_structs.sh b/ports/geckolib/tools/regen_style_structs.sh new file mode 100755 index 00000000000..b8d84651ebb --- /dev/null +++ b/ports/geckolib/tools/regen_style_structs.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Run in the tools directory. +cd `dirname $0` + +if [ $# -ne 1 ]; then + echo "Usage: $0 /path/to/objdir/" + exit 1 +fi + +# Check for rust-bindgen +if [ ! -d rust-bindgen ]; then + echo "rust-bindgen not found. Run setup_bindgen.sh first." + exit 1 +fi + +# Need to find a way to avoid hardcoding these +STD_LIB_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include +STDXX_LIB_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 +if [ ! -d $STD_LIB_PATH ] || [ ! -d $STDXX_LIB_PATH ]; then + echo "Please update the above environmental variables to point to your standard library." + exit 1 +fi + +export RUST_BACKTRACE=1 +export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib +export DYLD_LIBRARY_PATH=`pwd`/llvm/build/Release+Asserts/lib +export DIST_INCLUDE=$1/dist/include + +# Check for the include directory. +if [ ! -d $DIST_INCLUDE ]; then + echo "$DIST_INCLUDE: directory not found" + exit 1 +fi + +# Uncomment the following line to run rust-bindgen in a debugger on mac. +# The absolute path is required to allow launching lldb with an untrusted +# library in DYLD_LIBRARY_PATH. +# +# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -- +./rust-bindgen/target/debug/bindgen -x c++ -std=gnu++0x -ignore-functions -allow-unknown-types -isystem $STDXX_LIB_PATH -isystem $STD_LIB_PATH -I$DIST_INCLUDE -I$DIST_INCLUDE/nspr -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 -DOS_MACOSX=1 -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -include $1/mozilla-config.h -o ../gecko_style_structs.rs $DIST_INCLUDE/nsStyleStruct.h diff --git a/ports/geckolib/tools/setup_bindgen.sh b/ports/geckolib/tools/setup_bindgen.sh new file mode 100755 index 00000000000..d1fae60f6ae --- /dev/null +++ b/ports/geckolib/tools/setup_bindgen.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Run in the tools directory. +cd `dirname $0` + +# Make sure we have a custom clang set up. +if [ ! -d llvm ]; then + echo "Custom LLVM/Clang not found. Run build_custom_clang.sh first." + exit 1 +fi + +# Don't run twice. +if [ -d rust-bindgen ]; then + echo "rust-bindgen directory already exists." + exit 1 +fi + +# Check for multirust +if [ ! -x "$(command -v multirust)" ]; then + echo 'multirust must be installed.' + exit 1 +fi + +# Setup and build bindgen. +export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib +git clone https://github.com/bholley/rust-bindgen.git +cd rust-bindgen +git checkout sm-hacks +multirust override nightly +cargo build