Skip to content

Commit

Permalink
net-im/element-desktop: bump to 1.11.14
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJJ committed Nov 16, 2022
1 parent d695e89 commit 3eb701f
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 41 deletions.
2 changes: 1 addition & 1 deletion net-im/element-desktop/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DIST element-desktop-1.11.13.tar.gz 2013021 BLAKE2B b4345dab5bf697427a20423864e1aeacd66c156970e98f4af04e3015c8df781a04ab4fbb7c1dd34515aa09c666e111f13648ae8eddc314de534aa7bf8a46f295 SHA512 b40b6971acecc2cea9e7f4a5335ce5a317971502a0fb5b1b46815c15ccea63bee82e538a58dbc2e050083bb858f990c229b7ceb5361811b96dd07f076194275c
DIST element-desktop-1.11.14.tar.gz 2010513 BLAKE2B 45be06b1e389f394d0c990ff65566aa7a1211a24db3e43176c59fcb1b2f6b14f2513508e74ee3da630e7bf8d118ab4925f40d5bd94066dac5c293d1f48d3a173 SHA512 4eda9ba41b310cae5c57cceff32317a87d3300a0c7be200007408283b7928a806cb7f474b8275ac6cd7d8cc661debd9de7e3ba37bcb277a510528f606bea478c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 1999-2021 Gentoo Foundation
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# NETWORK ACCESS
Expand Down Expand Up @@ -48,50 +48,41 @@ RESTRICT="network-sandbox"

# get dependencies via:
# readelf -a element-desktop | ag "Shared library" | ag -o '\[(.*)\]' | tr -d '[]' | while read lib; do qfile /usr/lib/$lib; done | cut -d: -f1 | sort | uniq
# don't use ldd - it would show you transitive dependencies!
#
# libsecret is dlopen'd because of node-keytar
RDEPEND="
!net-im/element-desktop-bin
app-accessibility/at-spi2-atk:2
=net-im/element-web-${PV}
app-crypt/libsecret
dev-libs/atk
native-extensions? (
dev-db/sqlcipher
)
app-accessibility/at-spi2-core
dev-libs/expat
dev-libs/glib
dev-libs/nspr
dev-libs/nss
dev-libs/openssl
media-libs/alsa-lib
media-libs/fontconfig
media-libs/mesa
net-print/cups
sys-apps/dbus
x11-libs/cairo
x11-libs/gdk-pixbuf
x11-libs/gtk+:3
x11-libs/gtk+
x11-libs/libdrm
x11-libs/libX11
x11-libs/libXScrnSaver
x11-libs/libxcb
x11-libs/libXcomposite
x11-libs/libXcursor
x11-libs/libXdamage
x11-libs/libXext
x11-libs/libXfixes
x11-libs/libXi
x11-libs/libxkbcommon
x11-libs/libXrandr
x11-libs/libXrender
x11-libs/libXtst
x11-libs/libdrm
x11-libs/libxcb
x11-libs/pango
native-extensions? (
dev-db/sqlcipher
)
=net-im/element-web-${PV}
"
DEPEND="
${RDEPEND}
sys-apps/yarn
>=net-libs/nodejs-14.17.0
net-libs/nodejs
native-extensions? (
virtual/rust
)
Expand All @@ -106,25 +97,18 @@ src_prepare() {
sed -i 's@"https://packages.riot.im/desktop/update/"@null@g' ${S}/element.io/release/config.json
yarn install || die "yarn module installation failed"

# workaround for:
# https://github.com/nodejs/node-gyp/issues/2673
#
# gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
# gyp ERR! configure error
# gyp ERR! stack Error: `gyp` failed with exit code: 1
# gyp ERR! stack at ChildProcess.onCpExit (/tmp/portage/net-im/element-desktop-1.11.10/work/element-desktop-1.11.10/.hak/keytar/x86_64-unknown-linux-gnu/build/node_modules/node-gyp/lib/configure.js:259:16)
# gyp ERR! stack at ChildProcess.emit (node:events:513:28)
# gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
#
npm install --openssl_fips='' || die "npm fips workaround failed"
# workaround chain for https://github.com/nodejs/node-gyp/issues/2750
# we patch hak to patch gyp to patch node-headers.
# we need to do this sequentially since the nodejs clusterfuck downloads all these projects from the internet.
# maybe a simpler approach: let keytar depend on node-gyp:9 since that may have fixed the local-var problem?
eapply ${FILESDIR}/hak_insert_patch_chain.patch
}


src_compile() {
if use native-extensions; then
yarn run build:native || die "native extensions build failed"
yarn run "build:native" || die "native extensions build failed"
fi

yarn run build || die "build failed"
}

Expand Down
19 changes: 19 additions & 0 deletions net-im/element-desktop/files/gyp_apply_patch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/node_modules/node-gyp/gyp/gyp_main.py 2022-11-16 14:17:56.957243192 +0100
+++ b/node_modules/node-gyp/gyp/gyp_main.py 2022-11-16 14:20:42.203568020 +0100
@@ -42,4 +42,16 @@
import gyp # noqa: E402

if __name__ == "__main__":
+ # really ugly workaround fix for https://github.com/nodejs/node-gyp/issues/2750
+ # roughly the same as https://github.com/nodejs/node/pull/45076
+ savepwd = os.getcwd()
+
+ import glob
+ # go to the funny electron-headers directory in the homedir
+ os.chdir(os.environ["HOME"])
+ os.chdir(glob.glob(".electron-gyp/*/.")[0])
+ subprocess.run("patch -p1 -i ${FILESDIR}/ignore_openssl_fips.patch", shell=True)
+
+ os.chdir(savepwd)
+
sys.exit(gyp.script_main())
27 changes: 27 additions & 0 deletions net-im/element-desktop/files/hak_insert_patch_chain.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- a/hak/keytar/build.ts 2022-11-16 13:53:20.727247977 +0100
+++ b/hak/keytar/build.ts 2022-11-16 13:53:22.857327151 +0100
@@ -23,6 +23,24 @@
export default async function buildKeytar(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
const env = hakEnv.makeGypEnv();

+ // patch gyp so it patches the node-headers file
+ // we have to do it here because node-gyp is fetched independently of the
+ // yarn install run in the ebuild's src_prepare phase wtf
+ console.log("Patching node-gyp to patch node headers in " + moduleInfo.moduleBuildDir);
+ await new Promise<void>((resolve, reject) => {
+ const proc = childProcess.spawn(
+ 'sh',
+ ['-c', 'patch -p1 -i ${FILESDIR}/gyp_apply_patch.patch'],
+ {
+ stdio: 'inherit',
+ cwd: moduleInfo.moduleBuildDir,
+ },
+ );
+ proc.on('exit', code => {
+ code ? reject(code) : resolve();
+ });
+ });
+
console.log("Running yarn with env", env);
await new Promise<void>((resolve, reject) => {
const proc = childProcess.spawn(
22 changes: 22 additions & 0 deletions net-im/element-desktop/files/ignore_openssl_fips.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- a/include/node/common.gypi 2022-11-16 12:59:09.485683884 +0100
+++ b/include/node/common.gypi 2022-11-16 13:16:32.245949353 +0100
@@ -30,6 +30,7 @@

'openssl_fips%': '',
'openssl_no_asm%': 0,
+ 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',

# Don't use ICU data file (icudtl.dat) from V8, we use our own.
'icu_use_data_file_flag%': 0,
@@ -123,11 +124,6 @@
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
}],
- ['openssl_fips != ""', {
- 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
- }, {
- 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
- }],
['OS=="mac"', {
'clang%': 1,
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
2 changes: 1 addition & 1 deletion net-im/element-web/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DIST element-web-1.11.13.tar.gz 1469294 BLAKE2B 7af37353e80bdc93ad5855095f7482c61258675915f6098f5f82d64a5298be0daa8277868d9eb6114837e0a0d7d261e8186426deaad51f9c9ec3e2e48f05cd29 SHA512 7a7a04bf7adf9ba4b347dd41d24f2884f033b00f22024a48b4d4387d80758219b75f5105507879f9400520b98f3686ec6cb755fd8be9b5ea46648b8d170ad183
DIST element-web-1.11.14.tar.gz 1471851 BLAKE2B 400ff431b9ca861f56c31713db9216f5ded8f40fad528bb8c01bd665843f91d3c887e78e200b4eec9ffbd2a3e094bcf29276f1eb07ef08901a526d87eebc9434 SHA512 de958749c7ccd27648eac270618f6d0912af7d70d7925e3defc6f00274b0f195f3a22b821115f5754d9f0172e992cf4c51dad313adb323b2a804cfd115eb3835
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ IUSE=""
REQUIRED_USE=""
RESTRICT="network-sandbox"

# maybe nodejs version needs to be limited according to these compatibilities:
# https://github.com/node-gfx/node-canvas-prebuilt/releases
# https://nodejs.org/en/download/releases/
# <nodejs-17 seems to be required because
# - electron uses node16-config files
# - the build fails with openssl_fips being undefined, since node17+ no longer defines it.
# see https://github.com/nodejs/node-gyp/issues/2750
RDEPEND="
net-libs/nodejs
x11-libs/cairo
Expand Down

0 comments on commit 3eb701f

Please sign in to comment.