python/python3-soxr: Fix builds on i686 and arm.

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Jeremy Hansen 2023-07-02 20:15:13 -07:00 committed by Willy Sudiarto Raharjo
parent 76d29b375a
commit f79a3415d5
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 20c26bb5f8402f12f1a2452a7228c258c64d5b95 Mon Sep 17 00:00:00 2001
From: dofuuz <dofu@nate.com>
Date: Wed, 14 Jul 2021 19:15:15 +0900
Subject: [PATCH] Fix ARM, linux_i686 compile
---
.github/workflows/build-dist.yml | 2 +-
setup.py | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build-dist.yml b/.github/workflows/build-dist.yml
index 1cccbec..3a406a7 100644
--- a/.github/workflows/build-dist.yml
+++ b/.github/workflows/build-dist.yml
@@ -33,7 +33,7 @@ jobs:
uses: joerick/cibuildwheel@v1.11.0
env:
# Skip build errors
- CIBW_SKIP: "*-manylinux_i686 pp*-macosx_x86_64 pp*-win32"
+ CIBW_SKIP: "pp*-macosx_x86_64 pp*-win32"
- uses: actions/upload-artifact@v2
with:
diff --git a/setup.py b/setup.py
index b7b6a85..66f8ff1 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,8 @@
from setuptools import find_packages
from setuptools import setup, Extension
+import distutils.util
+
class CySoxrExtension(Extension):
def __init__(self, *args, **kwargs):
@@ -48,13 +50,21 @@ def include_dirs(self, dirs):
'soxr/cysoxr.pyx'
]
+compile_args = ['-DSOXR_LIB']
+platform = distutils.util.get_platform()
+
+if '-arm' in platform or '-aarch' in platform:
+ compile_args.append('-mfpu=neon')
+elif '-i686' in platform:
+ compile_args.append('-msse')
+
extensions = [
CySoxrExtension(
"soxr.cysoxr",
src,
include_dirs=['libsoxr/src', 'soxr'],
language="c",
- extra_compile_args=['-DSOXR_LIB'])
+ extra_compile_args=compile_args)
]

View File

@ -27,7 +27,7 @@ PRGNAM=python3-soxr
VERSION=${VERSION:-0.2.4}
SOXRVER=${SOXRVER:-0.1.3}
SRCNAM=${SRCNAM:-python-soxr}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -82,6 +82,11 @@ find -L . \
export SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION
# Fix builds on i686 and possibly arm
# Thanks to dofuuz
# https://github.com/dofuuz/python-soxr/issues/17
patch -p1 < $CWD/fix_arm_and_i686.patch
python3 setup.py install --root=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \