Skip to content

Commit

Permalink
[LW-9860] Don’t rely on uname (for cross-builds)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrus committed Feb 28, 2024
1 parent 8f08423 commit d817efd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nix/internal/any-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ in rec {
patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs
# This is building against Node.js, not Electron, but it still will fail, unless:
ourArch="$(uname -m)"
ourArch="${__replaceStrings ["aarch64"] ["arm64"] (__head (__split "-" targetSystem))}"
for f in \
node_modules/usb/binding.gyp \
node_modules/usb/libusb.gypi \
Expand Down
9 changes: 5 additions & 4 deletions scripts/rebuild-native-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ nix run -L .#internal."${system:-x86_64-darwin}".common.patchElectronRebuild
# XXX: Electron 24.2 requires c++17, not 14 (or old 1y):
sed -r 's,std=c\+\+(14|1y),std=c++17,g' -i node_modules/usb/binding.gyp

if [ "$(uname)" == "Darwin" ] ; then
ourArch="$(uname -m)"

if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "darwin" ] ; then
ourArch="$(cut -d- -f1 <<<"${system:-x86_64-darwin}" | sed -r 's/aarch64/arm64/')"
for f in \
node_modules/usb/binding.gyp \
node_modules/usb/libusb.gypi \
Expand All @@ -37,7 +38,7 @@ electron-rebuild --force

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

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

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

0 comments on commit d817efd

Please sign in to comment.