aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-09-29 17:11:35 -0500
committerGitHub <noreply@github.com>2016-09-29 17:11:35 -0500
commit495fbef1295c13d538fd5a24a61182d4e67b765d (patch)
tree7335c2e01af72f264b450e396796b3b51864c516
parent5996e008a34dd92602acb7bbd3ea41a880053110 (diff)
parent67d26b36a1fb97441ee2d0013f9501d8bd081663 (diff)
downloadservo-495fbef1295c13d538fd5a24a61182d4e67b765d.tar.gz
servo-495fbef1295c13d538fd5a24a61182d4e67b765d.zip
Auto merge of #13455 - Wafflespeanut:bindgen, r=emilio
Cleanup the bindgen tools and update their README <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's just a cleanup <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @emilio <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13455) <!-- Reviewable:end -->
-rw-r--r--components/style/binding_tools/README.md24
-rwxr-xr-xcomponents/style/binding_tools/regen.sh8
-rwxr-xr-xcomponents/style/binding_tools/setup_bindgen.sh17
3 files changed, 15 insertions, 34 deletions
diff --git a/components/style/binding_tools/README.md b/components/style/binding_tools/README.md
index dbd9ae4526d..5b23c7a57bb 100644
--- a/components/style/binding_tools/README.md
+++ b/components/style/binding_tools/README.md
@@ -1,26 +1,12 @@
-# GeckoLib tools
+# 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.
+This directory contains simple tools for generating the Rust bindings for [stylo](https://public.etherpad-mozilla.org/p/stylo).
## `setup_bindgen.sh`
-This uses downloads a custom version of bindgen, up to date to generate the
-bindings, and uses the required `llvm38` to build it.
-
-It will also rebuild it if it's already downloaded.
+This clones Servo's version of bindgen, and uses `llvm-3.8` library to build it. It will then be used to generate the Rust bindings.
-## `regen_bindings.sh`
+## `regen.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. Current bindings are
-actually in `ports/geckolib/structs.rs`.
+build. The generated bindings live in `components/style/gecko_bindings/bindings.rs`. For structs, the bindings are in `components/style/gecko_bindings/structs_*`
diff --git a/components/style/binding_tools/regen.sh b/components/style/binding_tools/regen.sh
index fc2ed08a833..d08e17116b0 100755
--- a/components/style/binding_tools/regen.sh
+++ b/components/style/binding_tools/regen.sh
@@ -8,13 +8,15 @@ set -o errexit
set -o nounset
set -o pipefail
+TOOLS_DIR="$(dirname ${0})"
+
if [[ ${#} -eq 0 ]]; then
echo "Usage: ${0} /path/to/gecko/objdir [other-regen.py-flags]"
exit 1
fi
# Check for rust-bindgen
-if [[ ! -d rust-bindgen ]]; then
+if [[ ! -d "${TOOLS_DIR}/rust-bindgen" ]]; then
echo "rust-bindgen not found. Run setup_bindgen.sh first."
exit 1
fi
@@ -22,7 +24,7 @@ fi
# Check for /usr/include
if [[ ! -d /usr/include ]]; then
echo "/usr/include doesn't exist." \
- "Mac users may need to run xcode-select --install."
+ "Mac users may need to run 'xcode-select --install.'"
exit 1
fi
@@ -32,4 +34,4 @@ else
LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
-./regen.py --target all "${@}"
+"./${TOOLS_DIR}/regen.py" --target all "${@}"
diff --git a/components/style/binding_tools/setup_bindgen.sh b/components/style/binding_tools/setup_bindgen.sh
index 4d1b67e3f43..cb0c5f175db 100755
--- a/components/style/binding_tools/setup_bindgen.sh
+++ b/components/style/binding_tools/setup_bindgen.sh
@@ -18,28 +18,21 @@ else
export LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
-# Make sure we have llvm38.
+# Make sure we have llvm-3.8.
if [[ ! -x "$(command -v clang-3.8)" ]]; then
- echo "llmv38 must be installed." \
- "Mac users should |brew install llvm38|, Linux varies by distro."
- exit 1
+ echo "llvm-3.8 is required." \
+ "Mac users should |brew install llvm38|," \
+ "Linux users can find it in clang-3.8."
+ exit 1
fi
export LD_LIBRARY_PATH="${LIBCLANG_PATH}"
export DYLD_LIBRARY_PATH="${LIBCLANG_PATH}"
-# Check for multirust
-if [[ ! -x "$(command -v multirust)" ]]; then
- echo "multirust must be installed."
- exit 1
-fi
-
# Don't try to clone twice.
if [[ ! -d rust-bindgen ]]; then
git clone https://github.com/servo/rust-bindgen.git
fi
cd rust-bindgen
-
-multirust override nightly
cargo build --features llvm_stable