Skip to content

Commit 095d0c3

Browse files
committed
[DDW-1083] Remove redundant native modules on Windows
1 parent c363044 commit 095d0c3

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

nix/x86_64-windows.nix

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ in rec {
1919

2020
inherit newCommon oldCode;
2121

22-
package = unsignedInstaller; # FIXME: this is wrong
22+
package = daedalusJs; # FIXME: this is wrong
2323

2424
unsignedInstaller = unsigned-windows-installer;
2525

@@ -105,17 +105,23 @@ in rec {
105105
mkdir -pv $out/resources/app/node_modules
106106
cp -r node_modules/{\@babel,\@protobufjs,regenerator-runtime,node-fetch,\@trezor,parse-uri,randombytes,safe-buffer,bip66,pushdata-bitcoin,bitcoin-ops,typeforce,varuint-bitcoin,create-hash,blake2b,blakejs,nanoassert,blake2b-wasm,bs58check,bs58,base-x,create-hmac,wif,ms,semver-compare,long,define-properties,object-keys,has,function-bind,es-abstract,has-symbols,json-stable-stringify,cashaddrjs,big-integer,inherits,bchaddrjs,cross-fetch,js-chain-libs-node,bignumber.js,call-bind,get-intrinsic,base64-js,ieee754,util-deprecate,bech32,blake-hash,tiny-secp256k1,bn.js,elliptic,minimalistic-assert,minimalistic-crypto-utils,brorand,hash.js,hmac-drbg,int64-buffer,object.values,bytebuffer,protobufjs,usb-detection,babel-runtime,bindings,brotli,clone,deep-equal,dfa,eventemitter2,file-uri-to-path,fontkit,functions-have-names,has-property-descriptors,has-tostringtag,is-arguments,is-date-object,is-regex,linebreak,node-hid,object-is,pdfkit,png-js,regexp.prototype.flags,restructure,tiny-inflate,unicode-properties,unicode-trie,socks,socks-proxy-agent,ip,smart-buffer,ripple-lib,lodash,jsonschema,ripple-address-codec,ripple-keypairs,ripple-lib-transactionparser,ripple-binary-codec,buffer,decimal.js,debug,agent-base,tslib} $out/resources/app/node_modules
107107
108-
cd $out/resources/app/
109-
unzip ${./windows-usb-libs.zip}
110-
111-
# Investigate why this is needed:
112108
chmod -R +w $out
113-
mkdir -p $out/resources/app/node_modules/usb-detection/build
114-
cp $out/resources/app/build/Debug/detection.node $out/resources/app/node_modules/usb-detection/build
115-
mkdir -p $out/resources/app/node_modules/node-hid/build
116-
cp $out/resources/app/build/Debug/HID.node $out/resources/app/node_modules/node-hid/build
117-
mkdir -p $out/resources/app/node_modules/usb/build
118-
cp $out/resources/app/build/Debug/usb_bindings.node $out/resources/app/node_modules/usb/build
109+
110+
# XXX: remove redundant native modules, and point bindings.js to C:/Program\ Files/Daedalus/*.node instead:
111+
echo 'Deleting all redundant ‘*.node’ files under to-be-distributed ‘node_modules/’:'
112+
(
113+
cd $out/
114+
find resources/ -name '*.node' -exec rm -vf '{}' ';'
115+
find resources/app/node_modules -type f '(' -name '*.o' -o -name '*.o.d' -o -name '*.target.mk' -o -name '*.Makefile' -o -name 'Makefile' -o -name 'config.gypi' ')' -exec rm -vf '{}' ';'
116+
sed -r 's#try: \[#\0 [process.env.DAEDALUS_INSTALL_DIRECTORY, "bindings"],#' -i resources/app/node_modules/bindings/bindings.js
117+
)
118+
119+
# TODO: build the distributed ones from source:
120+
(
121+
cd $(mktemp -d)
122+
unzip ${./windows-usb-libs.zip}
123+
mv build/Debug/*.node $out/
124+
)
119125
'';
120126
dontFixup = true; # TODO: just to shave some seconds, turn back on after everything works
121127
};

0 commit comments

Comments
 (0)