File magika.spec of Package magika
#
# spec file for package magika
#
# Copyright (c) 2024, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: magika
Version: 0.1.0rc2
Release: 0
Summary: AI powered file type detection tool
License: GPL-3.0-or-later
Group: Development/Tools/Version Control
URL: https://google.github.io/magika/
#Git-Clone: https://github.com/google/magika.git
Source: %{name}-%{version}.tar.gz
Source1: vendor.tar.zst
Source2: https://parcel.pyke.io/v2/delivery/ortrs/packages/msort-binary/1.20.0/ortrs_static-v1.20.0-x86_64-unknown-linux-gnu.tgz
BuildRequires: cargo-packaging
ExclusiveArch: %{rust_tier1_arches}
%description
Magika is a AI powered file type detection tool that relies on the
recent advance of deep learning to provide accurate detection.
%prep
%autosetup -a 1
tar xxvf %{SOURCE2}
%build
# needs Open Neural Network Exchange (ONNX) Runtime (via rust ort)
# https://github.com/google/magika/issues/824
# https://github.com/Microsoft/onnxruntime
# https://github.com/pykeio/ort
# https://github.com/pykeio/ort/blob/main/ort-sys/build.rs
ls -la onnxruntime/lib/
ls -la .cargo/config.toml
###################################################
cat >> .cargo/config.toml <<EOF
[env]
ORT_LIB_LOCATION = "$PWD/onnxruntime/lib/"
EOF
###################################################
cd rust/cli/
%{cargo_build}
%install
#%%{cargo_install}
%check
#%%{cargo_test}
%files
%license LICENSE.txt
%doc README.md
%{_bindir}/magika
%changelog