[neon/backports-noble/onnxruntime-noble/Neon/unstable] debian: backport for newer pipewire
Carlos De Maine
null at kde.org
Sat Sep 26 06:37:17 BST 2026
Git commit 6f20b9f4aa1708e48846363cbbe2909d0ead7756 by Carlos De Maine.
Committed on 26/09/2026 at 05:37.
Pushed by carlosdem into branch 'Neon/unstable'.
backport for newer pipewire
A +65 -0 debian/changelog
A +93 -0 debian/control
A +284 -0 debian/copyright
A +5 -0 debian/libonnxruntime-dev.install
A +2 -0 debian/libonnxruntime1.16.3.install
A +2 -0 debian/libonnxruntime1.16.3.lintian-overrides
A +1 -0 debian/onnxruntime-tools.install
A +194 -0 debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch
A +35 -0 debian/patches/Add-missing-include.patch
A +19 -0 debian/patches/Disable-AVX-tests-on-non-AMD64.patch
A +276 -0 debian/patches/Disable-failing-tests-on-ARM32.patch
A +17 -0 debian/patches/disable-power10.patch
A +24 -0 debian/patches/fix-cxx20-template-constructor.patch
A +159 -0 debian/patches/fix_forward_decl_flatbuffers.patch
A +38 -0 debian/patches/gcc-false-positive.patch
A +210 -0 debian/patches/no-nsync.patch
A +58 -0 debian/patches/remove-wil.patch
A +22 -0 debian/patches/series
A +15 -0 debian/patches/system-benchmark.patch
A +32 -0 debian/patches/system-cpuinfo.patch
A +39 -0 debian/patches/system-datadir.patch
A +105 -0 debian/patches/system-date-and-mp11.patch
A +15 -0 debian/patches/system-flatbuffers.patch
A +40 -0 debian/patches/system-onnx.patch
A +40 -0 debian/patches/system-protobuf.patch
A +22 -0 debian/patches/system-python.patch
A +32 -0 debian/patches/system-re2.patch
A +42 -0 debian/patches/system-safeint.patch
A +14 -0 debian/patches/versioned-onnxruntime_providers_shared.patch
A +31 -0 debian/rules
A +13 -0 debian/salsa-ci.yml
A +1 -0 debian/source/format
A +4 -0 debian/source/lintian-overrides
A +31 -0 debian/tests/build
A +3 -0 debian/tests/control
A +4 -0 debian/watch
https://invent.kde.org/neon/backports-noble/onnxruntime-noble/-/commit/6f20b9f4aa1708e48846363cbbe2909d0ead7756
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..88e5776
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,65 @@
+onnxruntime (1.16.3+dfsg-7) unstable; urgency=medium
+
+ * Fix includedir in pkgconfig (Closes: #1079791)
+ * Add a basic build autopkgtest for the library
+
+ -- Dylan Aïssi <daissi at debian.org> Tue, 27 Aug 2024 16:53:29 +0200
+
+onnxruntime (1.16.3+dfsg-6) unstable; urgency=medium
+
+ * Update patch to include the missing header in more files,
+ fix FTBFS on arm64.
+
+ -- Dylan Aïssi <daissi at debian.org> Thu, 22 Aug 2024 09:54:30 +0200
+
+onnxruntime (1.16.3+dfsg-5) unstable; urgency=medium
+
+ * Add patch fixing compilation with newer flatbuffers (Closes: #1076959)
+ * Add patch adding missing include <iomanip>
+
+ -- Dylan Aïssi <daissi at debian.org> Tue, 20 Aug 2024 17:45:03 +0200
+
+onnxruntime (1.16.3+dfsg-4) unstable; urgency=medium
+
+ * Add patches fixing FTBFS with GCC-14 (Closes: #1075334)
+
+ -- Dylan Aïssi <daissi at debian.org> Sat, 06 Jul 2024 17:57:45 +0200
+
+onnxruntime (1.16.3+dfsg-3) unstable; urgency=medium
+
+ * Upload to unstable
+
+ -- Dylan Aïssi <daissi at debian.org> Thu, 30 May 2024 10:15:32 +0200
+
+onnxruntime (1.16.3+dfsg-2) experimental; urgency=medium
+
+ * Cherry-pick upstream patch:
+ - 17eaf9b: Fix a build error in SparseTensor code for 32-bit build configs
+
+ -- Dylan Aïssi <daissi at debian.org> Wed, 29 May 2024 16:07:29 +0200
+
+onnxruntime (1.16.3+dfsg-1) experimental; urgency=medium
+
+ * New upstream version 1.16.3+dfsg
+ - Fix FTBFS with newer re2 (Closes: #1071819)
+ * Bump SONAME to libonnxruntime1.16.3
+ * Add new Build-Deps: libmsgsl-dev and pkgconf
+ * Mark libonnxruntime-dev as Breaks+Replaces libonnxruntime1.13.1
+ * Standards-Version: 4.7.0 (no changes required)
+ * Adapt patches for new version, mainly based on those from Fedora
+ * Update lintian-overrides
+
+ -- Dylan Aïssi <daissi at debian.org> Tue, 28 May 2024 15:57:08 +0200
+
+onnxruntime (1.13.1+dfsg-1) unstable; urgency=medium
+
+ [ Mo Zhou ]
+ * Initial release. (Closes: #933354, #1035081)
+
+ [ Andre Moreira Magalhaes ]
+ * Import new upstream release
+
+ [ Dylan Aïssi ]
+ * Finalize packaging
+
+ -- Dylan Aïssi <daissi at debian.org> Thu, 04 Jan 2024 17:23:31 +0100
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..dab8c55
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,93 @@
+Source: onnxruntime
+Maintainer: Debian Deep Learning Team <debian-ai at lists.debian.org>
+Uploaders: Mo Zhou <lumin at debian.org>,
+ Dylan Aïssi <daissi at debian.org>
+Section: science
+Priority: optional
+Build-Depends: debhelper-compat (= 13),
+ cmake,
+ flatbuffers-compiler,
+ libboost-dev,
+ libbenchmark-dev,
+ libcpuinfo-dev (>= 0.0~git20220819.8ec7bd9),
+ libeigen3-dev (>= 3.4.0),
+ libflatbuffers-dev,
+ libgmock-dev,
+ libgtest-dev,
+ libhowardhinnant-date-dev,
+ libmsgsl-dev,
+ libnsync-dev,
+ libonnx-dev,
+ libonnx-testdata,
+ libpng-dev,
+ libprotobuf-dev,
+ libpthreadpool-dev,
+ libsafeint-dev,
+ libre2-dev,
+ libxnnpack-dev (>= 0.0~git20221221.51a9875),
+ nlohmann-json3-dev,
+ protobuf-compiler,
+ pkgconf,
+ python3-all,
+ python3-all-dev,
+ python3-numpy,
+ python3-onnx,
+ python3-setuptools,
+ python3-wheel,
+ zlib1g-dev
+Standards-Version: 4.7.0
+Vcs-Browser: https://salsa.debian.org/deeplearning-team/onnxruntime
+Vcs-Git: https://salsa.debian.org/deeplearning-team/onnxruntime.git
+Homepage: https://github.com/microsoft/onnxruntime
+Rules-Requires-Root: no
+
+Package: libonnxruntime1.16.3
+Architecture: any
+Multi-Arch: same
+Section: libs
+Depends: ${misc:Depends},
+ ${shlibs:Depends}
+Description: cross-platform inference and training ML accelerator (shared lib)
+ ONNX Runtime is a performance-focused complete scoring engine for Open Neural
+ Network Exchange (ONNX) models, with an open extensible architecture to
+ continually address the latest developments in AI and Deep Learning. ONNX
+ Runtime stays up to date with the ONNX standard with complete implementation of
+ all ONNX operators, and supports all ONNX releases (1.2+) with both future and
+ backwards compatibility. Please refer to this page for ONNX opset compatibility
+ details.
+ .
+ This package provides the shared library.
+
+Package: libonnxruntime-dev
+Architecture: any
+Multi-Arch: same
+Section: libdevel
+Depends: libonnxruntime1.16.3 (= ${binary:Version}),
+ ${misc:Depends}
+Breaks: libonnxruntime1.13.1 (<< 1.16.3+dfsg-1~)
+Replaces: libonnxruntime1.13.1 (<< 1.16.3+dfsg-1~)
+Description: cross-platform inference and training ML accelerator (dev files)
+ ONNX Runtime is a performance-focused complete scoring engine for Open Neural
+ Network Exchange (ONNX) models, with an open extensible architecture to
+ continually address the latest developments in AI and Deep Learning. ONNX
+ Runtime stays up to date with the ONNX standard with complete implementation of
+ all ONNX operators, and supports all ONNX releases (1.2+) with both future and
+ backwards compatibility. Please refer to this page for ONNX opset compatibility
+ details.
+ .
+ This package provides the development files for libonnxruntime.
+
+Package: onnxruntime-tools
+Architecture: any
+Depends: ${misc:Depends},
+ ${shlibs:Depends}
+Description: cross-platform inference and training ML accelerator (tools)
+ ONNX Runtime is a performance-focused complete scoring engine for Open Neural
+ Network Exchange (ONNX) models, with an open extensible architecture to
+ continually address the latest developments in AI and Deep Learning. ONNX
+ Runtime stays up to date with the ONNX standard with complete implementation of
+ all ONNX operators, and supports all ONNX releases (1.2+) with both future and
+ backwards compatibility. Please refer to this page for ONNX opset compatibility
+ details.
+ .
+ This package provides the onnxruntime tools.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..748b97b
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,284 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: ONNX Runtime
+Source: https://github.com/microsoft/onnxruntime
+Comment: Model files with unclear licenses.
+ See https://github.com/microsoft/onnxruntime/issues/8963
+Files-Excluded:
+ *.onnx
+ *.ort
+ *.jar
+ .gitignore
+ .gitattributes
+ csharp/ApiDocs
+
+Files: *
+Copyright: 2017-2024 Microsoft Corporation
+ 2018-2022 Intel Corporation.
+ Xilinx Inc.
+ 2020 rock-chips.com Inc.
+ 2019-2022, Oracle and/or its affiliates.
+ Facebook, Inc. and its affiliates.
+ 2019-2020, NXP Semiconductor, Inc.
+ 2016-2020, NVIDIA CORPORATION.
+ 2012-2018, MIT CSAIL, Google Inc., and other contributors
+ 2015-2018, Martin Moene
+ 2014-2016, Baptiste Wicht
+ 2020, The Microsoft DeepSpeed Team
+ 2016, manylinux
+ 2016, Facebook Inc.
+ 2019, AMD AMDMIGraphX
+ 2019, JD.com Inc. JD AI
+License: Expat
+
+Files: include/onnxruntime/core/common/common.h
+ include/onnxruntime/core/common/make_string.h
+ include/onnxruntime/core/common/status.h
+ include/onnxruntime/core/platform/threadpool.h
+ onnxruntime/contrib_ops/cpu/crop_and_resize.cc
+ onnxruntime/contrib_ops/cuda/bert/attention_softmax.h
+ onnxruntime/contrib_ops/cuda/bert/longformer_attention_softmax.h
+ onnxruntime/contrib_ops/rocm/bert/*
+ onnxruntime/core/common/status.cc
+ onnxruntime/core/common/threadpool.cc
+ onnxruntime/core/framework/bfc_arena.h
+ onnxruntime/core/platform/context.h
+ onnxruntime/core/platform/env.cc
+ onnxruntime/core/platform/env.h
+ onnxruntime/core/platform/env_time.cc
+ onnxruntime/core/platform/env_time.h
+ onnxruntime/core/platform/posix/env.cc
+ onnxruntime/core/platform/posix/env_time.cc
+ onnxruntime/core/platform/windows/env.cc
+ onnxruntime/core/platform/windows/env_time.cc
+ onnxruntime/core/providers/cpu/generator/random.cc
+ onnxruntime/core/providers/cpu/math/softmax_shared.cc
+ onnxruntime/core/providers/cpu/math/top_k.cc
+ onnxruntime/core/providers/cpu/nn/batch_norm.cc
+ onnxruntime/core/providers/cpu/nn/batch_norm.h
+ onnxruntime/core/providers/cpu/nn/conv.cc
+ onnxruntime/core/providers/cpu/nn/conv_transpose.cc
+ onnxruntime/core/providers/cpu/nn/conv_transpose.h
+ onnxruntime/core/providers/cpu/nn/conv_transpose_attributes.h
+ onnxruntime/core/providers/cpu/nn/lp_norm.h
+ onnxruntime/core/providers/cpu/nn/lrn.cc
+ onnxruntime/core/providers/cpu/object_detection/non_max_suppression.cc
+ onnxruntime/core/providers/cpu/object_detection/roialign.cc
+ onnxruntime/core/providers/cpu/tensor/onehot.cc
+ onnxruntime/core/providers/nnapi/nnapi_builtin/nnapi_lib/*
+ onnxruntime/core/util/math.h
+ onnxruntime/core/util/math_cpu.cc
+ onnxruntime/core/util/math_cpuonly.h
+ onnxruntime/python/tools/transformers/benchmark.py
+ onnxruntime/test/framework/math_test.cc
+ orttraining/orttraining/core/framework/tensorboard/crc32c.cc
+ orttraining/orttraining/core/framework/tensorboard/crc32c.h
+ orttraining/orttraining/test/gradient/gradient_checker.cc
+ orttraining/orttraining/test/gradient/gradient_checker.h
+ orttraining/orttraining/training_ops/cpu/nn/conv_grad.cc
+ orttraining/orttraining/training_ops/cpu/tensorboard/summary_op.cc
+ orttraining/orttraining/training_ops/cuda/nn/layer_norm_impl.h
+ orttraining/tools/scripts/nv_run_pretraining.py
+Copyright: 2016-2024, Facebook, Inc.
+ 2015-2017, The TensorFlow Authors.
+ 2018-2019, NVIDIA Corporation
+ NVIDIA Corporation and Microsoft Corporation
+ 2017, The Android Open Source Project
+ 2018, The HuggingFace Inc. team.
+ 2018, The Google AI Language Team Authors and The HugginFace Inc. team.
+License: Apache-2.0
+
+Files: include/onnxruntime/core/platform/Barrier.h
+ include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h
+Copyright: 2016, Dmitry Vyukov <dvyukov at google.com>
+License: MPL-2.0
+
+Files: onnxruntime/core/mlas/lib/qdwconv_kernelsize.cpp
+ onnxruntime/test/onnx/pb_helper.cc
+ onnxruntime/test/onnx/pb_helper.h
+ onnxruntime/test/win_getopt/mb/getopt.cc
+ onnxruntime/test/win_getopt/mb/include/getopt.h
+ onnxruntime/test/win_getopt/wide/*
+Copyright: Facebook, Inc. and its affiliates.
+ 2019, Google LLC
+ 2008, Google Inc.
+ 1987, 1993, 1994, The Regents of the University of California.
+License: BSD-3-clause
+
+Files: winml/test/collateral/*
+Copyright: 2017
+License: BSD-2-clause and BSD-3-clause
+
+Files: onnxruntime/contrib_ops/cpu/murmur_hash3.cc
+Copyright: Microsoft.
+License: BSD-3-clause and public-domain
+
+Files: onnxruntime/core/framework/mem_pattern_planner.h
+ onnxruntime/test/python/transformers/test_parity_decoder_attention.py
+ onnxruntime/test/python/transformers/test_parity_huggingface_gpt_attention.py
+Copyright: 2017, The TensorFlow Authors.
+ 2020, The HuggingFace Inc. team
+License: Apache-2.0 and Expat
+
+Files: onnxruntime/core/framework/murmurhash3.cc
+Copyright: Microsoft Corporation.
+License: Expat and public-domain
+
+Files: onnxruntime/test/providers/cpu/ml/normalizer_test.cc
+Copyright: Microsoft Corporation.
+License: BSD-3-clause and Expat
+
+Files: onnxruntime/test/testdata/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: This folder contains mainly basic test datasets in the ORT or ONNX
+ format with a corresponding python script to regenerate them. When no
+ license is specified in the header of the generating script, thus they
+ inherite of the project license i.e. MIT license.
+
+Files: onnxruntime/test/testdata/CNTK/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by gen.py.
+
+Files: onnxruntime/test/testdata/test_data_generation/adamw_test/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by adamw_test_data_generator.py.
+
+Files: onnxruntime/test/testdata/transform/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by the corresponding python script,
+ i.e. same filename but with a .py extension in the same folder. Sometimes,
+ the corresponding python script has a "create" prefix or a "gen" suffix.
+
+Files: onnxruntime/test/testdata/transform/approximation/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by gelu_approximation_gen.py
+
+Files: onnxruntime/test/testdata/transform/computation_reduction/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by the corresponding python script,
+ i.e. same filename but with a .py extension in the same folder.
+
+Files: onnxruntime/test/testdata/transform/cse/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by generate.py.
+
+Files: onnxruntime/test/testdata/transform/fusion/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by the corresponding python script,
+ i.e. same filename but with a .py extension in the same folder. Sometimes,
+ the corresponding python script has a "create" prefix or a "gen" suffix.
+
+Files: onnxruntime/test/testdata/transform/model_parallel/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by the corresponding python script,
+ i.e. same filename but with a .py extension in the same folder.
+
+Files: onnxruntime/test/testdata/transform/propagate_cast/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by gen_propagate_cast.py.
+
+Files: onnxruntime/test/testdata/transform/runtime_optimization/*
+Copyright: The ONNX Runtime Authors.
+License: Expat
+Comment: Basic test datasets generated by add_with_surrounding_identities_gen.py.
+
+Files: debian/*
+Copyright: 2023-2024 Collabora, Ltd.
+License: Expat
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and\/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+ .
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+License: Apache-2.0
+ On Debian systems you can find the full text of the Apache License at
+ /usr/share/common-licenses/Apache-2.0.
+
+License: MPL-2.0
+ Licensed under the Mozilla Public License Version 2.0.
+ .
+ On Debian systems, the complete text of the Mozilla Public License
+ Version 2.0 can be found in /usr/share/common-licenses/MPL-2.0.
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ .
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ .
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and\/or other materials provided with the
+ distribution.
+ .
+ Neither the name of the <ORGANIZATION> nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: BSD-2-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ .
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ .
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and\/or other materials provided with the
+ distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: public-domain
+ MurmurHash3 was written by Austin Appleby, and is placed in the public
+ domain. The author hereby disclaims copyright to this source code.
diff --git a/debian/libonnxruntime-dev.install b/debian/libonnxruntime-dev.install
new file mode 100644
index 0000000..4a47cf2
--- /dev/null
+++ b/debian/libonnxruntime-dev.install
@@ -0,0 +1,5 @@
+usr/include/
+usr/lib/*/cmake
+usr/lib/*/pkgconfig
+usr/lib/*/libonnxruntime.so
+usr/lib/*/libonnxruntime_providers_shared.so
diff --git a/debian/libonnxruntime1.16.3.install b/debian/libonnxruntime1.16.3.install
new file mode 100644
index 0000000..92f2c25
--- /dev/null
+++ b/debian/libonnxruntime1.16.3.install
@@ -0,0 +1,2 @@
+usr/lib/*/libonnxruntime.so.*
+usr/lib/*/libonnxruntime_providers_shared.so.*
diff --git a/debian/libonnxruntime1.16.3.lintian-overrides b/debian/libonnxruntime1.16.3.lintian-overrides
new file mode 100644
index 0000000..b316f93
--- /dev/null
+++ b/debian/libonnxruntime1.16.3.lintian-overrides
@@ -0,0 +1,2 @@
+# This is a loadable plugin
+libonnxruntime1.16.3: shared-library-lacks-prerequisites [usr/lib/*/libonnxruntime_providers_shared.so.*]
diff --git a/debian/onnxruntime-tools.install b/debian/onnxruntime-tools.install
new file mode 100644
index 0000000..e772481
--- /dev/null
+++ b/debian/onnxruntime-tools.install
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch b/debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch
new file mode 100644
index 0000000..268e705
--- /dev/null
+++ b/debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch
@@ -0,0 +1,194 @@
+From 17eaf9b053238b3efec303e9c94008201ca42462 Mon Sep 17 00:00:00 2001
+From: Changming Sun <chasun at microsoft.com>
+Date: Wed, 13 Dec 2023 11:11:13 -0800
+Subject: [PATCH] Fix a build warning in SparseTensor code for 32-bit build
+ configs (#18766) and the warning in #18195
+Co-authored-by: Dmitri Smirnov <yuslepukhin at users.noreply.github.com>
+
+Origin: upstream, https://github.com/microsoft/onnxruntime/commit/17eaf9b053
+Bug: https://github.com/microsoft/onnxruntime/issues/18195
+Forwarded: https://github.com/microsoft/onnxruntime/pull/18766
+
+17eaf9b053238b3efec303e9c94008201ca42462
+---
+ .../cpu/math/sparse_dense_matmul.cc | 73 ++++++++++++-------
+ onnxruntime/core/util/math_cpuonly.h | 2 +-
+ .../contrib_ops/math/matmul_sparse_test.cc | 2 -
+ .../azure-pipelines/linux-ci-pipeline.yml | 3 +-
+ 4 files changed, 50 insertions(+), 30 deletions(-)
+
+--- a/onnxruntime/contrib_ops/cpu/math/sparse_dense_matmul.cc
++++ b/onnxruntime/contrib_ops/cpu/math/sparse_dense_matmul.cc
+@@ -47,7 +47,6 @@
+ float alpha;
+ };
+
+-#if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+ template <typename T>
+ inline void SparseDenseMatMulImpl(const ComputeCtx& ctx, const ConstSparseMatrixMap<T>& map_A,
+ const ConstEigenMatrixMapRowMajor<T>& map_B, EigenMatrixMapRowMajor<T>& output_map) {
+@@ -64,7 +63,8 @@
+
+ template <>
+ inline void SparseDenseMatMulImpl<float>(const ComputeCtx& ctx, const ConstSparseMatrixMap<float>& map_A,
+- const ConstEigenMatrixMapRowMajor<float>& map_B, EigenMatrixMapRowMajor<float>& output_map) {
++ const ConstEigenMatrixMapRowMajor<float>& map_B,
++ EigenMatrixMapRowMajor<float>& output_map) {
+ if (ctx.trans_A && ctx.trans_B) {
+ output_map = map_A.transpose() * ctx.alpha * map_B.transpose();
+ } else if (ctx.trans_A && !ctx.trans_B) {
+@@ -84,21 +84,47 @@
+ const auto& b_dims = B.Shape().GetDims();
+ const auto& out_dims = output.Shape().GetDims();
+ auto csr_view = A.AsCsr();
+-
+- ConstSparseMatrixMap<T> map_A(a_dims[0], a_dims[1], A.NumValues(),
+- csr_view.Outer().Data<int64_t>(),
+- csr_view.Inner().Data<int64_t>(),
++ const Eigen::Index* inner_index_pointer = nullptr;
++ const Eigen::Index* outer_index_pointer = nullptr;
++ // For auto-release the above two pointers when they are not NULL.
++ std::unique_ptr<Eigen::Index[]> buffer_holder_inner, buffer_holder_outer;
++ if constexpr (std::is_integral<Eigen::Index>::value &&
++ std::is_signed<Eigen::Index>::value &&
++ (sizeof(Eigen::Index) == sizeof(int64_t))) {
++ // On macOS the following reinterpret_cast is necessary because Eigen::Index is an alias of `long` but int64_t is
++ // `long long`. Though they have the same size, compilers still do not allow an implicit casting between them.
++ inner_index_pointer = reinterpret_cast<const Eigen::Index*>(csr_view.Inner().Data<int64_t>());
++ outer_index_pointer = reinterpret_cast<const Eigen::Index*>(csr_view.Outer().Data<int64_t>());
++ } else {
++ // In a 32-bit build we need to cast the following two tensors to 32 bits
++ gsl::span<const int64_t> inner_data = csr_view.Inner().DataAsSpan<int64_t>();
++ gsl::span<const int64_t> outer_data = csr_view.Outer().DataAsSpan<int64_t>();
++ buffer_holder_inner.reset(new Eigen::Index[inner_data.size()]);
++ buffer_holder_outer.reset(new Eigen::Index[outer_data.size()]);
++ inner_index_pointer = buffer_holder_inner.get();
++ outer_index_pointer = buffer_holder_outer.get();
++
++ std::transform(inner_data.begin(), inner_data.end(),
++ buffer_holder_inner.get(), [](int64_t v) -> Eigen::Index {
++ return narrow<Eigen::Index>(v);
++ });
++ std::transform(outer_data.begin(), outer_data.end(),
++ buffer_holder_outer.get(), [](int64_t v) -> Eigen::Index {
++ return narrow<Eigen::Index>(v);
++ });
++ }
++ ConstSparseMatrixMap<T> map_A(narrow<Eigen::Index>(a_dims[0]), narrow<Eigen::Index>(a_dims[1]),
++ narrow<Eigen::Index>(A.NumValues()), outer_index_pointer, inner_index_pointer,
+ A.Values().Data<T>());
+- ConstEigenMatrixMapRowMajor<T> map_B(B.Data<T>(), b_dims[0], b_dims[1]);
+- EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), out_dims[0], out_dims[1]);
++ ConstEigenMatrixMapRowMajor<T> map_B(B.Data<T>(), narrow<Eigen::Index>(b_dims[0]), narrow<Eigen::Index>(b_dims[1]));
++ EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), narrow<Eigen::Index>(out_dims[0]),
++ narrow<Eigen::Index>(out_dims[1]));
+ // XXX: Consider re-writing it as a parallel loop as Eigen requires it to use OpenMP
+ // XXX: Consider vectorization
+ SparseDenseMatMulImpl(ctx, map_A, map_B, output_map);
+ }
+ };
+
+-#endif //! defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+-
+ template <typename T>
+ inline T Mul(T a_value, float, T b_value) {
+ return a_value * b_value;
+@@ -121,9 +147,11 @@
+ auto coo_view = A.AsCoo();
+ const auto& ind_dims = coo_view.Indices().Shape().GetDims();
+ ORT_RETURN_IF_NOT(ind_dims.size() == 2, "COO indices must be 2-D, got: ", ind_dims.size());
+- ConstEigenMatrixMapRowMajor<int64_t> a_indicies_map(coo_view.Indices().Data<int64_t>(), narrow<size_t>(ind_dims[0]), narrow<size_t>(ind_dims[1]));
++ ConstEigenMatrixMapRowMajor<int64_t> a_indicies_map(coo_view.Indices().Data<int64_t>(), narrow<size_t>(ind_dims[0]),
++ narrow<size_t>(ind_dims[1]));
+ ConstEigenMatrixMapRowMajor<T> map_b(B.Data<T>(), narrow<size_t>(b_dims[0]), narrow<size_t>(b_dims[1]));
+- EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), narrow<size_t>(out_dims[0]), narrow<size_t>(out_dims[1]));
++ EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), narrow<size_t>(out_dims[0]),
++ narrow<size_t>(out_dims[1]));
+ output_map.setZero();
+
+ const auto rhs_right = (ctx.trans_B) ? b_dims[0] : b_dims[1];
+@@ -140,7 +168,8 @@
+ ORT_RETURN_IF_NOT(m < out_left, "COO m index: ", m, " is out of bounds of out_left: ", out_left);
+ const T a_value = a_values[i];
+ for (int64_t n = 0; n < rhs_right; ++n) {
+- const T b_value = (ctx.trans_B) ? map_b(narrow<size_t>(n), narrow<size_t>(k)) : map_b(narrow<size_t>(k), narrow<size_t>(n));
++ const T b_value =
++ (ctx.trans_B) ? map_b(narrow<size_t>(n), narrow<size_t>(k)) : map_b(narrow<size_t>(k), narrow<size_t>(n));
+ output_map(narrow<size_t>(m), narrow<size_t>(n)) += Mul(a_value, ctx.alpha, b_value);
+ }
+ }
+@@ -170,8 +199,9 @@
+ const auto inner_B = (trans_b_attr_) ? b_dims[1] : b_dims[0];
+ const auto outer_B = (trans_b_attr_) ? b_dims[0] : b_dims[1];
+
+- ORT_RETURN_IF_NOT(inner_A == inner_B, "Can not multiply A and B as inner dimension does not match. inner_A: ",
+- inner_A, " vs inner_B: ", inner_B);
++ ORT_RETURN_IF_NOT(inner_A == inner_B,
++ "Can not multiply A and B as inner dimension does not match. inner_A: ", inner_A,
++ " vs inner_B: ", inner_B);
+
+ TensorShape output_shape{outer_A, outer_B};
+ auto* output = ctx->Output(0, output_shape);
+@@ -184,12 +214,10 @@
+ auto coo_view = A->AsCoo();
+ const auto num_dims = coo_view.Indices().Shape().NumDimensions();
+ ORT_RETURN_IF_NOT(num_dims == 2, "Expecting COO 2-D indices shape");
+- ORT_RETURN_IF_NOT(A->Values().Shape().Size() * 2 == coo_view.Indices().Shape().Size(), "Expecting 2xValues == indices");
++ ORT_RETURN_IF_NOT(A->Values().Shape().Size() * 2 == coo_view.Indices().Shape().Size(),
++ "Expecting 2xValues == indices");
+ auto status = t_disp.InvokeRet<Status, SparseToDenseCoo>(compute_ctx, *A, *B, *output);
+ ORT_RETURN_IF_ERROR(status);
+-// Eigen has a bug in x86 where it calculates reallocation size as -1
+-// and throws bad_alloc
+-#if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+ } else if (A->Format() == SparseFormat::kCsrc) {
+ auto csr_view = A->AsCsr();
+ ORT_RETURN_IF_NOT(A->Values().Shape().Size() == csr_view.Inner().Shape().Size(),
+@@ -199,11 +227,6 @@
+ } else {
+ return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Currently support only COO and CSR(x64) formats");
+ }
+-#else
+- } else {
+- return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "WASM and 32-bit builds support only COO format");
+- }
+-#endif //! defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+
+ return Status::OK();
+ }
+@@ -211,4 +234,4 @@
+ } // namespace contrib
+ } // namespace onnxruntime
+
+-#endif //! defined(DISABLE_SPARSE_TENSORS)
+\ No newline at end of file
++#endif //! defined(DISABLE_SPARSE_TENSORS)
+--- a/onnxruntime/core/util/math_cpuonly.h
++++ b/onnxruntime/core/util/math_cpuonly.h
+@@ -93,7 +93,7 @@
+ using ConstEigenMatrixMap = Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>;
+
+ template <class T>
+-using ConstSparseMatrixMap = Eigen::Map<const Eigen::SparseMatrix<T, Eigen::RowMajor, int64_t>>;
++using ConstSparseMatrixMap = Eigen::Map<const Eigen::SparseMatrix<T, Eigen::RowMajor, Eigen::Index>>;
+
+ template <typename T>
+ using ConstEigenArrayMap = Eigen::Map<const Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic>>;
+--- a/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
++++ b/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
+@@ -140,7 +140,6 @@
+ }
+ */
+ #if !defined(DISABLE_SPARSE_TENSORS)
+-#if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+ #if !defined(__arm__)
+ TEST(SparseToDenseMatMul, TestCsr) {
+ constexpr int64_t rows = 9;
+@@ -263,7 +262,6 @@
+ }
+ }
+ #endif // #if !defined(__arm__)
+-#endif // //!defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+
+ TEST(SparseToDenseMatMul, TestCoo) {
+ constexpr int64_t rows = 9;
diff --git a/debian/patches/Add-missing-include.patch b/debian/patches/Add-missing-include.patch
new file mode 100644
index 0000000..8896d39
--- /dev/null
+++ b/debian/patches/Add-missing-include.patch
@@ -0,0 +1,35 @@
+Description: Both 'std::setw' and 'std::setfill' are defined in '<iomanip>
+Origin: upstream, https://github.com/microsoft/onnxruntime/commit/bf33919
+Forwarded: not-needed
+
+--- a/onnxruntime/test/mlas/unittest/test_activation.cpp
++++ b/onnxruntime/test/mlas/unittest/test_activation.cpp
+@@ -1,6 +1,6 @@
+ // Copyright (c) Microsoft Corporation. All rights reserved.
+ // Licensed under the MIT License.
+-
++#include <iomanip>
+ #include "test_util.h"
+
+ class MlasActivationTest : public MlasTestBase {
+--- a/onnxruntime/test/framework/kernel_type_str_resolver_utils_test.cc
++++ b/onnxruntime/test/framework/kernel_type_str_resolver_utils_test.cc
+@@ -5,7 +5,7 @@
+
+ #include <iostream>
+ #include <sstream>
+-
++#include <iomanip>
+ #include "gtest/gtest.h"
+
+ #include "core/flatbuffers/schema/ort.fbs.h"
+--- a/onnxruntime/test/mlas/unittest/test_fp16_activation.cpp
++++ b/onnxruntime/test/mlas/unittest/test_fp16_activation.cpp
+@@ -2,6 +2,7 @@
+ // Licensed under the MIT License.
+
+ #include "test_fp16.h"
++#include <iomanip>
+
+ #ifdef MLAS_F16VEC_INTRINSICS_SUPPORTED
+
diff --git a/debian/patches/Disable-AVX-tests-on-non-AMD64.patch b/debian/patches/Disable-AVX-tests-on-non-AMD64.patch
new file mode 100644
index 0000000..7a5853c
--- /dev/null
+++ b/debian/patches/Disable-AVX-tests-on-non-AMD64.patch
@@ -0,0 +1,19 @@
+Subject: Fix build on non-amd64 systems
+ /usr/src/packages/BUILD/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc:101:5:
+ error: MlasReduceMinimumMaximumF32KernelAvx was not declared in this scope; did you mean MlasReduceMinimumMaximumF32Kernel?
+
+--- a/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
++++ b/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
+@@ -91,6 +91,7 @@
+ ->Arg(98304)
+ ->Arg(160000);
+
++#if defined(MLAS_TARGET_AMD64)
+ // MLAS avx implementation
+ static void BM_FindMinMaxMlasAvx(benchmark::State& state) {
+ const size_t batch_size = static_cast<size_t>(state.range(0));
+@@ -115,3 +116,4 @@
+ ->Arg(80000)
+ ->Arg(98304)
+ ->Arg(160000);
++#endif
diff --git a/debian/patches/Disable-failing-tests-on-ARM32.patch b/debian/patches/Disable-failing-tests-on-ARM32.patch
new file mode 100644
index 0000000..6749a43
--- /dev/null
+++ b/debian/patches/Disable-failing-tests-on-ARM32.patch
@@ -0,0 +1,276 @@
+Subject: ARM32 has a limited support (see docs/Roadmap.md)
+ Several tests fail on this architecture, so skipping them for now.
+
+--- a/onnxruntime/test/optimizer/qdq_transformer_test.cc
++++ b/onnxruntime/test/optimizer/qdq_transformer_test.cc
+@@ -116,11 +116,13 @@
+ QDQTransformerConvTests<int8_t, int8_t, int32_t, uint8_t>();
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, Conv_S8X8S8) {
+ // input not uint8_t and output not uint8_t
+ QDQTransformerConvTests<int8_t, uint8_t, int32_t, int8_t>();
+ QDQTransformerConvTests<int8_t, int8_t, int32_t, int8_t>();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QDQTransformerTests, ConvMaxPoolReshape_UInt8) {
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape, int opset_version) {
+@@ -187,6 +189,7 @@
+ test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3}, 19);
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, ConvMaxPoolReshape_Int8) {
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape) {
+ auto build_test_case = [&](ModelTestBuilder& builder) {
+@@ -639,10 +642,12 @@
+ QDQTransformerMatMulTests<uint8_t, int8_t, uint8_t>(true);
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, MatMul_S8S8S8) {
+ QDQTransformerMatMulTests<int8_t, int8_t, int8_t>(false);
+ QDQTransformerMatMulTests<int8_t, int8_t, int8_t>(true);
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QDQTransformerTests, MatMul_S8U8U8) {
+ QDQTransformerMatMulTests<int8_t, uint8_t, uint8_t>(false);
+@@ -654,10 +659,12 @@
+ QDQTransformerMatMulTests<int8_t, uint8_t, int8_t>(true);
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, MatMul_S8S8U8) {
+ QDQTransformerMatMulTests<int8_t, int8_t, uint8_t>(false);
+ QDQTransformerMatMulTests<int8_t, int8_t, uint8_t>(true);
+ }
++#endif // #if !defined(__arm__)
+
+ template <typename Input1Type, typename Input2Type, typename OutputType, typename BiasType = int32_t>
+ void QDQTransformerGemmTests(bool has_output_q, bool has_bias, bool beta_not_one = false) {
+@@ -821,10 +828,12 @@
+ QDQTransformerGemmTests<uint8_t, int8_t, uint8_t, uint8_t>();
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, Gemm_S8S8S8) {
+ QDQTransformerGemmTests<int8_t, int8_t, int8_t>();
+ QDQTransformerGemmTests<int8_t, int8_t, int8_t, uint8_t>();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QDQTransformerTests, Gemm_S8U8U8) {
+ QDQTransformerGemmTests<int8_t, uint8_t, uint8_t>();
+@@ -836,10 +845,12 @@
+ QDQTransformerGemmTests<int8_t, uint8_t, int8_t, uint8_t>();
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, Gemm_S8S8U8) {
+ QDQTransformerGemmTests<int8_t, int8_t, uint8_t>();
+ QDQTransformerGemmTests<int8_t, int8_t, uint8_t, uint8_t>();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QDQTransformerTests, Gather) {
+ auto test_case = [&](const std::vector<int64_t>& input1_shape, const std::vector<int64_t>& weights_shape) {
+@@ -1539,6 +1550,7 @@
+ test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3});
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, ConvAveragePoolReshape_Int8) {
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape) {
+ auto build_test_case = [&](ModelTestBuilder& builder) {
+@@ -1675,6 +1687,7 @@
+ test_case({1, 23, 13, 13}, {30, 23, 3, 3});
+ test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3});
+ }
++#endif // #if !defined(__arm__)
+
+ template <typename InputType, typename OutputType>
+ void QDQTransformerLeakyReluTests() {
+@@ -1847,6 +1860,7 @@
+ QDQTransformerSigmoidTests<uint8_t, int8_t>();
+ }
+
++#if !defined(__arm__)
+ TEST(QDQTransformerTests, ConvTranspose_QBackward) {
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape, const std::vector<int64_t>& perms) {
+ auto build_test_case = [&](ModelTestBuilder& builder) {
+@@ -2686,6 +2700,7 @@
+
+ test_case({1, 13, 13, 23});
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QDQTransformerTests, QDQ_Selector_Test) {
+ const ORTCHAR_T* model_file_name = ORT_TSTR("testdata/transform/qdq_conv.onnx");
+@@ -3076,6 +3091,7 @@
+ test_case(true);
+ test_case(false);
+ }
++#endif // #if !defined(__arm__)
+
+ // test removal when we have graph input -> Q/DQ pair -> graph output
+ TEST(QDQTransformerTests, QDQFinalCleanupTransformer_GraphInputToOutput) {
+--- a/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
++++ b/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
+@@ -141,6 +141,7 @@
+ */
+ #if !defined(DISABLE_SPARSE_TENSORS)
+ #if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
++#if !defined(__arm__)
+ TEST(SparseToDenseMatMul, TestCsr) {
+ constexpr int64_t rows = 9;
+ constexpr int64_t cols = 9;
+@@ -261,6 +262,7 @@
+ tester.Run(OpTester::ExpectResult::kExpectSuccess);
+ }
+ }
++#endif // #if !defined(__arm__)
+ #endif // //!defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+
+ TEST(SparseToDenseMatMul, TestCoo) {
+@@ -383,4 +385,4 @@
+ #endif // !defined(DISABLE_SPARSE_TENSORS)
+
+ } // namespace test
+-} // namespace onnxruntime
+\ No newline at end of file
++} // namespace onnxruntime
+--- a/onnxruntime/test/contrib_ops/quant_gemm_test.cc
++++ b/onnxruntime/test/contrib_ops/quant_gemm_test.cc
+@@ -180,6 +180,7 @@
+ false /*per_column*/);
+ }
+
++#if !defined(__arm__)
+ TEST(QuantGemmTest, Scalar) {
+ RunQuantGemmTestBatch(1, 1, 32);
+ RunQuantGemmTestBatch(1, 1, 260);
+@@ -194,6 +195,7 @@
+ RunQuantGemmTestBatch(1, 8, 400);
+ RunQuantGemmTestBatch(1, 512, 1024);
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QuantGemmTest, GEMM) {
+ RunQuantGemmTestBatch(2, 2, 40);
+--- a/onnxruntime/test/providers/cpu/nn/qlinearconv_op_test.cc
++++ b/onnxruntime/test/providers/cpu/nn/qlinearconv_op_test.cc
+@@ -1080,6 +1080,7 @@
+ }
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv1D_S8S8) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+ test.GenerateRandomInput({3, 24, 15}, .05f, 4);
+@@ -1089,6 +1090,7 @@
+ test.SetOutputScaleAndZeroPoint(.55f, 54);
+ test.Run();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv2D_S8S8_Sym_M64_C64) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+@@ -1100,6 +1102,7 @@
+ test.Run();
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv2D_S8S8_Sym_M16_C4_Bias) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+ test.GenerateRandomInput({1, 4, 3, 3}, .05f, 4);
+@@ -1119,6 +1122,7 @@
+ test.SetOutputScaleAndZeroPoint(.55f, 54);
+ test.Run();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv2D_S8S8_Sym_M48_C48_Bias_Pads) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+@@ -1140,6 +1144,7 @@
+ test.Run();
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv2D_S8S8) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+ test.GenerateRandomInput({3, 24, 15, 11}, .05f, 4);
+@@ -1149,6 +1154,7 @@
+ test.SetOutputScaleAndZeroPoint(.55f, 54);
+ test.Run();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv3D_S8S8) {
+ // TODO: Unskip when fixed #41968513
+@@ -1165,6 +1171,7 @@
+ test.Run();
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv1D_S8S8_Pointwise) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+ test.GenerateRandomInput({3, 24, 15}, .05f, 4);
+@@ -1191,6 +1198,7 @@
+ test.SetOutputScaleAndZeroPoint(.75f, -14);
+ test.Run();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv3D_S8S8_Pointwise) {
+ // TODO: Unskip when fixed #41968513
+@@ -1206,6 +1214,7 @@
+ test.Run();
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv1D_S8S8_Dilations) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+ test.GenerateRandomInput({1, 4, 19}, .02f, 20);
+@@ -1214,6 +1223,7 @@
+ test.SetOutputScaleAndZeroPoint(.24f, -15);
+ test.Run();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv2D_S8S8_Dilations) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+@@ -1238,6 +1248,7 @@
+ test.Run();
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv1D_S8S8_Strides) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+ test.GenerateRandomInput({1, 7, 18}, .04f, 16);
+@@ -1349,6 +1360,7 @@
+ test.SetOutputScaleAndZeroPoint(.26f, 8);
+ test.Run();
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv1D_S8S8_Depthwise) {
+ for (int8_t weight_zero_point : std::initializer_list<int8_t>{-2, 0, 2}) {
+@@ -1462,6 +1474,7 @@
+ }
+ }
+
++#if !defined(__arm__)
+ TEST(QLinearConvTest, Conv2D_S8S8_Requantize_NoBias) {
+ for (int64_t channels = 1; channels <= 32; channels++) {
+ QLinearConvOpTester<int8_t, int8_t> test;
+@@ -1506,6 +1519,7 @@
+ test.Run();
+ }
+ }
++#endif // #if !defined(__arm__)
+
+ TEST(QLinearConvTest, Conv2D_S8S8_Depthwise_Kernelsize) {
+ TestQLinearConv2dDepthwiseKernelsize<int8_t, int8_t>();
diff --git a/debian/patches/disable-power10.patch b/debian/patches/disable-power10.patch
new file mode 100644
index 0000000..71f8bdc
--- /dev/null
+++ b/debian/patches/disable-power10.patch
@@ -0,0 +1,17 @@
+Description: Disable POWER10, targets POWER8 instead
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/disable-power10.patch
+Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
+
+--- a/cmake/onnxruntime_mlas.cmake
++++ b/cmake/onnxruntime_mlas.cmake
+@@ -377,7 +377,8 @@
+ set_source_files_properties(${MLAS_SRC_DIR}/power/QuantizePowerVSX.cpp PROPERTIES COMPILE_FLAGS "-mcpu=power9")
+ endif()
+
+- check_cxx_compiler_flag("-mcpu=power10" HAS_POWER10)
++ #check_cxx_compiler_flag("-mcpu=power10" HAS_POWER10)
++ set(HAS_POWER10 OFF)
+ if(HAS_POWER10)
+ set(CMAKE_REQUIRED_FLAGS "-mcpu=power10")
+ check_cxx_source_compiles("
diff --git a/debian/patches/fix-cxx20-template-constructor.patch b/debian/patches/fix-cxx20-template-constructor.patch
new file mode 100644
index 0000000..112bd16
--- /dev/null
+++ b/debian/patches/fix-cxx20-template-constructor.patch
@@ -0,0 +1,24 @@
+Description: Fix C++20 template constructor
+Forwarded: https://github.com/microsoft/onnxruntime/pull/21057
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/fix-cxx20-template-constructor.patch
+Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
+
+--- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h
++++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h
+@@ -326,11 +326,11 @@
+ template <typename InputType, typename ThresholdType, typename OutputType>
+ class TreeAggregatorMax : public TreeAggregator<InputType, ThresholdType, OutputType> {
+ public:
+- TreeAggregatorMax<InputType, ThresholdType, OutputType>(size_t n_trees,
+- const int64_t& n_targets_or_classes,
+- POST_EVAL_TRANSFORM post_transform,
+- const std::vector<ThresholdType>& base_values) : TreeAggregator<InputType, ThresholdType, OutputType>(n_trees, n_targets_or_classes,
+- post_transform, base_values) {}
++ TreeAggregatorMax(size_t n_trees,
++ const int64_t& n_targets_or_classes,
++ POST_EVAL_TRANSFORM post_transform,
++ const std::vector<ThresholdType>& base_values) : TreeAggregator<InputType, ThresholdType, OutputType>(n_trees, n_targets_or_classes,
++ post_transform, base_values) {}
+
+ // 1 output
+
diff --git a/debian/patches/fix_forward_decl_flatbuffers.patch b/debian/patches/fix_forward_decl_flatbuffers.patch
new file mode 100644
index 0000000..98d86b3
--- /dev/null
+++ b/debian/patches/fix_forward_decl_flatbuffers.patch
@@ -0,0 +1,159 @@
+Description: Fix compilation with newer flatbuffers
+Forwarded: https://github.com/microsoft/onnxruntime/pull/17164
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/fix_forward_decl_flatbuffers.patch
+Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
+Bug-Debian: https://bugs.debian.org/1076959
+
+diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h
+index 81015b25bc..9ae5b130b4 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 4e7db4df9a..e4e100c129 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 75fc2fa894..e029e5cdae 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 d546f264a9..5741a78489 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 f4899ffc12..08b9345eee 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 5337211ae7..cb03cf9119 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 265364a88d..4023a5edbf 100644
+--- a/onnxruntime/core/graph/op_identifier_utils.h
++++ b/onnxruntime/core/graph/op_identifier_utils.h
+@@ -9,8 +9,9 @@
+ #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 5db784f1a2..7fecf4a9c5 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 {
diff --git a/debian/patches/gcc-false-positive.patch b/debian/patches/gcc-false-positive.patch
new file mode 100644
index 0000000..c3f0c67
--- /dev/null
+++ b/debian/patches/gcc-false-positive.patch
@@ -0,0 +1,38 @@
+Description: Ignore GCC false positives
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/gcc-false-positive.patch
+Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
+
+--- 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 {
+--- 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"
++
+ using namespace ONNX_NAMESPACE;
+ using namespace onnxruntime::common;
+
+--- 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/debian/patches/no-nsync.patch b/debian/patches/no-nsync.patch
new file mode 100644
index 0000000..180d680
--- /dev/null
+++ b/debian/patches/no-nsync.patch
@@ -0,0 +1,210 @@
+Description: Replace the use of nsync by pthread
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/no-nsync.patch
+
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -922,7 +922,7 @@
+ 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 @@
+ 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()
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -64,7 +64,7 @@
+ )
+ endif()
+
+-if (NOT WIN32)
++if (FALSE AND NOT WIN32)
+ FetchContent_Declare(
+ google_nsync
+ URL ${DEP_URL_google_nsync}
+@@ -270,7 +270,7 @@
+ 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)
+--- a/cmake/onnxruntime_mlas.cmake
++++ b/cmake/onnxruntime_mlas.cmake
+@@ -613,7 +613,7 @@
+ target_link_libraries(onnxruntime_mlas_q4dq PRIVATE cpuinfo)
+ endif()
+ if(NOT WIN32)
+- target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
++# target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
+ endif()
+ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
+ target_link_libraries(onnxruntime_mlas_q4dq PRIVATE ${android_shared_libs})
+--- a/cmake/onnxruntime_unittests.cmake
++++ b/cmake/onnxruntime_unittests.cmake
+@@ -697,7 +697,7 @@
+ 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 @@
+ 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 @@
+ # "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 @@
+ ${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 @@
+ # 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 (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 @@
+
+ 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
+--- a/include/onnxruntime/core/platform/ort_mutex.h
++++ b/include/onnxruntime/core/platform/ort_mutex.h
+@@ -102,13 +102,13 @@
+ }
+ } // 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 @@
+ 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 @@
+ 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 @@
+ */
+ 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:
+--- a/onnxruntime/core/platform/posix/ort_mutex.cc
++++ b/onnxruntime/core/platform/posix/ort_mutex.cc
+@@ -27,7 +27,7 @@
+ 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 @@
+ 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
diff --git a/debian/patches/remove-wil.patch b/debian/patches/remove-wil.patch
new file mode 100644
index 0000000..ee8df80
--- /dev/null
+++ b/debian/patches/remove-wil.patch
@@ -0,0 +1,58 @@
+Description: Remove dependency on WIL (Windows Implementation Libraries)
+ https://github.com/microsoft/wil/
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/remove-wil.patch
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -412,7 +412,7 @@
+
+
+ include(eigen)
+-include(wil)
++#include(wil)
+
+ #if (NOT onnxruntime_MINIMAL_BUILD)
+ # onnxruntime_fetchcontent_makeavailable(onnx)
+@@ -449,7 +449,7 @@
+ #onnxruntime_EXTERNAL_LIBRARIES could contain onnx, onnx_proto,libprotobuf, cuda/cudnn,
+ # dnnl/mklml, onnxruntime_codegen_tvm, tvm and pthread
+ # pthread is always at the last
+-set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} ${WIL_TARGET} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date_interface)
++set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date_interface)
+ # The source code of onnx_proto is generated, we must build this lib first before starting to compile the other source code that uses ONNX protobuf types.
+ # The other libs do not have the problem. All the sources are already there. We can compile them in any order.
+ set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto flatbuffers::flatbuffers)
+--- a/cmake/onnxruntime_common.cmake
++++ b/cmake/onnxruntime_common.cmake
+@@ -121,7 +121,7 @@
+ endif()
+ endif()
+
+-onnxruntime_add_include_to_target(onnxruntime_common date_interface ${WIL_TARGET})
++onnxruntime_add_include_to_target(onnxruntime_common date_interface)
+ target_include_directories(onnxruntime_common
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}
+ # propagate include directories of dependencies that are part of public interface
+--- a/cmake/onnxruntime_graph.cmake
++++ b/cmake/onnxruntime_graph.cmake
+@@ -87,7 +87,7 @@
+
+ onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_lib_src})
+ add_dependencies(onnxruntime_graph onnx_proto flatbuffers::flatbuffers)
+-onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common ${WIL_TARGET} onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers safeint_interface Boost::mp11)
++onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers safeint_interface Boost::mp11)
+
+ if (MSVC)
+ set(ONNX_PROTOBUF_NATVIS_FILE "onnx_protobuf.natvis")
+--- a/cmake/onnxruntime_providers.cmake
++++ b/cmake/onnxruntime_providers.cmake
+@@ -1283,7 +1283,7 @@
+ source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dml_cc_srcs})
+ onnxruntime_add_static_library(onnxruntime_providers_dml ${onnxruntime_providers_dml_cc_srcs})
+ onnxruntime_add_include_to_target(onnxruntime_providers_dml
+- onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers Boost::mp11 safeint_interface ${WIL_TARGET}
++ onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers Boost::mp11 safeint_interface
+ )
+ add_dependencies(onnxruntime_providers_dml ${onnxruntime_EXTERNAL_DEPENDENCIES})
+ target_include_directories(onnxruntime_providers_dml PRIVATE
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..9515602
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,22 @@
+system-flatbuffers.patch
+system-protobuf.patch
+system-onnx.patch
+disable-power10.patch
+no-nsync.patch
+remove-wil.patch
+system-safeint.patch
+versioned-onnxruntime_providers_shared.patch
+system-date-and-mp11.patch
+system-cpuinfo.patch
+system-python.patch
+system-re2.patch
+system-datadir.patch
+system-benchmark.patch
+Disable-AVX-tests-on-non-AMD64.patch
+Disable-failing-tests-on-ARM32.patch
+fix-cxx20-template-constructor.patch
+gcc-false-positive.patch
+fix_forward_decl_flatbuffers.patch
+
+17eaf9b053238b3efec303e9c94008201ca42462.patch
+Add-missing-include.patch
diff --git a/debian/patches/system-benchmark.patch b/debian/patches/system-benchmark.patch
new file mode 100644
index 0000000..c1c520f
--- /dev/null
+++ b/debian/patches/system-benchmark.patch
@@ -0,0 +1,15 @@
+Description: Use system benchmark lib (libbenchmark-dev)
+Forwarded: not-needed
+Author: Dylan Aïssi <daissi at debian.org>
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -274,7 +274,7 @@
+
+
+ if (onnxruntime_BUILD_BENCHMARKS)
+- onnxruntime_fetchcontent_makeavailable(google_benchmark)
++ find_package(benchmark REQUIRED)
+ endif()
+
+ if (FALSE AND NOT WIN32)
diff --git a/debian/patches/system-cpuinfo.patch b/debian/patches/system-cpuinfo.patch
new file mode 100644
index 0000000..34a4077
--- /dev/null
+++ b/debian/patches/system-cpuinfo.patch
@@ -0,0 +1,32 @@
+Description: Use system cpuinfo lib (libcpuinfo-dev)
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-cpuinfo.patch
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -382,13 +382,7 @@
+
+
+ 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()
+
+
+--- a/cmake/onnxruntime_common.cmake
++++ b/cmake/onnxruntime_common.cmake
+@@ -208,7 +208,7 @@
+ # 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()
diff --git a/debian/patches/system-datadir.patch b/debian/patches/system-datadir.patch
new file mode 100644
index 0000000..de931d5
--- /dev/null
+++ b/debian/patches/system-datadir.patch
@@ -0,0 +1,39 @@
+Description: Use system ONNX data dir (python3-onnx and libonnx-testdata)
+Forwarded: not-needed
+Author: Andre Moreira Magalhaes <andrunko at gmail.com>
+
+--- a/cmake/onnxruntime_unittests.cmake
++++ b/cmake/onnxruntime_unittests.cmake
+@@ -909,7 +909,7 @@
+ onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto)
+ target_include_directories(onnx_test_data_proto PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+ set_target_properties(onnx_test_data_proto PROPERTIES FOLDER "ONNXRuntimeTest")
+-onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnx_SOURCE_DIR} TARGET onnx_test_data_proto)
++onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnxruntime_ONNX_PROTO_DATA_DIR} TARGET onnx_test_data_proto)
+
+ #
+ # onnxruntime_ir_graph test data
+@@ -1133,9 +1133,9 @@
+
+ if (NOT onnxruntime_REDUCED_OPS_BUILD AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ add_test(NAME onnx_test_pytorch_converted
+- COMMAND onnx_test_runner ${onnx_SOURCE_DIR}/onnx/backend/test/data/pytorch-converted)
++ COMMAND onnx_test_runner ${onnxruntime_ONNX_TEST_DATA_DIR}/pytorch-converted)
+ add_test(NAME onnx_test_pytorch_operator
+- COMMAND onnx_test_runner ${onnx_SOURCE_DIR}/onnx/backend/test/data/pytorch-operator)
++ COMMAND onnx_test_runner ${onnxruntime_ONNX_TEST_DATA_DIR}/pytorch-operator)
+ endif()
+
+ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -104,6 +104,9 @@
+ option(onnxruntime_GCOV_COVERAGE "Compile with options necessary to run code coverage" OFF)
+ option(onnxruntime_DONT_VECTORIZE "Do not vectorize operations in Eigen" OFF)
+
++option(onnxruntime_ONNX_PROTO_DATA_DIR "Path where onnx/onnx-data.proto is located in your system, only used when onnxruntime_PREFER_SYSTEM_LIB is set")
++option(onnxruntime_ONNX_TEST_DATA_DIR "Path where onnx's pytorch-converted|operator test data in your system, only used when onnxruntime_PREFER_SYSTEM_LIB is set")
++
+ #It's preferred to turn it OFF when onnxruntime is dynamically linked to PROTOBUF. But Tensort always required the full version of protobuf.
+ cmake_dependent_option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF "NOT onnxruntime_USE_TENSORRT" ON)
+ option(tensorflow_C_PACKAGE_PATH "Path to tensorflow C package installation dir")
diff --git a/debian/patches/system-date-and-mp11.patch b/debian/patches/system-date-and-mp11.patch
new file mode 100644
index 0000000..177eb1b
--- /dev/null
+++ b/debian/patches/system-date-and-mp11.patch
@@ -0,0 +1,105 @@
+Description: Use system date and mp11 libs (libhowardhinnant-date-dev and libboost-dev)
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-date-and-mp11.patch
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -169,20 +169,8 @@
+ set(ENABLE_DATE_TESTING OFF CACHE BOOL "" FORCE)
+ set(USE_SYSTEM_TZ_DB ON CACHE BOOL "" FORCE)
+
+-FetchContent_Declare(
+- date
+- URL ${DEP_URL_date}
+- URL_HASH SHA1=${DEP_SHA1_date}
+- )
+-onnxruntime_fetchcontent_makeavailable(date)
+-
+-
+-
+-FetchContent_Declare(
+- mp11
+- URL ${DEP_URL_mp11}
+- URL_HASH SHA1=${DEP_SHA1_mp11}
+-)
++find_package(date)
++find_package(Boost COMPONENTS mp11)
+
+ set(JSON_BuildTests OFF CACHE INTERNAL "")
+ set(JSON_Install OFF CACHE INTERNAL "")
+@@ -297,7 +285,7 @@
+ endif()
+
+ # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
+-onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 GSL flatbuffers)
++onnxruntime_fetchcontent_makeavailable(nlohmann_json re2 GSL flatbuffers)
+ if(NOT flatbuffers_FOUND)
+ if(NOT TARGET flatbuffers::flatbuffers)
+ add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
+@@ -443,7 +431,7 @@
+ #onnxruntime_EXTERNAL_LIBRARIES could contain onnx, onnx_proto,libprotobuf, cuda/cudnn,
+ # dnnl/mklml, onnxruntime_codegen_tvm, tvm and pthread
+ # pthread is always at the last
+-set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date_interface)
++set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::boost safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date::date)
+ # The source code of onnx_proto is generated, we must build this lib first before starting to compile the other source code that uses ONNX protobuf types.
+ # The other libs do not have the problem. All the sources are already there. We can compile them in any order.
+ set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto flatbuffers::flatbuffers)
+--- a/cmake/onnxruntime_common.cmake
++++ b/cmake/onnxruntime_common.cmake
+@@ -121,7 +121,7 @@
+ endif()
+ endif()
+
+-onnxruntime_add_include_to_target(onnxruntime_common date_interface)
++onnxruntime_add_include_to_target(onnxruntime_common date::date)
+ target_include_directories(onnxruntime_common
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}
+ # propagate include directories of dependencies that are part of public interface
+--- a/cmake/onnxruntime_unittests.cmake
++++ b/cmake/onnxruntime_unittests.cmake
+@@ -61,7 +61,7 @@
+ target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES})
+ endif()
+
+- onnxruntime_add_include_to_target(${_UT_TARGET} date_interface flatbuffers::flatbuffers)
++ onnxruntime_add_include_to_target(${_UT_TARGET} date::date flatbuffers::flatbuffers)
+ target_include_directories(${_UT_TARGET} PRIVATE ${TEST_INC_DIR})
+ if (onnxruntime_USE_CUDA)
+ target_include_directories(${_UT_TARGET} PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${onnxruntime_CUDNN_HOME}/include)
+@@ -147,7 +147,7 @@
+ else()
+ target_link_libraries(${_UT_TARGET}_xc PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES})
+ endif()
+- onnxruntime_add_include_to_target(${_UT_TARGET}_xc date_interface flatbuffers::flatbuffers)
++ onnxruntime_add_include_to_target(${_UT_TARGET}_xc date::date flatbuffers::flatbuffers)
+ target_include_directories(${_UT_TARGET}_xc PRIVATE ${TEST_INC_DIR})
+ get_target_property(${_UT_TARGET}_DEFS ${_UT_TARGET} COMPILE_DEFINITIONS)
+ target_compile_definitions(${_UT_TARGET}_xc PRIVATE ${_UT_TARGET}_DEFS)
+@@ -705,7 +705,7 @@
+ if (onnxruntime_USE_ROCM)
+ target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/onnxruntime ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/orttraining)
+ endif()
+-onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers::flatbuffers nlohmann_json::nlohmann_json Boost::mp11 safeint_interface)
++onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers::flatbuffers nlohmann_json::nlohmann_json Boost::boost safeint_interface)
+
+
+
+@@ -739,7 +739,7 @@
+ target_compile_options(onnx_test_runner_common PRIVATE "/wd4244")
+ endif()
+ onnxruntime_add_include_to_target(onnx_test_runner_common onnxruntime_common onnxruntime_framework
+- onnxruntime_test_utils onnx onnx_proto re2::re2 flatbuffers::flatbuffers Boost::mp11 safeint_interface)
++ onnxruntime_test_utils onnx onnx_proto re2::re2 flatbuffers::flatbuffers Boost::boost safeint_interface)
+
+ add_dependencies(onnx_test_runner_common onnx_test_data_proto ${onnxruntime_EXTERNAL_DEPENDENCIES})
+ target_include_directories(onnx_test_runner_common PRIVATE ${eigen_INCLUDE_DIRS}
+@@ -1683,7 +1683,7 @@
+
+ onnxruntime_add_shared_library_module(test_execution_provider ${test_execution_provider_srcs})
+ add_dependencies(test_execution_provider onnxruntime_providers_shared onnx ${ABSEIL_LIBS})
+- target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared ${ABSEIL_LIBS} Boost::mp11)
++ target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared ${ABSEIL_LIBS} Boost::boost)
+ target_include_directories(test_execution_provider PRIVATE $<TARGET_PROPERTY:onnx,INTERFACE_INCLUDE_DIRECTORIES>)
+ target_include_directories(test_execution_provider PRIVATE $<TARGET_PROPERTY:onnxruntime_common,INTERFACE_INCLUDE_DIRECTORIES>)
+ target_include_directories(test_execution_provider PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${ORTTRAINING_ROOT})
diff --git a/debian/patches/system-flatbuffers.patch b/debian/patches/system-flatbuffers.patch
new file mode 100644
index 0000000..7547d2b
--- /dev/null
+++ b/debian/patches/system-flatbuffers.patch
@@ -0,0 +1,15 @@
+Description: Use system flatbuffers lib (libflatbuffers-dev)
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-flatbuffers.patch
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -103,7 +103,7 @@
+ 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
diff --git a/debian/patches/system-onnx.patch b/debian/patches/system-onnx.patch
new file mode 100644
index 0000000..4ebecbb
--- /dev/null
+++ b/debian/patches/system-onnx.patch
@@ -0,0 +1,40 @@
+Description: Use system ONNX lib (libonnx-dev)
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-onnx.patch
+Author: Alejandro Alvarez Ayllon <a.alvarezayllon at gmail.com>
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -414,11 +414,12 @@
+ include(eigen)
+ include(wil)
+
+-if (NOT onnxruntime_MINIMAL_BUILD)
+- onnxruntime_fetchcontent_makeavailable(onnx)
+-else()
+- include(onnx_minimal)
+-endif()
++#if (NOT onnxruntime_MINIMAL_BUILD)
++# onnxruntime_fetchcontent_makeavailable(onnx)
++#else()
++# include(onnx_minimal)
++#endif()
++find_package(ONNX REQUIRED)
+
+ set(GSL_TARGET "Microsoft.GSL::GSL")
+ set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
+@@ -453,10 +454,10 @@
+ # The other libs do not have the problem. All the sources are already there. We can compile them in any order.
+ set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto flatbuffers::flatbuffers)
+
+-target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
+-if (NOT onnxruntime_USE_FULL_PROTOBUF)
+- target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
+-endif()
++#target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
++#if (NOT onnxruntime_USE_FULL_PROTOBUF)
++# target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
++#endif()
+
+ if (onnxruntime_RUN_ONNX_TESTS)
+ add_definitions(-DORT_RUN_EXTERNAL_ONNX_TESTS)
diff --git a/debian/patches/system-protobuf.patch b/debian/patches/system-protobuf.patch
new file mode 100644
index 0000000..caa4c41
--- /dev/null
+++ b/debian/patches/system-protobuf.patch
@@ -0,0 +1,40 @@
+Description: Use system protobuf lib (libprotobuf-dev)
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-protobuf.patch
+Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -161,22 +161,8 @@
+ 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 @@
+ )
+
+ # 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)
diff --git a/debian/patches/system-python.patch b/debian/patches/system-python.patch
new file mode 100644
index 0000000..fa94bea
--- /dev/null
+++ b/debian/patches/system-python.patch
@@ -0,0 +1,22 @@
+Description: Use system Python
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-python.patch
+
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -531,12 +531,12 @@
+ 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()
+
diff --git a/debian/patches/system-re2.patch b/debian/patches/system-re2.patch
new file mode 100644
index 0000000..5ac87c3
--- /dev/null
+++ b/debian/patches/system-re2.patch
@@ -0,0 +1,32 @@
+Description: Use system re2 lib (libre2-dev)
+Forwarded: not-needed
+Author: Dylan Aïssi <daissi at debian.org>
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -30,6 +30,25 @@
+ URL_HASH SHA1=${DEP_SHA1_re2}
+ FIND_PACKAGE_ARGS NAMES re2
+ )
++find_package(PkgConfig REQUIRED)
++pkg_check_modules(RE2 re2)
++if(RE2_FOUND)
++ set(re2_FOUND "${RE2_FOUND}")
++ add_library(re2::re2 INTERFACE IMPORTED)
++ if(RE2_INCLUDE_DIRS)
++ set_property(TARGET re2::re2 PROPERTY
++ INTERFACE_INCLUDE_DIRECTORIES "${RE2_INCLUDE_DIRS}")
++ endif()
++ if(RE2_CFLAGS_OTHER)
++ set_property(TARGET re2::re2 PROPERTY
++ INTERFACE_COMPILE_OPTIONS "${RE2_CFLAGS_OTHER}")
++ endif()
++ if(RE2_LDFLAGS)
++ set_property(TARGET re2::re2 PROPERTY
++ INTERFACE_LINK_LIBRARIES "${RE2_LDFLAGS}")
++ endif()
++ message(STATUS "Found RE2 via pkg-config.")
++endif()
+
+ if (onnxruntime_BUILD_UNIT_TESTS)
+ # WebAssembly threading support in Node.js is still an experimental feature and
diff --git a/debian/patches/system-safeint.patch b/debian/patches/system-safeint.patch
new file mode 100644
index 0000000..8150508
--- /dev/null
+++ b/debian/patches/system-safeint.patch
@@ -0,0 +1,42 @@
+Description: Use system safeint lib (libsafeint-dev)
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-safeint.patch
+Author: Alejandro Alvarez Ayllon <a.alvarezayllon at gmail.com>, Dylan Aïssi <daissi at debian.org>
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -296,14 +296,8 @@
+ )
+ endif()
+
+-FetchContent_Declare(
+- safeint
+- URL ${DEP_URL_safeint}
+- URL_HASH SHA1=${DEP_SHA1_safeint}
+-)
+-
+ # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
+-onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 safeint GSL flatbuffers)
++onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 GSL flatbuffers)
+ if(NOT flatbuffers_FOUND)
+ if(NOT TARGET flatbuffers::flatbuffers)
+ add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
+@@ -425,7 +419,7 @@
+ set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
+
+ add_library(safeint_interface INTERFACE)
+-target_include_directories(safeint_interface INTERFACE ${safeint_SOURCE_DIR})
++target_include_directories(safeint_interface INTERFACE /usr/include/safeint)
+
+ # XNNPACK EP
+ if (onnxruntime_USE_XNNPACK)
+--- a/onnxruntime/core/common/safeint.h
++++ b/onnxruntime/core/common/safeint.h
+@@ -24,6 +24,7 @@
+
+ #define SAFEINT_EXCEPTION_HANDLER_CPP 1
+ #define SafeIntDefaultExceptionHandler SafeIntExceptionHandler<onnxruntime::OnnxRuntimeException>
++#define SAFEINT_CPP_THROW noexcept(false)
+
+ #if defined(__GNUC__)
+ #include "onnxruntime_config.h"
diff --git a/debian/patches/versioned-onnxruntime_providers_shared.patch b/debian/patches/versioned-onnxruntime_providers_shared.patch
new file mode 100644
index 0000000..7460e91
--- /dev/null
+++ b/debian/patches/versioned-onnxruntime_providers_shared.patch
@@ -0,0 +1,14 @@
+Description: Make onnxruntime_providers_shared versioned
+Forwarded: not-needed
+Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/versioned-onnxruntime_providers_shared.patch
+
+--- a/cmake/onnxruntime_providers.cmake
++++ b/cmake/onnxruntime_providers.cmake
+@@ -338,6 +338,7 @@
+ onnxruntime_add_shared_library(onnxruntime_providers_shared ${onnxruntime_providers_shared_cc_srcs} "${ONNXRUNTIME_ROOT}/core/dll/onnxruntime.rc")
+ set_target_properties(onnxruntime_providers_shared PROPERTIES FOLDER "ONNXRuntime")
+ set_target_properties(onnxruntime_providers_shared PROPERTIES LINKER_LANGUAGE CXX)
++ set_target_properties(onnxruntime_providers_shared PROPERTIES VERSION ${ORT_VERSION})
+
+ target_compile_definitions(onnxruntime_providers_shared PRIVATE VER_MAJOR=${VERSION_MAJOR_PART})
+ target_compile_definitions(onnxruntime_providers_shared PRIVATE VER_MINOR=${VERSION_MINOR_PART})
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..27b2510
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,31 @@
+#!/usr/bin/make -f
+
+COMPILE_SCHEMA = onnxruntime/core/flatbuffers/schema/compile_schema.py
+
+%:
+ dh $@ -Scmake -Dcmake
+
+override_dh_auto_configure:
+ # Rebuild autogenerated flatbuffers files
+ chmod +x ${COMPILE_SCHEMA}
+ ${COMPILE_SCHEMA} --flatc /usr/bin/flatc
+ dh_auto_configure -- \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_INSTALL_INCLUDEDIR=include \
+ -Deigen_SOURCE_PATH=/usr/include/eigen3 \
+ -Donnxruntime_BUILD_BENCHMARKS=ON \
+ -Donnxruntime_BUILD_SHARED_LIB=ON \
+ -Donnxruntime_BUILD_UNIT_TESTS=ON \
+ -Donnxruntime_DISABLE_ABSEIL=ON \
+ -Donnxruntime_ENABLE_CPUINFO=ON \
+ -Donnxruntime_ENABLE_PYTHON=OFF \
+ -Donnxruntime_ONNX_PROTO_DATA_DIR=/usr/lib/python3/dist-packages \
+ -Donnxruntime_ONNX_TEST_DATA_DIR=/usr/share/libonnx-testdata/data \
+ -Donnxruntime_USE_FULL_PROTOBUF=ON \
+ -Donnxruntime_USE_PREINSTALLED_EIGEN=ON \
+ -Donnxruntime_USE_XNNPACK=ON \
+ $(NULL)
+
+override_dh_auto_test:
+ # Do NOT run tests, they depend on *.onnx dataset with unclear license
+ # See https://github.com/microsoft/onnxruntime/issues/8963
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
new file mode 100644
index 0000000..7971007
--- /dev/null
+++ b/debian/salsa-ci.yml
@@ -0,0 +1,13 @@
+---
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
+
+variables:
+ SALSA_CI_DISABLE_BUILD_PACKAGE_I386: 1
+
+blhc:
+ allow_failure: true
+
+reprotest:
+ allow_failure: true
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
new file mode 100644
index 0000000..ec08286
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1,4 @@
+# This files lists licenses of third party libraries.
+# This JSON evil license comes from RapidJSON which is neither embedded
+# nor used in this package.
+onnxruntime source: license-problem-json-evil ThirdPartyNotices.txt
diff --git a/debian/tests/build b/debian/tests/build
new file mode 100644
index 0000000..17a2315
--- /dev/null
+++ b/debian/tests/build
@@ -0,0 +1,31 @@
+#!/bin/sh
+# autopkgtest check: Build and run a program against libonnxruntime, to verify that
+# the headers and pkg-config file are installed correctly
+
+set -e
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
+cat <<EOF > libonnxruntime_test.c
+#include <onnxruntime_c_api.h>
+#include <stdio.h>
+
+int main(void)
+{
+ printf("%s\n", OrtGetApiBase()->GetVersionString());
+ return 0;
+}
+EOF
+
+# deliberately word-splitting pkg-config output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -o libonnxruntime_test libonnxruntime_test.c \
+$("${CROSS_COMPILE}pkg-config" --cflags --libs libonnxruntime)
+echo "build: OK"
+[ -x libonnxruntime_test ]
+./libonnxruntime_test
+echo "run: OK"
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..759ff82
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: build
+Depends: build-essential, pkgconf, libonnxruntime-dev
+Restrictions: superficial
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..b702ac5
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+version=4
+opts="repacksuffix=+dfsg,dversionmangle=s/\+dfsg//g,\
+ filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE at -$1.tar.gz%" \
+ https://github.com/microsoft/onnxruntime/tags (?:.*?/)?v?(\d[\d.]*)\.tar\.gz
More information about the Neon-commits
mailing list