1
0

- 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
This commit is contained in:
Dominik Heidler 2023-06-15 13:20:54 +00:00 committed by Git OBS Bridge
parent 18725a37fe
commit 26b596b3a6
5 changed files with 71 additions and 31 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jun 15 13:12:37 UTC 2023 - Dominik Heidler <dheidler@suse.de>
- 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 <dheidler@suse.de>

View File

@ -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

3
hak.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a595a63de72cb140e9fff09c76677108f053e2572b79c6593441740852442e49
size 131179308

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6a848008acc8cb8cf5d210557fe458c2fc56689711a2898a6a5d757d381c31ba
size 94143435
oid sha256:710408fb641a2a2ec7672c77b5172a62a6bbc346c6371d46232346e276bf0171
size 153625215

View File

@ -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 <<EOF
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
EOF
popd
patch -p0 <<EOF
--- .hak/keytar/x86_64-unknown-linux-gnu/build/node_modules/node-gyp/gyp/pylib/gyp/input.py 2023-06-15 12:09:05.127000000 +0200
+++ .hak/keytar/x86_64-unknown-linux-gnu/build/node_modules/node-gyp/gyp/pylib/gyp/input.py 2023-06-15 13:34:18.969088855 +0200
@@ -1190,7 +1190,7 @@
else:
ast_code = compile(cond_expr_expanded, "<string>", "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'"