-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This redoes all the packaging for their new build-system. It feels a bit fragile, but in practice it works. Basically, we build most of it in nix, write some wrapper scripts to mock out stuff we just did in nix, and then call thier build system to make a wheel
- Loading branch information
Showing
7 changed files
with
339 additions
and
171 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
pkgs/games/anki/0001-Don-t-download-nodejs-if-NODE_BINARY-is-set.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 53740ca75d167fab5c403a462e21ecd717b1dafa Mon Sep 17 00:00:00 2001 | ||
From: Euan Kemp <[email protected]> | ||
Date: Fri, 17 Mar 2023 22:38:04 +0900 | ||
Subject: [PATCH 1/2] Don't download nodejs if NODE_BINARY is set | ||
|
||
Some build environments, such as nixpkgs, restrict network access and | ||
thus would prefer to not download anything at all. Setting PROTOC_BINARY | ||
and friends makes the build system not download stuff, and the same | ||
should be true for nodejs | ||
--- | ||
build/ninja_gen/src/node.rs | 19 +++++++++---------- | ||
1 file changed, 9 insertions(+), 10 deletions(-) | ||
|
||
diff --git a/build/ninja_gen/src/node.rs b/build/ninja_gen/src/node.rs | ||
index df05e149d..d08c7011e 100644 | ||
--- a/build/ninja_gen/src/node.rs | ||
+++ b/build/ninja_gen/src/node.rs | ||
@@ -105,16 +105,6 @@ pub fn setup_node( | ||
binary_exports: &[&'static str], | ||
mut data_exports: HashMap<&str, Vec<Cow<str>>>, | ||
) -> Result<()> { | ||
- download_and_extract( | ||
- build, | ||
- "node", | ||
- archive, | ||
- hashmap! { | ||
- "bin" => vec![if cfg!(windows) { "node.exe" } else { "bin/node" }], | ||
- "npm" => vec![if cfg!(windows) { "npm.cmd " } else { "bin/npm" }] | ||
- }, | ||
- )?; | ||
- | ||
let node_binary = match std::env::var("NODE_BINARY") { | ||
Ok(path) => { | ||
assert!( | ||
@@ -124,6 +114,15 @@ pub fn setup_node( | ||
path.into() | ||
} | ||
Err(_) => { | ||
+ download_and_extract( | ||
+ build, | ||
+ "node", | ||
+ archive, | ||
+ hashmap! { | ||
+ "bin" => vec![if cfg!(windows) { "node.exe" } else { "bin/node" }], | ||
+ "npm" => vec![if cfg!(windows) { "npm.cmd " } else { "bin/npm" }] | ||
+ }, | ||
+ )?; | ||
inputs![":extract:node:bin"] | ||
} | ||
}; | ||
-- | ||
2.39.2 | ||
|
36 changes: 36 additions & 0 deletions
36
pkgs/games/anki/0002-Allow-setting-YARN_BINARY-for-the-build-system.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
From 16af7d4cabcf10797bd110c905a9d7694bde0fb4 Mon Sep 17 00:00:00 2001 | ||
From: Euan Kemp <[email protected]> | ||
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 | ||
|
Oops, something went wrong.