diff --git a/sci-libs/onnx/onnx-1.17.0.recipe b/sci-libs/onnx/onnx-1.17.0.recipe new file mode 100644 index 000000000..0c709419b --- /dev/null +++ b/sci-libs/onnx/onnx-1.17.0.recipe @@ -0,0 +1,90 @@ +SUMMARY="Open standard for machine learning interoperability" +DESCRIPTION="Open Neural Network Exchange (ONNX) is an open ecosystem that empowers AI developers \ +to choose the right tools as their project evolves. ONNX provides an open source format for AI \ +models, both deep learning and traditional ML. It defines an extensible computation graph model, \ +as well as definitions of built-in operators and standard data types. Currently we focus on the \ +capabilities needed for inferencing (scoring)." +HOMEPAGE="https://github.com/onnx/onnx" +COPYRIGHT="2024 ONNX Project Contributors" +LICENSE="Apache v2" +REVISION="1" +SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz" +CHECKSUM_SHA256="8d5e983c36037003615e5a02d36b18fc286541bf52de1a78f6cf9f32005a820e" +PATCHES="onnx-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + onnx$secondaryArchSuffix = $portVersion + lib:libonnx$secondaryArchSuffix + lib:libonnx_proto$secondaryArchSuffix + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libprotobuf$secondaryArchSuffix + " + +PROVIDES_devel=" + onnx${secondaryArchSuffix}_devel = $portVersion + devel:libonnx$secondaryArchSuffix + devel:libonnx_proto$secondaryArchSuffix + " +REQUIRES_devel=" + onnx$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libgtest$secondaryArchSuffix + devel:libprotobuf$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:cmake + cmd:gcc$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:python3 + " + +defineDebugInfoPackage onnx$secondaryArchSuffix \ + "$libDir"/libonnx.so \ + "$libDir"/libonnx_proto.so + +BUILD() +{ + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \ + $cmakeDirArgs \ + -DONNX_USE_LITE_PROTO=OFF \ + -DONNX_USE_PROTOBUF_SHARED_LIBS=ON \ + -DCMAKE_SKIP_RPATH:BOOL=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DONNX_VERIFY_PROTO3=ON \ + -DONNX_BUILD_TESTS=ON \ + -Wno-dev + + make -C build $jobArgs +} + +INSTALL() +{ + make -C build install + + # Fix usage of hardcoded "/include": + sed -e "s|\(\${_IMPORT_PREFIX}\)/include|\1/$relativeIncludeDir|" \ + -i $libDir/cmake/ONNX/ONNXTargets.cmake + + prepareInstalledDevelLibs \ + libonnx \ + libonnx_proto + + packageEntries devel \ + "$developDir" \ + $libDir/cmake +} + +TEST() +{ + export LIBRARY_PATH="$sourceDir/build${LIBRARY_PATH:+:$LIBRARY_PATH}" + ctest --test-dir build --output-on-failure +} diff --git a/sci-libs/onnx/patches/onnx-1.17.0.patchset b/sci-libs/onnx/patches/onnx-1.17.0.patchset new file mode 100644 index 000000000..2cca33d04 --- /dev/null +++ b/sci-libs/onnx/patches/onnx-1.17.0.patchset @@ -0,0 +1,41 @@ +From bfb2edab1fe354fb8a5f3ef5f3d27dbed3be8379 Mon Sep 17 00:00:00 2001 +From: Alejandro Alvarez Ayllon +Date: Sat, 24 Feb 2024 14:52:25 +0100 +Subject: Use system protobuf and require parameterized + + +diff --git a/requirements.txt b/requirements.txt +index 7f3a9ad..46dd7f7 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,2 +1,3 @@ + numpy>=1.20 +-protobuf>=3.20.2 ++protobuf >= 3.14.0, < 4 ++parameterized >= 0.8.1, < 1 +-- +2.45.2 + + +From 92f9784ea21dd433cff7bb8ed2f82b651045502c Mon Sep 17 00:00:00 2001 +From: Schrijvers Luc +Date: Thu, 12 Dec 2024 11:22:16 +0100 +Subject: Use -fPIC for building the test binary + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d15d97e..987af64 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -114,7 +114,7 @@ endif() + + # Build the libraries with -fPIC including the protobuf lib. + if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++ set(CMAKE_POSITION_INDEPENDENT_CODE OFF) + endif() + + if(ONNX_BUILD_TESTS) +-- +2.45.2 +