From f3c858c15145f28bdb3de0224ab924a21144524e Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jeremy@system76.com>
Date: Sun, 20 Jan 2019 20:17:04 -0700
Subject: [PATCH] Build includes in parallel

---
 include.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/include.sh b/include.sh
index d596769e..16d265a2 100755
--- a/include.sh
+++ b/include.sh
@@ -1,10 +1,13 @@
 #!/usr/bin/env bash
 
-set -ex
+set -e
 
 include="$(realpath "$1")"
-cbindgen="$(realpath cbindgen)"
 
+cargo build --release --manifest-path cbindgen/Cargo.toml
+cbindgen="$(realpath target/release/cbindgen)"
+
+jobs=()
 for config in src/header/*/cbindgen.toml
 do
     dir="$(dirname "$config")"
@@ -13,8 +16,13 @@ do
     then
         header="$include/${name/_//}.h"
         pushd "$dir"
-        cargo run --release --manifest-path "$cbindgen/Cargo.toml" -- \
-            -c cbindgen.toml -o "$header" mod.rs
+        "$cbindgen" -c cbindgen.toml -o "$header" mod.rs &
+        jobs+=($!)
         popd
     fi
 done
+
+for job in "${jobs[@]}"
+do
+    wait "$job"
+done
-- 
GitLab