[arch-commits] Commit in element.io/trunk (3 files)

Bruno Pagani archange at gemini.archlinux.org
Sat Mar 5 15:16:57 UTC 2022


    Date: Saturday, March 5, 2022 @ 15:16:57
  Author: archange
Revision: 1142216

Fix crashes by building a statically linked sqlcipher.

This remove the need to preload one to avoid conflicts with gtk linkings.

Thanks go to heftig for the actual patch for this.

Added:
  element.io/trunk/encapsulate-sqlcipher.diff
Modified:
  element.io/trunk/PKGBUILD
  element.io/trunk/element-desktop.sh

----------------------------+
 PKGBUILD                   |   11 ++--
 element-desktop.sh         |    2 
 encapsulate-sqlcipher.diff |  105 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-03-05 14:51:54 UTC (rev 1142215)
+++ PKGBUILD	2022-03-05 15:16:57 UTC (rev 1142216)
@@ -7,12 +7,12 @@
 pkgbase=element.io
 pkgname=(element-web element-desktop)
 pkgver=1.10.6
-pkgrel=1
+pkgrel=2
 pkgdesc="Glossy Matrix collaboration client — "
 arch=(x86_64)
 url="https://element.io"
 license=(Apache)
-makedepends=(npm git yarn python rust sqlcipher ${_electron} nodejs-lts-gallium)
+makedepends=(npm git yarn python rust tcl ${_electron} nodejs-lts-gallium)
 _url="https://github.com/vector-im/element"
 source=(element-web-${pkgver}.tar.gz::${_url}-web/archive/v${pkgver}.tar.gz
         element-web-${pkgver}.tar.gz.asc::${_url}-web/releases/download/v${pkgver}/v${pkgver}-src.tar.gz.asc
@@ -19,6 +19,7 @@
         element-desktop-${pkgver}.tar.gz::${_url}-desktop/archive/v${pkgver}.tar.gz
         element-desktop-${pkgver}.tar.gz.asc::${_url}-desktop/releases/download/v${pkgver}/v${pkgver}-src.tar.gz.asc
         autolaunch.patch
+        encapsulate-sqlcipher.diff
         io.element.Element.desktop
         element-desktop.sh)
 sha256sums=('0afbddbaf9215b6aa6e566a9456a1186262245d472d457954febb7b4e12d345f'
@@ -26,8 +27,9 @@
             '388931f2de254f66499ac79d047e4402cba9fc7b289de60e27720bfdca012000'
             'SKIP'
             'aaae4ffa41590361dac0c159aecc1166f69e459e89faa9d5cab1202f0277e06f'
+            '3b2112d25b258b67d18b9329faeb9e5c5b218732c9c020ee01911347a90a1cb8'
             '0103f28a32fe31f698836516783c1c70a76a0117b5df7fd0af5c422c224220f9'
-            '4c931121009985e7d3f73928c9db88508eedd974a7741e635bb290e3a2cd75db')
+            'c1bd9ace215e3ec9af14d7f28b163fc8c8b42e23a2cf04ce6f4ce2fcc465feba')
 validpgpkeys=(712BFBEE92DCA45252DB17D7C7BE97EFA179B100) # Element Releases <releases at riot.im>
 
 prepare() {
@@ -39,6 +41,7 @@
 
   cd ../element-desktop-${pkgver}
   patch -p1 < ../autolaunch.patch
+  patch -p1 < ../encapsulate-sqlcipher.diff
   sed -i 's|"target": "deb"|"target": "dir"|' package.json
   sed -i 's|"https://packages.element.io/desktop/update/"|null|' element.io/release/config.json
   yarn install --no-fund
@@ -70,7 +73,7 @@
 package_element-desktop() {
   pkgdesc+="desktop version."
   replaces=(riot-desktop)
-  depends=("element-web=${pkgver}" ${_electron} sqlcipher)
+  depends=("element-web=${pkgver}" ${_electron})
   backup=('etc/element/config.json')
 
   cd element-desktop-${pkgver}

Modified: element-desktop.sh
===================================================================
--- element-desktop.sh	2022-03-05 14:51:54 UTC (rev 1142215)
+++ element-desktop.sh	2022-03-05 15:16:57 UTC (rev 1142216)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-LD_PRELOAD=/usr/lib/libsqlcipher.so exec @ELECTRON@ /usr/lib/element/app.asar --disable-dev-mode "$@"
+exec @ELECTRON@ /usr/lib/element/app.asar --disable-dev-mode "$@"

Added: encapsulate-sqlcipher.diff
===================================================================
--- encapsulate-sqlcipher.diff	                        (rev 0)
+++ encapsulate-sqlcipher.diff	2022-03-05 15:16:57 UTC (rev 1142216)
@@ -0,0 +1,105 @@
+diff --git i/hak/matrix-seshat/build.ts w/hak/matrix-seshat/build.ts
+index 8d50bb1..33ad8d5 100644
+--- i/hak/matrix-seshat/build.ts
++++ w/hak/matrix-seshat/build.ts
+@@ -26,7 +26,7 @@ export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promi
+     if (hakEnv.isWin()) {
+         await buildOpenSslWin(hakEnv, moduleInfo);
+         await buildSqlCipherWin(hakEnv, moduleInfo);
+-    } else if (hakEnv.isMac()) {
++    } else {
+         await buildSqlCipherUnix(hakEnv, moduleInfo);
+     }
+     await buildMatrixSeshat(hakEnv, moduleInfo);
+@@ -179,12 +179,17 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) {
+         '--prefix=' + moduleInfo.depPrefix + '',
+         '--enable-tempstore=yes',
+         '--enable-shared=no',
++        '--enable-tcl=no',
+     ];
+ 
+     if (hakEnv.isMac()) {
+         args.push('--with-crypto-lib=commoncrypto');
+     }
+ 
++    if (hakEnv.isLinux()) {
++        args.push('--with-pic=yes');
++    }
++
+     if (!hakEnv.isHost()) {
+         // In the nonsense world of `configure`, it is assumed you are building
+         // a compiler like `gcc`, so the `host` option actually means the target
+@@ -265,12 +270,14 @@ async function buildMatrixSeshat(hakEnv, moduleInfo) {
+     // it for now: we should confirm how much of this it still actually needs.
+     const env = hakEnv.makeGypEnv();
+ 
+-    if (!hakEnv.isLinux()) {
+-        Object.assign(env, {
+-            SQLCIPHER_STATIC: 1,
+-            SQLCIPHER_LIB_DIR: path.join(moduleInfo.depPrefix, 'lib'),
+-            SQLCIPHER_INCLUDE_DIR: path.join(moduleInfo.depPrefix, 'include'),
+-        });
++    Object.assign(env, {
++        SQLCIPHER_STATIC: 1,
++        SQLCIPHER_LIB_DIR: path.join(moduleInfo.depPrefix, 'lib'),
++        SQLCIPHER_INCLUDE_DIR: path.join(moduleInfo.depPrefix, 'include'),
++    });
++
++    if (hakEnv.isLinux()) {
++        env.RUSTFLAGS = '-Clink-arg=-Wl,-Bsymbolic -Clink-arg=-Wl,--exclude-libs,ALL'
+     }
+ 
+     if (hakEnv.isWin()) {
+diff --git i/hak/matrix-seshat/check.ts w/hak/matrix-seshat/check.ts
+index d34247f..ad6533a 100644
+--- i/hak/matrix-seshat/check.ts
++++ w/hak/matrix-seshat/check.ts
+@@ -22,21 +22,19 @@ import { DependencyInfo } from '../../scripts/hak/dep';
+ 
+ export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
+     // of course tcl doesn't have a --version
+-    if (!hakEnv.isLinux()) {
+-        await new Promise<void>((resolve, reject) => {
+-            const proc = childProcess.spawn('tclsh', [], {
+-                stdio: ['pipe', 'ignore', 'ignore'],
+-            });
+-            proc.on('exit', (code) => {
+-                if (code !== 0) {
+-                    reject("Can't find tclsh - have you installed TCL?");
+-                } else {
+-                    resolve();
+-                }
+-            });
+-            proc.stdin.end();
++    await new Promise<void>((resolve, reject) => {
++        const proc = childProcess.spawn('tclsh', [], {
++            stdio: ['pipe', 'ignore', 'ignore'],
+         });
+-    }
++        proc.on('exit', (code) => {
++            if (code !== 0) {
++                reject("Can't find tclsh - have you installed TCL?");
++            } else {
++                resolve();
++            }
++        });
++        proc.stdin.end();
++    });
+ 
+     const tools = [
+         ['rustc', '--version'],
+diff --git i/hak/matrix-seshat/fetchDeps.ts w/hak/matrix-seshat/fetchDeps.ts
+index a2fcf34..1ae1286 100644
+--- i/hak/matrix-seshat/fetchDeps.ts
++++ w/hak/matrix-seshat/fetchDeps.ts
+@@ -25,9 +25,7 @@ import HakEnv from '../../scripts/hak/hakEnv';
+ import { DependencyInfo } from '../../scripts/hak/dep';
+ 
+ export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
+-    if (!hakEnv.isLinux()) {
+-        await getSqlCipher(hakEnv, moduleInfo);
+-    }
++    await getSqlCipher(hakEnv, moduleInfo);
+ 
+     if (hakEnv.isWin()) {
+         await getOpenSsl(hakEnv, moduleInfo);



More information about the arch-commits mailing list