Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: python3-adblock-0.4.2
@ 2021-02-01 21:01 ahesford
  2021-02-01 21:02 ` ahesford
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: ahesford @ 2021-02-01 21:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

There is a new pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages adblock
https://github.com/void-linux/void-packages/pull/28396

New package: python3-adblock-0.4.2
This supersedes #28380 and #27490.

Compiles natively on `x86_64*`, `aarch64` and `armv7l`. Works as expected on `x86_64` and `aarch64`. I haven't tried the other ARM architectures.

I can't figure out what happens with `openssl-sys` when cross-compiling; the flags passed to GCC include `-m64`, which are rejected by the ARM compilers. On `i686`, the build fails with SIGABRT when trying to build the `psl` crate. The `openssl-sys` issue appears even if I try using the built-in `cargo` build style rather than `maturin`, so this is some configuration problem that extends beyond `maturin`.

Any help fixing these issue would be appreciated. If we can't sort them out, `broken` on `i686` and `nocross` will be sufficient for now.

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR


A patch file from https://github.com/void-linux/void-packages/pull/28396.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-adblock-28396.patch --]
[-- Type: text/x-diff, Size: 3406 bytes --]

From 26080c8cebee773a1e32352e050fc83ebcb0d594 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 11:13:44 +0300
Subject: [PATCH 1/2] New package: maturin-0.9.0

---
 srcpkgs/maturin/template | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 srcpkgs/maturin/template

diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template
new file mode 100644
index 00000000000..34b9556bb91
--- /dev/null
+++ b/srcpkgs/maturin/template
@@ -0,0 +1,28 @@
+# Template file for 'maturin'
+pkgname=maturin
+version=0.9.0
+revision=1
+build_style=cargo
+hostmakedepends="python3-setuptools python3-toml"
+depends="python3-toml"
+short_desc="Build and publish crates as python packages"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/PyO3/maturin"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
+
+post_patch() {
+	# setup.py is broken, just use it for the pure python part
+	vsed -e 's/cmdclass.*/packages=["maturin"],/' -i setup.py
+}
+
+post_build() {
+	# python package is pure; the cross environment is not relevant
+	python3 setup.py build
+}
+
+post_install() {
+	vlicense license-mit LICENSE-MIT
+	python3 setup.py install --prefix=/usr --root=${DESTDIR}
+}

From 4b8005562d50c84d839a0776ea8a7668882e0c16 Mon Sep 17 00:00:00 2001
From: FollieHiyuki <folliekazetani@protonmail.com>
Date: Mon, 1 Feb 2021 13:50:32 +0300
Subject: [PATCH 2/2] New package: python3-adblock-0.4.2

---
 srcpkgs/python3-adblock/template | 48 ++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 srcpkgs/python3-adblock/template

diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
new file mode 100644
index 00000000000..0602a510fe1
--- /dev/null
+++ b/srcpkgs/python3-adblock/template
@@ -0,0 +1,48 @@
+# Template file for 'python3-adblock'
+pkgname=python3-adblock
+version=0.4.2
+revision=1
+wrksrc="${pkgname/python3/python}-${version}"
+build_style=python3-pep517
+build_helper="rust"
+hostmakedepends="maturin pkg-config cargo"
+makedepends="libressl-devel python3-devel"
+depends="python3"
+checkdepends="python3-pytest"
+short_desc="Brave's adblock library in Python"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/ArniDagur/python-adblock"
+distfiles="${homepage}/archive/${version}.tar.gz"
+checksum=06de6074e6cfe889fc0383cc929a5a2306570251c14e51abbfcedd328b83e0e9
+nocross="openssl-sys gets wrong compiler flags on cross targets"
+
+case "$XBPS_TARGET_MACHINE" in
+	i686*) broken="compiler throws SIGABRT on the psl crate" ;;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+	makedepends+=" rust-std"
+	export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
+	export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
+fi
+
+do_build() {
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		RUSTFLAGS+=" -C target-feature=-crt-static"
+	fi
+
+	mkdir -p build
+	maturin build -o . --release --target "${RUST_TARGET}" \
+		--rustc-extra-args="$RUSTFLAGS" --manylinux off
+}
+
+pre_check() {
+	# Tests require the compiled extension
+	cp target/release/libadblock.so adblock/adblock.so
+}
+
+post_install() {
+	vlicense LICENSE-MIT
+	chmod 755 ${DESTDIR}/${py3_sitelib}/${pkgname#python3-}/*.so
+}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
@ 2021-02-01 21:02 ` ahesford
  2021-02-01 21:09 ` [PR REVIEW] " ericonr
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-01 21:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771155801

Comment:
@ericonr Please test operation on `x86_64-musl` and, if you're interested, help sort through the `openssl-sys` issue.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
  2021-02-01 21:02 ` ahesford
@ 2021-02-01 21:09 ` ericonr
  2021-02-01 21:10 ` ahesford
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r568141069

Comment:
Does this make it link in static openssl?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
  2021-02-01 21:02 ` ahesford
  2021-02-01 21:09 ` [PR REVIEW] " ericonr
@ 2021-02-01 21:10 ` ahesford
  2021-02-01 21:14 ` ericonr
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-01 21:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r568141878

Comment:
No idea, I cargo culted that from the older PRs. You can see if it builds without that feature if you like.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (2 preceding siblings ...)
  2021-02-01 21:10 ` ahesford
@ 2021-02-01 21:14 ` ericonr
  2021-02-01 21:15 ` ericonr
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r568141069

Comment:
Does this make it link in static openssl? <-- just checked, the final package doesn't depend on any dynamic libraries besides musl and libgcc

Also, can you add a `# FIXME` about the issue/where you found the workaround?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (3 preceding siblings ...)
  2021-02-01 21:14 ` ericonr
@ 2021-02-01 21:15 ` ericonr
  2021-02-01 21:22 ` ericonr
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r568144010

Comment:
Ah, ok.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (4 preceding siblings ...)
  2021-02-01 21:15 ` ericonr
@ 2021-02-01 21:22 ` ericonr
  2021-02-01 21:23 ` ericonr
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r568148014

Comment:
Seems to build and work just as well without that...

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (5 preceding siblings ...)
  2021-02-01 21:22 ` ericonr
@ 2021-02-01 21:23 ` ericonr
  2021-02-01 21:24 ` ericonr
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r568148690

Comment:
Though it's still not linked against libssl :/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (6 preceding siblings ...)
  2021-02-01 21:23 ` ericonr
@ 2021-02-01 21:24 ` ericonr
  2021-02-01 21:25 ` ericonr
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771168447

Comment:
(why is this broken in CI but not locally??)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (7 preceding siblings ...)
  2021-02-01 21:24 ` ericonr
@ 2021-02-01 21:25 ` ericonr
  2021-02-01 21:35 ` ericonr
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771168447

Comment:
(why is this broken in CI but not locally??)

EDIT: it fails in `do_check`, so it seems they use unstable features in their tests. Probably best to just disable for now.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (8 preceding siblings ...)
  2021-02-01 21:25 ` ericonr
@ 2021-02-01 21:35 ` ericonr
  2021-02-01 21:46 ` ericonr
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771174763

Comment:
About cross, when trying a build for armv7l-musl:

```
  TARGET = Some("x86_64-unknown-linux-musl")
  HOST = Some("x86_64-unknown-linux-musl")
  CC_x86_64-unknown-linux-musl = None
  CC_x86_64_unknown_linux_musl = None
  HOST_CC = None
  CC = Some("armv7l-linux-musleabihf-gcc")
  CFLAGS_x86_64-unknown-linux-musl = None
  CFLAGS_x86_64_unknown_linux_musl = None
  HOST_CFLAGS = None
  CFLAGS = Some("-fstack-clash-protection -D_FORTIFY_SOURCE=2 -O2 -pipe -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard   -I/usr/armv7l-linux-musleabihf/usr/include")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "armv7l-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-fstack-clash-protection" "-D_FORTIFY_SOURCE=2" "-O2" "-pipe" "-march=armv7-a" "-mfpu=vfpv3" "-mfloat-abi=hard" "-I/usr/armv7l-linux-musleabihf/usr/include" "-I" "/usr/armv7l-linux-musleabihf/usr/include" "-E" "build/expando.c"
```

What this means: maturin isn't passing target to cargo correctly; since `TARGET` is incorrect, together with `CARGO_CFG_TARGET_FEATURE`. Also, `cargo` unconditionally adds `"-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64"` to the compiler command line.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (9 preceding siblings ...)
  2021-02-01 21:35 ` ericonr
@ 2021-02-01 21:46 ` ericonr
  2021-02-01 21:48 ` ericonr
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771174763

Comment:
About cross, when trying a build for armv7l-musl:

```
  TARGET = Some("x86_64-unknown-linux-musl")
  HOST = Some("x86_64-unknown-linux-musl")
  CC_x86_64-unknown-linux-musl = None
  CC_x86_64_unknown_linux_musl = None
  HOST_CC = None
  CC = Some("armv7l-linux-musleabihf-gcc")
  CFLAGS_x86_64-unknown-linux-musl = None
  CFLAGS_x86_64_unknown_linux_musl = None
  HOST_CFLAGS = None
  CFLAGS = Some("-fstack-clash-protection -D_FORTIFY_SOURCE=2 -O2 -pipe -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard   -I/usr/armv7l-linux-musleabihf/usr/include")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "armv7l-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-fstack-clash-protection" "-D_FORTIFY_SOURCE=2" "-O2" "-pipe" "-march=armv7-a" "-mfpu=vfpv3" "-mfloat-abi=hard" "-I/usr/armv7l-linux-musleabihf/usr/include" "-I" "/usr/armv7l-linux-musleabihf/usr/include" "-E" "build/expando.c"
```

What this means: maturin isn't passing target to cargo correctly; since `TARGET` is incorrect, together with `CARGO_CFG_TARGET_FEATURE`. Also, `cargo` unconditionally adds `"-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64"` to the compiler command line.

Fruthermore, `openssl-sys` gets into the build via addr -> psl -> psl-codegen -> psl-lexer -> native-tls -> openssl. I have no idea if it's truly necessary, but if anything those are the scripts to investigate.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (10 preceding siblings ...)
  2021-02-01 21:46 ` ericonr
@ 2021-02-01 21:48 ` ericonr
  2021-02-02  1:42 ` ericonr
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-01 21:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1782 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771174763

Comment:
About cross, when trying a build for armv7l-musl:

```
  TARGET = Some("x86_64-unknown-linux-musl")
  HOST = Some("x86_64-unknown-linux-musl")
  CC_x86_64-unknown-linux-musl = None
  CC_x86_64_unknown_linux_musl = None
  HOST_CC = None
  CC = Some("armv7l-linux-musleabihf-gcc")
  CFLAGS_x86_64-unknown-linux-musl = None
  CFLAGS_x86_64_unknown_linux_musl = None
  HOST_CFLAGS = None
  CFLAGS = Some("-fstack-clash-protection -D_FORTIFY_SOURCE=2 -O2 -pipe -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard   -I/usr/armv7l-linux-musleabihf/usr/include")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "armv7l-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-fstack-clash-protection" "-D_FORTIFY_SOURCE=2" "-O2" "-pipe" "-march=armv7-a" "-mfpu=vfpv3" "-mfloat-abi=hard" "-I/usr/armv7l-linux-musleabihf/usr/include" "-I" "/usr/armv7l-linux-musleabihf/usr/include" "-E" "build/expando.c"
```

What this means: maturin isn't passing target to cargo correctly; since `TARGET` is incorrect, together with `CARGO_CFG_TARGET_FEATURE`. Also, `cargo` unconditionally adds `"-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64"` to the compiler command line.

Fruthermore, `openssl-sys` gets into the build via addr -> psl -> psl-codegen -> psl-lexer -> native-tls -> openssl. I have no idea if it's truly necessary, but if anything those are the scripts to investigate.

I'm not sure it's really maturin's fault, since it shows an appropriate cargo command line.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (11 preceding siblings ...)
  2021-02-01 21:48 ` ericonr
@ 2021-02-02  1:42 ` ericonr
  2021-02-02 15:34 ` [PR PATCH] [Updated] " ahesford
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-02  1:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771174763

Comment:
About cross, when trying a build for armv7l-musl:

```
  TARGET = Some("x86_64-unknown-linux-musl")
  HOST = Some("x86_64-unknown-linux-musl")
  CC_x86_64-unknown-linux-musl = None
  CC_x86_64_unknown_linux_musl = None
  HOST_CC = None
  CC = Some("armv7l-linux-musleabihf-gcc")
  CFLAGS_x86_64-unknown-linux-musl = None
  CFLAGS_x86_64_unknown_linux_musl = None
  HOST_CFLAGS = None
  CFLAGS = Some("-fstack-clash-protection -D_FORTIFY_SOURCE=2 -O2 -pipe -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard   -I/usr/armv7l-linux-musleabihf/usr/include")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "armv7l-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-fstack-clash-protection" "-D_FORTIFY_SOURCE=2" "-O2" "-pipe" "-march=armv7-a" "-mfpu=vfpv3" "-mfloat-abi=hard" "-I/usr/armv7l-linux-musleabihf/usr/include" "-I" "/usr/armv7l-linux-musleabihf/usr/include" "-E" "build/expando.c"
```

What this means: maturin isn't passing target to cargo correctly; since `TARGET` is incorrect, together with `CARGO_CFG_TARGET_FEATURE`. Also, `cargo` unconditionally adds `"-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64"` to the compiler command line.

Fruthermore, `openssl-sys` gets into the build via addr -> psl -> psl-codegen -> psl-lexer -> native-tls -> openssl. I have no idea if it's truly necessary, but if anything those are the scripts to investigate.

I'm not sure it's really maturin's fault, since it shows an appropriate cargo command line.

In a way, it's this line to blame: https://github.com/ArniDagur/python-adblock/blob/master/Cargo.toml#L25 . If you remove `embedded-domain-resolver`, it won't pull in the library mess anymore, but I doubt it will be truly functional either.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (12 preceding siblings ...)
  2021-02-02  1:42 ` ericonr
@ 2021-02-02 15:34 ` ahesford
  2021-02-02 15:49 ` ahesford
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-02 15:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages adblock
https://github.com/void-linux/void-packages/pull/28396

New package: python3-adblock-0.4.2
This supersedes #28380 and #27490.

Compiles natively on `x86_64*`, `aarch64` and `armv7l`. Works as expected on `x86_64` and `aarch64`. I haven't tried the other ARM architectures.

I can't figure out what happens with `openssl-sys` when cross-compiling; the flags passed to GCC include `-m64`, which are rejected by the ARM compilers. On `i686`, the build fails with SIGABRT when trying to build the `psl` crate. The `openssl-sys` issue appears even if I try using the built-in `cargo` build style rather than `maturin`, so this is some configuration problem that extends beyond `maturin`.

Any help fixing these issue would be appreciated. If we can't sort them out, `broken` on `i686` and `nocross` will be sufficient for now.

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR


A patch file from https://github.com/void-linux/void-packages/pull/28396.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-adblock-28396.patch --]
[-- Type: text/x-diff, Size: 3425 bytes --]

From 29eecdef1ceeb342c78e5995d48d5772b6b04588 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 11:13:44 +0300
Subject: [PATCH 1/2] New package: maturin-0.9.0

---
 srcpkgs/maturin/template | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 srcpkgs/maturin/template

diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template
new file mode 100644
index 00000000000..fefdd2b1757
--- /dev/null
+++ b/srcpkgs/maturin/template
@@ -0,0 +1,32 @@
+# Template file for 'maturin'
+pkgname=maturin
+version=0.9.0
+revision=1
+build_style=cargo
+hostmakedepends="python3-setuptools python3-toml"
+depends="python3-toml"
+short_desc="Build and publish crates as python packages"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/PyO3/maturin"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
+
+post_patch() {
+	# setup.py is broken, just use it for the pure python part
+	vsed -e 's/cmdclass.*/packages=["maturin"],/' -i setup.py
+}
+
+post_build() {
+	# python package is pure; the cross environment is not relevant
+	python3 setup.py build
+}
+
+do_check() {
+	: tests fail to build
+}
+
+post_install() {
+	vlicense license-mit LICENSE-MIT
+	python3 setup.py install --prefix=/usr --root=${DESTDIR}
+}

From 23f36433edbc0dc9a0ca2550823f5df36a4be9ea Mon Sep 17 00:00:00 2001
From: FollieHiyuki <folliekazetani@protonmail.com>
Date: Mon, 1 Feb 2021 13:50:32 +0300
Subject: [PATCH 2/2] New package: python3-adblock-0.4.2

---
 srcpkgs/python3-adblock/template | 42 ++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 srcpkgs/python3-adblock/template

diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
new file mode 100644
index 00000000000..56ffaf53c46
--- /dev/null
+++ b/srcpkgs/python3-adblock/template
@@ -0,0 +1,42 @@
+# Template file for 'python3-adblock'
+pkgname=python3-adblock
+version=0.4.2
+revision=1
+wrksrc="${pkgname/python3/python}-${version}"
+build_style=python3-pep517
+build_helper="rust"
+hostmakedepends="maturin pkg-config cargo"
+makedepends="libressl-devel python3-devel"
+depends="python3"
+checkdepends="python3-pytest"
+short_desc="Brave's adblock library in Python"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/ArniDagur/python-adblock"
+distfiles="${homepage}/archive/${version}.tar.gz"
+checksum=06de6074e6cfe889fc0383cc929a5a2306570251c14e51abbfcedd328b83e0e9
+nocross="openssl-sys gets wrong compiler flags on cross targets"
+
+case "$XBPS_TARGET_MACHINE" in
+	i686*) broken="compiler throws SIGABRT on the psl crate" ;;
+esac
+
+do_build() {
+	mkdir -p build
+	maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
+
+	# Drop platform specifiers from the wheel; pip will refuse to install,
+	# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
+	# armv7l. The wheel is correct; no need for name compatibility checks.
+	mv adblock-${version}-*.whl adblock-${version}-py3-none-any.whl
+}
+
+pre_check() {
+	# Tests require the compiled extension
+	cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so
+}
+
+post_install() {
+	vlicense LICENSE-MIT
+	chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so
+}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (13 preceding siblings ...)
  2021-02-02 15:34 ` [PR PATCH] [Updated] " ahesford
@ 2021-02-02 15:49 ` ahesford
  2021-02-03 22:06 ` [PR PATCH] [Updated] " ahesford
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-02 15:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-771731631

Comment:
I cleaned up the templates a bit. Everything builds natively for `aarch64*` and `armv7l*`; I'm trying to test `armv6l*` masterdirs for now. After spending too much time trying to track down the cross issue with `openssl-sys`, I'm prepared to give up and leave this `nocross`.

The `native-tls` dependency can be dropped if the default `remote_list` feature of `psl-lexer` can be disabled, but I have no idea how to disable a feature that far down the dependency chain without forking everything up the chain. If we can figure that out, we can probably get cross-building working, but I don't know if that breaks important functionality.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (14 preceding siblings ...)
  2021-02-02 15:49 ` ahesford
@ 2021-02-03 22:06 ` ahesford
  2021-02-04  1:23 ` [PR REVIEW] " ericonr
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-03 22:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages adblock
https://github.com/void-linux/void-packages/pull/28396

New package: python3-adblock-0.4.2
This supersedes #28380 and #27490.

Compiles natively on `x86_64*`, `aarch64` and `armv7l`. Works as expected on `x86_64` and `aarch64`. I haven't tried the other ARM architectures.

I can't figure out what happens with `openssl-sys` when cross-compiling; the flags passed to GCC include `-m64`, which are rejected by the ARM compilers. On `i686`, the build fails with SIGABRT when trying to build the `psl` crate. The `openssl-sys` issue appears even if I try using the built-in `cargo` build style rather than `maturin`, so this is some configuration problem that extends beyond `maturin`.

Any help fixing these issue would be appreciated. If we can't sort them out, `broken` on `i686` and `nocross` will be sufficient for now.

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR


A patch file from https://github.com/void-linux/void-packages/pull/28396.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-adblock-28396.patch --]
[-- Type: text/x-diff, Size: 3706 bytes --]

From 29eecdef1ceeb342c78e5995d48d5772b6b04588 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 11:13:44 +0300
Subject: [PATCH 1/2] New package: maturin-0.9.0

---
 srcpkgs/maturin/template | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 srcpkgs/maturin/template

diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template
new file mode 100644
index 00000000000..fefdd2b1757
--- /dev/null
+++ b/srcpkgs/maturin/template
@@ -0,0 +1,32 @@
+# Template file for 'maturin'
+pkgname=maturin
+version=0.9.0
+revision=1
+build_style=cargo
+hostmakedepends="python3-setuptools python3-toml"
+depends="python3-toml"
+short_desc="Build and publish crates as python packages"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/PyO3/maturin"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
+
+post_patch() {
+	# setup.py is broken, just use it for the pure python part
+	vsed -e 's/cmdclass.*/packages=["maturin"],/' -i setup.py
+}
+
+post_build() {
+	# python package is pure; the cross environment is not relevant
+	python3 setup.py build
+}
+
+do_check() {
+	: tests fail to build
+}
+
+post_install() {
+	vlicense license-mit LICENSE-MIT
+	python3 setup.py install --prefix=/usr --root=${DESTDIR}
+}

From 8ce64bd0ac07bfc51047c239362944cf938cb0ab Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 13:50:32 +0300
Subject: [PATCH 2/2] New package: python3-adblock-0.4.2

---
 srcpkgs/python3-adblock/template | 51 ++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 srcpkgs/python3-adblock/template

diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
new file mode 100644
index 00000000000..f3c02883768
--- /dev/null
+++ b/srcpkgs/python3-adblock/template
@@ -0,0 +1,51 @@
+# Template file for 'python3-adblock'
+pkgname=python3-adblock
+version=0.4.2
+revision=1
+wrksrc="${pkgname/python3/python}-${version}"
+build_style=python3-pep517
+build_helper="rust"
+hostmakedepends="maturin pkg-config cargo libressl-devel"
+makedepends="libressl-devel python3-devel"
+depends="python3"
+checkdepends="python3-pytest"
+short_desc="Brave's adblock library in Python"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/ArniDagur/python-adblock"
+distfiles="${homepage}/archive/${version}.tar.gz"
+checksum=06de6074e6cfe889fc0383cc929a5a2306570251c14e51abbfcedd328b83e0e9
+
+case "$XBPS_TARGET_MACHINE" in
+	i686*) broken="compiler throws SIGABRT on the psl crate" ;;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+	makedepends+=" rust-std"
+	export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
+	export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
+
+	# openssl-sys tries to build for host, but without HOST_CC and
+	# HOST_CFLAGS, it mixes host flags with target compiler
+	export HOST_CC=gcc
+	export HOST_CFLAGS=-O2
+fi
+
+do_build() {
+	maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
+
+	# Drop platform specifiers from the wheel; pip will refuse to install,
+	# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
+	# armv7l. The wheel is correct; no need for name compatibility checks.
+	mv adblock-${version}-*.whl adblock-${version}-py3-none-any.whl
+}
+
+pre_check() {
+	# Tests require the compiled extension
+	cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so
+}
+
+post_install() {
+	vlicense LICENSE-MIT
+	chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so
+}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (15 preceding siblings ...)
  2021-02-03 22:06 ` [PR PATCH] [Updated] " ahesford
@ 2021-02-04  1:23 ` ericonr
  2021-02-04  1:23 ` ericonr
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-04  1:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r569875188

Comment:
It did work on armv7l, right? So the issue isn't 32-bit wordsize.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (18 preceding siblings ...)
  2021-02-04  1:23 ` ericonr
@ 2021-02-04  1:23 ` ericonr
  2021-02-04  1:34 ` ericonr
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-04  1:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r569875750

Comment:
IMO include this in the build style already.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (17 preceding siblings ...)
  2021-02-04  1:23 ` ericonr
@ 2021-02-04  1:23 ` ericonr
  2021-02-04  1:23 ` ericonr
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-04  1:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r569876155

Comment:
I have confirmed, `libressl-devel` is necessary for target as well. You probably already knew that.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR REVIEW] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (16 preceding siblings ...)
  2021-02-04  1:23 ` [PR REVIEW] " ericonr
@ 2021-02-04  1:23 ` ericonr
  2021-02-04  1:23 ` ericonr
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-04  1:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#discussion_r569876642

Comment:
Should mention that they fail to build because they use unstable features. That way people might remember to try and re-enable them when we get a new rust version.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (19 preceding siblings ...)
  2021-02-04  1:23 ` ericonr
@ 2021-02-04  1:34 ` ericonr
  2021-02-04  4:21 ` [PR PATCH] [Updated] " ahesford
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ericonr @ 2021-02-04  1:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-772957386

Comment:
To remove rustls: 

```
diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template
index fefdd2b175..9043a551c3 100644
--- a/srcpkgs/maturin/template
+++ b/srcpkgs/maturin/template
@@ -3,7 +3,11 @@ pkgname=maturin
 version=0.9.0
 revision=1
 build_style=cargo
+# take a look at Cargo.toml ever so often to check for new features
+# we do this to disable the 'rustls' feature, which leads to bad platform compatibility
+configure_args="--no-default-features --features auditwheel,log,upload,human-panic"
 hostmakedepends="python3-setuptools python3-toml"
+makedepends="libressl-devel"
 depends="python3-toml"
 short_desc="Build and publish crates as python packages"
 maintainer="Andrew J. Hesford <ajh@sideband.org>"
```

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (20 preceding siblings ...)
  2021-02-04  1:34 ` ericonr
@ 2021-02-04  4:21 ` ahesford
  2021-02-04  4:22 ` ahesford
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-04  4:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages adblock
https://github.com/void-linux/void-packages/pull/28396

New package: python3-adblock-0.4.2
This supersedes #28380 and #27490.

Compiles natively on `x86_64*`, `aarch64` and `armv7l`. Works as expected on `x86_64` and `aarch64`. I haven't tried the other ARM architectures.

I can't figure out what happens with `openssl-sys` when cross-compiling; the flags passed to GCC include `-m64`, which are rejected by the ARM compilers. On `i686`, the build fails with SIGABRT when trying to build the `psl` crate. The `openssl-sys` issue appears even if I try using the built-in `cargo` build style rather than `maturin`, so this is some configuration problem that extends beyond `maturin`.

Any help fixing these issue would be appreciated. If we can't sort them out, `broken` on `i686` and `nocross` will be sufficient for now.

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR


A patch file from https://github.com/void-linux/void-packages/pull/28396.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-adblock-28396.patch --]
[-- Type: text/x-diff, Size: 5604 bytes --]

From ac7abcaee4ca0e495cc8ccca00a2aa57a6225861 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 3 Feb 2021 22:41:02 -0500
Subject: [PATCH 1/3] build-helper/rust: define HOST_CC and HOST_CFLAGS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The cc-rs crate will try to guess the host compiler and use default
flags these are not specifically set. The default behavior is wrong in
Void cross-compilation environments. Explicitly define HOST_CC=gcc and
use innocuous HOST_CFLAGS=-O2 just to thwart the bad defaults.

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
---
 common/build-helper/rust.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index 6fcd3bd7d9e..431cb5f0fd4 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -17,6 +17,12 @@ if [ "$CROSS_BUILD" ]; then
 	# [build]
 	# target = ${RUST_TARGET}
 	export CARGO_BUILD_TARGET="$RUST_TARGET"
+
+	# If cc-rs needs to build host binaries, it guesses the compiler and
+	# uses default (wrong) flags unless they are specified explicitly;
+	# innocuous flags are used here just to disable its defaults
+	export HOST_CC="gcc"
+	export HOST_CFLAGS="-O2"
 else
 	unset CARGO_BUILD_TARGET
 fi

From b6d6a406d3129d042492674493572cbed1bb94c4 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 11:13:44 +0300
Subject: [PATCH 2/3] New package: maturin-0.9.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
---
 srcpkgs/maturin/template | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 srcpkgs/maturin/template

diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template
new file mode 100644
index 00000000000..cce53cf58cc
--- /dev/null
+++ b/srcpkgs/maturin/template
@@ -0,0 +1,36 @@
+# Template file for 'maturin'
+pkgname=maturin
+version=0.9.0
+revision=1
+build_style=cargo
+# Disable the 'rustls' feature, which leads to bad platform compatibility
+# The list of enabled features should be reconciled with each new release
+configure_args="--no-default-features --features auditwheel,log,upload,human-panic"
+hostmakedepends="python3-setuptools python3-toml"
+makedepends="libressl-devel"
+depends="python3-toml"
+short_desc="Build and publish crates as python packages"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/PyO3/maturin"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
+
+post_patch() {
+	# setup.py is broken, just use it for the pure python part
+	vsed -e 's/cmdclass.*/packages=["maturin"],/' -i setup.py
+}
+
+post_build() {
+	# python package is pure; the cross environment is not relevant
+	python3 setup.py build
+}
+
+do_check() {
+	echo "Tests use unstable features and fail to build; skipping"
+}
+
+post_install() {
+	vlicense license-mit LICENSE-MIT
+	python3 setup.py install --prefix=/usr --root=${DESTDIR}
+}

From 709def161ba041e70c58a93395a92b3587a90b40 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 13:50:32 +0300
Subject: [PATCH 3/3] New package: python3-adblock-0.4.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
---
 srcpkgs/python3-adblock/template | 46 ++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 srcpkgs/python3-adblock/template

diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
new file mode 100644
index 00000000000..c1200f89027
--- /dev/null
+++ b/srcpkgs/python3-adblock/template
@@ -0,0 +1,46 @@
+# Template file for 'python3-adblock'
+pkgname=python3-adblock
+version=0.4.2
+revision=1
+wrksrc="${pkgname/python3/python}-${version}"
+build_style=python3-pep517
+build_helper="rust"
+hostmakedepends="maturin pkg-config cargo libressl-devel"
+makedepends="libressl-devel python3-devel"
+depends="python3"
+checkdepends="python3-pytest"
+short_desc="Brave's adblock library in Python"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/ArniDagur/python-adblock"
+distfiles="${homepage}/archive/${version}.tar.gz"
+checksum=06de6074e6cfe889fc0383cc929a5a2306570251c14e51abbfcedd328b83e0e9
+
+case "$XBPS_TARGET_MACHINE" in
+	i686*) broken="compiler throws SIGABRT on the psl crate" ;;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+	makedepends+=" rust-std"
+	export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
+	export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
+fi
+
+do_build() {
+	maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
+
+	# Drop platform specifiers from the wheel; pip will refuse to install,
+	# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
+	# armv7l. The wheel is correct; no need for name compatibility checks.
+	mv adblock-${version}-*.whl adblock-${version}-py3-none-any.whl
+}
+
+pre_check() {
+	# Tests require the compiled extension
+	cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so
+}
+
+post_install() {
+	vlicense LICENSE-MIT
+	chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so
+}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (21 preceding siblings ...)
  2021-02-04  4:21 ` [PR PATCH] [Updated] " ahesford
@ 2021-02-04  4:22 ` ahesford
  2021-02-04  4:25 ` ahesford
  2021-02-04  5:33 ` [PR PATCH] [Closed]: " ahesford
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-04  4:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages adblock
https://github.com/void-linux/void-packages/pull/28396

New package: python3-adblock-0.4.2
This supersedes #28380 and #27490.

Compiles natively on `x86_64*`, `aarch64` and `armv7l`. Works as expected on `x86_64` and `aarch64`. I haven't tried the other ARM architectures.

I can't figure out what happens with `openssl-sys` when cross-compiling; the flags passed to GCC include `-m64`, which are rejected by the ARM compilers. On `i686`, the build fails with SIGABRT when trying to build the `psl` crate. The `openssl-sys` issue appears even if I try using the built-in `cargo` build style rather than `maturin`, so this is some configuration problem that extends beyond `maturin`.

Any help fixing these issue would be appreciated. If we can't sort them out, `broken` on `i686` and `nocross` will be sufficient for now.

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR


A patch file from https://github.com/void-linux/void-packages/pull/28396.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-adblock-28396.patch --]
[-- Type: text/x-diff, Size: 5670 bytes --]

From 5ca707edc2d74114b9273c75fea1b9e659fd779e Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 3 Feb 2021 22:41:02 -0500
Subject: [PATCH 1/3] build-helper/rust: define HOST_CC and HOST_CFLAGS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The cc-rs crate will try to guess the host compiler and use default
flags these are not specifically set. The default behavior is wrong in
Void cross-compilation environments. Explicitly define HOST_CC=gcc and
use innocuous HOST_CFLAGS=-O2 just to thwart the bad defaults.

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>

Closes: #28416.
---
 common/build-helper/rust.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index 6fcd3bd7d9e..431cb5f0fd4 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -17,6 +17,12 @@ if [ "$CROSS_BUILD" ]; then
 	# [build]
 	# target = ${RUST_TARGET}
 	export CARGO_BUILD_TARGET="$RUST_TARGET"
+
+	# If cc-rs needs to build host binaries, it guesses the compiler and
+	# uses default (wrong) flags unless they are specified explicitly;
+	# innocuous flags are used here just to disable its defaults
+	export HOST_CC="gcc"
+	export HOST_CFLAGS="-O2"
 else
 	unset CARGO_BUILD_TARGET
 fi

From 7a379b82942a9aad3fb85c28048adb3bd53e7b5c Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 11:13:44 +0300
Subject: [PATCH 2/3] New package: maturin-0.9.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
---
 srcpkgs/maturin/template | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 srcpkgs/maturin/template

diff --git a/srcpkgs/maturin/template b/srcpkgs/maturin/template
new file mode 100644
index 00000000000..cce53cf58cc
--- /dev/null
+++ b/srcpkgs/maturin/template
@@ -0,0 +1,36 @@
+# Template file for 'maturin'
+pkgname=maturin
+version=0.9.0
+revision=1
+build_style=cargo
+# Disable the 'rustls' feature, which leads to bad platform compatibility
+# The list of enabled features should be reconciled with each new release
+configure_args="--no-default-features --features auditwheel,log,upload,human-panic"
+hostmakedepends="python3-setuptools python3-toml"
+makedepends="libressl-devel"
+depends="python3-toml"
+short_desc="Build and publish crates as python packages"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/PyO3/maturin"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
+
+post_patch() {
+	# setup.py is broken, just use it for the pure python part
+	vsed -e 's/cmdclass.*/packages=["maturin"],/' -i setup.py
+}
+
+post_build() {
+	# python package is pure; the cross environment is not relevant
+	python3 setup.py build
+}
+
+do_check() {
+	echo "Tests use unstable features and fail to build; skipping"
+}
+
+post_install() {
+	vlicense license-mit LICENSE-MIT
+	python3 setup.py install --prefix=/usr --root=${DESTDIR}
+}

From aac6cc97bf3d3f00c7fdbeeee70f574b51b889df Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 1 Feb 2021 13:50:32 +0300
Subject: [PATCH 3/3] New package: python3-adblock-0.4.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>

Closes: #28396.
Closes: #28380.
Closes: #27490.
---
 srcpkgs/python3-adblock/template | 46 ++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 srcpkgs/python3-adblock/template

diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
new file mode 100644
index 00000000000..c1200f89027
--- /dev/null
+++ b/srcpkgs/python3-adblock/template
@@ -0,0 +1,46 @@
+# Template file for 'python3-adblock'
+pkgname=python3-adblock
+version=0.4.2
+revision=1
+wrksrc="${pkgname/python3/python}-${version}"
+build_style=python3-pep517
+build_helper="rust"
+hostmakedepends="maturin pkg-config cargo libressl-devel"
+makedepends="libressl-devel python3-devel"
+depends="python3"
+checkdepends="python3-pytest"
+short_desc="Brave's adblock library in Python"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, MIT"
+homepage="https://github.com/ArniDagur/python-adblock"
+distfiles="${homepage}/archive/${version}.tar.gz"
+checksum=06de6074e6cfe889fc0383cc929a5a2306570251c14e51abbfcedd328b83e0e9
+
+case "$XBPS_TARGET_MACHINE" in
+	i686*) broken="compiler throws SIGABRT on the psl crate" ;;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+	makedepends+=" rust-std"
+	export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
+	export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
+fi
+
+do_build() {
+	maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
+
+	# Drop platform specifiers from the wheel; pip will refuse to install,
+	# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
+	# armv7l. The wheel is correct; no need for name compatibility checks.
+	mv adblock-${version}-*.whl adblock-${version}-py3-none-any.whl
+}
+
+pre_check() {
+	# Tests require the compiled extension
+	cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so
+}
+
+post_install() {
+	vlicense LICENSE-MIT
+	chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so
+}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (22 preceding siblings ...)
  2021-02-04  4:22 ` ahesford
@ 2021-02-04  4:25 ` ahesford
  2021-02-04  5:33 ` [PR PATCH] [Closed]: " ahesford
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-04  4:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/28396#issuecomment-773018417

Comment:
OK, good detective work, @ericonr. Your fixes have cross builds working. I'll test your recommended build-helper changes on nushell just to verify that it builds as expected.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PR PATCH] [Closed]: New package: python3-adblock-0.4.2
  2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
                   ` (23 preceding siblings ...)
  2021-02-04  4:25 ` ahesford
@ 2021-02-04  5:33 ` ahesford
  24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2021-02-04  5:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

There's a closed pull request on the void-packages repository

New package: python3-adblock-0.4.2
https://github.com/void-linux/void-packages/pull/28396

Description:
This supersedes #28380 and #27490.

Compiles natively on `x86_64*`, `aarch64` and `armv7l`. Works as expected on `x86_64` and `aarch64`. I haven't tried the other ARM architectures.

I can't figure out what happens with `openssl-sys` when cross-compiling; the flags passed to GCC include `-m64`, which are rejected by the ARM compilers. On `i686`, the build fails with SIGABRT when trying to build the `psl` crate. The `openssl-sys` issue appears even if I try using the built-in `cargo` build style rather than `maturin`, so this is some configuration problem that extends beyond `maturin`.

Any help fixing these issue would be appreciated. If we can't sort them out, `broken` on `i686` and `nocross` will be sufficient for now.

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2021-02-04  5:33 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 21:01 [PR PATCH] New package: python3-adblock-0.4.2 ahesford
2021-02-01 21:02 ` ahesford
2021-02-01 21:09 ` [PR REVIEW] " ericonr
2021-02-01 21:10 ` ahesford
2021-02-01 21:14 ` ericonr
2021-02-01 21:15 ` ericonr
2021-02-01 21:22 ` ericonr
2021-02-01 21:23 ` ericonr
2021-02-01 21:24 ` ericonr
2021-02-01 21:25 ` ericonr
2021-02-01 21:35 ` ericonr
2021-02-01 21:46 ` ericonr
2021-02-01 21:48 ` ericonr
2021-02-02  1:42 ` ericonr
2021-02-02 15:34 ` [PR PATCH] [Updated] " ahesford
2021-02-02 15:49 ` ahesford
2021-02-03 22:06 ` [PR PATCH] [Updated] " ahesford
2021-02-04  1:23 ` [PR REVIEW] " ericonr
2021-02-04  1:23 ` ericonr
2021-02-04  1:23 ` ericonr
2021-02-04  1:23 ` ericonr
2021-02-04  1:34 ` ericonr
2021-02-04  4:21 ` [PR PATCH] [Updated] " ahesford
2021-02-04  4:22 ` ahesford
2021-02-04  4:25 ` ahesford
2021-02-04  5:33 ` [PR PATCH] [Closed]: " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).