Skip to content
Merged
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
1 change: 1 addition & 0 deletions maturin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/121.patch
98 changes: 98 additions & 0 deletions maturin/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

pkgbase=maturin
pkgname=("python-maturin" "maturin")
pkgver=1.9.6
pkgrel=1
pkgdesc='Build and publish crates with pyo3, rust-cpython and cffi bindings'
arch=('x86_64')
url='https://www.maturin.rs/'
msys2_repository_url='https://github.com/pyo3/maturin'
msys2_references=(
'purl: pkg:pypi/maturin'
)
license=('spdx:MIT OR Apache-2.0')
depends=("python" "libopenssl")
makedepends=(
"python-build"
"python-installer"
"python-setuptools-rust"
"openssl-devel"
"pkgconf")
options=('!strip')
source=("https://pypi.org/packages/source/${pkgbase::1}/${pkgbase}/${pkgbase}-${pkgver}.tar.gz"
"tar-0.4.43.tar.gz::https://crates.io/api/v1/crates/tar/0.4.43/download"
"target-lexicon-0.13.1.tar.gz::https://crates.io/api/v1/crates/target-lexicon/0.13.1/download"
"getrandom-0.2.15.tar.gz::https://crates.io/api/v1/crates/getrandom/0.2.15/download"
"maturin-update-deps.patch"
"tar-rs-update-deps.patch"
"getrandom-support-cygwin.patch"
"https://patch-diff.githubusercontent.com/raw/bytecodealliance/target-lexicon/pull/121.patch")
sha256sums=('2c2ae37144811d365509889ed7220b0598487f1278c2441829c3abf56cc6324a'
'c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6'
'dc12939a1c9b9d391e0b7135f72fd30508b73450753e28341fed159317582a77'
'c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7'
'36bb5955216d19aed9a8fb2ec9440e7e3133de2e7d5ed1da2ad2204d449a2095'
'2422ed08564445528695499757258aecde785bb6e95cde2d88f4b2cefe8417d8'
'acac76aa379bc45285f067524d7c5adceb3100698d72ae150a6b626a137e947d'
'e0b46bbfb946b0231469e9ae1112e766430113cbeae33edb72eb314a32466cac')

prepare() {
cp -r "${pkgbase}-${pkgver}" "python-build" && cd "python-build"

# support cygwin in some deps
patch -d ../target-lexicon-0.13.1 -p1 -i ../121.patch
patch -d ../getrandom-0.2.15 -p1 -i ../getrandom-support-cygwin.patch
# update deps to add cygwin support
patch -Np1 -i ../maturin-update-deps.patch
patch -d ../tar-0.4.43 -p1 -i ../tar-rs-update-deps.patch
cat >> Cargo.toml <<END

[patch.crates-io]
getrandom = { path = "../getrandom-0.2.15" }
tar = { path = "../tar-0.4.43" }
target-lexicon = { path = "../target-lexicon-0.13.1" }
END

cargo update -p tempfile@3.11.0 --precise 3.18.0
cargo update -p which@7.0.0 --precise 7.0.3
cargo update -p clap@4.5.7 --precise 4.5.19
cargo update -p psm@0.1.21 --precise 0.1.26
cargo fetch --locked --target 'x86_64-pc-cygwin'
}

build() {
cd "python-build"

export MATURIN_SETUP_ARGS="--no-default-features --features cli-completion,scaffolding"
export OPENSSL_NO_VENDOR=1
python -m build --wheel --skip-dependency-check --no-isolation
}

package_python-maturin() {
pkgdesc+=' (Python bindings)'
depends=("python" "maturin")

cd "python-build"

python -m installer --prefix=/usr \
--destdir="${pkgdir}" dist/*.whl

install -Dm644 license-{apache,mit} -t "${pkgdir}/usr/share/licenses/python-${pkgbase}/"

# split maturin executable
mkdir -p "dest/usr/bin"
mv "${pkgdir}/usr"/bin/* "dest/usr/bin/"
}

package_maturin() {
cd "python-build"

mv dest/* "${pkgdir}"

local _complete="${pkgdir}/usr/bin/maturin completions"
$_complete bash | install -Dm644 /dev/stdin "${pkgdir}/usr/share/bash-completion/completions/maturin"
$_complete zsh | install -Dm644 /dev/stdin "${pkgdir}/usr/share/zsh/site-functions/_maturin"
$_complete fish | install -Dm644 /dev/stdin "${pkgdir}/usr/share/fish/vendor_completions.d/maturin.fish"
install -Dm644 license-{apache,mit} -t "${pkgdir}/usr/share/licenses/${pkgbase}/"
}
23 changes: 23 additions & 0 deletions maturin/getrandom-support-cygwin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,6 +87,7 @@ cfg_if! {
target_os = "freebsd",
target_os = "hurd",
target_os = "illumos",
+ target_os = "cygwin",
// Check for target_arch = "arm" to only include the 3DS. Does not
// include the Nintendo Switch (which is target_arch = "aarch64").
all(target_os = "horizon", target_arch = "arm"),
diff --git a/src/util_libc.rs b/src/util_libc.rs
index 80003013..24c53c0c 100644
--- a/src/util_libc.rs
+++ b/src/util_libc.rs
@@ -2,7 +2,7 @@ use crate::Error;
use core::mem::MaybeUninit;

cfg_if! {
- if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] {
+ if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android", target_os = "cygwin"))] {
use libc::__errno as errno_location;
} else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox", target_os = "dragonfly"))] {
use libc::__errno_location as errno_location;
11 changes: 11 additions & 0 deletions maturin/maturin-update-deps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -142,7 +142,7 @@

[dev-dependencies]
expect-test = "1.4.1"
-fs4 = { version = "0.12.0", features = ["fs-err3"] }
+fs4 = { version = "0.13.1", features = ["fs-err3"] }
indoc = "2.0.3"
insta = "1.34.0"
pretty_assertions = "1.3.0"
9 changes: 9 additions & 0 deletions maturin/tar-rs-update-deps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/Cargo.toml.orig
+++ b/Cargo.toml
@@ -78,5 +78,5 @@
version = "0.2"

[target."cfg(unix)".dependencies.xattr]
-version = "1.1.3"
+version = "1.5.0"
optional = true