mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
geckolib: Add basic documentation, be consistent and safe with quotes
This commit is contained in:
parent
38b30c6490
commit
a6ffabb2ad
6 changed files with 80 additions and 29 deletions
2
ports/geckolib/tools/.gitignore
vendored
Normal file
2
ports/geckolib/tools/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
llvm/
|
||||
rust-bindgen/
|
30
ports/geckolib/tools/README.md
Normal file
30
ports/geckolib/tools/README.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
# GeckoLib tools
|
||||
|
||||
This directory contains mostly simple tools for working with
|
||||
[stylo](https://public.etherpad-mozilla.org/p/stylo).
|
||||
|
||||
Some scripts require [multirust](https://github.com/brson/multirust) in order to
|
||||
work.
|
||||
|
||||
You can see a description of them below.
|
||||
|
||||
## `build_custom_clang.sh`
|
||||
|
||||
Download a patched LLVM which is needed to use bindgen properly with C++.
|
||||
|
||||
## `setup_bindgen.sh`
|
||||
|
||||
This uses downloads a custom version of bindgen, up to date to generate the
|
||||
bindings, and uses the custom `clang` to build it.
|
||||
|
||||
It will also rebuild it if it's already downloaded.
|
||||
|
||||
## `regen_bindings.sh`
|
||||
|
||||
This will regenerate the bindings for the `ServoBindings.h` file in your gecko
|
||||
build (which are in `ports/geckolib/bindings.rs`).
|
||||
|
||||
## `regen_style_structs.sh`
|
||||
|
||||
This will generate the bindings for Gecko's style structs. These bindings are a
|
||||
work in progress, and are not in master yet.
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run in the tools directory.
|
||||
cd `dirname $0`
|
||||
cd "$(dirname $0)"
|
||||
|
||||
# Don't run twice.
|
||||
if [ -d llvm ]; then
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run in the tools directory.
|
||||
cd `dirname $0`
|
||||
cd "$(dirname $0)"
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 /path/to/objdir/"
|
||||
echo "Usage: $0 /path/to/gecko/objdir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -15,13 +15,13 @@ if [ ! -d rust-bindgen ]; then
|
|||
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 LD_LIBRARY_PATH=`pwd`/llvm/build/Release+Asserts/lib
|
||||
export DIST_INCLUDE=$1/dist/include
|
||||
export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export DYLD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export LD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export DIST_INCLUDE="$1/dist/include"
|
||||
|
||||
# Check for the include directory.
|
||||
if [ ! -d $DIST_INCLUDE ]; then
|
||||
if [ ! -d "$DIST_INCLUDE" ]; then
|
||||
echo "$DIST_INCLUDE: directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -31,4 +31,8 @@ fi
|
|||
# library in DYLD_LIBRARY_PATH.
|
||||
#
|
||||
# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb --
|
||||
./rust-bindgen/target/debug/bindgen -x c++ -std=gnu++0x -I$DIST_INCLUDE -o ../bindings.rs $DIST_INCLUDE/mozilla/ServoBindings.h
|
||||
./rust-bindgen/target/debug/bindgen \
|
||||
-x c++ -std=gnu++0x \
|
||||
"-I$DIST_INCLUDE" \
|
||||
-o ../bindings.rs \
|
||||
"$DIST_INCLUDE/mozilla/ServoBindings.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
cd `dirname $0`
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 /path/to/objdir/"
|
||||
echo "Usage: $0 /path/to/gecko/objdir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -16,11 +16,10 @@ fi
|
|||
|
||||
# Need to find a way to avoid hardcoding these
|
||||
export RUST_BACKTRACE=1
|
||||
export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib
|
||||
export DYLD_LIBRARY_PATH=`pwd`/llvm/build/Release+Asserts/lib
|
||||
export LD_LIBRARY_PATH=`pwd`/llvm/build/Release+Asserts/lib
|
||||
export DIST_INCLUDE=$1/dist/include
|
||||
CLANG_SEARCH_DIRS=$(clang++ -print-search-dirs | grep 'libraries: ' | cut -d = -f 2)
|
||||
export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export DYLD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export LD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export DIST_INCLUDE="$1/dist/include"
|
||||
CLANG_SEARCH_DIRS=$(clang++ -E -x c++ - -v < /dev/null 2>&1 | awk '{ \
|
||||
if ($0 == "#include <...> search starts here:") \
|
||||
in_headers = 1; \
|
||||
|
@ -33,17 +32,31 @@ CLANG_SEARCH_DIRS=$(clang++ -E -x c++ - -v < /dev/null 2>&1 | awk '{ \
|
|||
}' | sed -e s/:$//g)
|
||||
|
||||
# Check for the include directory.
|
||||
if [ ! -d $DIST_INCLUDE ]; then
|
||||
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.
|
||||
PLATFORM_DEPENDENT_DEFINES="";
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
PLATFORM_DEPENDENT_DEFINES+="-DOS_LINUX";
|
||||
else
|
||||
PLATFORM_DEPENDENT_DEFINES+="-DOS_MACOSX";
|
||||
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 \
|
||||
./rust-bindgen/target/debug/bindgen \
|
||||
-x c++ -std=gnu++0x \
|
||||
-ignore-functions -allow-unknown-types \
|
||||
$CLANG_SEARCH_DIRS \
|
||||
-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
|
||||
"-I$DIST_INCLUDE" "-I$DIST_INCLUDE/nspr" \
|
||||
$PLATFORM_DEPENDENT_DEFINES \
|
||||
-DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 \
|
||||
-DMOZILLA_INTERNAL_API -DIMPL_LIBXUL \
|
||||
-include "$1/mozilla-config.h" \
|
||||
-o ../gecko_style_structs.rs \
|
||||
"$DIST_INCLUDE/nsStyleStruct.h"
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run in the tools directory.
|
||||
cd `dirname $0`
|
||||
cd "$(dirname $0)"
|
||||
|
||||
# Setup and build bindgen.
|
||||
export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
|
||||
|
||||
# Make sure we have a custom clang set up.
|
||||
if [ ! -d llvm ]; then
|
||||
if [ ! -d "$LIBCLANG_PATH" ]; then
|
||||
echo "Custom LLVM/Clang not found. Run build_custom_clang.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for multirust
|
||||
if [ ! -x "$(command -v multirust)" ]; then
|
||||
echo 'multirust must be installed.'
|
||||
echo "multirust must be installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup and build bindgen.
|
||||
export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib
|
||||
# Don't run twice.
|
||||
# Don't try to clone twice.
|
||||
if [ ! -d rust-bindgen ]; then
|
||||
git clone https://github.com/bholley/rust-bindgen.git
|
||||
cd rust-bindgen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue