From nobody Thu Dec 29 00:41:33 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nj8ht1z29z2kgpT; Thu, 29 Dec 2022 00:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nj8ht0f1xz3pbf; Thu, 29 Dec 2022 00:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672274494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0hLfQn9UFvDYmRSO3KD15+ZO/jzMFmFm0EWuuJz4gDg=; b=S532VmeWsY+l2C5VLS8gyKRm8wSLH3cPdzqBXW5ts0GIlR/jcURdppLt059CBViNi0MveG GUtxAL/cs1otIDvfPdJB8MFg1HKTUJX5p2wK73MPXBTL/ome86lhZtNKklZYGYZQhaRr5M kua/QGEWxgMKV6NNhr5ihix2uAi7ESp8En1IcoY52MuSw6/Vws8cMGOTsINZU0r2xV2drr GgBAVmXG93vTip3LYxy3/2iNnVSJ2BYNUVR43/PeZzUntA2OmwAxC6ws0JJJvhBbdXZj9U go7QkI7wnD6ti6d4/ya0EG9xQZS9nZc/TGqHgfVCyNTjKObLkufdfIXjmbDa6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672274494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0hLfQn9UFvDYmRSO3KD15+ZO/jzMFmFm0EWuuJz4gDg=; b=e5/4p+pD+ipknUt3VynO9S3l7cjRTz/+AjHywPSOfddvadDl7GGh0IUYwWge5eknIcNHOq Bymc20YggVxboP9gk2GyRJJShhdnDB2x2Cr+rFGVxC38CZOcupPtX+8oL10+KFqV7tgTQN npcJRppzi4Gd9/wrqhX9M9POz5Hmd1SLKGZ1JcbBiFHJh6ujoxD1jffhiLbHh6d8WE5lZ3 FJKRXapMd2uELWXuwIhJZF4Y5ETa2Teu5RGR23eRMSLDSCOSqtsbcX25GjOzF1rensXwvu 74fH7F6nXmYxPys9P4GjfXJnVBj6iyLGnZtvTKSAKCEeCYX+YLzysYZcaDUpcQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672274494; a=rsa-sha256; cv=none; b=Y7g1VEQzHcup21FAPygP29lppyTrHbOLfAu2lKSELS7jaaQhCWUkLDNPViuBTBY6Dx8Uh9 K5Kib1vOEAHRoIc8kZqm+jRsBzyZ9xGbu5la+FdX4OA7EftliXCAH9lOrRGXhvLtER7ArK hM3DlAhM3hibRviialtOaO5QY9bJxiBN70bsuZ75VA66tIy/xiFdH/SNRgsyvDThHz+lSa xDFZSRLNphdOMmb1bR6dcNsJHbk4FJgVyHhE1SRVT8kJrbNmTVBUFnoChTp/nb3yLdKD6o 1pOnyNnkvqBoPwrqjVL0cEu/uRVml7x5dSUNWSoVCu2dVr59uxiXtlkcGk2lrw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nj8hs5Kjnz18p0; Thu, 29 Dec 2022 00:41:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BT0fX6e011877; Thu, 29 Dec 2022 00:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BT0fX8X011876; Thu, 29 Dec 2022 00:41:33 GMT (envelope-from git) Date: Thu, 29 Dec 2022 00:41:33 GMT Message-Id: <202212290041.2BT0fX8X011876@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Piotr Kubaj Subject: git: 7b822dde35ab - main - math/py-numpy: fix runtime on powerpc64* List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b822dde35aba238c5975a3c1fc33ebca75d71b5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=7b822dde35aba238c5975a3c1fc33ebca75d71b5 commit 7b822dde35aba238c5975a3c1fc33ebca75d71b5 Author: Piotr Kubaj AuthorDate: 2022-12-29 00:41:28 +0000 Commit: Piotr Kubaj CommitDate: 2022-12-29 00:41:28 +0000 math/py-numpy: fix runtime on powerpc64* Currently powerpc64* is not properly detected by numpy, due to python returning just "powerpc" as architecture name. This commit fixes architecture detection with numpy and properly checks for CPU features on FreeBSD. --- math/py-numpy/Makefile | 1 + ...atch-numpy_core_src_common_npy__cpu__features.c | 49 ++++++++++++++++++++++ .../files/patch-numpy_distutils_ccompiler__opt.py | 17 ++++++++ 3 files changed, 67 insertions(+) diff --git a/math/py-numpy/Makefile b/math/py-numpy/Makefile index c909f6bf034b..1cebcf5eb698 100644 --- a/math/py-numpy/Makefile +++ b/math/py-numpy/Makefile @@ -1,5 +1,6 @@ PORTNAME= numpy PORTVERSION= 1.23.5 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= math python MASTER_SITES= CHEESESHOP \ diff --git a/math/py-numpy/files/patch-numpy_core_src_common_npy__cpu__features.c b/math/py-numpy/files/patch-numpy_core_src_common_npy__cpu__features.c new file mode 100644 index 000000000000..7119bfb88896 --- /dev/null +++ b/math/py-numpy/files/patch-numpy_core_src_common_npy__cpu__features.c @@ -0,0 +1,49 @@ +--- numpy/core/src/common/npy_cpu_features.c.orig 2022-11-19 22:40:58 UTC ++++ numpy/core/src/common/npy_cpu_features.c +@@ -527,6 +527,18 @@ npy__cpu_init_features(void) + #ifndef PPC_FEATURE2_ARCH_3_1 + #define PPC_FEATURE2_ARCH_3_1 0x00040000 + #endif ++#elif defined(__FreeBSD__) ++ #include ++ #include ++ #ifndef PPC_FEATURE2_ARCH_2_07 ++ #define PPC_FEATURE2_ARCH_2_07 0x80000000 ++ #endif ++ #ifndef PPC_FEATURE2_ARCH_3_00 ++ #define PPC_FEATURE2_ARCH_3_00 0x00800000 ++ #endif ++ #ifndef PPC_FEATURE2_ARCH_3_1 ++ #define PPC_FEATURE2_ARCH_3_1 0x00040000 ++ #endif + #endif + + static void +@@ -551,7 +563,26 @@ npy__cpu_init_features(void) + npy__cpu_have[NPY_CPU_FEATURE_VSX2] = (hwcap & PPC_FEATURE2_ARCH_2_07) != 0; + npy__cpu_have[NPY_CPU_FEATURE_VSX3] = (hwcap & PPC_FEATURE2_ARCH_3_00) != 0; + npy__cpu_have[NPY_CPU_FEATURE_VSX4] = (hwcap & PPC_FEATURE2_ARCH_3_1) != 0; +-// TODO: AIX, FreeBSD ++#elif defined(__FreeBSD__) ++ unsigned long hwcap; ++ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); ++ if ((hwcap & PPC_FEATURE_HAS_VSX) == 0) ++ return; ++ ++ elf_aux_info(AT_HWCAP2, &hwcap, sizeof(hwcap)); ++ if (hwcap & PPC_FEATURE2_ARCH_3_1) ++ { ++ npy__cpu_have[NPY_CPU_FEATURE_VSX] = ++ npy__cpu_have[NPY_CPU_FEATURE_VSX2] = ++ npy__cpu_have[NPY_CPU_FEATURE_VSX3] = ++ npy__cpu_have[NPY_CPU_FEATURE_VSX4] = 1; ++ return; ++ } ++ npy__cpu_have[NPY_CPU_FEATURE_VSX] = 1; ++ npy__cpu_have[NPY_CPU_FEATURE_VSX2] = (hwcap & PPC_FEATURE2_ARCH_2_07) != 0; ++ npy__cpu_have[NPY_CPU_FEATURE_VSX3] = (hwcap & PPC_FEATURE2_ARCH_3_00) != 0; ++ npy__cpu_have[NPY_CPU_FEATURE_VSX4] = (hwcap & PPC_FEATURE2_ARCH_3_1) != 0; ++// TODO: AIX, OpenBSD + #else + npy__cpu_have[NPY_CPU_FEATURE_VSX] = 1; + #if defined(NPY_CPU_PPC64LE) || defined(NPY_HAVE_VSX2) diff --git a/math/py-numpy/files/patch-numpy_distutils_ccompiler__opt.py b/math/py-numpy/files/patch-numpy_distutils_ccompiler__opt.py new file mode 100644 index 000000000000..d8a0abca53bd --- /dev/null +++ b/math/py-numpy/files/patch-numpy_distutils_ccompiler__opt.py @@ -0,0 +1,17 @@ +--- numpy/distutils/ccompiler_opt.py.orig 2022-11-19 22:40:58 UTC ++++ numpy/distutils/ccompiler_opt.py +@@ -959,8 +959,12 @@ class _CCompiler: + detect_arch = ( + ("cc_on_x64", ".*(x|x86_|amd)64.*", ""), + ("cc_on_x86", ".*(win32|x86|i386|i686).*", ""), +- ("cc_on_ppc64le", ".*(powerpc|ppc)64(el|le).*", ""), +- ("cc_on_ppc64", ".*(powerpc|ppc)64.*", ""), ++ ("cc_on_ppc64le", ".*(powerpc|ppc)64(el|le).*|.*powerpc.*", "" ++ "defined(__LP64__) && " ++ "defined(__LITTLE_ENDIAN__)"), ++ ("cc_on_ppc64", ".*(powerpc|ppc).*|.*powerpc.*", "" ++ "defined(__LP64__) && " ++ "defined(__BIG_ENDIAN__)"), + ("cc_on_aarch64", ".*(aarch64|arm64).*", ""), + ("cc_on_armhf", ".*arm.*", "defined(__ARM_ARCH_7__) || " + "defined(__ARM_ARCH_7A__)"),