Skip to content

Commit 8328898

Browse files
committed
[DDW-596] Try to fix the Linux build
1 parent c65462d commit 8328898

File tree

6 files changed

+115
-37
lines changed

6 files changed

+115
-37
lines changed

.buildkite/pipeline.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
env:
22
ARTIFACT_BUCKET: s3://ci-output-sink
33
steps:
4-
- label: 'daedalus-x86_64-darwin'
5-
command: 'scripts/build-installer-unix.sh --build-id $BUILDKITE_BUILD_NUMBER'
6-
env:
7-
NIX_SSL_CERT_FILE: /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
8-
agents:
9-
queue: daedalus
10-
system: x86_64-darwin
4+
# - label: 'daedalus-x86_64-darwin'
5+
# command: 'scripts/build-installer-unix.sh --build-id $BUILDKITE_BUILD_NUMBER'
6+
# env:
7+
# NIX_SSL_CERT_FILE: /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
8+
# agents:
9+
# queue: daedalus
10+
# system: x86_64-darwin
1111
- label: 'daedalus-x86_64-linux-nix'
1212
command: 'scripts/build-installer-nix.sh $BUILDKITE_BUILD_NUMBER'
1313
agents:
1414
system: x86_64-linux
15-
- label: 'daedalus-x86_64-windows-nix'
16-
command: 'scripts/build-cross-windows.sh $BUILDKITE_BUILD_NUMBER'
17-
agents:
18-
system: x86_64-linux
15+
# - label: 'daedalus-x86_64-windows-nix'
16+
# command: 'scripts/build-cross-windows.sh $BUILDKITE_BUILD_NUMBER'
17+
# agents:
18+
# system: x86_64-linux
1919

2020
# TODO: Re-enable once script is fixed
2121
# - label: 'release.nix'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ build/Release
3131
# Dependency directory
3232
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
3333
node_modules
34+
/node_modules.*
3435

3536
# OSX
3637
.DS_Store

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@
302302
},
303303
"resolutions": {
304304
"@types/react": "16.9.56",
305-
"**/**/minimatch": "3.0.4",
306305
"**/**/handlebars": "4.7.7",
307306
"**/**/elliptic": "6.5.4",
308307
"**/**/bl": "4.1.0",
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# This script *can* help in minimizing runtime dependencies of
5+
# Daedalus… but only the ones which prevent Electron from starting.
6+
#
7+
# That’s a good starting point before we get this automatically from
8+
# webpack – <https://input-output.atlassian.net/browse/DDW-1103>.
9+
#
10+
11+
set -o errexit
12+
set -o pipefail
13+
14+
if [ -z "$IN_NIX_SHELL" ] ; then
15+
echo >&2 'fatal: please, enter nix-shell first'
16+
exit 1
17+
fi
18+
19+
dir=$(git rev-parse --show-toplevel)
20+
srcDir="$dir"/node_modules.pre-minimize-"$(date -Ins)"
21+
dstDir="$dir"/node_modules
22+
23+
yarn build
24+
mv "$dstDir" "$srcDir"
25+
mkdir "$dstDir"
26+
27+
while true ; do
28+
29+
the_log=$(mktemp)
30+
export the_log
31+
32+
bash -c '
33+
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
34+
electron ./ 2>&1 | tee "$the_log"
35+
' &
36+
child_pid=$!
37+
38+
sleep 2
39+
kill TERM $child_pid
40+
41+
module=$(head "$the_log" -n 2 | tail -n 1 | grep -F 'Error: Cannot find module')
42+
rm "$the_log"
43+
44+
if [ -z "$module" ]; then
45+
echo 'done?'
46+
exit 77
47+
else
48+
module=$(echo "$module" | sed -r "s/^.*'(.*)'/\1/")
49+
50+
echo
51+
echo
52+
echo "Missing module is: ‘$module’."
53+
54+
module=$(echo "$module" | cut -d/ -f1)
55+
56+
echo "Press <RET> to copy ‘$srcDir/$module’ → ‘$dstDir/’, and continue…"
57+
read -r
58+
59+
cp -r "$srcDir/$module" "$dstDir/"
60+
fi
61+
62+
done

yarn.lock

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,11 @@
29862986
version "1.3.2"
29872987
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a"
29882988

2989-
"@types/minimatch@*", "@types/minimatch@^3.0.3":
2989+
"@types/minimatch@*":
2990+
version "3.0.5"
2991+
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
2992+
2993+
"@types/minimatch@^3.0.3":
29902994
version "3.0.5"
29912995
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
29922996

@@ -11690,9 +11694,27 @@ minimalistic-crypto-utils@^1.0.1:
1169011694
version "1.0.1"
1169111695
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
1169211696

11693-
[email protected], minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.1.2:
11694-
version "3.0.4"
11695-
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
11697+
11698+
version "3.1.2"
11699+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
11700+
dependencies:
11701+
brace-expansion "^1.1.7"
11702+
11703+
minimatch@^3.0.2:
11704+
version "3.1.2"
11705+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
11706+
dependencies:
11707+
brace-expansion "^1.1.7"
11708+
11709+
minimatch@^3.0.4:
11710+
version "3.1.2"
11711+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
11712+
dependencies:
11713+
brace-expansion "^1.1.7"
11714+
11715+
minimatch@^3.1.2:
11716+
version "3.1.2"
11717+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
1169611718
dependencies:
1169711719
brace-expansion "^1.1.7"
1169811720

yarn2nix.nix

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
let
1919
cluster' = launcherConfig.networkName;
2020
yarn2nix = import (fetchzip {
21-
url = "https://github.com/moretea/yarn2nix/archive/v1.0.0.tar.gz";
22-
sha256 = "02bzr9j83i1064r1r34cn74z7ccb84qb5iaivwdplaykyyydl1k8";
21+
# v1.0.0 with a PR to handle duplicate file names between @types/* and original/* – <https://github.com/nix-community/yarn2nix/pull/75>
22+
# TODO: use the version from recent Nixpkgs
23+
url = "https://github.com/nix-community/yarn2nix/archive/276994748d556e0812bb1bc5f92ac095b5da71d2.tar.gz";
24+
sha256 = "1fxiq43w8mfs0aiyj4kazwjl6b829a5r0jbx6bcs3kmil9asq3fg";
2325
}) {
2426
inherit pkgs nodejs yarn;
2527
};
@@ -140,38 +142,26 @@ yarn2nix.mkYarnPackage {
140142
#export DEBUG=electron-rebuild
141143
142144
ls -ltrha $NIX_BUILD_TOP/daedalus/node_modules/
143-
function dup() {
144-
cp -vr node_modules/''${1}/ node_modules/''${1}-temp
145-
rm -v node_modules/''${1}
146-
mv -v node_modules/''${1}-temp node_modules/''${1}
147-
chmod -R +w node_modules/''${1}
148-
}
149145
150-
dup keccak
151-
dup node-hid
152-
dup usb
153-
dup @ledgerhq
154-
dup electron-chromedriver
155-
dup blake-hash
156-
dup blake2
157-
dup tiny-secp256k1
158-
dup usb-detection
146+
chmod -R +w node_modules/
159147
160148
# We ship debug version because the release one has issues with ledger nano s
161149
node_modules/.bin/electron-rebuild -w usb --useCache -s --debug
162150
163151
mkdir -p $out/bin $out/share/daedalus
164-
cp -R dist/* $out/share/daedalus
152+
cp -R deps/daedalus/dist/* $out/share/daedalus
165153
cp ${newPackagePath} $out/share/daedalus/package.json
166154
pushd $out/share/daedalus
167155
${nukeAllRefs}
168156
popd
169157
mkdir -p $out/share/fonts
170158
ln -sv $out/share/daedalus/renderer/assets $out/share/fonts/daedalus
171159
mkdir -pv $out/share/daedalus/node_modules
172-
cp -rv $node_modules/{\@babel,\@protobufjs,regenerator-runtime,node-fetch,\@trezor,runtypes,parse-uri,randombytes,safe-buffer,bip66,pushdata-bitcoin,bitcoin-ops,typeforce,varuint-bitcoin,create-hash,blake2b,nanoassert,blake2b-wasm,bs58check,bs58,base-x,create-hmac,wif,ms,keccak,semver-compare,long,define-properties,object-keys,has,function-bind,es-abstract,has-symbols,json-stable-stringify,tiny-worker,cashaddrjs,big-integer,inherits,bchaddrjs,cross-fetch,trezor-connect,js-chain-libs-node,bignumber.js,call-bind,get-intrinsic,base64-js,ieee754,cbor-web,util-deprecate,bech32,blake-hash,blake2,tiny-secp256k1,bn.js,elliptic,minimalistic-assert,minimalistic-crypto-utils,brorand,hash.js,hmac-drbg,int64-buffer,object.values,bytebuffer,protobufjs,usb-detection} $out/share/daedalus/node_modules/
160+
cp -rv $node_modules/{\@babel,\@protobufjs,regenerator-runtime,node-fetch,\@trezor,runtypes,parse-uri,randombytes,safe-buffer,bip66,pushdata-bitcoin,bitcoin-ops,typeforce,varuint-bitcoin,create-hash,blake2b,nanoassert,blake2b-wasm,bs58check,bs58,base-x,create-hmac,wif,ms,keccak,semver-compare,long,define-properties,object-keys,has,function-bind,es-abstract,has-symbols,json-stable-stringify,tiny-worker,cashaddrjs,big-integer,inherits,bchaddrjs,cross-fetch,trezor-connect,js-chain-libs-node,bignumber.js,call-bind,get-intrinsic,base64-js,ieee754,cbor-web,util-deprecate,bech32,blake-hash,blake2,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,buffer,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} $out/share/daedalus/node_modules/
173161
find $out $NIX_BUILD_TOP -name '*.node'
174162
163+
chmod -R +w $out
164+
175165
mkdir -pv $out/share/daedalus/build
176166
cp node_modules/usb/build/Debug/usb_bindings.node $out/share/daedalus/build/usb_bindings.node
177167
cp node_modules/node-hid/build/Debug/HID_hidraw.node $out/share/daedalus/build/HID_hidraw.node
@@ -181,12 +171,16 @@ yarn2nix.mkYarnPackage {
181171
done
182172
183173
node_modules/.bin/electron-rebuild -w usb-detection --useCache -s
184-
cp node_modules/usb-detection/build/Release/detection.node $out/share/daedalus/build/detection.node
185-
for file in $out/share/daedalus/build/detection.node; do
174+
mkdir -p $out/share/daedalus/node_modules/usb-detection/build/
175+
cp node_modules/usb-detection/build/Release/detection.node $out/share/daedalus/node_modules/usb-detection/build/detection.node
176+
for file in $out/share/daedalus/node_modules/usb-detection/build/detection.node; do
186177
$STRIP $file
187178
patchelf --shrink-rpath $file
188179
done
189180
'';
181+
distPhase = ''
182+
# unused
183+
'';
190184
#allowedReferences = [ "out" ];
191185
#allowedRequisites = [
192186
# systemd.lib

0 commit comments

Comments
 (0)