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

WIP: KDE 5.14/Anki 2.26 #32

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,901 changes: 2,901 additions & 0 deletions maturin-sources.json

Large diffs are not rendered by default.

191 changes: 116 additions & 75 deletions net.ankiweb.Anki.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
app-id: net.ankiweb.Anki

runtime: org.kde.Platform
runtime-version: '5.12'
runtime-version: '5.14'
sdk: org.kde.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable

base: io.qt.qtwebengine.BaseApp
base-version: '5.14'

command: anki
rename-desktop-file: anki.desktop
rename-icon: anki

build-options:
append-path: /usr/lib/sdk/rust-stable/bin

finish-args:
# X11/Wayland
- --socket=x11
Expand All @@ -22,93 +30,104 @@ finish-args:
- --env=TMPDIR=/var/tmp

modules:
- name: maturin
buildsystem: simple
build-commands:
- cargo --offline fetch --manifest-path Cargo.toml --verbose
- cargo --offline build --release --locked --all-features
- install -Dm755 -t /app/bin/ target/release/maturin
build-options:
env:
- CARGO_HOME=/run/build/maturin/cargo
sources:
- type: archive
url: https://github.com/PyO3/maturin/archive/v0.8.1.tar.gz
sha256: b72a9885cda3ba4e53906a43aab101acb790622218ade6405b2ddf1ef1461f8f
- maturin-sources.json

- name: sip
config-opts:
- --no-dist-info
- --no-stubs
- --bindir=/app/bin
- --destdir=/app/lib/python3.7/site-packages
- --incdir=/app/include
- --pyidir=/app/lib/python3.7/site-packages
- --sipdir=/app/share/sip
- --sip-module=PyQt5.sip
buildsystem: simple
build-commands:
- python3 setup.py install --prefix="${FLATPAK_DEST}" --root=/ --optimize=1
sources:
- type: archive
url: https://www.riverbankcomputing.com/static/Downloads/sip/4.19.17/sip-4.19.17.tar.gz
sha256: 12bcd8f4d5feefc105bc075d12c5090ee783f7380728563c91b8b95d0ec45df3
- type: script
commands:
- processed=`sed -e 's|--prefix=/app||' <<< $@`
- python3 configure.py $processed
dest-filename: configure
url: https://pypi.python.org/packages/source/s/sip/sip-5.2.0.tar.gz
sha256: 3d3f279a61d54d832b12496409811ee062dab1ac05a1e7b40824f63b423fb0e7
cleanup:
- /bin
- /include
modules:
- python3-toml.json
- python3-packaging.json

- name: PyQt5_sip
buildsystem: simple
build-commands:
- python3 setup.py install --prefix="${FLATPAK_DEST}" --root=/ --optimize=1
sources:
- type: archive
url: https://pypi.python.org/packages/source/P/PyQt5_sip/PyQt5_sip-12.7.2.tar.gz
sha256: 16a19b9f36985b8bff30b89fb8859d831713dd528fba5600563e36ff077960a2

- python3-pyqt-builder.json

- name: pyqt5
config-opts:
- --assume-shared
- --concatenate
- --confirm-license
- --no-designer-plugin
- --no-dist-info
- --no-docstrings
- --no-qml-plugin
- --no-qsci-api
- --no-stubs
- --no-tools
- QMAKE_CFLAGS_RELEASE='-I/usr/include/python3.7m/'
- QMAKE_CXXFLAGS_RELEASE='-I/usr/include/python3.7m/'
# FIXME: we should do this on ARM too, but for some reason it fails to build
buildsystem: simple
build-options:
arch:
i386:
config-opts:
- --enable=QtCore
- --enable=QtGui
- --enable=QtNetwork
- --enable=QtPrintSupport
- --enable=QtWebChannel
- --enable=QtWidgets
x86_64:
config-opts:
- --enable=QtCore
- --enable=QtGui
- --enable=QtNetwork
- --enable=QtPrintSupport
- --enable=QtWebChannel
- --enable=QtWidgets
env:
- ANKI_BINDINGS=--enable=QtCore --enable=QtGui --enable=QtNetwork --enable=QtPrintSupport --enable=QtWebChannel --enable=QtWidgets
env:
- QMAKEPATH=/app/lib
build-commands:
- sip-install
--verbose
--build-dir ${FLATPAK_BUILDER_BUILDDIR}/build
--target-dir ${FLATPAK_DEST}/lib/python$(python3 -c 'import sys; print(sys.version[:3])')/site-packages
$ANKI_BINDINGS
--confirm-license
--qt-share
--no-designer-plugin
--no-qml-plugin
--no-dbus-python
--no-tools
--qmake-setting QMAKE_CFLAGS_RELEASE="$CFLAGS"
--qmake-setting QMAKE_CXXFLAGS_RELEASE="$CXXFLAGS"
--qmake-setting QMAKE_LFLAGS_RELEASE="$LDFLAGS"
--concatenate 1
--debug
--no-docstrings
sources:
- type: archive
url: https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.12.2/PyQt5_gpl-5.12.2.tar.gz
sha256: c565829e77dc9c281aa1a0cdf2eddaead4e0f844cbaf7a4408441967f03f5f0f
- type: script
commands:
- processed=`sed -e 's|prefix|sysroot|' <<< $@`
- python3 configure.py $processed
dest-filename: configure
url: https://pypi.python.org/packages/source/P/PyQt5/PyQt5-5.14.2.tar.gz
sha256: bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0
cleanup:
- /share/sip

- name: pyqt5-webengine
config-opts:
- --concatenate
- --no-dist-info
- --no-docstrings
- --no-qsci-api
- --no-sip-files
- --no-stubs
- QMAKE_CFLAGS_RELEASE='-I/usr/include/python3.7m/'
- QMAKE_CXXFLAGS_RELEASE='-I/usr/include/python3.7m/'
buildsystem: simple
build-options:
env:
- QMAKEPATH=/app/lib
build-commands:
- sip-install
--verbose
--build-dir ${FLATPAK_BUILDER_BUILDDIR}/build
--target-dir ${FLATPAK_DEST}/lib/python$(python3 -c 'import sys; print(sys.version[:3])')/site-packages
--qmake-setting QMAKE_CFLAGS_RELEASE="$CFLAGS"
--qmake-setting QMAKE_CXXFLAGS_RELEASE="$CXXFLAGS"
--qmake-setting QMAKE_LFLAGS_RELEASE="$LDFLAGS"
--qmake-setting QMAKE_INCDIR+=/app/include/QtWebEngine
--qmake-setting QMAKE_INCDIR+=/app/include/QtWebEngineCore
--qmake-setting QMAKE_INCDIR+=/app/include/QtWebEngineWidgets
--concatenate 1
--debug
--no-docstrings
sources:
- type: archive
url: https://www.riverbankcomputing.com/static/Downloads/PyQtWebEngine/5.12.1/PyQtWebEngine_gpl-5.12.1.tar.gz
sha256: 860704672ea1b616e1347be1f347bc1c749e64ed378370863fe209e84e9bd473
- type: script
commands:
- processed=`sed -e 's|prefix|sysroot|' <<< $@`
- python3 configure.py $processed
dest-filename: configure
url: https://pypi.python.org/packages/source/P/PyQtWebEngine/PyQtWebEngine-5.14.0.tar.gz
sha256: e11595051f8bfbfa49175d899b2c8c2eea3a3deac4141edf4db68c3555221c92

- name: mpv
buildsystem: simple
Expand Down Expand Up @@ -163,9 +182,16 @@ modules:
- python3-attrs.json
- python3-setuptools_scm.json
- python3-jsonschema.json
- python3-mypy-protobuf.json


- name: anki
no-autogen: true
buildsystem: simple
build-commands:
- echo flatpak > meta/buildhash
- make -C rspy build
- make -C pylib build
- make -C qt build
make-install-args:
- PREFIX=/app
post-install:
Expand All @@ -178,14 +204,29 @@ modules:
- ln -s /app/share/locale /app/share/anki/locale
sources:
- type: archive
url: https://apps.ankiweb.net/downloads/current/anki-2.1.15-source.tgz
sha256: 5a53760164c77d619f55107a13099cffe620566a7f610b61b6c4b52487f3bb89
url: https://github.com/ankitects/anki/archive/2.1.26.tar.gz
sha256: f5a0c41f3eebe0e77de9d46f2a5cbbe20f7c3a4787f0f02e1d33f298428acbdf
- type: archive
url: https://github.com/ankitects/anki-core-i18n/archive/8d6ec08.tar.gz
sha256: 697ba7987673e8d70d9ae0ffe36bd6fa3b9ed3a0906f99460f14429730ce7892
dest: rslib/ftl/repo
- type: archive
url: https://github.com/ankitects/anki-desktop-ftl/archive/04f26f2.tar.gz
sha256: 37fc9af8383f770554714474289576601497c2d62cdb17a6115c17d7559df9e0
dest: qt/ftl/repo
- type: archive
url: https://github.com/ankitects/anki-desktop-i18n/archive/0c64190.tar.gz
sha256: 6d86619e75e49d4d8da07133140c72aae9dad364ecbaa85f836fd89ad8f5b446
dest: qt/po/repo
- type: file
path: anki.svg
- type: file
path: net.ankiweb.Anki.appdata.xml
- type: script
commands:
- sed -i -e 's/cp -a/cp -dR/' Makefile
- type: patch
paths:
- patches/0001-Move-aqt_data-to-sys.prefix-share.patch
- patches/0002-Remove-bad-build-steps-from-makefiles.patch
- patches/0003-Compile-.py-s-before-building-wheel.patch
- patches/0004-Disable-auto-updates.patch
cleanup:
- /share/pixmaps
45 changes: 45 additions & 0 deletions patches/0001-Move-aqt_data-to-sys.prefix-share.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From a0a9ac1aeb8b8678f1102aed81010a901ad8d9e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <[email protected]>
Date: Sun, 29 Mar 2020 06:24:43 +0200
Subject: [PATCH 1/4] Move aqt_data to sys.prefix/share
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These files do _not_ belong right under sys.prefix.

Signed-off-by: Johannes Löthberg <[email protected]>
---
qt/aqt/utils.py | 2 +-
qt/setup.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py
index a0e12362..4d8c8c34 100644
--- a/qt/aqt/utils.py
+++ b/qt/aqt/utils.py
@@ -21,7 +21,7 @@ from aqt.theme import theme_manager

def aqt_data_folder() -> str:
# wheel install?
- dir = os.path.join(sys.prefix, "aqt_data")
+ dir = os.path.join(sys.prefix,"share", "aqt_data")
if not os.path.exists(dir) or not os.listdir(dir):
# running in place?
dir = os.path.join(os.path.dirname(__file__), "..", "aqt_data")
diff --git a/qt/setup.py b/qt/setup.py
index 38f4e2b7..bdda3baa 100644
--- a/qt/setup.py
+++ b/qt/setup.py
@@ -8,7 +8,7 @@ import setuptools
def package_files(directory):
entries = []
for (path, directories, filenames) in os.walk(directory):
- entries.append((path, [os.path.join(path, f) for f in filenames]))
+ entries.append((os.path.join("share", path), [os.path.join(path, f) for f in filenames]))
return entries


--
2.26.2

66 changes: 66 additions & 0 deletions patches/0002-Remove-bad-build-steps-from-makefiles.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 5f8a3a14906d4ad20cd0d1be6b90e0922a5ba098 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <[email protected]>
Date: Sun, 29 Mar 2020 05:54:00 +0200
Subject: [PATCH 2/4] Remove bad build steps from makefiles
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Johannes Löthberg <[email protected]>
---
pylib/Makefile | 4 ++--
qt/Makefile | 2 +-
rspy/Makefile | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pylib/Makefile b/pylib/Makefile
index b9e6aa63..feae25d8 100644
--- a/pylib/Makefile
+++ b/pylib/Makefile
@@ -41,7 +41,7 @@ all: check

PROTODEPS := $(wildcard ../proto/*.proto)

-.build/py-proto: .build/dev-deps $(PROTODEPS)
+.build/py-proto: $(PROTODEPS)
protoc --proto_path=../proto --python_out=anki --mypy_out=anki $(PROTODEPS)
perl -i'' -pe 's/from fluent_pb2/from anki.fluent_pb2/' anki/backend_pb2.pyi
perl -i'' -pe 's/import fluent_pb2/import anki.fluent_pb2/' anki/backend_pb2.py
@@ -52,7 +52,7 @@ PROTODEPS := $(wildcard ../proto/*.proto)
python -m black anki/hooks.py
@touch $@

-BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps .build/py-proto anki/buildinfo.py .build/hooks
+BUILD_STEPS := .build/vernum .build/py-proto anki/buildinfo.py

# Checking
######################
diff --git a/qt/Makefile b/qt/Makefile
index 2ebee696..c0ba93e3 100644
--- a/qt/Makefile
+++ b/qt/Makefile
@@ -64,7 +64,7 @@ TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss)
python -m black aqt/gui_hooks.py
@touch $@

-BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n
+BUILD_STEPS := .build/vernum .build/js .build/ui aqt/buildinfo.py .build/i18n

# Checking
######################
diff --git a/rspy/Makefile b/rspy/Makefile
index 7506608d..01b7aff4 100644
--- a/rspy/Makefile
+++ b/rspy/Makefile
@@ -47,7 +47,7 @@ all: develop

develop: .build/develop

-DEPS := .build/tools .build/vernum ../meta/buildhash \
+DEPS := .build/vernum ../meta/buildhash \
$(wildcard $(QT_FTL_TEMPLATES)/*.ftl) \
$(wildcard $(QT_FTL_LOCALES)/*/*.ftl) \
$(shell "${FIND}" ../rslib/src -name '*.rs') $(wildcard ../proto/*) \
--
2.26.2

Loading