36 lines
1.6 KiB
Diff
36 lines
1.6 KiB
Diff
--- a/setup.py 2024-07-28 00:42:16.501461696 +0200
|
|
+++ - 2024-07-28 00:51:45.867441942 +0200
|
|
@@ -17,7 +17,6 @@
|
|
|
|
import os
|
|
import sys
|
|
-import platform
|
|
import re
|
|
import tempfile
|
|
from setuptools import distutils
|
|
@@ -73,10 +72,10 @@
|
|
class SABCToolsBuild(build_ext):
|
|
def build_extension(self, ext: Extension):
|
|
# Try to determine the architecture to build for
|
|
- machine = platform.machine().lower()
|
|
- IS_X86 = machine in ["i386", "i686", "x86", "x86_64", "x64", "amd64"]
|
|
+ xbps_target_machine = os.getenv("XBPS_TARGET_MACHINE")
|
|
+ IS_X86 = any(arch in xbps_target_machine for arch in ["i386", "i686", "x86", "x86_64", "x64", "amd64"])
|
|
IS_MACOS = sys.platform == "darwin"
|
|
- IS_ARM = machine.startswith("arm") or machine.startswith("aarch64")
|
|
+ IS_ARM = any(arch in xbps_target_machine for arch in ["arm", "aarch64"])
|
|
IS_AARCH64 = True
|
|
|
|
log.info("==> Baseline detection: ARM=%s, x86=%s, macOS=%s", IS_ARM, IS_X86, IS_MACOS)
|
|
@@ -168,8 +167,8 @@
|
|
if IS_X86 and autoconf_check(self.compiler, flag_check="-mno-evex512"):
|
|
gcc_avx10_flags = ["-mno-evex512"]
|
|
|
|
- if machine.startswith("riscv"):
|
|
- arch_flag = "-march=rv" + ("32" if machine.startswith("riscv32") else "64") + "gc"
|
|
+ if "riscv" in xbps_target_machine:
|
|
+ arch_flag = "-march=rv" + ("32" if "riscv32" in xbps_target_machine else "64") + "gc"
|
|
if autoconf_check(self.compiler, flag_check=arch_flag+"v"):
|
|
gcc_rvv_flags = [arch_flag+"v"]
|
|
if autoconf_check(self.compiler, flag_check=arch_flag+"_zbkc"):
|