signal-desktop-from-src: cleanup even more
This commit is contained in:
@@ -83,6 +83,7 @@
|
||||
|
||||
{ lib
|
||||
, alsa-lib
|
||||
, asar
|
||||
, at-spi2-atk
|
||||
, at-spi2-core
|
||||
, atk
|
||||
@@ -109,7 +110,6 @@
|
||||
, nspr
|
||||
, nss
|
||||
, pango
|
||||
, pkgs
|
||||
, python3
|
||||
# , sqlite
|
||||
# , sqlcipher
|
||||
@@ -132,21 +132,6 @@ let
|
||||
url = "https://build-artifacts.signal.org/desktop/sqlcipher-4.5.5-fts5-fix--3.0.7--0.2.1-ef53ea45ed92b928ecfd33c552d8d405263e86e63dec38e1ec63e1b0193b630b.tar.gz";
|
||||
hash = "sha256-71PqRe2SuSjs/TPFUtjUBSY+huY97Djh7GPhsBk7Yws=";
|
||||
};
|
||||
# TODO: possibly i could instead use nodejs-slim (npm-less nodejs)
|
||||
# mkNodeJs = pkgs: pkgs.nodejs_20.overrideAttrs (upstream:
|
||||
# let
|
||||
# # build with the same nodejs upstream expects in package.json (it will error if the version here is incorrect)
|
||||
# version = "20.9.0";
|
||||
# hash = "sha256-oj2WgQq/BFVCazSdR85TEPMwlbe8BXG5zFEPSBw6RRk=";
|
||||
# in {
|
||||
# inherit version;
|
||||
# src = fetchurl {
|
||||
# url = "https://nodejs.org/dist/v${version}/node-v${version}.tar.xz";
|
||||
# inherit hash;
|
||||
# };
|
||||
# }
|
||||
# );
|
||||
mkNodeJs = pkgs: pkgs.nodejs;
|
||||
|
||||
# signal-fts5-extension = callPackage ./fts5-extension { };
|
||||
# bettersqlitePatch = substituteAll {
|
||||
@@ -168,9 +153,6 @@ let
|
||||
hash = "sha256-HHpv+Kv7Y+653CBSpRePfWQmeRzznmdmUaU5AIxLQUw=";
|
||||
};
|
||||
|
||||
nodejs' = mkNodeJs pkgs;
|
||||
buildNodejs = mkNodeJs buildPackages;
|
||||
|
||||
# note that `package.json` locks the electron version, but we seem to not be strictly beholden to that.
|
||||
# prefer to use the same electron version as everywhere else, and a `-bin` version to avoid 4hr rebuilds.
|
||||
# the non-bin varieties *seem* to ship the wrong `electron.headers` property.
|
||||
@@ -199,11 +181,15 @@ buildNpmPackage rec {
|
||||
|
||||
postPatch = ''
|
||||
# unpin nodejs. i should probably *try* to keep these vaguely in sync, but it seems to work decently with these out of sync too (at least, if the major versions match?)
|
||||
sed -i 's/"node": .*/"node": "${nodejs'.version}"/' package.json
|
||||
# don't populate fallback DNS mappings:
|
||||
substituteInPlace package.json --replace-fail \
|
||||
'"build:dns-fallback": "node ts/scripts/generate-dns-fallback.js"' \
|
||||
'"build:dns-fallback": "true"'
|
||||
sed -i 's/"node": .*/"node": "*"/' package.json
|
||||
# don't populate fallback DNS mappings, and don't try to install electron-builder deps during build:
|
||||
substituteInPlace package.json \
|
||||
--replace-fail \
|
||||
'"build:dns-fallback": "node ts/scripts/generate-dns-fallback.js"' \
|
||||
'"build:dns-fallback": "true"' \
|
||||
--replace-fail \
|
||||
'"electron:install-app-deps": "electron-builder install-app-deps"' \
|
||||
'"electron:install-app-deps": "true"'
|
||||
|
||||
# fixes build failure:
|
||||
# > Fusing electron at /build/source/release/linux-unpacked/signal-desktop inspect-arguments=false
|
||||
@@ -216,11 +202,11 @@ buildNpmPackage rec {
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
asar # used during fixup
|
||||
autoPatchelfHook
|
||||
git # to calculate build date
|
||||
gnused
|
||||
makeShellWrapper
|
||||
buildNodejs
|
||||
python3
|
||||
wrapGAppsHook
|
||||
];
|
||||
@@ -239,7 +225,6 @@ buildNpmPackage rec {
|
||||
libwebp
|
||||
libxslt
|
||||
mesa # for libgbm
|
||||
nodejs' # to patch in the runtime
|
||||
nspr
|
||||
nss
|
||||
pango
|
||||
@@ -248,14 +233,20 @@ buildNpmPackage rec {
|
||||
# sqlcipher
|
||||
];
|
||||
|
||||
env.SIGNAL_ENV = "production";
|
||||
strictDeps = true;
|
||||
# disallowedReferences = [ buildPackages.nodejs ]; #< TODO: set when cross compiling
|
||||
|
||||
# env.SIGNAL_ENV = "production";
|
||||
# env.NODE_ENV = "production"; #< XXX setting this causes `node_modules/protobufjs-cli/bin/pbjs` to not be fetched...
|
||||
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
# env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
# env.npm_config_arch = buildNpmArch;
|
||||
# env.npm_config_target_arch = hostNpmArch;
|
||||
|
||||
dontWrapGApps = true;
|
||||
# dontStrip = false;
|
||||
# makeCacheWritable = true;
|
||||
|
||||
npmRebuildFlags = [ "--offline" "--ignore-scripts" ];
|
||||
makeCacheWritable = true;
|
||||
|
||||
# NIX_DEBUG = 6;
|
||||
|
||||
@@ -266,28 +257,23 @@ buildNpmPackage rec {
|
||||
# see: Signal-Desktop/ts/scripts/get-expire-time.ts
|
||||
export SOURCE_DATE_EPOCH=
|
||||
|
||||
# prevent any attempt at downloading nodejs C headers
|
||||
# apparently electron projects aren't "stock" node.
|
||||
# so subprojects which want to use node internals (i.e. call C functions provided by node)
|
||||
# need to build against electron's versions of the node headers, or something.
|
||||
# without patching this, Signal can build, but will fail with `undefined symbol: ...` errors at runtime.
|
||||
# see: <https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules>
|
||||
tar xzf ${electron'.headers}
|
||||
export npm_config_nodedir=$(pwd)/node_headers
|
||||
|
||||
export npm_config_arch=${buildNpmArch}
|
||||
export npm_config_target_arch=${hostNpmArch}
|
||||
|
||||
patchShebangs --build --update node_modules/{bufferutil/node_modules/node-gyp-build/,node-gyp-build,utf-8-validate/node_modules/node-gyp-build}
|
||||
# patchShebangs --build --update node_modules/{bufferutil/node_modules/node-gyp-build/,node-gyp-build,utf-8-validate/node_modules/node-gyp-build}
|
||||
# patch these out to remove a runtime reference back to the build bash
|
||||
# (better, perhaps, would be for these build scripts to not be included in the asar...)
|
||||
sed -i 's:#!.*/bin/bash:#!/bin/sh:g' node_modules/@swc/helpers/scripts/gen.sh
|
||||
sed -i 's:#!.*/bin/bash:#!/bin/sh:g' node_modules/@swc/helpers/scripts/generator.sh
|
||||
substituteInPlace node_modules/dashdash/etc/dashdash.bash_completion.in --replace-fail '#!/bin/bash' '#!/bin/sh'
|
||||
|
||||
set -x
|
||||
|
||||
# provide necessecities which were skipped as part of --ignore-scripts
|
||||
cp ${ringrtcPrebuild} node_modules/@signalapp/ringrtc/scripts/prebuild.tar.gz
|
||||
pushd node_modules/@signalapp/ringrtc/
|
||||
tar -xzf ./scripts/prebuild.tar.gz
|
||||
popd
|
||||
# provide necessities which were skipped as part of --ignore-scripts
|
||||
tar -xzf ${ringrtcPrebuild} --directory node_modules/@signalapp/ringrtc/
|
||||
|
||||
cp ${sqlcipherTarball} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
||||
# pushd node_modules/@signalapp/better-sqlite3
|
||||
@@ -300,10 +286,10 @@ buildNpmPackage rec {
|
||||
# popd
|
||||
|
||||
# run signal's own `postinstall`:
|
||||
# npm run build:acknowledgments
|
||||
# patch-package
|
||||
# npm run electron:install-app-deps
|
||||
npm run postinstall || true
|
||||
# - npm run build:acknowledgments
|
||||
# - npm exec patch-package
|
||||
# - npm run electron:install-app-deps
|
||||
npm run postinstall
|
||||
'';
|
||||
|
||||
# excerpts from package.json:
|
||||
@@ -330,21 +316,12 @@ buildNpmPackage rec {
|
||||
runHook preBuild
|
||||
|
||||
npm run generate
|
||||
# npm run build-protobuf --offline --frozen-lockfile
|
||||
# npm run build:esbuild --offline --frozen-lockfile
|
||||
# # npm run build:dns-fallback --offline --frozen-lockfile # requires network
|
||||
# npm run build:icu-types --offline --frozen-lockfile
|
||||
# npm run build:compact-locales --offline --frozen-lockfile
|
||||
# npm run sass
|
||||
# npm run get-expire-time
|
||||
# npm run copy-components
|
||||
|
||||
npm run build:esbuild:prod --offline --frozen-lockfile
|
||||
|
||||
cp -r ${electron'}/libexec/electron electron-dist
|
||||
npm run build:release -- \
|
||||
--linux --${hostNpmArch} \
|
||||
-c.electronDist=electron-dist \
|
||||
-c.electronDist=${electron'}/libexec/electron \
|
||||
-c.electronVersion=${electron'.version} \
|
||||
--dir
|
||||
|
||||
@@ -367,10 +344,10 @@ buildNpmPackage rec {
|
||||
|
||||
preFixup = ''
|
||||
# fixup the app.asar to use host nodejs
|
||||
${buildPackages.asar}/bin/asar extract $out/lib/Signal/resources/app.asar unpacked
|
||||
asar extract $out/lib/Signal/resources/app.asar unpacked
|
||||
rm $out/lib/Signal/resources/app.asar
|
||||
patchShebangs --host --update unpacked
|
||||
${buildPackages.asar}/bin/asar pack unpacked $out/lib/Signal/resources/app.asar
|
||||
asar pack unpacked $out/lib/Signal/resources/app.asar
|
||||
|
||||
# XXX: add --ozone-platform-hint=auto to make it so that NIXOS_OZONE_WL isn't *needed*.
|
||||
# electron should auto-detect x11 v.s. wayland: launching with `NIXOS_OZONE_WL=1` is an optional way to force it when debugging.
|
||||
@@ -391,8 +368,6 @@ buildNpmPackage rec {
|
||||
rev-prefix = "v";
|
||||
ignoredVersions = "beta";
|
||||
};
|
||||
nodejs = nodejs';
|
||||
buildNodejs = buildNodejs;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
@@ -18,7 +18,7 @@ index e10fd8084..1b0bad1f1 100644
|
||||
"node_modules/fs-xattr/build/Release/*.node",
|
||||
"node_modules/@nodert-win10-rs4/windows.data.xml.dom/build/Release/*.node",
|
||||
"node_modules/@nodert-win10-rs4/windows.ui.notifications/build/Release/*.node",
|
||||
diff --git scripts/esbuild.js scripts/esbuild.js
|
||||
diff --git a/scripts/esbuild.js b/scripts/esbuild.js
|
||||
index 5cd771718..4dfccd95c 100644
|
||||
--- a/scripts/esbuild.js
|
||||
+++ b/scripts/esbuild.js
|
||||
@@ -30,7 +30,7 @@ index 5cd771718..4dfccd95c 100644
|
||||
'sass',
|
||||
'bufferutil',
|
||||
'utf-8-validate',
|
||||
diff --git ts/state/ducks/calling.ts ts/state/ducks/calling.ts
|
||||
diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts
|
||||
index f58b9edd1..5d836b325 100644
|
||||
--- a/ts/state/ducks/calling.ts
|
||||
+++ b/ts/state/ducks/calling.ts
|
||||
@@ -45,3 +45,22 @@ index f58b9edd1..5d836b325 100644
|
||||
import { omit, pick } from 'lodash';
|
||||
import type { ReadonlyDeep } from 'type-fest';
|
||||
import {
|
||||
diff --git a/patches/mac-screen-capture-permissions+2.0.0.patch b/patches/mac-screen-capture-permissions+2.0.0.patch
|
||||
deleted file mode 100644
|
||||
index ac391bab4..000000000
|
||||
--- a/patches/mac-screen-capture-permissions+2.0.0.patch
|
||||
+++ /dev/null
|
||||
@@ -1,13 +0,0 @@
|
||||
-diff --git a/node_modules/mac-screen-capture-permissions/screen-capture-permissions.m b/node_modules/mac-screen-capture-permissions/screen-capture-permissions.m
|
||||
-index d9d6a00..78fa83f 100644
|
||||
---- a/node_modules/mac-screen-capture-permissions/screen-capture-permissions.m
|
||||
-+++ b/node_modules/mac-screen-capture-permissions/screen-capture-permissions.m
|
||||
-@@ -2,6 +2,8 @@
|
||||
- #import <Foundation/Foundation.h>
|
||||
- #include <node_api.h>
|
||||
-
|
||||
-+CG_EXTERN bool CGPreflightScreenCaptureAccess(void) CG_AVAILABLE_STARTING(10.15);
|
||||
-+
|
||||
- static napi_value hasPermissions(napi_env env, napi_callback_info info) {
|
||||
- napi_status status;
|
||||
- bool hasPermissions;
|
||||
|
Reference in New Issue
Block a user