The key issue is the line in cmake/googletest.CMakeLists.txt.in cmake_minimum_required(VERSION 2.8.2)
Upstream changed the 2.8.2 to 3.16 Attached patch updates the package to the latest upstream release and more recent upstream commits in debian/patches/ -Maitland
>From 4e864f77f21b7a88d5db4f20db557c2411676ea5 Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" <[email protected]> Date: Wed, 22 Oct 2025 12:52:38 -0400 Subject: [PATCH] prepare 0.10.1-1 --- debian/changelog | 8 + debian/control | 3 +- ...-wrapper-https-github.com-mscdex-cpu.patch | 26 ++ ...ckout-from-4-to-5-in-the-github-acti.patch | 272 ++++++++++++ ...EATURES_OS_MACOS-and-CPU_FEATURES_OS.patch | 31 ++ ...pdate-AArch64-features-to-Linux-6.12.patch | 75 ++++ .../0005-cmake-Fix-googletest-build.patch | 30 ++ debian/patches/0006-Build-with-zig-431.patch | 418 ++++++++++++++++++ debian/patches/series | 8 +- ...est-src.patch => use-local-googletest-src} | 8 +- debian/rules | 0 debian/watch | 2 +- 12 files changed, 872 insertions(+), 9 deletions(-) create mode 100644 debian/patches/0001-docs-Add-Node.JS-wrapper-https-github.com-mscdex-cpu.patch create mode 100644 debian/patches/0002-Bump-actions-checkout-from-4-to-5-in-the-github-acti.patch create mode 100644 debian/patches/0003-Fix-broken-CPU_FEATURES_OS_MACOS-and-CPU_FEATURES_OS.patch create mode 100644 debian/patches/0004-Update-AArch64-features-to-Linux-6.12.patch create mode 100644 debian/patches/0005-cmake-Fix-googletest-build.patch create mode 100644 debian/patches/0006-Build-with-zig-431.patch rename debian/patches/{0001-use-local-googletest-src.patch => use-local-googletest-src} (79%) mode change 100644 => 100755 debian/rules diff --git a/debian/changelog b/debian/changelog index 438924b..ee0f2f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +cpu-features (0.10.1-1) unstable; urgency=medium + + * New upstream release. + * Update to v0.10.1-7-g2182eb5 (Closes: #1112810) + * Update Standards-Version to 4.7.2 (no changes) + + -- A. Maitland Bottoms <[email protected]> Wed, 22 Oct 2025 00:07:55 -0400 + cpu-features (0.9.0-1) unstable; urgency=medium * New upstream version diff --git a/debian/control b/debian/control index 51fc1aa..c57b54f 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,13 @@ Source: cpu-features Section: libdevel Priority: optional Maintainer: Shengjing Zhu <[email protected]> +Uploaders: A. Maitland Bottoms <[email protected]> Rules-Requires-Root: no Build-Depends: cmake, debhelper-compat (= 13), googletest, -Standards-Version: 4.6.2 +Standards-Version: 4.7.2 Homepage: https://github.com/google/cpu_features Vcs-Git: https://salsa.debian.org/zhsj/cpu-features.git Vcs-Browser: https://salsa.debian.org/zhsj/cpu-features diff --git a/debian/patches/0001-docs-Add-Node.JS-wrapper-https-github.com-mscdex-cpu.patch b/debian/patches/0001-docs-Add-Node.JS-wrapper-https-github.com-mscdex-cpu.patch new file mode 100644 index 0000000..84f9f94 --- /dev/null +++ b/debian/patches/0001-docs-Add-Node.JS-wrapper-https-github.com-mscdex-cpu.patch @@ -0,0 +1,26 @@ +From 6516495ce9041d61deac40e50feb87330b24e847 Mon Sep 17 00:00:00 2001 +From: Michael Vorburger <[email protected]> +Date: Tue, 18 Mar 2025 11:03:58 +0100 +Subject: [PATCH 1/6] docs: Add Node.JS wrapper + https://github.com/mscdex/cpu-features to README + +--- + README.md | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/README.md b/README.md +index 417fa1c..b34fd85 100644 +--- a/README.md ++++ b/README.md +@@ -277,6 +277,7 @@ Links provided here are not affiliated with Google but are kindly provided by th + - https://github.com/Narasimha1997/py_cpu + - Java + - https://github.com/aecsocket/cpu-features-java +- ++- Node.JS (and [Bun](https://bun.sh/blog/bun-v1.2#c-addons-using-v8-apis)) ++ - https://github.com/mscdex/cpu-features + + _Send PR to showcase your wrapper here_ +-- +2.47.3 + diff --git a/debian/patches/0002-Bump-actions-checkout-from-4-to-5-in-the-github-acti.patch b/debian/patches/0002-Bump-actions-checkout-from-4-to-5-in-the-github-acti.patch new file mode 100644 index 0000000..748ac7f --- /dev/null +++ b/debian/patches/0002-Bump-actions-checkout-from-4-to-5-in-the-github-acti.patch @@ -0,0 +1,272 @@ +From ed3cc44739767473fc402594ce1d9d1197bb16cd Mon Sep 17 00:00:00 2001 +From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon, 18 Aug 2025 12:15:04 +0000 +Subject: [PATCH 2/6] Bump actions/checkout from 4 to 5 in the github-actions + group + +Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). + + +Updates `actions/checkout` from 4 to 5 +- [Release notes](https://github.com/actions/checkout/releases) +- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) +- [Commits](https://github.com/actions/checkout/compare/v4...v5) + +--- +updated-dependencies: +- dependency-name: actions/checkout + dependency-version: '5' + dependency-type: direct:production + update-type: version-update:semver-major + dependency-group: github-actions +... + +Signed-off-by: dependabot[bot] <[email protected]> +--- + .github/workflows/aarch64_linux_bazel.yml | 2 +- + .github/workflows/aarch64_linux_cmake.yml | 2 +- + .github/workflows/amd64_linux_bazel.yml | 2 +- + .github/workflows/amd64_linux_cmake.yml | 2 +- + .github/workflows/amd64_macos_bazel.yml | 2 +- + .github/workflows/amd64_macos_cmake.yml | 4 ++-- + .github/workflows/amd64_windows_bazel.yml | 2 +- + .github/workflows/amd64_windows_cmake.yml | 2 +- + .github/workflows/arm64_macos_bazel.yml | 2 +- + .github/workflows/arm64_macos_cmake.yml | 4 ++-- + .github/workflows/arm_linux_cmake.yml | 2 +- + .github/workflows/clang_format.yml | 2 +- + .github/workflows/mips_linux_cmake.yml | 2 +- + .github/workflows/power_linux_cmake.yml | 2 +- + .github/workflows/riscv_linux_cmake.yml | 2 +- + .github/workflows/s390x_linux_cmake.yml | 2 +- + 16 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/.github/workflows/aarch64_linux_bazel.yml b/.github/workflows/aarch64_linux_bazel.yml +index 782d368..89d1447 100644 +--- a/.github/workflows/aarch64_linux_bazel.yml ++++ b/.github/workflows/aarch64_linux_bazel.yml +@@ -13,7 +13,7 @@ jobs: + runs-on: ubuntu-24.04-arm + steps: + - name: Check out repository code +- uses: actions/checkout@v4 ++ uses: actions/checkout@v5 + - name: Build + run: make --directory=bazel/ci arm64_build + - name: Test +diff --git a/.github/workflows/aarch64_linux_cmake.yml b/.github/workflows/aarch64_linux_cmake.yml +index 21dbacf..3e9ed43 100644 +--- a/.github/workflows/aarch64_linux_cmake.yml ++++ b/.github/workflows/aarch64_linux_cmake.yml +@@ -21,7 +21,7 @@ jobs: + env: + TARGET: ${{ matrix.targets[0] }} + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Build + run: make --directory=cmake/ci ${TARGET}_build + - name: Test +diff --git a/.github/workflows/amd64_linux_bazel.yml b/.github/workflows/amd64_linux_bazel.yml +index 23e54f0..89db12e 100644 +--- a/.github/workflows/amd64_linux_bazel.yml ++++ b/.github/workflows/amd64_linux_bazel.yml +@@ -13,7 +13,7 @@ jobs: + runs-on: ubuntu-latest + steps: + - name: Check out repository code +- uses: actions/checkout@v4 ++ uses: actions/checkout@v5 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Check docker +diff --git a/.github/workflows/amd64_linux_cmake.yml b/.github/workflows/amd64_linux_cmake.yml +index 5559b32..5e21b09 100644 +--- a/.github/workflows/amd64_linux_cmake.yml ++++ b/.github/workflows/amd64_linux_cmake.yml +@@ -12,7 +12,7 @@ jobs: + make: + runs-on: ubuntu-latest + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Env + run: make --directory=cmake/ci amd64_env + - name: Devel +diff --git a/.github/workflows/amd64_macos_bazel.yml b/.github/workflows/amd64_macos_bazel.yml +index ee27c8e..5b21cba 100644 +--- a/.github/workflows/amd64_macos_bazel.yml ++++ b/.github/workflows/amd64_macos_bazel.yml +@@ -14,7 +14,7 @@ jobs: + runs-on: macos-13 # Using x86 processors, ref: https://github.com/actions/runner-images + steps: + - name: Check out repository code +- uses: actions/checkout@v4 ++ uses: actions/checkout@v5 + - name: Install Bazel + run: | + brew update +diff --git a/.github/workflows/amd64_macos_cmake.yml b/.github/workflows/amd64_macos_cmake.yml +index a527cbe..1bf3709 100644 +--- a/.github/workflows/amd64_macos_cmake.yml ++++ b/.github/workflows/amd64_macos_cmake.yml +@@ -15,7 +15,7 @@ jobs: + env: + CTEST_OUTPUT_ON_FAILURE: 1 + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Check cmake + run: cmake --version + - name: Configure +@@ -31,7 +31,7 @@ jobs: + env: + CTEST_OUTPUT_ON_FAILURE: 1 + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Check cmake + run: cmake --version + - name: Configure +diff --git a/.github/workflows/amd64_windows_bazel.yml b/.github/workflows/amd64_windows_bazel.yml +index 184a0df..aaa1f3d 100644 +--- a/.github/workflows/amd64_windows_bazel.yml ++++ b/.github/workflows/amd64_windows_bazel.yml +@@ -14,7 +14,7 @@ jobs: + runs-on: windows-latest + steps: + - name: Check out repository code +- uses: actions/checkout@v4 ++ uses: actions/checkout@v5 + - name: Install Bazel + run: | + choco install bazel +diff --git a/.github/workflows/amd64_windows_cmake.yml b/.github/workflows/amd64_windows_cmake.yml +index 847a549..f73f547 100644 +--- a/.github/workflows/amd64_windows_cmake.yml ++++ b/.github/workflows/amd64_windows_cmake.yml +@@ -14,7 +14,7 @@ jobs: + env: + CTEST_OUTPUT_ON_FAILURE: 1 + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Configure + run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES=Release + - name: Build +diff --git a/.github/workflows/arm64_macos_bazel.yml b/.github/workflows/arm64_macos_bazel.yml +index 5a2e9cb..9ca6fe7 100644 +--- a/.github/workflows/arm64_macos_bazel.yml ++++ b/.github/workflows/arm64_macos_bazel.yml +@@ -14,7 +14,7 @@ jobs: + runs-on: macos-latest # Using M1 processors, ref: https://github.com/actions/runner-images + steps: + - name: Check out repository code +- uses: actions/checkout@v4 ++ uses: actions/checkout@v5 + - name: Install Bazel + run: | + brew update +diff --git a/.github/workflows/arm64_macos_cmake.yml b/.github/workflows/arm64_macos_cmake.yml +index e686a22..e76b356 100644 +--- a/.github/workflows/arm64_macos_cmake.yml ++++ b/.github/workflows/arm64_macos_cmake.yml +@@ -15,7 +15,7 @@ jobs: + env: + CTEST_OUTPUT_ON_FAILURE: 1 + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Check cmake + run: cmake --version + - name: Configure +@@ -31,7 +31,7 @@ jobs: + env: + CTEST_OUTPUT_ON_FAILURE: 1 + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Check cmake + run: cmake --version + - name: Configure +diff --git a/.github/workflows/arm_linux_cmake.yml b/.github/workflows/arm_linux_cmake.yml +index 29bfda8..a6b2708 100644 +--- a/.github/workflows/arm_linux_cmake.yml ++++ b/.github/workflows/arm_linux_cmake.yml +@@ -21,7 +21,7 @@ jobs: + env: + TARGET: ${{ matrix.targets[0] }} + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Build + run: make --directory=cmake/ci ${TARGET}_build + - name: Test +diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml +index 2ab0de0..437ced2 100644 +--- a/.github/workflows/clang_format.yml ++++ b/.github/workflows/clang_format.yml +@@ -7,7 +7,7 @@ jobs: + clang-format: + runs-on: ubuntu-latest + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Fetch origin/main + run: git fetch origin main + - name: List of changed file(s) +diff --git a/.github/workflows/mips_linux_cmake.yml b/.github/workflows/mips_linux_cmake.yml +index c7e6905..5d83d04 100644 +--- a/.github/workflows/mips_linux_cmake.yml ++++ b/.github/workflows/mips_linux_cmake.yml +@@ -23,7 +23,7 @@ jobs: + env: + TARGET: ${{ matrix.targets[0] }} + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Build + run: make --directory=cmake/ci ${TARGET}_build + - name: Test +diff --git a/.github/workflows/power_linux_cmake.yml b/.github/workflows/power_linux_cmake.yml +index 6bd8860..26d4aa8 100644 +--- a/.github/workflows/power_linux_cmake.yml ++++ b/.github/workflows/power_linux_cmake.yml +@@ -22,7 +22,7 @@ jobs: + env: + TARGET: ${{ matrix.targets[0] }} + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Build + run: make --directory=cmake/ci ${TARGET}_build + - name: Test +diff --git a/.github/workflows/riscv_linux_cmake.yml b/.github/workflows/riscv_linux_cmake.yml +index 6e5a51b..75b23fb 100644 +--- a/.github/workflows/riscv_linux_cmake.yml ++++ b/.github/workflows/riscv_linux_cmake.yml +@@ -21,7 +21,7 @@ jobs: + env: + TARGET: ${{ matrix.targets[0] }} + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Build + run: make --directory=cmake/ci ${TARGET}_build + - name: Test +diff --git a/.github/workflows/s390x_linux_cmake.yml b/.github/workflows/s390x_linux_cmake.yml +index 8c78cd1..a470df7 100644 +--- a/.github/workflows/s390x_linux_cmake.yml ++++ b/.github/workflows/s390x_linux_cmake.yml +@@ -20,7 +20,7 @@ jobs: + env: + TARGET: ${{ matrix.targets[0] }} + steps: +- - uses: actions/checkout@v4 ++ - uses: actions/checkout@v5 + - name: Build + run: make --directory=cmake/ci ${TARGET}_build + - name: Test +-- +2.47.3 + diff --git a/debian/patches/0003-Fix-broken-CPU_FEATURES_OS_MACOS-and-CPU_FEATURES_OS.patch b/debian/patches/0003-Fix-broken-CPU_FEATURES_OS_MACOS-and-CPU_FEATURES_OS.patch new file mode 100644 index 0000000..eb6e9e8 --- /dev/null +++ b/debian/patches/0003-Fix-broken-CPU_FEATURES_OS_MACOS-and-CPU_FEATURES_OS.patch @@ -0,0 +1,31 @@ +From f7fe16f5ecfebcdabefaf4a1640cdfebe7c3b271 Mon Sep 17 00:00:00 2001 +From: Guillaume Chatelet <[email protected]> +Date: Wed, 27 Aug 2025 09:23:08 +0000 +Subject: [PATCH 3/6] Fix broken `CPU_FEATURES_OS_MACOS` and + `CPU_FEATURES_OS_IPHONE` detection + +Fixes #402 +--- + include/cpu_features_macros.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/cpu_features_macros.h b/include/cpu_features_macros.h +index d61ec10..99964b4 100644 +--- a/include/cpu_features_macros.h ++++ b/include/cpu_features_macros.h +@@ -115,10 +115,10 @@ + #if (defined(__apple__) || defined(__APPLE__) || defined(__MACH__)) + // From https://stackoverflow.com/a/49560690 + #include "TargetConditionals.h" +-#if defined(TARGET_OS_OSX) ++#if TARGET_OS_OSX + #define CPU_FEATURES_OS_MACOS + #endif +-#if defined(TARGET_OS_IPHONE) ++#if TARGET_OS_IPHONE + // This is set for any non-Mac Apple products (IOS, TV, WATCH) + #define CPU_FEATURES_OS_IPHONE + #endif +-- +2.47.3 + diff --git a/debian/patches/0004-Update-AArch64-features-to-Linux-6.12.patch b/debian/patches/0004-Update-AArch64-features-to-Linux-6.12.patch new file mode 100644 index 0000000..bffbb09 --- /dev/null +++ b/debian/patches/0004-Update-AArch64-features-to-Linux-6.12.patch @@ -0,0 +1,75 @@ +From 822b9a6cea8dcdf88b15bd0006c81a069a927bb3 Mon Sep 17 00:00:00 2001 +From: Peter Tarjan <[email protected]> +Date: Thu, 4 Sep 2025 12:28:03 +0200 +Subject: [PATCH 4/6] Update AArch64 features to Linux 6.12. + +Change-Id: Ie4e3f6a1e308e81e89f45976e5cba3c0d9bc3039 +--- + include/cpuinfo_aarch64.h | 2 ++ + include/internal/hwcaps.h | 1 + + src/impl_aarch64__base_implementation.inl | 4 +++- + test/cpuinfo_aarch64_test.cc | 1 + + 4 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/include/cpuinfo_aarch64.h b/include/cpuinfo_aarch64.h +index 826f0ab..523d598 100644 +--- a/include/cpuinfo_aarch64.h ++++ b/include/cpuinfo_aarch64.h +@@ -217,6 +217,7 @@ typedef struct { + // (4-way) instructions. + int smesf8dp2 : 1; // SVE2 FP8 to half-precision 2-way dot product FDOT + // (2-way) instructions. ++ int poe : 1; // Stage 1 Permission Overlay. + + // Make sure to update Aarch64FeaturesEnum below if you add a field here. + } Aarch64Features; +@@ -331,6 +332,7 @@ typedef enum { + AARCH64_SME_SF8FMA, + AARCH64_SME_SF8DP4, + AARCH64_SME_SF8DP2, ++ AARCH64_POE, + AARCH64_LAST_, + } Aarch64FeaturesEnum; + +diff --git a/include/internal/hwcaps.h b/include/internal/hwcaps.h +index 2490e3e..fcc229b 100644 +--- a/include/internal/hwcaps.h ++++ b/include/internal/hwcaps.h +@@ -124,6 +124,7 @@ CPU_FEATURES_START_CPP_NAMESPACE + #define AARCH64_HWCAP2_SME_SF8FMA (1UL << 60) + #define AARCH64_HWCAP2_SME_SF8DP4 (1UL << 61) + #define AARCH64_HWCAP2_SME_SF8DP2 (1UL << 62) ++#define AARCH64_HWCAP2_POE (1UL << 63) + + // http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h + #define ARM_HWCAP_SWP (1UL << 0) +diff --git a/src/impl_aarch64__base_implementation.inl b/src/impl_aarch64__base_implementation.inl +index 16960a9..228a5bf 100644 +--- a/src/impl_aarch64__base_implementation.inl ++++ b/src/impl_aarch64__base_implementation.inl +@@ -136,7 +136,9 @@ + AARCH64_HWCAP2_SME_SF8FMA) \ + LINE(AARCH64_SME_SF8DP4, smesf8dp4, "smesf8dp4", 0, \ + AARCH64_HWCAP2_SME_SF8DP4) \ +- LINE(AARCH64_SME_SF8DP2, smesf8dp2, "smesf8dp2", 0, AARCH64_HWCAP2_SME_SF8DP2) ++ LINE(AARCH64_SME_SF8DP2, smesf8dp2, "smesf8dp2", 0, \ ++ AARCH64_HWCAP2_SME_SF8DP2) \ ++ LINE(AARCH64_POE, poe, "poe", 0, AARCH64_HWCAP2_POE) + + #define INTROSPECTION_PREFIX Aarch64 + #define INTROSPECTION_ENUM_PREFIX AARCH64 +diff --git a/test/cpuinfo_aarch64_test.cc b/test/cpuinfo_aarch64_test.cc +index a84e6b6..b09cbfa 100644 +--- a/test/cpuinfo_aarch64_test.cc ++++ b/test/cpuinfo_aarch64_test.cc +@@ -330,6 +330,7 @@ CPU revision : 3)"); + EXPECT_FALSE(info.features.smesf8fma); + EXPECT_FALSE(info.features.smesf8dp4); + EXPECT_FALSE(info.features.smesf8dp2); ++ EXPECT_FALSE(info.features.poe); + } + #elif defined(CPU_FEATURES_OS_MACOS) + TEST_F(CpuidAarch64Test, FromDarwinSysctlFromName) { +-- +2.47.3 + diff --git a/debian/patches/0005-cmake-Fix-googletest-build.patch b/debian/patches/0005-cmake-Fix-googletest-build.patch new file mode 100644 index 0000000..b6c6fe2 --- /dev/null +++ b/debian/patches/0005-cmake-Fix-googletest-build.patch @@ -0,0 +1,30 @@ +From d8680367ef6138bb42ba0981e53dc858cc255e2e Mon Sep 17 00:00:00 2001 +From: Corentin Le Molgat <[email protected]> +Date: Mon, 13 Oct 2025 17:39:57 +0200 +Subject: [PATCH 5/6] cmake: Fix googletest build + +note: googletest require cmake 3.16 as its minimum +--- + cmake/googletest.CMakeLists.txt.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/googletest.CMakeLists.txt.in b/cmake/googletest.CMakeLists.txt.in +index 8003c2c..5421e9d 100644 +--- a/cmake/googletest.CMakeLists.txt.in ++++ b/cmake/googletest.CMakeLists.txt.in +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.8.2) ++cmake_minimum_required(VERSION 3.16) + + project(googletest-download NONE) + +@@ -12,4 +12,4 @@ ExternalProject_Add(googletest + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +-) +\ No newline at end of file ++) +-- +2.47.3 + diff --git a/debian/patches/0006-Build-with-zig-431.patch b/debian/patches/0006-Build-with-zig-431.patch new file mode 100644 index 0000000..99955db --- /dev/null +++ b/debian/patches/0006-Build-with-zig-431.patch @@ -0,0 +1,418 @@ +From 2182eb53ec2b80cd8e5b1a916300f9fe31c8d401 Mon Sep 17 00:00:00 2001 +From: Francesco Gualazzi <[email protected]> +Date: Tue, 14 Oct 2025 13:17:32 +0200 +Subject: [PATCH 6/6] Build with zig (#431) + +* build with Zig + +Add the necessary files to build a static library with Zig. +The build also includes producing execuable that can be cross-compiled + +Signed-off-by: inge4pres <[email protected]> + +* ci: add zig build workflow + +Signed-off-by: inge4pres <[email protected]> + +* build(zig): aarch64 macros on Linux + +* CI: split zig build by platform + +Signed-off-by: inge4pres <[email protected]> + +* CI: release script updates version in build.zig.zon + +Signed-off-by: inge4pres <[email protected]> + +--------- + +Signed-off-by: inge4pres <[email protected]> +--- + .github/workflows/aarch64_linux_zig.yml | 21 ++ + .github/workflows/amd64_linux_zig.yml | 21 ++ + .github/workflows/zig.yml | 13 ++ + .gitignore | 4 + + build.zig | 248 ++++++++++++++++++++++++ + build.zig.zon | 12 ++ + scripts/make_release.sh | 3 + + 7 files changed, 322 insertions(+) + create mode 100644 .github/workflows/aarch64_linux_zig.yml + create mode 100644 .github/workflows/amd64_linux_zig.yml + create mode 100644 .github/workflows/zig.yml + create mode 100644 build.zig + create mode 100644 build.zig.zon + +diff --git a/.github/workflows/aarch64_linux_zig.yml b/.github/workflows/aarch64_linux_zig.yml +new file mode 100644 +index 0000000..522875a +--- /dev/null ++++ b/.github/workflows/aarch64_linux_zig.yml +@@ -0,0 +1,21 @@ ++name: aarch64 Linux Zig ++ ++on: [push, pull_request] ++ ++jobs: ++ run: ++ strategy: ++ matrix: ++ target: ++ - aarch64-linux-musl ++ - aarch64-linux-gnu ++ runs-on: ubuntu-24.04-arm ++ steps: ++ - uses: actions/checkout@v5 ++ - uses: mlugg/setup-zig@v2 ++ with: ++ version: latest ++ - name: Build ++ run: zig build -Dtarget=${{ matrix.target }} ++ - name: Run list_cpu_features ++ run: ./zig-out/bin/list_cpu_features --json +diff --git a/.github/workflows/amd64_linux_zig.yml b/.github/workflows/amd64_linux_zig.yml +new file mode 100644 +index 0000000..d23da30 +--- /dev/null ++++ b/.github/workflows/amd64_linux_zig.yml +@@ -0,0 +1,21 @@ ++name: amd64 Linux Zig ++ ++on: [push, pull_request] ++ ++jobs: ++ run: ++ strategy: ++ matrix: ++ target: ++ - x86_64-linux-musl ++ - x86_64-linux-gnu ++ runs-on: ubuntu-latest ++ steps: ++ - uses: actions/checkout@v5 ++ - uses: mlugg/setup-zig@v2 ++ with: ++ version: latest ++ - name: Build ++ run: zig build -Dtarget=${{ matrix.target }} ++ - name: Run list_cpu_features ++ run: ./zig-out/bin/list_cpu_features --json +diff --git a/.github/workflows/zig.yml b/.github/workflows/zig.yml +new file mode 100644 +index 0000000..777ffba +--- /dev/null ++++ b/.github/workflows/zig.yml +@@ -0,0 +1,13 @@ ++name: Zig Check ++ ++on: [push, pull_request] ++ ++jobs: ++ zig-fmt: ++ runs-on: ubuntu-latest ++ steps: ++ - uses: actions/checkout@v5 ++ - uses: mlugg/setup-zig@v2 ++ with: ++ version: latest ++ - run: zig fmt --check . +diff --git a/.gitignore b/.gitignore +index c4ee9c8..f7f06b9 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -18,3 +18,7 @@ MODULE.bazel.lock + + # Per-user bazelrc files + user.bazelrc ++ ++# Zig build artifacts ++.zig-cache ++zig-out +diff --git a/build.zig b/build.zig +new file mode 100644 +index 0000000..7ff7d79 +--- /dev/null ++++ b/build.zig +@@ -0,0 +1,248 @@ ++const std = @import("std"); ++ ++pub fn build(b: *std.Build) void { ++ // Standard target and optimization options ++ const target = b.standardTargetOptions(.{}); ++ const optimize = b.standardOptimizeOption(.{}); ++ ++ // Build options (mirroring CMake options) ++ const build_executable = b.option(bool, "BUILD_EXECUTABLE", "Build list_cpu_features executable") orelse true; ++ const enable_install = b.option(bool, "ENABLE_INSTALL", "Enable install targets") orelse true; ++ ++ // Create the cpu_features static library ++ const cpu_features = b.addLibrary(.{ ++ .name = "cpu_features", ++ .linkage = .static, ++ .root_module = b.createModule(.{ ++ .target = target, ++ .optimize = optimize, ++ .link_libc = true, ++ }), ++ }); ++ ++ cpu_features.addIncludePath(b.path("include")); ++ cpu_features.addIncludePath(b.path("include/internal")); ++ ++ // Public compile definitions ++ cpu_features.root_module.addCMacro("STACK_LINE_READER_BUFFER_SIZE", "1024"); ++ ++ // Platform-specific defines ++ const os_tag = target.result.os.tag; ++ const cpu_arch = target.result.cpu.arch; ++ ++ if (os_tag.isDarwin()) { ++ cpu_features.root_module.addCMacro("HAVE_SYSCTLBYNAME", "1"); ++ } else if (os_tag == .linux) { ++ // Linux (including musl) provides getauxval() for hardware capability detection ++ cpu_features.root_module.addCMacro("HAVE_STRONG_GETAUXVAL", "1"); ++ cpu_features.root_module.addCMacro("HAVE_DLFCN_H", "1"); ++ } ++ ++ // Utility sources (always included) ++ const utility_sources = [_][]const u8{ ++ "src/filesystem.c", ++ "src/stack_line_reader.c", ++ "src/string_view.c", ++ }; ++ ++ // Common C flags for all source files ++ const c_flags = [_][]const u8{ ++ "-Wall", ++ "-Wextra", ++ "-Wmissing-declarations", ++ "-Wmissing-prototypes", ++ "-Wno-implicit-fallthrough", ++ "-Wno-unused-function", ++ "-Wold-style-definition", ++ "-Wshadow", ++ "-Wsign-compare", ++ "-Wstrict-prototypes", ++ "-std=c99", ++ "-fno-sanitize=undefined", // Disable UBSan for C code with intentional unaligned access ++ }; ++ ++ for (utility_sources) |source| { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path(source), ++ .flags = &c_flags, ++ }); ++ } ++ ++ // Unix-based hardware detection (for non-x86 Unix platforms) ++ // Note: Android is represented as Linux in Zig's target system ++ if (os_tag != .windows and !cpu_arch.isX86()) { ++ const hwcaps_sources = [_][]const u8{ ++ "src/hwcaps.c", ++ "src/hwcaps_linux_or_android.c", ++ "src/hwcaps_freebsd_or_openbsd.c", ++ }; ++ ++ for (hwcaps_sources) |source| { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path(source), ++ .flags = &c_flags, ++ }); ++ } ++ } ++ ++ // Architecture-specific implementation files ++ // Determine which implementation files to include based on target architecture ++ // Note: Android is represented as Linux in Zig's target system ++ switch (cpu_arch) { ++ .x86, .x86_64 => { ++ // x86/x86_64 architecture ++ const source: ?[]const u8 = if (os_tag == .linux) ++ "src/impl_x86_linux_or_android.c" ++ else if (os_tag.isDarwin()) ++ "src/impl_x86_macos.c" ++ else if (os_tag == .windows) ++ "src/impl_x86_windows.c" ++ else if (os_tag == .freebsd) ++ "src/impl_x86_freebsd.c" ++ else ++ null; ++ ++ if (source) |s| { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path(s), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .aarch64, .aarch64_be => { ++ // AArch64 architecture - always needs cpuid ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_aarch64_cpuid.c"), ++ .flags = &c_flags, ++ }); ++ ++ const source: ?[]const u8 = if (os_tag == .linux) ++ "src/impl_aarch64_linux_or_android.c" ++ else if (os_tag.isDarwin()) ++ "src/impl_aarch64_macos_or_iphone.c" ++ else if (os_tag == .windows) ++ "src/impl_aarch64_windows.c" ++ else if (os_tag == .freebsd or os_tag == .openbsd) ++ "src/impl_aarch64_freebsd_or_openbsd.c" ++ else ++ null; ++ ++ if (source) |s| { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path(s), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .arm, .armeb, .thumb, .thumbeb => { ++ // ARM (32-bit) architecture ++ if (os_tag == .linux) { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_arm_linux_or_android.c"), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .mips, .mipsel, .mips64, .mips64el => { ++ // MIPS architecture ++ if (os_tag == .linux) { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_mips_linux_or_android.c"), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .powerpc, .powerpcle, .powerpc64, .powerpc64le => { ++ // PowerPC architecture ++ if (os_tag == .linux) { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_ppc_linux.c"), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .riscv32, .riscv64 => { ++ // RISC-V architecture ++ if (os_tag == .linux) { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_riscv_linux.c"), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .s390x => { ++ // s390x architecture ++ if (os_tag == .linux) { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_s390x_linux.c"), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ .loongarch64 => { ++ // LoongArch architecture ++ if (os_tag == .linux) { ++ cpu_features.addCSourceFile(.{ ++ .file = b.path("src/impl_loongarch_linux.c"), ++ .flags = &c_flags, ++ }); ++ } ++ }, ++ else => { ++ std.debug.print("Warning: Unsupported architecture {s}\n", .{@tagName(cpu_arch)}); ++ }, ++ } ++ ++ // Link against dl library on Unix-like systems ++ if (os_tag != .windows and os_tag != .wasi) { ++ cpu_features.linkSystemLibrary("dl"); ++ } ++ ++ // Install the library if enabled ++ if (enable_install) { ++ b.installArtifact(cpu_features); ++ ++ // Install headers ++ const install_headers = b.addInstallDirectory(.{ ++ .source_dir = b.path("include"), ++ .install_dir = .header, ++ .install_subdir = "cpu_features", ++ .exclude_extensions = &.{}, ++ }); ++ b.getInstallStep().dependOn(&install_headers.step); ++ } ++ ++ // Build list_cpu_features executable if requested ++ if (build_executable) { ++ const list_cpu_features = b.addExecutable(.{ ++ .name = "list_cpu_features", ++ .root_module = b.createModule(.{ ++ .target = target, ++ .optimize = optimize, ++ .link_libc = true, ++ }), ++ }); ++ ++ list_cpu_features.linkLibrary(cpu_features); ++ list_cpu_features.addIncludePath(b.path("include")); ++ ++ list_cpu_features.addCSourceFile(.{ ++ .file = b.path("src/utils/list_cpu_features.c"), ++ .flags = &c_flags, ++ }); ++ ++ if (enable_install) { ++ b.installArtifact(list_cpu_features); ++ } ++ ++ // Add a run step for convenience ++ const run_cmd = b.addRunArtifact(list_cpu_features); ++ run_cmd.step.dependOn(b.getInstallStep()); ++ if (b.args) |args| { ++ run_cmd.addArgs(args); ++ } ++ ++ const run_step = b.step("run", "Run list_cpu_features"); ++ run_step.dependOn(&run_cmd.step); ++ } ++} +diff --git a/build.zig.zon b/build.zig.zon +new file mode 100644 +index 0000000..d54afba +--- /dev/null ++++ b/build.zig.zon +@@ -0,0 +1,12 @@ ++.{ ++ .name = .cpu_features, ++ .version = "0.0.1", ++ .minimum_zig_version = "0.15.1", ++ .paths = .{ ++ "build.zig", ++ "build.zig.zon", ++ "src", ++ "include", ++ }, ++ .fingerprint = 0xbd52e965d3c20004, ++} +diff --git a/scripts/make_release.sh b/scripts/make_release.sh +index 2e11a44..d15adfc 100755 +--- a/scripts/make_release.sh ++++ b/scripts/make_release.sh +@@ -65,6 +65,9 @@ sed -i "s/CpuFeatures VERSION ${LATEST_VERSION}/CpuFeatures VERSION ${VERSION}/g + echo -e "${ACTION}Modifying MODULE.bazel${NOCOLOR}" + sed -i "s/CPU_FEATURES_VERSION = \"${LATEST_VERSION}\"/CPU_FEATURES_VERSION = \"${VERSION}\"/g" MODULE.bazel + ++echo -e "${ACTION}Modifying build.zig.zon${NOCOLOR}" ++sed -i "s/.version = \"${LATEST_VERSION}\"/.version = \"${VERSION}\"/g" build.zig.zon ++ + echo -e "${ACTION}Commit new revision${NOCOLOR}" + git add CMakeLists.txt MODULE.bazel + git commit -m"Release ${GIT_TAG}" +-- +2.47.3 + diff --git a/debian/patches/series b/debian/patches/series index b59fd31..a0e38ce 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,7 @@ -0001-use-local-googletest-src.patch +0001-docs-Add-Node.JS-wrapper-https-github.com-mscdex-cpu.patch +0002-Bump-actions-checkout-from-4-to-5-in-the-github-acti.patch +0003-Fix-broken-CPU_FEATURES_OS_MACOS-and-CPU_FEATURES_OS.patch +0004-Update-AArch64-features-to-Linux-6.12.patch +0005-cmake-Fix-googletest-build.patch +0006-Build-with-zig-431.patch +use-local-googletest-src diff --git a/debian/patches/0001-use-local-googletest-src.patch b/debian/patches/use-local-googletest-src similarity index 79% rename from debian/patches/0001-use-local-googletest-src.patch rename to debian/patches/use-local-googletest-src index 80293d8..de76f0c 100644 --- a/debian/patches/0001-use-local-googletest-src.patch +++ b/debian/patches/use-local-googletest-src @@ -8,11 +8,9 @@ Forwarded: not-needed cmake/googletest.CMakeLists.txt.in | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 81451d4..1f14611 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -203,7 +203,7 @@ if(BUILD_TESTING) +@@ -242,7 +242,7 @@ # Add googletest directly to our build. This defines the gtest and # gtest_main targets. @@ -21,11 +19,9 @@ index 81451d4..1f14611 100644 ${CMAKE_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL) endif() -diff --git a/cmake/googletest.CMakeLists.txt.in b/cmake/googletest.CMakeLists.txt.in -index 8003c2c..e52b102 100644 --- a/cmake/googletest.CMakeLists.txt.in +++ b/cmake/googletest.CMakeLists.txt.in -@@ -4,9 +4,7 @@ project(googletest-download NONE) +@@ -4,9 +4,7 @@ include(ExternalProject) ExternalProject_Add(googletest diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755 diff --git a/debian/watch b/debian/watch index d272953..b6fb5a7 100644 --- a/debian/watch +++ b/debian/watch @@ -1,4 +1,4 @@ version=4 opts="mode=git, pgpmode=none" \ https://github.com/google/cpu_features \ - refs/tags/v?@ANY_VERSION@ debian + refs/tags/v?@ANY_VERSION@ debian uupdate -- 2.47.3

