From 26b596b3a6fcf18f6abfc74cbf7524b35ce96187ce5cd8e6f705bb35079dc3f5 Mon Sep 17 00:00:00 2001 From: Dominik Heidler Date: Thu, 15 Jun 2023 13:20:54 +0000 Subject: [PATCH] - Build with native extensons - keytar for talking to system keyring - seshat for maintaining encrypted sqlite db for msg search OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/element-desktop?expand=0&rev=36 --- element-desktop.changes | 7 ++++ element-desktop.spec | 33 +++++++++++++++---- hak.tar.gz | 3 ++ npm-packages-offline-cache.tar.gz | 4 +-- prepare.sh | 55 ++++++++++++++++++------------- 5 files changed, 71 insertions(+), 31 deletions(-) create mode 100644 hak.tar.gz diff --git a/element-desktop.changes b/element-desktop.changes index e6e6b07..6a7c9f4 100644 --- a/element-desktop.changes +++ b/element-desktop.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Jun 15 13:12:37 UTC 2023 - Dominik Heidler + +- Build with native extensons + - keytar for talking to system keyring + - seshat for maintaining encrypted sqlite db for msg search + ------------------------------------------------------------------- Wed Jun 7 09:53:04 UTC 2023 - Dominik Heidler diff --git a/element-desktop.spec b/element-desktop.spec index f275510..9675967 100644 --- a/element-desktop.spec +++ b/element-desktop.spec @@ -28,6 +28,7 @@ Source2: npm-packages-offline-cache.tar.gz Source3: io.element.Element.desktop Source4: element-desktop.sh Source5: prepare.sh +Source6: hak.tar.gz BuildRequires: element-web = %{version} BuildRequires: fdupes BuildRequires: hicolor-icon-theme @@ -35,10 +36,15 @@ BuildRequires: jq BuildRequires: moreutils BuildRequires: nodejs-electron-devel BuildRequires: yarn +BuildRequires: rust +BuildRequires: cargo +BuildRequires: python3 +BuildRequires: sqlcipher-devel +BuildRequires: openssh-fips +BuildRequires: libsecret-devel +BuildRequires: gcc-c++ Requires: element-web = %{version} Requires: nodejs-electron -#Element contains no native code -BuildArch: noarch %if 0%{?suse_version} <= 1540 BuildRequires: nodejs18 %endif @@ -47,7 +53,7 @@ BuildRequires: nodejs18 A glossy Matrix collaboration client - desktop %prep -%setup -q -a1 -a2 +%setup -q -a1 -a2 -a6 %autopatch -p1 SYSTEM_ELECTRON_VERSION=$(<%{_libdir}/electron/version) jq -c '.build["electronVersion"]="'$SYSTEM_ELECTRON_VERSION'" | .build["electronDist"]="%{_libdir}/electron"' < package.json | sponge package.json @@ -55,6 +61,10 @@ jq -c '.build["linux"]["target"]="dir"' < package.json | sponge package.json cat package.json jq '.piwik=false | .update_base_url=null' < element.io/release/config.json | sponge element.io/release/config.json +# build tools expect python3 interpreter behind "python" +mkdir -p $HOME/bin +ln -sf /usr/bin/python3 $HOME/bin/python + %build echo 'yarn-offline-mirror "./npm-packages-offline-cache"' >> .yarnrc echo 'nodedir %{_includedir}/electron' >> .yarnrc @@ -64,18 +74,28 @@ export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --offline --pure-lockfile -export PATH="$(pwd)/node_modules/.bin:${PATH}" +export PATH="$(pwd)/node_modules/.bin:${HOME}/bin:${PATH}" #export ELECTRON_BUILDER_CACHE="$(pwd)/electron-builder-offline-cache/" -#yarn run build:native + +yarn run hak build +yarn run hak copyandlink + +yarn run build:native yarn run build:universal %install - # Install the app content, replace the webapp with a symlink to the system package install -d -m 0755 "%{buildroot}%{_datadir}/element/" cp -av dist/linux-universal-unpacked/resources/* "%{buildroot}%{_datadir}/element/" ln -s %{_datadir}/webapps/element "%{buildroot}%{_datadir}/element/webapp" +# Install binaries to /usr/lib +install -d -m 0755 "%{buildroot}%{_prefix}/lib/element/" +install -m0755 dist/linux-universal-unpacked/resources/app.asar.unpacked/node_modules/keytar/build/Release/keytar.node "%{buildroot}%{_prefix}/lib/element/keytar.node" +install -m0755 dist/linux-universal-unpacked/resources/app.asar.unpacked/node_modules/matrix-seshat/index.node "%{buildroot}%{_prefix}/lib/element/matrix-seshat.node" +ln -sfv "%{_prefix}/lib/element/keytar.node" "%{buildroot}%{_datadir}/element/app.asar.unpacked/node_modules/keytar/build/Release/keytar.node" +ln -sfv "%{_prefix}/lib/element/matrix-seshat.node" "%{buildroot}%{_datadir}/element/app.asar.unpacked/node_modules/matrix-seshat/index.node" + # Config file install -m 0755 -d %{buildroot}%{_sysconfdir}/element install -m 0644 element.io/release/config.json "%{buildroot}%{_sysconfdir}/element/config.json" @@ -106,6 +126,7 @@ done %license LICENSE %{_bindir}/%{name} %{_datadir}/element/ +%{_prefix}/lib/element/ %config(noreplace) %{_sysconfdir}/element/config.json %{_sysconfdir}/webapps/element/config.json %{_datadir}/webapps/element/config.json diff --git a/hak.tar.gz b/hak.tar.gz new file mode 100644 index 0000000..5ab9d86 --- /dev/null +++ b/hak.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a595a63de72cb140e9fff09c76677108f053e2572b79c6593441740852442e49 +size 131179308 diff --git a/npm-packages-offline-cache.tar.gz b/npm-packages-offline-cache.tar.gz index 4f028ff..975ff76 100644 --- a/npm-packages-offline-cache.tar.gz +++ b/npm-packages-offline-cache.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a848008acc8cb8cf5d210557fe458c2fc56689711a2898a6a5d757d381c31ba -size 94143435 +oid sha256:710408fb641a2a2ec7672c77b5172a62a6bbc346c6371d46232346e276bf0171 +size 153625215 diff --git a/prepare.sh b/prepare.sh index 963cbdc..5ea490e 100644 --- a/prepare.sh +++ b/prepare.sh @@ -24,24 +24,46 @@ cd element-desktop-${version} changes=$(grep "^=============" -B10000 -m2 CHANGELOG.md | head -n -3 | tail -n +4) -#sed -i 's@"electronVersion": "11.2.3"@"electronVersion": "13.1.2"@g' package.json -#sed -i 's@"https://packages.riot.im/desktop/update/"@null@g' element.io/release/config.json - echo 'yarn-offline-mirror "./npm-packages-offline-cache"' > .yarnrc yarn cache clean rm -rf node_modules/ yarn install --pure-lockfile || : # this will download tha packages into the offline cache -#mkdir -p electron-builder-offline-cache -#export ELECTRON_BUILDER_CACHE="$(pwd)/electron-builder-offline-cache/" -#export PATH="$PATH:node_modules/.bin" -#yarn run build +export PATH="$PATH:node_modules/.bin" +yarn run hak check +yarn run hak fetch + +# prefetch cargo crates +pushd .hak/matrix-seshat/x86_64-unknown-linux-gnu/build +cargo vendor +mkdir -p .cargo +cat > .cargo/config.toml <", "eval") + cached_conditions_asts[cond_expr_expanded] = ast_code +- env = {"__builtins__": {}, "v": StrictVersion} ++ env = {"__builtins__": {"openssl_fips": ""}, "v": StrictVersion} + if eval(ast_code, env, variables): + return true_dict + return false_dict +EOF tar czf npm-packages-offline-cache.tar.gz ./npm-packages-offline-cache -cp -v npm-packages-offline-cache.tar.gz "$oldwd/" +tar czf hak.tar.gz ./.hak +cp -v npm-packages-offline-cache.tar.gz hak.tar.gz "$oldwd/" -#tar czf electron-builder-offline-cache.tar.gz ./electron-builder-offline-cache/ -#cp electron-builder-offline-cache.tar.gz "$oldwd/" cd "$oldwd" echo rm -rf "$tmpdir" echo -e "\n\nDONE creating npm dependency offline cache file 'npm-packages-offline-cache.tar.gz'" @@ -49,16 +71,3 @@ echo -e "\n\nDONE creating npm dependency offline cache file 'npm-packages-offli read -p "Write changes?" osc vc -m "Version ${version}\n${changes}" element-desktop.changes - - -#yarn install -#export PATH="$PATH:node_modules/.bin" -#yarn run build:native -#yarn run build -#tar czvf ../dist.tar.gz dist/linux-unpacked/resources/ -#cd .. -#cp dist.tar.gz "$oldwd/" -#cd "$oldwd" -#rm -rf "$tmpdir" -#rm -rf "element-desktop-${version}" -#echo -e "\n\nDONE creating output file 'dist.tar.gz'"