signal-desktop-from-src: simplify build:release step

This commit is contained in:
2024-07-21 10:40:49 +00:00
parent 88df6b30ce
commit c026b8c40d

View File

@@ -270,9 +270,6 @@ buildNpmPackage rec {
export npm_config_arch=${buildNpmArch}
export npm_config_target_arch=${hostNpmArch}
# npm config set electronDist ${electron'}/libexec/electron
# npm config set electronVersion ${electron'.version}
# redo parts of npmConfigHook, but with `npm_config_nodedir` properly set:
# prefetchNpmDeps --map-cache
# prefetchNpmDeps --fixup-lockfile "$PWD/package-lock.json"
@@ -316,21 +313,23 @@ buildNpmPackage rec {
# excerpts from package.json:
# - "build": "run-s --print-label generate build:esbuild:prod build:release"
# - "generate": "npm-run-all build-protobuf build:esbuild sass get-expire-time copy-components"
# - "build-protobuf": "yarn build-module-protobuf"
# - "build-module-protobuf": "pbjs --target static-module --force-long --no-typeurl --no-verify --no-create --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js"
# - "build:esbuild": "node scripts/esbuild.js"
# - "sass": "sass stylesheets/manifest.scss:stylesheets/manifest.css stylesheets/manifest_bridge.scss:stylesheets/manifest_bridge.css"`
# - "get-expire-time": "node ts/scripts/get-expire-time.js"
# - "copy-components": "node ts/scripts/copy.js"
# - "build:esbuild:prod": "node scripts/esbuild.js --prod"
# - "build:release": "cross-env SIGNAL_ENV=production yarn build:electron -- --config.directories.output=release"
# - "build:electron": "electron-builder --config.extraMetadata.environment=$SIGNAL_ENV"
# - "generate": "npm-run-all build-protobuf build:esbuild build:dns-fallback build:icu-types build:compact-locales sass get-expire-time copy-components",
# - "build-protobuf": "npm run build-module-protobuf",
# - "build-module-protobuf": "pbjs --target static-module --force-long --no-typeurl --no-verify --no-create --no-convert --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --no-comments --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js",
# - "build:esbuild": "node scripts/esbuild.js",
# - "build:dns-fallback": "node ts/scripts/generate-dns-fallback.js",
# - "build:icu-types": "node ts/scripts/generate-icu-types.js",
# - "build:compact-locales": "node ts/scripts/generate-compact-locales.js",
# - "sass": "sass stylesheets/manifest.scss:stylesheets/manifest.css stylesheets/manifest_bridge.scss:stylesheets/manifest_bridge.css",
# - "get-expire-time": "node ts/scripts/get-expire-time.js",
# - "copy-components": "node ts/scripts/copy.js",
# - "build:esbuild:prod": "node scripts/esbuild.js --prod",
# - "build:release": "cross-env SIGNAL_ENV=production npm run build:electron -- --config.directories.output=release",
# - "build:electron": "electron-builder --config.extraMetadata.environment=$SIGNAL_ENV",
#
# - "build:dev": "run-s --print-label generate build:esbuild:prod"
#
# i can't call toplevel `yarn build` because it doesn't properly forward the `--offline` flags where they need to go.
# instead i call each step individually.
# i can't call toplevel `build` because some steps fail (e.g. dns-fallback) and can be skipped instead,
# while other steps fail (electron-builder) and need patching, but npm doesn't plumb the necessary flags through.
# so instead i call each step individually.
buildPhase = ''
runHook preBuild
@@ -352,7 +351,7 @@ buildNpmPackage rec {
npm run build:esbuild:prod --offline --frozen-lockfile
cp -r ${electron'}/libexec/electron electron-dist
npm exec electron-builder -- \
npm run build:release -- \
--linux --${hostNpmArch} \
-c.electronDist=electron-dist \
-c.electronVersion=${electron'.version} \
@@ -366,9 +365,9 @@ buildNpmPackage rec {
# directory structure follows the original `signal-desktop` nix package
mkdir -p $out/lib
cp -R dist/linux${crossNpmArchExt}-unpacked $out/lib/Signal
# cp -R dist/linux-unpacked/resources $out/lib/Signal/resources
# cp -R dist/linux-unpacked/locales $out/lib/Signal/locales
cp -R release/linux${crossNpmArchExt}-unpacked $out/lib/Signal
# cp -R release/linux-unpacked/resources $out/lib/Signal/resources
# cp -R release/linux-unpacked/locales $out/lib/Signal/locales
mkdir $out/bin