Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build from source #200

Closed
wants to merge 11 commits into from
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.flatpak-builder
builddir
repo
*build*/
repo/
3 changes: 0 additions & 3 deletions flathub.json

This file was deleted.

4,682 changes: 4,682 additions & 0 deletions generated-sources-desktop.json

Large diffs are not rendered by default.

11,185 changes: 11,185 additions & 0 deletions generated-sources-web.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion im.riot.Riot.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Type=Application
Name=Element
Icon=im.riot.Riot
Exec=/app/bin/element %U
Exec=/app/bin/run.sh %U
Categories=Network;InstantMessaging;Chat;VideoConference;
MimeType=x-scheme-handler/element;
StartupWMClass=element
Expand Down
176 changes: 137 additions & 39 deletions im.riot.Riot.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
app-id: im.riot.Riot
base: org.electronjs.Electron2.BaseApp
base-version: '20.08'
base-version: "20.08"
runtime: org.freedesktop.Platform
runtime-version: '20.08'
runtime-version: "20.08"
sdk: org.freedesktop.Sdk
command: element
rename-icon: element-desktop
copy-icon: true
sdk-extensions:
- org.freedesktop.Sdk.Extension.node14
command: run.sh
separate-locales: false
finish-args:
# Required due to being a GUI application
- --socket=x11
# Required to make sure x11 performance is achived on all platforms
- --socket=wayland
- --socket=fallback-x11
# Required to make sure x11 performance is achieved on all platforms
# At least that's what the legends tell. it might be worth experimenting
# with dropping this permission.
- --share=ipc
# Required for experimental wayland support
- --socket=wayland
# Required to provide Call functionality
- --socket=pulseaudio
- --device=all
Expand Down Expand Up @@ -50,17 +48,26 @@ cleanup:
- /man
modules:
- shared-modules/libsecret/libsecret.json

- name: tcl
buildsystem: autotools
subdir: unix
build-options:
no-debuginfo: true
post-install:
- chmod 755 /app/lib/libtcl*.so
cleanup:
- '*'
- /bin
- /lib/pkgconfig
- /man
sources:
- type: git
url: https://github.com/tcltk/tcl.git
tag: core-8-6-11
commit: 590390207d727708be57b4908eb24dbe705d090c
- type: archive
url: https://prdownloads.sourceforge.net/tcl/tcl8.6.11-src.tar.gz
sha256: 8c0486668586672c5693d7d95817cb05a18c5ecca2f40e2836b9578064088258
x-checker-data:
type: anitya
project-id: 4941
stable-only: true
url-template: https://prdownloads.sourceforge.net/tcl/tcl$version-src.tar.gz

- name: sqlcipher
rm-configure: true
config-opts:
Expand All @@ -73,13 +80,19 @@ modules:
- type: archive
url: https://github.com/sqlcipher/sqlcipher/archive/v4.3.0.tar.gz
sha256: fccb37e440ada898902b294d02cde7af9e8706b185d77ed9f6f4d5b18b4c305f
x-checker-data:
type: anitya
project-id: 11213
stable-only: true
url-template: https://github.com/sqlcipher/sqlcipher/archive/v$version.tar.gz
- type: shell
commands:
- cp -p /usr/share/automake-*/config.{sub,guess} .
- type: script
dest-filename: autogen.sh
commands:
- AUTOMAKE="automake --foreign" autoreconf -vfi

- name: pipewire
buildsystem: meson
config-opts:
Expand All @@ -95,37 +108,122 @@ modules:
- type: git
url: https://github.com/PipeWire/pipewire.git
tag: 0.2.7
- name: riot
commit: 14c11c0fe4d366bad4cfecdee97b6652ff9ed63d
x-checker-data:
type: anitya
project-id: 57357
stable-only: true
tag-template: $version

- name: yarn
buildsystem: simple
build-commands:
- cp -a * /app
cleanup:
- "*"
sources:
- type: archive
url: https://github.com/yarnpkg/yarn/releases/download/v1.22.11/yarn-v1.22.11.tar.gz
sha256: 2c320de14a6014f62d29c34fec78fdbb0bc71c9ccba48ed0668de452c1f5fe6c
x-checker-data:
type: anitya
project-id: 13363
url-template: https://github.com/yarnpkg/yarn/releases/download/v$version/yarn-v$version.tar.gz

- name: element-web
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/node14/bin:/app/yarn/bin
env:
XDG_CACHE_HOME: /run/build/element-web/flatpak-node/cache
npm_config_offline: "true"
NPM_CONFIG_LOGLEVEL: verbose
CXX: ccache g++
CC: ccache gcc
subdir: main
build-commands:
- ar x element-desktop_*.deb
- rm element-desktop_*.deb
- tar xf data.tar.xz
- cp -r 'opt/Element' /app/Element
- mkdir -p /app/share/icons/hicolor
- cp -r usr/share/icons/hicolor/* /app/share/icons/hicolor
- chmod -R a-s,go+rX,go-w "/app/Element"
- install element.sh /app/bin/element
- install -Dm644 im.riot.Riot.desktop /app/share/applications/im.riot.Riot.desktop
- install -Dm644 im.riot.Riot.metainfo.xml /app/share/metainfo/im.riot.Riot.metainfo.xml
- yarn
- yarn run build
- mkdir -p /app/main/resources
- cp -r webapp /app/main/resources/
sources:
- type: git
url: https://github.com/vector-im/element-web.git
tag: v1.7.34
commit: 245d13875faaecb7c3fec2df112bf3a7a6e8fec9
dest: main
x-checker-data:
type: json
url: https://api.github.com/repos/vector-im/element-web/releases/latest
tag-query: .tag_name
version-query: .tag_name | sub("^v"; "")
timestamp-query: .published_at

- type: file
only-arches:
- x86_64
url: https://packages.riot.im/debian/pool/main/e/element-desktop/element-desktop_1.7.34_amd64.deb
sha256: 97c3ca75fe00c77837b3289d9b1b863a547f54f0fc1a4f378dcffe11a90d8a95
url: data:yarn-offline-mirror%20/run/build/element-web/flatpak-node/yarn-mirror%0A--install.offline%20true%0A--run.offline%20true%0A
dest: main
dest-filename: .yarnrc

- generated-sources-web.json

- name: element-desktop
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/node14/bin:/app/yarn/bin
env:
XDG_CACHE_HOME: /run/build/element-desktop/flatpak-node/cache
npm_config_offline: "true"
npm_config_loglevel: verbose
subdir: main
build-commands:
# Patch the electronVersion to build with to match the minimum version in the dependency list.
- jq 'del(.build.electronVersion)' <<<$(cat package.json) > package.json

- yarn
- yarn run i18n
# - yarn run asar-webapp
- yarn run build:ts
- yarn run build:res
- |
. ../flatpak-node/electron-builder-arch-args.sh
yarn run electron-builder --linux dir -c.linux.target=dir $ELECTRON_BUILDER_ARCH_ARGS

- cp -r dist/linux*unpacked/* /app/main
- install -Dm 755 -t /app/bin/ ../run.sh
- for size in 16 24 48 64 96 128 256 512; do [[ -e "build/icons/${size}x${size}.png" ]] && install
-Dm644 "build/icons/${size}x${size}.png" "/app/share/icons/hicolor/${size}x${size}/apps/${FLATPAK_ID}.png";
done
- install -Dm644 ../im.riot.Riot.desktop /app/share/applications/im.riot.Riot.desktop
- install -Dm644 ../im.riot.Riot.metainfo.xml /app/share/metainfo/im.riot.Riot.metainfo.xml
sources:
- type: git
url: https://github.com/vector-im/element-desktop.git
tag: v1.7.34
commit: 4ceb91b3aee13c58d90a1c220342c88e044924fc
dest: main
x-checker-data:
type: debian-repo
package-name: element-desktop
root: https://packages.riot.im/debian
dist: sid
component: main
type: json
url: https://api.github.com/repos/vector-im/element-desktop/releases/latest
tag-query: .tag_name
version-query: .tag_name | sub("^v"; "")
timestamp-query: .published_at

- type: file
url: data:yarn-offline-mirror%20/run/build/element-desktop/flatpak-node/yarn-mirror%0A--install.offline%20true%0A--run.offline%20true%0A
dest: main
dest-filename: .yarnrc

- generated-sources-desktop.json

- type: script
dest-filename: element.sh
dest-filename: run.sh
commands:
- export TMPDIR="$XDG_RUNTIME_DIR/app/${FLATPAK_ID:-im.riot.Riot}"
- exec zypak-wrapper "/app/Element/element-desktop" "$@"
- if test -n "$WAYLAND_DISPLAY" && test -e "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" && [ "$DESKTOP_SESSION" != "gnome" ]; then set -- --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"; fi
- zypak-wrapper.sh /app/main/element-desktop "$@"

- type: file
path: im.riot.Riot.metainfo.xml

- type: file
path: im.riot.Riot.desktop