Binding generator tooling.

This should make it a lot easier for people to bootstrap and run the binding generator.
This commit is contained in:
Bobby Holley 2016-01-12 16:00:27 -08:00
parent 4da1171474
commit 23ace489b9
4 changed files with 130 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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