b/t/toolchain-bundle: patch bison to use env for path resolving
Change-Id: I266b30d442aa62f32ffbb6ccbe869012a91bcf0a
Reviewed-on: https://review.monogon.dev/c/monogon/+/4420
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index d868e74..eab83d7 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -10,6 +10,7 @@
bazel-unwrapped = import ./pkgs/bazel { pkgs = super; };
perl = import ./pkgs/perl { pkgs = super; };
python3Minimal = import ./pkgs/python3 { pkgs = super; };
+ bison = import ./pkgs/bison { pkgs = super; };
})
(self: super: {
vde2 = super.vde2.overrideAttrs (oldAttrs: {
diff --git a/third_party/nix/pkgs/bison/BUILD.bazel b/third_party/nix/pkgs/bison/BUILD.bazel
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/nix/pkgs/bison/BUILD.bazel
diff --git a/third_party/nix/pkgs/bison/default.nix b/third_party/nix/pkgs/bison/default.nix
new file mode 100644
index 0000000..8b2245e
--- /dev/null
+++ b/third_party/nix/pkgs/bison/default.nix
@@ -0,0 +1,10 @@
+{ pkgs }: with pkgs;
+if (!stdenv.hostPlatform.isStatic) then bison else
+bison.overrideAttrs (old: {
+ # Check overrided file for more informations
+ postPatch = ''
+ cp ${./yacc.in} src/yacc.in
+ '';
+
+ env.BISON = "${builtins.placeholder "out"}/bin/bison";
+})
diff --git a/third_party/nix/pkgs/bison/yacc.in b/third_party/nix/pkgs/bison/yacc.in
new file mode 100644
index 0000000..b6ff366
--- /dev/null
+++ b/third_party/nix/pkgs/bison/yacc.in
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# The exec-prefix is used by YACC to find Bison at runtime.
+# Since we don't exactly know that, we have to depend on an
+# environment variable we set in Bazel.
+exec "$BISON" -y "$@"
\ No newline at end of file