From a4ad5dee5dafa62da0cb3a0636b2965f121aec1f Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 18:31:46 +0100 Subject: [PATCH 1/8] New Recipe: CPUInfo v0.0.20200122 --- C/CPUInfo/build_tarballs.jl | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 C/CPUInfo/build_tarballs.jl diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl new file mode 100644 index 00000000000..c6c0c05d66d --- /dev/null +++ b/C/CPUInfo/build_tarballs.jl @@ -0,0 +1,51 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. +using BinaryBuilder, Pkg + +name = "CPUInfo" +version = v"0.0.20200122" + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/pytorch/cpuinfo.git", "0e6bde92b343c5fbcfe34ecd41abf9515d54b4a7") +] + +# Bash recipe for building across all platforms +script = raw""" +cd $WORKSPACE/srcdir +cd cpuinfo +mkdir build +cd build +cmake \ + -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_LIBDIR=$libdir \ + -DCPUINFO_BUILD_UNIT_TESTS=OFF \ + -DCPUINFO_BUILD_MOCK_TESTS=OFF \ + -DCPUINFO_BUILD_BENCHMARKS=OFF \ + -DCPUINFO_LIBRARY_TYPE=shared \ + .. +cmake --build . -- -j $nproc +make install +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = supported_platforms() + +# The products that we will ensure are always built +products = [ + LibraryProduct("libcpuinfo", :libcpuinfo), + ExecutableProduct("isa-info", :isa_info), + ExecutableProduct("cpu-info", :cpu_info), + ExecutableProduct("cpuid-dump", :cpuid_dump), + ExecutableProduct("cache-info", :cache_info) +] + +# Dependencies that must be installed before this package can be built +dependencies = Dependency[ +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6") From c20c5d7f97e80a7aec7e7e26f4edbe5352c3bdf4 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 18:35:37 +0100 Subject: [PATCH 2/8] Omitted cpuid-dump product to enable aarch64-linux-gnu --- C/CPUInfo/build_tarballs.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index c6c0c05d66d..7bbd2102119 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -39,7 +39,6 @@ products = [ LibraryProduct("libcpuinfo", :libcpuinfo), ExecutableProduct("isa-info", :isa_info), ExecutableProduct("cpu-info", :cpu_info), - ExecutableProduct("cpuid-dump", :cpuid_dump), ExecutableProduct("cache-info", :cache_info) ] From 30f675ecf1f4f87b258380305e7a0a374ee5cd59 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 19:03:08 +0100 Subject: [PATCH 3/8] Added lowercase windows include patch --- C/CPUInfo/build_tarballs.jl | 6 +++++- .../bundled/patches/lowercase-windows-include.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 C/CPUInfo/bundled/patches/lowercase-windows-include.patch diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index 7bbd2102119..ff13dbb8799 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -7,13 +7,17 @@ version = v"0.0.20200122" # Collection of sources required to complete build sources = [ - GitSource("https://github.com/pytorch/cpuinfo.git", "0e6bde92b343c5fbcfe34ecd41abf9515d54b4a7") + GitSource("https://github.com/pytorch/cpuinfo.git", "0e6bde92b343c5fbcfe34ecd41abf9515d54b4a7"), + DirectorySource("./bundled"), ] # Bash recipe for building across all platforms script = raw""" cd $WORKSPACE/srcdir cd cpuinfo +if [[ $target == *-w64-mingw32 ]]; then + atomic_patch -p1 ../patches/lowercase-windows-include.patch +fi mkdir build cd build cmake \ diff --git a/C/CPUInfo/bundled/patches/lowercase-windows-include.patch b/C/CPUInfo/bundled/patches/lowercase-windows-include.patch new file mode 100644 index 00000000000..3bd7e6555f3 --- /dev/null +++ b/C/CPUInfo/bundled/patches/lowercase-windows-include.patch @@ -0,0 +1,13 @@ +diff --git a/src/x86/windows/init.c b/src/x86/windows/init.c +index 7a2090e..115f366 100644 +--- a/src/x86/windows/init.c ++++ b/src/x86/windows/init.c +@@ -8,7 +8,7 @@ + #include + #include + +-#include ++#include + + static inline uint32_t bit_mask(uint32_t bits) { + return (UINT32_C(1) << bits) - UINT32_C(1); From 58d77fcf9ae4d45d0f04ac310f46f315221336fc Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 19:11:07 +0100 Subject: [PATCH 4/8] Excluded unsupported aarch64-macos and freebsd --- C/CPUInfo/build_tarballs.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index ff13dbb8799..f5f652efa21 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -1,6 +1,7 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message. using BinaryBuilder, Pkg +using BinaryBuilderBase: os name = "CPUInfo" version = v"0.0.20200122" @@ -37,6 +38,8 @@ make install # These are the platforms we will build for by default, unless further # platforms are passed in on the command line platforms = supported_platforms() +filter!(p -> arch(p) != "aarch64" || os(p) != "macos", platforms) # aarch64-macos unsupported +filter!(p -> os(p) != "freebsd", platforms) # FreeBSD unsupported # The products that we will ensure are always built products = [ From 83fe09ec041f06bd9e47b3932112c20fa7a97963 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 19:17:02 +0100 Subject: [PATCH 5/8] Excluded executable products to enable PowerPC64LE --- C/CPUInfo/build_tarballs.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index f5f652efa21..e857b4ca616 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -44,9 +44,6 @@ filter!(p -> os(p) != "freebsd", platforms) # FreeBSD unsupported # The products that we will ensure are always built products = [ LibraryProduct("libcpuinfo", :libcpuinfo), - ExecutableProduct("isa-info", :isa_info), - ExecutableProduct("cpu-info", :cpu_info), - ExecutableProduct("cache-info", :cache_info) ] # Dependencies that must be installed before this package can be built From 0eac1b9fb33029f6de4acc6abde1a8814a7bf4d7 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 19:32:29 +0100 Subject: [PATCH 6/8] Simplified filtering of platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mosè Giordano --- C/CPUInfo/build_tarballs.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index e857b4ca616..75e810ac852 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -1,7 +1,6 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message. using BinaryBuilder, Pkg -using BinaryBuilderBase: os name = "CPUInfo" version = v"0.0.20200122" @@ -38,8 +37,8 @@ make install # These are the platforms we will build for by default, unless further # platforms are passed in on the command line platforms = supported_platforms() -filter!(p -> arch(p) != "aarch64" || os(p) != "macos", platforms) # aarch64-macos unsupported -filter!(p -> os(p) != "freebsd", platforms) # FreeBSD unsupported +filter!(p -> !(Sys.isapple(p) && arch(p) == "aarch64"), platforms) # aarch64-macos unsupported +filter!(p -> !Sys.isfreebsd(p), platforms) # FreeBSD unsupported # The products that we will ensure are always built products = [ From 34ae1d5abd9f54a0eb44652e39c5f710c5e4f4b4 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 19:47:40 +0100 Subject: [PATCH 7/8] Added manual install of omitted shared library on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mosè Giordano --- C/CPUInfo/build_tarballs.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index 75e810ac852..3726bfa6535 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -32,6 +32,9 @@ cmake \ .. cmake --build . -- -j $nproc make install +if [[ $target == *-w64-mingw32 ]]; then + install -Dvm 755 libcpuinfo.dll "${libdir}/libcpuinfo.dll" +fi """ # These are the platforms we will build for by default, unless further From d46685e9e9fbc61c5e70448139b68f32cc550ce0 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sun, 6 Mar 2022 20:05:58 +0100 Subject: [PATCH 8/8] Excluded i686-windows --- C/CPUInfo/build_tarballs.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/C/CPUInfo/build_tarballs.jl b/C/CPUInfo/build_tarballs.jl index 3726bfa6535..e8c3804b3a1 100644 --- a/C/CPUInfo/build_tarballs.jl +++ b/C/CPUInfo/build_tarballs.jl @@ -42,6 +42,7 @@ fi platforms = supported_platforms() filter!(p -> !(Sys.isapple(p) && arch(p) == "aarch64"), platforms) # aarch64-macos unsupported filter!(p -> !Sys.isfreebsd(p), platforms) # FreeBSD unsupported +filter!(p -> !(Sys.iswindows(p) && arch(p) == "i686"), platforms) # Failing to link # The products that we will ensure are always built products = [