Skip to content

Commit 716f91a

Browse files
committed
[LW-9860] Don’t rely on uname (for cross-builds)
1 parent 8f08423 commit 716f91a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

nix/internal/any-darwin.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ in rec {
8181
patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs
8282
8383
# This is building against Node.js, not Electron, but it still will fail, unless:
84-
ourArch="$(uname -m)"
84+
ourArch="${__head (__split "-" targetSystem)}"
8585
for f in \
8686
node_modules/usb/binding.gyp \
8787
node_modules/usb/libusb.gypi \

scripts/rebuild-native-modules.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ nix run -L .#internal."${system:-x86_64-darwin}".common.patchElectronRebuild
2020
# XXX: Electron 24.2 requires c++17, not 14 (or old 1y):
2121
sed -r 's,std=c\+\+(14|1y),std=c++17,g' -i node_modules/usb/binding.gyp
2222

23-
if [ "$(uname)" == "Darwin" ] ; then
24-
ourArch="$(uname -m)"
23+
24+
if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "darwin" ] ; then
25+
ourArch="$(cut -d- -f1 <<<"${system:-x86_64-darwin}")"
2526
for f in \
2627
node_modules/usb/binding.gyp \
2728
node_modules/usb/libusb.gypi \
@@ -37,7 +38,7 @@ electron-rebuild --force
3738

3839
electron-rebuild -w usb-detection --force -s # <https://github.com/MadLittleMods/node-usb-detection#install-for-electron>
3940

40-
if [ "$(uname)" == "Linux" ] ; then
41+
if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "linux" ] ; then
4142
# We ship debug version because the release one has issues with Ledger Nano S
4243
electron-rebuild -w usb --force -s --debug
4344
fi
@@ -76,6 +77,6 @@ tryLink "usb-detection" "detection.node"
7677
tryLink "utf-8-validate" "validation.node"
7778
tryLink "node-hid" "HID.node"
7879

79-
if [ "$(uname)" == "Linux" ] ; then
80+
if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "linux" ] ; then
8081
tryLink "node-hid" "HID_hidraw.node"
8182
fi

0 commit comments

Comments
 (0)