From e88132a875c981abbac9216cce895b2b034d8ed0 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 23 May 2020 14:33:01 +1000 Subject: [PATCH 1/6] python3-mypy: update to 0.770, claim maintainership --- srcpkgs/python3-mypy/template | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/srcpkgs/python3-mypy/template b/srcpkgs/python3-mypy/template index 5d7f93d5772..bde1e7f4be6 100644 --- a/srcpkgs/python3-mypy/template +++ b/srcpkgs/python3-mypy/template @@ -1,19 +1,18 @@ # Template file for 'python3-mypy' pkgname=python3-mypy -version=0.761 +version=0.770 revision=1 archs=noarch wrksrc="mypy-${version}" build_style=python3-module -pycompile_module="mypy" hostmakedepends="python3-setuptools" depends="python3-mypy_extensions python3-typed-ast python3-typing_extensions" short_desc="Optional static typing for Python3" -maintainer="Orphaned " +maintainer="fosslinux " license="MIT" homepage="https://github.com/python/mypy" distfiles="${PYPI_SITE}/m/mypy/mypy-${version}.tar.gz" -checksum=85baab8d74ec601e86134afe2bcccd87820f79d2f8d5798c889507d1088287bf +checksum=8a627507ef9b307b46a1fea9513d5c98680ba09591253082b4c48697ba05a4ae post_install() { vlicense LICENSE From ae580c7dcc5fa9ee6c2040b185773341a8fdda2b Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 23 May 2020 14:34:38 +1000 Subject: [PATCH 2/6] New package: maturin-0.8.1 --- .../patches/cross-compile-setup-py.patch | 14 +++++++++++++ srcpkgs/maturin/template | 21 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 srcpkgs/maturin/patches/cross-compile-setup-py.patch create mode 100644 srcpkgs/maturin/template diff --git a/srcpkgs/maturin/patches/cross-compile-setup-py.patch b/srcpkgs/maturin/patches/cross-compile-setup-py.patch new file mode 100644 index 00000000000..e57189cb7ab --- /dev/null +++ b/srcpkgs/maturin/patches/cross-compile-setup-py.patch @@ -0,0 +1,14 @@ +--- setup.py 2020-04-30 22:36:01.000000000 +1000 ++++ setup.py 2020-05-20 14:31:40.404994499 +1000 +@@ -56,9 +56,9 @@ + "(https://www.rust-lang.org/tools/install) and try again" + ) + subprocess.check_call( +- ["cargo", "rustc", "--bin", "maturin", "--", "-C", "link-arg=-s"] ++ ["cargo", "rustc", "--bin", "maturin", "--release", "--target", os.environ["RUST_TARGET"], "--", "-C", "link-arg=-s", "-C", "linker=" + os.environ["CC"].split(" ", 1)[0]] + ) +- source = os.path.join(source_dir, "target", "debug", executable_name) ++ source = os.path.join(source_dir, "target", os.environ["RUST_TARGET"], "release", executable_name) + # run this after trying to build with cargo (as otherwise this leaves + # venv in a bad state: https://github.com/benfred/py-spy/issues/69) + install.run(self) diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template new file mode 100644 index 00000000000..7eba36204f9 --- /dev/null +++ b/srcpkgs/maturin/template @@ -0,0 +1,21 @@ +# Template file for 'maturin' +pkgname=maturin +version=0.8.1 +revision=1 +build_style=python3-module +hostmakedepends="cargo python3-setuptools python3-toml" +makedepends="rust rust-std llvm9" +short_desc="Build and publish crates with python bindings" +maintainer="fosslinux " +license="Apache-2.0, MIT" +homepage="https://github.com/PyO3/maturin" +distfiles="https://github.com/PyO3/maturin/archive/v${version}.tar.gz" +checksum=b72a9885cda3ba4e53906a43aab101acb790622218ade6405b2ddf1ef1461f8f + +post_install() { + # Dynamic detection of python version + PYTHON_VERSION=$(python3 --version | sed "s/^Python //" | rev | sed "s/^[0-9]*.//" | rev) + mkdir -p "${DESTDIR}/usr/lib/python${PYTHON_VERSION}/site-packages/" + mv "${DESTDIR}/maturin" "${DESTDIR}/usr/lib/python${PYTHON_VERSION}/site-packages/" + vlicense license-mit +} From 1bd1177a01ea7ce37e08a382eed7597a764ae457 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 23 May 2020 14:35:25 +1000 Subject: [PATCH 3/6] New package: mypy-protobuf-python-1.13 --- srcpkgs/mypy-protobuf-python/template | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 srcpkgs/mypy-protobuf-python/template diff --git a/srcpkgs/mypy-protobuf-python/template b/srcpkgs/mypy-protobuf-python/template new file mode 100644 index 00000000000..391d75f0c9e --- /dev/null +++ b/srcpkgs/mypy-protobuf-python/template @@ -0,0 +1,23 @@ +# Template file for 'mypy-protobuf-python' +# +# WARNING: THIS TEMPLATE SHOULD BE SYNCRONISED WITH mypy-protobuf-go +# +pkgname=mypy-protobuf-python +version=1.13 +revision=1 +wrksrc="mypy-protobuf-${version}" +build_wrksrc=python +build_style=python3-module +hostmakedepends="python3-setuptools" +depends="python3-mypy python3-typing_extensions python3-protobuf protobuf" +short_desc="Generate mypy stubs from protobufs - Python implementation" +maintainer="fosslinux " +license="Apache-2.0" +homepage="https://github.com/dropbox/mypy-protobuf" +distfiles="https://github.com/dropbox/mypy-protobuf/archive/v${version}.tar.gz" +checksum=7d86dfc076f8b51814fbfd3a66998a0b570fd1b82ebeda68ae6728cd538adb74 + +post_install() { + # We are not windows, remove the batch file + rm "${DESTDIR}/usr/bin/protoc_gen_mypy.bat" +} From 2005df10d61b46933f28eea0b17e701a09af437b Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 23 May 2020 14:35:37 +1000 Subject: [PATCH 4/6] New package: mypy-protobuf-go-1.13 --- .../patches/remote-go-improt.patch | 11 +++++++++++ srcpkgs/mypy-protobuf-go/template | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 srcpkgs/mypy-protobuf-go/patches/remote-go-improt.patch create mode 100644 srcpkgs/mypy-protobuf-go/template diff --git a/srcpkgs/mypy-protobuf-go/patches/remote-go-improt.patch b/srcpkgs/mypy-protobuf-go/patches/remote-go-improt.patch new file mode 100644 index 00000000000..300504bc70d --- /dev/null +++ b/srcpkgs/mypy-protobuf-go/patches/remote-go-improt.patch @@ -0,0 +1,11 @@ +--- go/src/protoc-gen-mypy/main.go.orig 2020-05-22 11:58:07.760761664 +1000 ++++ go/src/protoc-gen-mypy/main.go 2020-05-22 11:58:00.595762190 +1000 +@@ -6,7 +6,7 @@ + "sort" + "strings" + +- "proto/mypy" ++ "github.com/dropbox/mypy-protobuf/go/src/proto/mypy" + + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" diff --git a/srcpkgs/mypy-protobuf-go/template b/srcpkgs/mypy-protobuf-go/template new file mode 100644 index 00000000000..8f00e43d8a8 --- /dev/null +++ b/srcpkgs/mypy-protobuf-go/template @@ -0,0 +1,19 @@ +# Template file for 'mypy-protobuf-go' +# +# WARNING: THIS TEMPLATE SHOULD BE SYNCRONISED WITH mypy-protobuf-python +# +pkgname=mypy-protobuf-go +version=1.13 +revision=1 +wrksrc="mypy-protobuf-${version}" +build_style=go +go_import_path="github.com/dropbox/mypy-protobuf" +go_package="${go_import_path}/go/src/protoc-gen-mypy" +hostmakedepends="git" +depends="protobuf" +short_desc="Generate mypy stubs from protobufs - go implementation" +maintainer="fosslinux " +license="Apache-2.0" +homepage="https://github.com/dropbox/mypy-protobuf" +distfiles="https://github.com/dropbox/mypy-protobuf/archive/v${version}.tar.gz" +checksum=7d86dfc076f8b51814fbfd3a66998a0b570fd1b82ebeda68ae6728cd538adb74 From db650873d45635b6983c2d24717e827309303092 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 23 May 2020 14:33:36 +1000 Subject: [PATCH 5/6] New package: python-stringcase-1.2.0 --- srcpkgs/python-stringcase/template | 28 ++++++++++++++++++++++++++++ srcpkgs/python3-stringcase | 1 + 2 files changed, 29 insertions(+) create mode 100644 srcpkgs/python-stringcase/template create mode 120000 srcpkgs/python3-stringcase diff --git a/srcpkgs/python-stringcase/template b/srcpkgs/python-stringcase/template new file mode 100644 index 00000000000..849e677c784 --- /dev/null +++ b/srcpkgs/python-stringcase/template @@ -0,0 +1,28 @@ +# Template file for 'python-stringcase' +pkgname=python-stringcase +version=1.2.0 +revision=1 +wrksrc="stringcase-${version}" +build_style=python-module +hostmakedepends="python-devel python3-devel" +makedepends="${hostmakedepends}" +depends="python" +short_desc="String case converter for Python2" +maintainer="fosslinux " +license="MIT" +homepage="https://github.com/okunishinishi/python-stringcase" +distfiles="${PYPI_SITE}/s/stringcase/stringcase-${version}.tar.gz" +checksum=48a06980661908efe8d9d34eab2b6c13aefa2163b3ced26972902e3bdfd87008 + +post_install() { + vlicense LICENSE +} + +python3-stringcase_package() { + depends="python3" + short_desc="${short_desc/Python2/Python3}" + pkg_install() { + vmove usr/lib/python3* + vlicense LICENSE + } +} diff --git a/srcpkgs/python3-stringcase b/srcpkgs/python3-stringcase new file mode 120000 index 00000000000..53938bd1f0c --- /dev/null +++ b/srcpkgs/python3-stringcase @@ -0,0 +1 @@ +python-stringcase \ No newline at end of file From 7b045648ba4caa04579616dff5022d9c65af8114 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 23 May 2020 14:36:21 +1000 Subject: [PATCH 6/6] anki: update to 2.1.26 Has turned into a Bad Build System. Now uses rust nightly, python (with bindings!), qt5, nodejs... the list goes on. There are quite a few hacks and the like. --- .../anki/patches/rustc-cross-compile.patch | 11 +++ srcpkgs/anki/patches/vendored-deps.patch | 94 +++++++++++++++++++ srcpkgs/anki/template | 58 ++++++++++-- 3 files changed, 157 insertions(+), 6 deletions(-) create mode 100644 srcpkgs/anki/patches/rustc-cross-compile.patch create mode 100644 srcpkgs/anki/patches/vendored-deps.patch diff --git a/srcpkgs/anki/patches/rustc-cross-compile.patch b/srcpkgs/anki/patches/rustc-cross-compile.patch new file mode 100644 index 00000000000..15239ea4cf1 --- /dev/null +++ b/srcpkgs/anki/patches/rustc-cross-compile.patch @@ -0,0 +1,11 @@ +--- rspy/Makefile 2020-05-23 12:02:29.758286838 +1000 ++++ rspy/Makefile 2020-05-08 18:17:57.000000000 +1000 +@@ -69,7 +69,7 @@ + .build/build: $(DEPS) + touch ../proto/backend.proto + ${BUILD_VARIABLES} \ +- maturin build -i "${PYTHON_FILE}" -o "$(OUTDIR)" $(BUILDFLAGS) ++ maturin build -i "${PYTHON_FILE}" -o "$(OUTDIR)" $(BUILDFLAGS) --target $(RUST_TARGET) + touch $@ + + check: .build/check diff --git a/srcpkgs/anki/patches/vendored-deps.patch b/srcpkgs/anki/patches/vendored-deps.patch new file mode 100644 index 00000000000..1d2bc90ffb1 --- /dev/null +++ b/srcpkgs/anki/patches/vendored-deps.patch @@ -0,0 +1,94 @@ +diff -u -r Makefile Makefile +--- Makefile 2020-05-08 18:17:57.000000000 +1000 ++++ Makefile 2020-05-19 18:40:54.345223164 +1000 +@@ -92,7 +92,7 @@ + fi + + .PHONY: develop +-develop: pyenv buildhash prepare ++develop: buildhash prepare + @set -eu -o pipefail ${SHELLFLAGS}; \ + . "${ACTIVATE_SCRIPT}"; \ + for dir in $(DEVEL); do \ +diff -u -r pylib/Makefile pylib/Makefile +--- pylib/Makefile 2020-05-08 18:17:57.000000000 +1000 ++++ pylib/Makefile 2020-05-19 18:50:01.075182994 +1000 +@@ -52,7 +52,7 @@ + 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 .build/hooks + + # Checking + ###################### +diff -u -r qt/Makefile qt/Makefile +--- qt/Makefile 2020-05-08 18:17:57.000000000 +1000 ++++ qt/Makefile 2020-05-19 18:50:17.520181786 +1000 +@@ -64,7 +64,7 @@ + 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/hooks .build/i18n + + # Checking + ###################### +--- Makefile 2020-05-08 18:17:57.000000000 +1000 ++++ Makefile 2020-05-19 19:01:35.602131965 +1000 +@@ -122,7 +122,7 @@ + @echo "Build complete." + + .PHONY: build-rspy +-build-rspy: pyenv buildhash ++build-rspy: buildhash + @set -eu -o pipefail ${SHELLFLAGS}; \ + . "${ACTIVATE_SCRIPT}"; \ + $(SUBMAKE) -C rspy build BUILDFLAGS="$(BUILDFLAGS)" +--- Makefile 2020-05-19 19:41:44.191955000 +1000 ++++ Makefile 2020-05-19 19:42:21.423952264 +1000 +@@ -124,19 +124,16 @@ + .PHONY: build-rspy + build-rspy: buildhash + @set -eu -o pipefail ${SHELLFLAGS}; \ +- . "${ACTIVATE_SCRIPT}"; \ + $(SUBMAKE) -C rspy build BUILDFLAGS="$(BUILDFLAGS)" + + .PHONY: build-pylib + build-pylib: + @set -eu -o pipefail ${SHELLFLAGS}; \ +- . "${ACTIVATE_SCRIPT}"; \ + $(SUBMAKE) -C pylib build + + .PHONY: build-qt + build-qt: + @set -eu -o pipefail ${SHELLFLAGS}; \ +- . "${ACTIVATE_SCRIPT}"; \ + $(SUBMAKE) -C qt build + + .PHONY: clean +--- rspy/Makefile 2020-05-21 20:06:35.945720983 +1000 ++++ rspy/Makefile 2020-05-21 20:07:54.295720504 +1000 +@@ -86,10 +86,10 @@ + RUST_TOOLCHAIN := $(shell cat rust-toolchain) + + .build/tools: requirements.txt rust-toolchain +- python -m pip install -r requirements.txt + rustup toolchain install $(RUST_TOOLCHAIN) + rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN) + rustup component add clippy-preview --toolchain $(RUST_TOOLCHAIN) ++ rustup target add $(RUST_TARGET) + @touch $@ + + # we should not call clippy because it break things when running make check Mac OS +--- pylib/Makefile 2020-05-22 08:46:14.988607539 +1000 ++++ pylib/Makefile 2020-05-22 08:46:38.376605821 +1000 +@@ -41,7 +41,7 @@ + + 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 diff --git a/srcpkgs/anki/template b/srcpkgs/anki/template index 680e008a9d4..d900ec19ce2 100644 --- a/srcpkgs/anki/template +++ b/srcpkgs/anki/template @@ -1,10 +1,14 @@ # Template file for 'anki' pkgname=anki -version=2.1.15 -revision=2 -archs=noarch +version=2.1.26 +revision=1 build_style=gnu-makefile pycompile_dirs="/usr/share/anki/anki /usr/share/anki/aqt" +# rustup: anki needs nightly ... :( +hostmakedepends="git python3 rustup maturin which protobuf + mypy-protobuf-python python3-stringcase black python3-wheel + rsync nodejs python3-PyQt5-devel-tools gettext + qt5-translations" depends="python3-PyQt5-webengine python3-requests python3-SQLAlchemy python3-PyAudio python3-mpv python3-Markdown python3-send2trash python3-BeautifulSoup4 python3-decorator python3-jsonschema" @@ -13,11 +17,53 @@ maintainer="Steve Prybylski " license="AGPL-3.0-or-later" homepage="https://apps.ankiweb.net" changelog="https://apps.ankiweb.net/docs/changes.html" -distfiles="https://apps.ankiweb.net/downloads/current/anki-${version}-source.tgz" -checksum=5a53760164c77d619f55107a13099cffe620566a7f610b61b6c4b52487f3bb89 - +distfiles="https://github.com/ankitects/anki/archive/${version}.tar.gz" +checksum=f5a0c41f3eebe0e77de9d46f2a5cbbe20f7c3a4787f0f02e1d33f298428acbdf python_version=3 +# When a non-clean masterdir is used, rust is often left over from a +# previous rust-enabled build. Unfortunatly, xbps-src dosen't seem +# to clean out rust -.- So, use /usr/rustup, to avoid this issue. +export PATH=/usr/rustup/bin:${PATH} +export LD_LIBRARY_PATH=/usr/rustup/lib:${LD_LIBRARY_PATH} +export CARGO_HOME=/usr/rustup +export RUSTUP_HOME=/usr/rustup + +pre_configure() { + # If do_clean didn't run last time, we are stuffed. Run do_clean now. + do_clean || true + printf "1\\n" | rustup-init +} + +pre_build() { + mkdir -p dist + make prepare +} + +do_build() { + RUSTFLAGS="-C target-feature=-crt-static" make build +} + +do_install() { + pushd pylib + python3 setup.py install --prefix=/usr --root=${DESTDIR} + popd + + pushd qt + python3 setup.py install --prefix=/usr --root=${DESTDIR} + popd + + # Copied from arch's PKGBUILD + install -Dm755 qt/runanki "${DESTDIR}/usr/bin/anki" + install -Dm644 qt/anki.desktop "${DESTDIR}/usr/share/applications/anki.desktop" + install -Dm644 qt/anki.png "${DESTDIR}/usr/share/pixmaps/anki.png" +} + post_install() { vlicense LICENSE } + +# Remove rustup +do_clean() { + rm -rf /usr/rustup +}