summary refs log tree commit diff
path: root/pkgs/games/anki/patches/0002-Allow-setting-YARN_BINARY-for-the-build-system.patch
blob: 1dbba76ae081a03907e2fe88d785b2778b1f538d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 16af7d4cabcf10797bd110c905a9d7694bde0fb4 Mon Sep 17 00:00:00 2001
From: Euan Kemp <euank@euank.com>
Date: Fri, 17 Mar 2023 23:07:05 +0900
Subject: [PATCH 2/2] Allow setting YARN_BINARY for the build system

---
 build/ninja_gen/src/node.rs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/build/ninja_gen/src/node.rs b/build/ninja_gen/src/node.rs
index d08c7011e..c1e2ce1b3 100644
--- a/build/ninja_gen/src/node.rs
+++ b/build/ninja_gen/src/node.rs
@@ -129,7 +129,18 @@ pub fn setup_node(
     let node_binary = build.expand_inputs(node_binary);
     build.variable("node_binary", &node_binary[0]);
 
-    build.add("yarn", YarnSetup {})?;
+    match std::env::var("YARN_BINARY") {
+        Ok(path) => {
+            assert!(
+                Utf8Path::new(&path).is_absolute(),
+                "YARN_BINARY must be absolute"
+            );
+            build.add_resolved_files_to_group("yarn:bin", &vec![path]);
+        },
+        Err(_) => {
+            build.add("yarn", YarnSetup {})?;
+        },
+    };
 
     for binary in binary_exports {
         data_exports.insert(
-- 
2.39.2