summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch49
-rw-r--r--0001-downgrade-cmake-from-3.26-to-3.24.patch34
-rw-r--r--0001-fix-forward-decl-flatbuffers.patch172
-rw-r--r--0001-gcc-false-positive.patch53
-rw-r--r--0001-remove-nsync.patch221
-rw-r--r--0001-use-system-Flatbuffers.patch34
-rw-r--r--0001-use-system-cpuinfo.patch45
-rw-r--r--0001-use-system-protobuf.patch48
-rw-r--r--0001-use-system-python.patch32
-rw-r--r--0001-versioned-onnxruntime_providers_shared.patch24
-rw-r--r--0002-remove-nsync.patch25
-rw-r--r--onnxruntime-1.16.3.tar.gz3
-rw-r--r--onnxruntime.spec162
-rw-r--r--sources0
14 files changed, 902 insertions, 0 deletions
diff --git a/0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch b/0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch
new file mode 100644
index 0000000..ee2a723
--- /dev/null
+++ b/0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch
@@ -0,0 +1,49 @@
+From eef8d765c29a2d15fd22dee24a7af1bba42f1a2d Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Wed, 31 Jan 2024 09:07:22 +0800
+Subject: [PATCH] add onnxruntime_INSTALL_UNIT_TESTS option
+
+---
+ cmake/CMakeLists.txt | 1 +
+ cmake/onnxruntime_unittests.cmake | 13 +++++++------
+ 2 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index eaebef8..d3b1448 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -78,6 +78,7 @@ option(onnxruntime_USE_RKNPU "Build with RKNPU support" OFF)
+ option(onnxruntime_USE_DNNL "Build with DNNL support" OFF)
+ option(onnxruntime_USE_JSEP "Build with JavaScript implemented kernels support" OFF)
+ option(onnxruntime_BUILD_UNIT_TESTS "Build ONNXRuntime unit tests" ON)
++option(onnxruntime_INSTALL_UNIT_TESTS "Install ONNXRuntime unit tests" ON)
+ option(onnxruntime_BUILD_CSHARP "Build C# library" OFF)
+ option(onnxruntime_BUILD_OBJC "Build Objective-C library" OFF)
+ option(onnxruntime_USE_PREINSTALLED_EIGEN "Use pre-installed EIGEN. Need to provide eigen_SOURCE_PATH if turn this on." OFF)
+diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake
+index 38f9719..aaa57fc 100644
+--- a/cmake/onnxruntime_unittests.cmake
++++ b/cmake/onnxruntime_unittests.cmake
+@@ -1059,12 +1059,13 @@ if (onnxruntime_USE_TVM)
+ target_link_options(onnx_test_runner PRIVATE "/STACK:4000000")
+ endif()
+ endif()
+-
+-install(TARGETS onnx_test_runner
+- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+- BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
++if (onnxruntime_INSTALL_UNIT_TESTS)
++ install(TARGETS onnx_test_runner
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
++endif()
+
+ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
+ if(onnxruntime_BUILD_BENCHMARKS)
+--
+2.41.0
+
diff --git a/0001-downgrade-cmake-from-3.26-to-3.24.patch b/0001-downgrade-cmake-from-3.26-to-3.24.patch
new file mode 100644
index 0000000..f3cdb3f
--- /dev/null
+++ b/0001-downgrade-cmake-from-3.26-to-3.24.patch
@@ -0,0 +1,34 @@
+From 96fd81264df0a901567cb22391663da89f497b5a Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Tue, 30 Jan 2024 11:14:29 +0800
+Subject: [PATCH] downgrade cmake from 3.26 to 3.24
+
+---
+ cmake/CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index 82a4547..87a048f 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -2,7 +2,7 @@
+ # Licensed under the MIT License.
+
+ # Minimum CMake required
+-cmake_minimum_required(VERSION 3.26)
++cmake_minimum_required(VERSION 3.24)
+
+ cmake_policy(SET CMP0069 NEW)
+ set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
+@@ -14,7 +14,7 @@ cmake_policy(SET CMP0117 NEW)
+ cmake_policy(SET CMP0104 OLD)
+
+ # Enable Hot Reload for MSVC compilers if supported.
+-cmake_policy(SET CMP0141 NEW)
++# cmake_policy(SET CMP0141 NEW)
+
+ # Project
+ project(onnxruntime C CXX ASM)
+--
+2.41.0
+
diff --git a/0001-fix-forward-decl-flatbuffers.patch b/0001-fix-forward-decl-flatbuffers.patch
new file mode 100644
index 0000000..c80ccc6
--- /dev/null
+++ b/0001-fix-forward-decl-flatbuffers.patch
@@ -0,0 +1,172 @@
+From 9354134facbe2ab00546b45552bca62e2975c12c Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Wed, 31 Jan 2024 00:13:56 +0800
+Subject: [PATCH] fix forward decl flatbuffers
+
+---
+ include/onnxruntime/core/graph/graph.h | 3 ++-
+ onnxruntime/core/flatbuffers/flatbuffers_utils.h | 15 +++------------
+ .../core/framework/kernel_type_str_resolver.h | 2 +-
+ onnxruntime/core/framework/session_state.h | 3 ++-
+ onnxruntime/core/graph/graph_flatbuffers_utils.h | 2 +-
+ onnxruntime/core/graph/model.h | 3 ++-
+ onnxruntime/core/graph/op_identifier_utils.h | 2 +-
+ .../graph/runtime_optimization_record_container.h | 6 +++---
+ 8 files changed, 15 insertions(+), 21 deletions(-)
+
+diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h
+index 81015b2..9ae5b13 100644
+--- a/include/onnxruntime/core/graph/graph.h
++++ b/include/onnxruntime/core/graph/graph.h
+@@ -43,8 +43,9 @@
+ #include "core/graph/node_arg.h"
+ #include "core/graph/ort_format_load_options.h"
+
++#include <flatbuffers/flatbuffer_builder.h>
++
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+ template <typename T>
+ struct Offset;
+ } // namespace flatbuffers
+diff --git a/onnxruntime/core/flatbuffers/flatbuffers_utils.h b/onnxruntime/core/flatbuffers/flatbuffers_utils.h
+index 4e7db4d..e4e100c 100644
+--- a/onnxruntime/core/flatbuffers/flatbuffers_utils.h
++++ b/onnxruntime/core/flatbuffers/flatbuffers_utils.h
+@@ -8,22 +8,13 @@
+ #include "core/common/common.h"
+ #include "core/common/path_string.h"
+ #include "core/common/status.h"
++#include <flatbuffers/vector.h>
++#include <flatbuffers/flatbuffer_builder.h>
+
+ namespace ONNX_NAMESPACE {
+ class ValueInfoProto;
+ }
+
+-namespace flatbuffers {
+-class FlatBufferBuilder;
+-
+-template <typename T>
+-struct Offset;
+-
+-struct String;
+-
+-template <typename T>
+-class Vector;
+-} // namespace flatbuffers
+
+ namespace onnxruntime {
+
+@@ -57,7 +48,7 @@ onnxruntime::common::Status LoadValueInfoOrtFormat(
+ const fbs::ValueInfo& fbs_value_info, ONNX_NAMESPACE::ValueInfoProto& value_info_proto);
+
+ onnxruntime::common::Status LoadOpsetImportOrtFormat(
+- const flatbuffers::Vector<flatbuffers::Offset<fbs::OperatorSetId>>* fbs_op_set_ids,
++ const flatbuffers::Vector<flatbuffers::Offset<fbs::OperatorSetId>, uint32_t>* fbs_op_set_ids,
+ std::unordered_map<std::string, int>& domain_to_version);
+
+ // check if filename ends in .ort
+diff --git a/onnxruntime/core/framework/kernel_type_str_resolver.h b/onnxruntime/core/framework/kernel_type_str_resolver.h
+index 75fc2fa..e029e5c 100644
+--- a/onnxruntime/core/framework/kernel_type_str_resolver.h
++++ b/onnxruntime/core/framework/kernel_type_str_resolver.h
+@@ -17,9 +17,9 @@
+ #include "core/graph/op_identifier.h"
+ #include "core/graph/graph.h"
+ #include "core/platform/ort_mutex.h"
++#include <flatbuffers/flatbuffer_builder.h>
+
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+ template <typename T>
+ struct Offset;
+ } // namespace flatbuffers
+diff --git a/onnxruntime/core/framework/session_state.h b/onnxruntime/core/framework/session_state.h
+index d546f26..5741a78 100644
+--- a/onnxruntime/core/framework/session_state.h
++++ b/onnxruntime/core/framework/session_state.h
+@@ -43,8 +43,9 @@
+ #include "core/framework/program_region.h"
+ #endif
+
++#include <flatbuffers/flatbuffer_builder.h>
++
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+ template <typename T>
+ struct Offset;
+ } // namespace flatbuffers
+diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.h b/onnxruntime/core/graph/graph_flatbuffers_utils.h
+index f4899ff..08b9345 100644
+--- a/onnxruntime/core/graph/graph_flatbuffers_utils.h
++++ b/onnxruntime/core/graph/graph_flatbuffers_utils.h
+@@ -8,6 +8,7 @@
+ #include "core/common/status.h"
+ #include "core/graph/ort_format_load_options.h"
+ #include "core/framework/tensor.h"
++#include <flatbuffers/flatbuffer_builder.h>
+
+ namespace ONNX_NAMESPACE {
+ class AttributeProto;
+@@ -19,7 +20,6 @@ class SparseTensorProto;
+ } // namespace ONNX_NAMESPACE
+
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+ template <typename T>
+ struct Offset;
+ } // namespace flatbuffers
+diff --git a/onnxruntime/core/graph/model.h b/onnxruntime/core/graph/model.h
+index 5337211..cb03cf9 100644
+--- a/onnxruntime/core/graph/model.h
++++ b/onnxruntime/core/graph/model.h
+@@ -15,8 +15,9 @@
+ #include "core/graph/function_template.h"
+ #endif
+
++#include <flatbuffers/flatbuffer_builder.h>
++
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+ template <typename T>
+ struct Offset;
+ } // namespace flatbuffers
+diff --git a/onnxruntime/core/graph/op_identifier_utils.h b/onnxruntime/core/graph/op_identifier_utils.h
+index 265364a..be54a8c 100644
+--- a/onnxruntime/core/graph/op_identifier_utils.h
++++ b/onnxruntime/core/graph/op_identifier_utils.h
+@@ -8,9 +8,9 @@
+ #include "core/common/status.h"
+ #include "core/graph/graph.h"
+ #include "core/graph/onnx_protobuf.h"
++#include <flatbuffers/flatbuffer_builder.h>
+
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+
+ template <typename T>
+ struct Offset;
+diff --git a/onnxruntime/core/graph/runtime_optimization_record_container.h b/onnxruntime/core/graph/runtime_optimization_record_container.h
+index 5db784f..7fecf4a 100644
+--- a/onnxruntime/core/graph/runtime_optimization_record_container.h
++++ b/onnxruntime/core/graph/runtime_optimization_record_container.h
+@@ -12,12 +12,12 @@
+ #include "core/common/common.h"
+ #include "core/graph/runtime_optimization_record.h"
+
++#include <flatbuffers/flatbuffer_builder.h>
++#include <flatbuffers/vector.h>
++
+ namespace flatbuffers {
+-class FlatBufferBuilder;
+ template <typename T>
+ struct Offset;
+-template <typename T>
+-class Vector;
+ } // namespace flatbuffers
+
+ namespace onnxruntime {
+--
+2.41.0
+
diff --git a/0001-gcc-false-positive.patch b/0001-gcc-false-positive.patch
new file mode 100644
index 0000000..723f4ed
--- /dev/null
+++ b/0001-gcc-false-positive.patch
@@ -0,0 +1,53 @@
+From 9423894b789e9a7af10cf9ac2a0b114bd360c7bb Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Wed, 31 Jan 2024 09:20:19 +0800
+Subject: [PATCH] gcc false positive
+
+---
+ .../optimizer/selectors_actions/selector_action_transformer.cc | 2 ++
+ onnxruntime/core/providers/cpu/tensor/scatter.cc | 2 ++
+ onnxruntime/test/framework/sparse_kernels_test.cc | 2 ++
+ 3 files changed, 6 insertions(+)
+
+diff --git a/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc b/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc
+index e182b6c..29fb768 100644
+--- a/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc
++++ b/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc
+@@ -1,6 +1,8 @@
+ // Copyright (c) Microsoft Corporation. All rights reserved.
+ // Licensed under the MIT License.
+
++#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
++
+ #include "core/optimizer/selectors_actions/selector_action_transformer.h"
+
+ #include <cassert>
+diff --git a/onnxruntime/core/providers/cpu/tensor/scatter.cc b/onnxruntime/core/providers/cpu/tensor/scatter.cc
+index 8844b7e..7ca4edd 100644
+--- a/onnxruntime/core/providers/cpu/tensor/scatter.cc
++++ b/onnxruntime/core/providers/cpu/tensor/scatter.cc
+@@ -16,6 +16,8 @@
+ #include "orttraining/training_ops/cpu/tensor/gather_elements_grad_impl.h"
+ #endif
+
++#pragma GCC diagnostic ignored "-Warray-bounds"
++
+ namespace onnxruntime {
+
+ namespace op_kernel_type_control {
+diff --git a/onnxruntime/test/framework/sparse_kernels_test.cc b/onnxruntime/test/framework/sparse_kernels_test.cc
+index 80f23b0..dbdab02 100644
+--- a/onnxruntime/test/framework/sparse_kernels_test.cc
++++ b/onnxruntime/test/framework/sparse_kernels_test.cc
+@@ -27,6 +27,8 @@
+ #include "core/util/math_cpuonly.h"
+ #include <Eigen/SparseCore>
+
++// #pragma GCC diagnostic ignored "-Wdangling-reference" // TODO: fix this
++
+ using namespace ONNX_NAMESPACE;
+ using namespace onnxruntime::common;
+
+--
+2.41.0
+
diff --git a/0001-remove-nsync.patch b/0001-remove-nsync.patch
new file mode 100644
index 0000000..8bf253c
--- /dev/null
+++ b/0001-remove-nsync.patch
@@ -0,0 +1,221 @@
+From 6bff27675821cacc40b7150eee7fc99476fd336e Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Tue, 30 Jan 2024 23:10:57 +0800
+Subject: [PATCH] remove nsync
+
+---
+ cmake/CMakeLists.txt | 4 ++--
+ .../external/onnxruntime_external_deps.cmake | 4 ++--
+ cmake/onnxruntime_unittests.cmake | 22 +++++++++----------
+ include/onnxruntime/core/platform/ort_mutex.h | 20 ++++++++---------
+ onnxruntime/core/platform/posix/ort_mutex.cc | 6 ++---
+ 5 files changed, 28 insertions(+), 28 deletions(-)
+
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index 82a4547..eaebef8 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -922,7 +922,7 @@ function(onnxruntime_set_compile_flags target_name)
+ target_compile_options(${target_name} PRIVATE "-Wno-unused-parameter")
+ endif()
+ target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11)
+- onnxruntime_add_include_to_target(${target_name} nsync::nsync_cpp)
++ # onnxruntime_add_include_to_target(${target_name} nsync::nsync_cpp)
+ endif()
+ foreach(ORT_FLAG ${ORT_PROVIDER_FLAGS})
+ target_compile_definitions(${target_name} PRIVATE ${ORT_FLAG})
+@@ -1574,7 +1574,7 @@ if (WIN32)
+ list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SYS_PATH_LIB})
+ list(APPEND onnxruntime_EXTERNAL_LIBRARIES debug Dbghelp)
+ else()
+- list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp)
++ # list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp)
+ list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${ICONV_LIB} ${CMAKE_DL_LIBS} Threads::Threads)
+ endif()
+
+diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
+index 1e971e5..e338068 100644
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -64,7 +64,7 @@ if (onnxruntime_BUILD_BENCHMARKS)
+ )
+ endif()
+
+-if (NOT WIN32)
++if (FALSE AND NOT WIN32)
+ FetchContent_Declare(
+ google_nsync
+ URL ${DEP_URL_google_nsync}
+@@ -284,7 +284,7 @@ if (onnxruntime_BUILD_BENCHMARKS)
+ onnxruntime_fetchcontent_makeavailable(google_benchmark)
+ endif()
+
+-if (NOT WIN32)
++if (FALSE AND NOT WIN32)
+ #nsync tests failed on Mac Build
+ set(NSYNC_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
+ onnxruntime_fetchcontent_makeavailable(google_nsync)
+diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake
+index 695e218..38f9719 100644
+--- a/cmake/onnxruntime_unittests.cmake
++++ b/cmake/onnxruntime_unittests.cmake
+@@ -697,7 +697,7 @@ if(MSVC)
+ else()
+ target_compile_definitions(onnxruntime_test_utils PUBLIC -DNSYNC_ATOMIC_CPP11)
+ target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
+- onnxruntime_add_include_to_target(onnxruntime_test_utils nsync::nsync_cpp)
++ # onnxruntime_add_include_to_target(onnxruntime_test_utils nsync::nsync_cpp)
+ endif()
+ if (onnxruntime_USE_NCCL)
+ target_include_directories(onnxruntime_test_utils PRIVATE ${NCCL_INCLUDE_DIRS})
+@@ -732,7 +732,7 @@ if(MSVC)
+ else()
+ target_compile_definitions(onnx_test_runner_common PUBLIC -DNSYNC_ATOMIC_CPP11)
+ target_include_directories(onnx_test_runner_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
+- onnxruntime_add_include_to_target(onnx_test_runner_common nsync::nsync_cpp)
++ # onnxruntime_add_include_to_target(onnx_test_runner_common nsync::nsync_cpp)
+ endif()
+ if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
+ #TODO: fix the warnings, they are dangerous
+@@ -1119,7 +1119,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
+ # "Global initializer calls a non-constexpr function." BENCHMARK_CAPTURE macro needs this.
+ target_compile_options(onnxruntime_mlas_benchmark PRIVATE /wd26426)
+ else()
+- target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
++ # target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
+ endif()
+ if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ target_link_libraries(onnxruntime_mlas_benchmark PRIVATE cpuinfo)
+@@ -1196,7 +1196,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
+ ${onnxruntime_EXTERNAL_LIBRARIES}
+ ${GETOPT_LIB_WIDE} ${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
+ if(NOT WIN32)
+- list(APPEND onnxruntime_perf_test_libs nsync::nsync_cpp)
++ # list(APPEND onnxruntime_perf_test_libs nsync::nsync_cpp)
+ if(onnxruntime_USE_SNPE)
+ list(APPEND onnxruntime_perf_test_libs onnxruntime_providers_snpe)
+ endif()
+@@ -1240,7 +1240,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
+ # test inference using shared lib
+ set(onnxruntime_shared_lib_test_LIBS onnxruntime_mocked_allocator onnxruntime_test_utils onnxruntime_common onnx_proto)
+ if(NOT WIN32)
+- list(APPEND onnxruntime_shared_lib_test_LIBS nsync::nsync_cpp)
++ # list(APPEND onnxruntime_shared_lib_test_LIBS nsync::nsync_cpp)
+ if(onnxruntime_USE_SNPE)
+ list(APPEND onnxruntime_shared_lib_test_LIBS onnxruntime_providers_snpe)
+ endif()
+@@ -1367,9 +1367,9 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
+ if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ target_link_libraries(onnxruntime_mlas_test PRIVATE cpuinfo)
+ endif()
+- if(NOT WIN32)
+- target_link_libraries(onnxruntime_mlas_test PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
+- endif()
++ # if(NOT WIN32)
++ # target_link_libraries(onnxruntime_mlas_test PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
++ # endif()
+ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
+ target_link_libraries(onnxruntime_mlas_test PRIVATE ${android_shared_libs})
+ endif()
+@@ -1631,9 +1631,9 @@ if (onnxruntime_BUILD_SHARED_LIB AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten"
+
+ set(onnxruntime_logging_apis_test_LIBS onnxruntime_common onnxruntime_test_utils)
+
+- if(NOT WIN32)
+- list(APPEND onnxruntime_logging_apis_test_LIBS nsync::nsync_cpp ${CMAKE_DL_LIBS})
+- endif()
++ # if(NOT WIN32)
++ # list(APPEND onnxruntime_logging_apis_test_LIBS nsync::nsync_cpp ${CMAKE_DL_LIBS})
++ # endif()
+
+ AddTest(DYN
+ TARGET onnxruntime_logging_apis_test
+diff --git a/include/onnxruntime/core/platform/ort_mutex.h b/include/onnxruntime/core/platform/ort_mutex.h
+index e24665f..2ea7272 100644
+--- a/include/onnxruntime/core/platform/ort_mutex.h
++++ b/include/onnxruntime/core/platform/ort_mutex.h
+@@ -102,13 +102,13 @@ std::cv_status OrtCondVar::wait_for(std::unique_lock<OrtMutex>& cond_mutex,
+ }
+ } // namespace onnxruntime
+ #else
+-#include "nsync.h"
++#include <pthread.h>
+ #include <mutex> //for unique_lock
+ #include <condition_variable> //for cv_status
+ namespace onnxruntime {
+
+ class OrtMutex {
+- nsync::nsync_mu data_ = NSYNC_MU_INIT;
++ pthread_mutex_t data_ = PTHREAD_MUTEX_INITIALIZER;
+
+ public:
+ constexpr OrtMutex() = default;
+@@ -116,16 +116,16 @@ class OrtMutex {
+ OrtMutex(const OrtMutex&) = delete;
+ OrtMutex& operator=(const OrtMutex&) = delete;
+
+- void lock() { nsync::nsync_mu_lock(&data_); }
+- bool try_lock() noexcept { return nsync::nsync_mu_trylock(&data_) == 0; }
+- void unlock() noexcept { nsync::nsync_mu_unlock(&data_); }
++ void lock() { pthread_mutex_lock(&data_); }
++ bool try_lock() noexcept { return pthread_mutex_lock(&data_) == 0; }
++ void unlock() noexcept { pthread_mutex_unlock(&data_); }
+
+- using native_handle_type = nsync::nsync_mu*;
++ using native_handle_type = pthread_mutex_t*;
+ native_handle_type native_handle() { return &data_; }
+ };
+
+ class OrtCondVar {
+- nsync::nsync_cv native_cv_object = NSYNC_CV_INIT;
++ pthread_cond_t native_cv_object = PTHREAD_COND_INITIALIZER;
+
+ public:
+ constexpr OrtCondVar() noexcept = default;
+@@ -134,8 +134,8 @@ class OrtCondVar {
+ OrtCondVar(const OrtCondVar&) = delete;
+ OrtCondVar& operator=(const OrtCondVar&) = delete;
+
+- void notify_one() noexcept { nsync::nsync_cv_signal(&native_cv_object); }
+- void notify_all() noexcept { nsync::nsync_cv_broadcast(&native_cv_object); }
++ void notify_one() noexcept { pthread_cond_signal(&native_cv_object); }
++ void notify_all() noexcept { pthread_cond_broadcast(&native_cv_object); }
+
+ void wait(std::unique_lock<OrtMutex>& lk);
+ template <class _Predicate>
+@@ -151,7 +151,7 @@ class OrtCondVar {
+ */
+ template <class Rep, class Period>
+ std::cv_status wait_for(std::unique_lock<OrtMutex>& cond_mutex, const std::chrono::duration<Rep, Period>& rel_time);
+- using native_handle_type = nsync::nsync_cv*;
++ using native_handle_type = pthread_cond_t*;
+ native_handle_type native_handle() { return &native_cv_object; }
+
+ private:
+diff --git a/onnxruntime/core/platform/posix/ort_mutex.cc b/onnxruntime/core/platform/posix/ort_mutex.cc
+index e124ce1..5397793 100644
+--- a/onnxruntime/core/platform/posix/ort_mutex.cc
++++ b/onnxruntime/core/platform/posix/ort_mutex.cc
+@@ -27,7 +27,7 @@ void OrtCondVar::timed_wait_impl(std::unique_lock<OrtMutex>& lk,
+ abs_deadline.tv_sec = ts_sec_max;
+ abs_deadline.tv_nsec = 999999999;
+ }
+- nsync::nsync_cv_wait_with_deadline(&native_cv_object, lk.mutex()->native_handle(), abs_deadline, nullptr);
++ pthread_cond_timedwait(&native_cv_object, lk.mutex()->native_handle(), &abs_deadline);
+ }
+
+ void OrtCondVar::wait(std::unique_lock<OrtMutex>& lk) {
+@@ -36,7 +36,7 @@ void OrtCondVar::wait(std::unique_lock<OrtMutex>& lk) {
+ ORT_THROW("OrtCondVar wait failed: mutex not locked");
+ }
+ #endif
+- nsync::nsync_cv_wait(&native_cv_object, lk.mutex()->native_handle());
++ pthread_cond_wait(&native_cv_object, lk.mutex()->native_handle());
+ }
+
+-} // namespace onnxruntime
+\ No newline at end of file
++} // namespace onnxruntime
+--
+2.41.0
+
diff --git a/0001-use-system-Flatbuffers.patch b/0001-use-system-Flatbuffers.patch
new file mode 100644
index 0000000..c172c82
--- /dev/null
+++ b/0001-use-system-Flatbuffers.patch
@@ -0,0 +1,34 @@
+From 6af43995de7e860560b9ebfafb854d7eacf27b32 Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Tue, 30 Jan 2024 22:55:45 +0800
+Subject: [PATCH] use system Flatbuffers
+
+---
+ cmake/external/onnxruntime_external_deps.cmake | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
+index 8e412c7..1e971e5 100644
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -103,7 +103,7 @@ FetchContent_Declare(
+ URL ${DEP_URL_flatbuffers}
+ URL_HASH SHA1=${DEP_SHA1_flatbuffers}
+ PATCH_COMMAND ${ONNXRUNTIME_FLATBUFFERS_PATCH_COMMAND}
+- FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES Flatbuffers
++ FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES FlatBuffers
+ )
+
+ # Download a protoc binary from Internet if needed
+@@ -342,6 +342,8 @@ namespace std { using ::getenv; }
+ target_compile_options(flatc PRIVATE /FI${CMAKE_BINARY_DIR}/gdk_cstdlib_wrapper.h)
+ endif()
+ endif()
++else()
++ add_library(flatbuffers::flatbuffers ALIAS flatbuffers::flatbuffers_shared)
+ endif()
+
+ if (onnxruntime_BUILD_UNIT_TESTS)
+--
+2.41.0
+
diff --git a/0001-use-system-cpuinfo.patch b/0001-use-system-cpuinfo.patch
new file mode 100644
index 0000000..f6f439d
--- /dev/null
+++ b/0001-use-system-cpuinfo.patch
@@ -0,0 +1,45 @@
+From 1aa74e654178dbc0258187606e52a030f2448a51 Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Tue, 30 Jan 2024 23:14:27 +0800
+Subject: [PATCH] use system cpuinfo
+
+---
+ cmake/external/onnxruntime_external_deps.cmake | 8 +-------
+ cmake/onnxruntime_common.cmake | 2 +-
+ 2 files changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
+index e338068..f78477c 100644
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -416,13 +416,7 @@ FetchContent_Declare(
+
+
+ if (CPUINFO_SUPPORTED)
+- onnxruntime_fetchcontent_makeavailable(pytorch_cpuinfo)
+- if (pytorch_cpuinfo_SOURCE_DIR)
+- # shouldn't need to define these aliases after we use a version of cpuinfo with this commit:
+- # https://github.com/pytorch/cpuinfo/commit/082deffc80ce517f81dc2f3aebe6ba671fcd09c9
+- add_library(cpuinfo::cpuinfo ALIAS cpuinfo)
+- add_library(cpuinfo::clog ALIAS clog)
+- endif()
++ find_package(cpuinfo REQUIRED)
+ endif()
+
+
+diff --git a/cmake/onnxruntime_common.cmake b/cmake/onnxruntime_common.cmake
+index 687a231..f44f4f9 100644
+--- a/cmake/onnxruntime_common.cmake
++++ b/cmake/onnxruntime_common.cmake
+@@ -208,7 +208,7 @@ if (ARM64 OR ARM OR X86 OR X64 OR X86_64)
+ # Its functionality in detecting x86 cpu features are lacking, so is support for Windows.
+ if (CPUINFO_SUPPORTED)
+ onnxruntime_add_include_to_target(onnxruntime_common cpuinfo::cpuinfo)
+- list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::cpuinfo cpuinfo::clog)
++ list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::cpuinfo)
+ endif()
+ endif()
+ endif()
+--
+2.41.0
+
diff --git a/0001-use-system-protobuf.patch b/0001-use-system-protobuf.patch
new file mode 100644
index 0000000..d0cd65c
--- /dev/null
+++ b/0001-use-system-protobuf.patch
@@ -0,0 +1,48 @@
+From c3838bb95a9d65dc5faff856a6cd92fe4b1e3caf Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Wed, 31 Jan 2024 09:04:09 +0800
+Subject: [PATCH] use system protobuf
+
+---
+ cmake/external/onnxruntime_external_deps.cmake | 18 ++----------------
+ 1 file changed, 2 insertions(+), 16 deletions(-)
+
+diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
+index f78477c..e91a094 100644
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -161,21 +161,7 @@ if(Patch_FOUND)
+ else()
+ set(ONNXRUNTIME_PROTOBUF_PATCH_COMMAND "")
+ endif()
+-FetchContent_Declare(
+- Protobuf
+- URL ${DEP_URL_protobuf}
+- URL_HASH SHA1=${DEP_SHA1_protobuf}
+- PATCH_COMMAND ${ONNXRUNTIME_PROTOBUF_PATCH_COMMAND}
+- FIND_PACKAGE_ARGS 3.21.12 NAMES Protobuf
+-)
+-set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
+-if (CMAKE_SYSTEM_NAME STREQUAL "Android")
+- set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protobuf tests" FORCE)
+- set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
+-endif()
+-if (onnxruntime_DISABLE_RTTI)
+- set(protobuf_DISABLE_RTTI ON CACHE BOOL "Remove runtime type information in the binaries" FORCE)
+-endif()
++find_package(Protobuf REQUIRED)
+
+ include(protobuf_function)
+ #protobuf end
+@@ -317,7 +303,7 @@ FetchContent_Declare(
+ )
+
+ # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
+-onnxruntime_fetchcontent_makeavailable(Protobuf nlohmann_json mp11 re2 safeint GSL flatbuffers)
++onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 safeint GSL flatbuffers)
+ if(NOT flatbuffers_FOUND)
+ if(NOT TARGET flatbuffers::flatbuffers)
+ add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
+--
+2.41.0
+
diff --git a/0001-use-system-python.patch b/0001-use-system-python.patch
new file mode 100644
index 0000000..c821a1f
--- /dev/null
+++ b/0001-use-system-python.patch
@@ -0,0 +1,32 @@
+From d26aa78fa89c57938fdedc0cf0e0072e903ff18e Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Wed, 31 Jan 2024 09:09:49 +0800
+Subject: [PATCH] use system python
+
+---
+ cmake/CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index d3b1448..8e289d1 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -532,12 +532,12 @@ endif()
+ if (onnxruntime_BUILD_SHARED_LIB OR onnxruntime_ENABLE_PYTHON)
+ if (onnxruntime_ENABLE_PYTHON)
+ if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS OR onnxruntime_REQUIRE_PYTHON_EMBED_LIB)
+- find_package(Python 3.8 COMPONENTS Interpreter Development NumPy)
++ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development NumPy)
+ else()
+- find_package(Python 3.8 COMPONENTS Interpreter Development.Module NumPy)
++ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development.Module NumPy)
+ endif()
+ else()
+- find_package(Python 3.8 COMPONENTS Interpreter)
++ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter)
+ endif()
+ endif()
+
+--
+2.41.0
+
diff --git a/0001-versioned-onnxruntime_providers_shared.patch b/0001-versioned-onnxruntime_providers_shared.patch
new file mode 100644
index 0000000..21a44e6
--- /dev/null
+++ b/0001-versioned-onnxruntime_providers_shared.patch
@@ -0,0 +1,24 @@
+From 82ecf405121b4bccd75e99c913214ca695726eaa Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Wed, 31 Jan 2024 13:25:01 +0800
+Subject: [PATCH] versioned-onnxruntime_providers_shared
+
+---
+ cmake/onnxruntime_providers.cmake | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake
+index 03360ff..ac1fb4c 100644
+--- a/cmake/onnxruntime_providers.cmake
++++ b/cmake/onnxruntime_providers.cmake
+@@ -634,6 +634,7 @@ if (onnxruntime_USE_DNNL)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/)
+ set_target_properties(onnxruntime_providers_dnnl PROPERTIES FOLDER "ONNXRuntime")
+ set_target_properties(onnxruntime_providers_dnnl PROPERTIES LINKER_LANGUAGE CXX)
++ set_target_properties(onnxruntime_providers_shared PROPERTIES VERSION ${ORT_VERSION})
+
+ # Needed for the provider interface, as it includes training headers when training is enabled
+ if (onnxruntime_ENABLE_TRAINING_OPS)
+--
+2.41.0
+
diff --git a/0002-remove-nsync.patch b/0002-remove-nsync.patch
new file mode 100644
index 0000000..3c53fa1
--- /dev/null
+++ b/0002-remove-nsync.patch
@@ -0,0 +1,25 @@
+From c285edeb9c5f8af7893fd4fd08dc803f33bafd3a Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Tue, 30 Jan 2024 23:37:42 +0800
+Subject: [PATCH] remove nsync
+
+---
+ cmake/onnxruntime_mlas.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake
+index e0ccc50..279d63d 100644
+--- a/cmake/onnxruntime_mlas.cmake
++++ b/cmake/onnxruntime_mlas.cmake
+@@ -611,7 +611,7 @@ if (NOT onnxruntime_ORT_MINIMAL_BUILD)
+ if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ target_link_libraries(onnxruntime_mlas_q4dq PRIVATE cpuinfo)
+ endif()
+- if(NOT WIN32)
++ if (FALSE AND NOT WIN32)
+ target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
+ endif()
+ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
+--
+2.41.0
+
diff --git a/onnxruntime-1.16.3.tar.gz b/onnxruntime-1.16.3.tar.gz
new file mode 100644
index 0000000..5392408
--- /dev/null
+++ b/onnxruntime-1.16.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d26b8a7eed1df4440aa3d8eac5049980cbe585514ccedfda809712051a4b1721
+size 228216055
diff --git a/onnxruntime.spec b/onnxruntime.spec
new file mode 100644
index 0000000..f21b9d9
--- /dev/null
+++ b/onnxruntime.spec
@@ -0,0 +1,162 @@
+%global _empty_manifest_terminate_build 0
+%global __brp_check_rpaths %{nil}
+%global __cmake_build_dir "./cmake-build"
+
+Name: onnxruntime
+Version: 1.16.3
+Release: 1
+Summary: ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
+License: MIT
+URL: https://github.com/microsoft/onnxruntime
+Source0: https://github.com/microsoft/onnxruntime/archive/v%{version}/%{name}-%{version}.tar.gz
+
+Patch0: 0001-downgrade-cmake-from-3.26-to-3.24.patch
+Patch1: 0001-use-system-Flatbuffers.patch
+Patch2: 0001-use-system-cpuinfo.patch
+Patch3: 0001-use-system-protobuf.patch
+Patch4: 0001-use-system-python.patch
+Patch5: 0001-remove-nsync.patch
+Patch6: 0002-remove-nsync.patch
+Patch7: 0001-fix-forward-decl-flatbuffers.patch
+Patch8: 0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch
+Patch9: 0001-gcc-false-positive.patch
+Patch10: 0001-versioned-onnxruntime_providers_shared.patch
+
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-setuptools_scm
+BuildRequires: python3-pbr
+BuildRequires: python3-pip
+BuildRequires: python3-wheel
+BuildRequires: python3-hatchling
+
+BuildRequires: python3-numpy
+BuildRequires: pybind11-devel
+
+BuildRequires: abseil-cpp-devel
+BuildRequires: protobuf-devel
+BuildRequires: eigen3-devel
+BuildRequires: boost-devel
+BuildRequires: bzip2
+BuildRequires: cmake
+BuildRequires: g++
+
+BuildRequires: flatbuffers-compiler
+BuildRequires: flatbuffers-devel >= 23.5.26
+BuildRequires: cpuinfo-devel
+BuildRequires: gtest-devel
+BuildRequires: gmock-devel
+BuildRequires: zlib-devel
+BuildRequires: gsl-devel
+
+%description
+onnxruntime is a cross-platform inferencing and training accelerator compatible
+with many popular ML/DNN frameworks, including PyTorch, TensorFlow/Keras,
+scikit-learn, and more.
+
+%package devel
+Summary: The development part of the %{name} package
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+The development part of the %{name} package
+
+%package -n python3-onnxruntime
+Summary: %{summary}
+Requires: %{name} = %{version}-%{release}
+
+%description -n python3-onnxruntime
+Python bindings for the %{name} package
+
+%package doc
+Summary: Documentation files for the %{name} package
+
+%description doc
+Documentation files for the %{name} package
+
+%prep
+%autosetup -p1 -n %{name}-%{version}
+
+%build
+# Broken test in aarch64
+%ifarch aarch64
+rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc
+%endif
+
+# Re-generate flatbuffer headers
+%{__python3} onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc %{_bindir}/flatc
+
+# Overrides BUILD_SHARED_LIBS flag since onnxruntime compiles individual components as static, and links
+# all together into a single shared library when onnxruntime_BUILD_SHARED_LIB is ON.
+# The array-bounds and dangling-reference checks have false positives.
+%cmake \
+ -DCMAKE_INSTALL_LIBDIR=%{_lib} \
+ -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
+ -Donnxruntime_BUILD_SHARED_LIB=ON \
+ -Donnxruntime_BUILD_UNIT_TESTS=ON \
+ -Donnxruntime_INSTALL_UNIT_TESTS=OFF \
+ -Donnxruntime_BUILD_BENCHMARKS=OFF \
+ -Donnxruntime_USE_PREINSTALLED_EIGEN=OFF \
+ -Donnxruntime_USE_FULL_PROTOBUF=ON \
+ -DPYTHON_VERSION=%{python3_version} \
+ -Donnxruntime_ENABLE_CPUINFO=ON \
+ -Donnxruntime_DISABLE_ABSEIL=ON \
+ -Donnxruntime_ENABLE_PYTHON=ON \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -B "%{__cmake_build_dir}" \
+ -S cmake \
+
+%{__cmake} --build "%{__cmake_build_dir}" -j8 --verbose
+
+# Build python libs
+mv ./onnxruntime ./onnxruntime.src
+cp -R %{__cmake_build_dir}/onnxruntime ./onnxruntime
+cp %{__cmake_build_dir}/requirements.txt ./requirements.txt
+
+#mkdir -p %{buildroot}/.python_wheel
+#CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" TMPDIR="%{buildroot}/.pyproject-builddir" \
+# %{__python3} -m pip wheel --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check \
+# --no-clean --progress-bar off --verbose \
+# --wheel-dir "%{buildroot}/pyproject-wheeldir"
+%pyproject_build
+
+%install
+DESTDIR="%{buildroot}" %{__cmake} --install "%{__cmake_build_dir}"
+mkdir -p "%{buildroot}/%{_docdir}/"
+cp --preserve=timestamps -r "./docs/" "%{buildroot}/%{_docdir}/%{name}"
+# /usr/bin/python3 -m pip install --root /builddir/build/BUILDROOT/onnxruntime-1.16.3-1.x86_64 \
+# --prefix /usr --no-deps --disable-pip-version-check --progress-bar off --verbose \
+# --ignore-installed --no-warn-script-location --no-index --no-cache-dir \
+# --find-links /builddir/build/BUILD/%{name}-%{version}/build \
+# %{name}==%{version}
+%pyproject_install
+# %pyproject_save_files onnxruntime
+
+%check
+export GTEST_FILTER=-CApiTensorTest.load_huge_tensor_with_external_data
+export LT_SYS_LIBRARY_PATH=/usr/lib64
+/usr/bin/ctest --test-dir "%{__cmake_build_dir}" --output-on-failure --force-new-ctest-process %{?_smp_mflags}
+# %ctest
+
+%files
+%license LICENSE
+%doc ThirdPartyNotices.txt
+%{_libdir}/libonnxruntime.so.%{version}
+%{_libdir}/libonnxruntime_providers_shared.so.%{version}
+
+%files devel
+%dir %{_includedir}/onnxruntime/
+%{_includedir}/onnxruntime/*
+%{_libdir}/libonnxruntime.so
+%{_libdir}/libonnxruntime_providers_shared.so
+%{_libdir}/pkgconfig/libonnxruntime.pc
+
+%files -n python3-onnxruntime -f %{pyproject_files}
+%{_bindir}/onnxruntime_test
+
+%files doc
+%{_docdir}/%{name}
+
+%changelog
+* Sun Jan 28 2024 Binshuo Zu <274620705z@gmail.com> - 1.16.3-1
+- Package init
diff --git a/sources b/sources
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/sources