From 25fa645184d5f9871bee9a234e931ad054b864e3 Mon Sep 17 00:00:00 2001 From: zhangwenlong Date: Thu, 24 Jul 2025 11:39:09 +0800 Subject: [PATCH] add rustfs.spec for rustfs (#103) add support on loongarch64 --- build-rustfs.sh | 5 ++++- rustfs.spec | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 rustfs.spec diff --git a/build-rustfs.sh b/build-rustfs.sh index 0a024449..e73dd7a2 100755 --- a/build-rustfs.sh +++ b/build-rustfs.sh @@ -30,6 +30,9 @@ detect_platform() { "armv7l") echo "armv7-unknown-linux-gnueabihf" ;; + "loongarch64") + echo "loongarch64-unknown-linux-musl" + ;; *) echo "unknown-platform" ;; @@ -397,7 +400,7 @@ build_binary() { fi else # Native compilation - build_cmd="cargo build" + build_cmd="RUSTFLAGS=-Clink-arg=-lm cargo build" fi if [ "$BUILD_TYPE" = "release" ]; then diff --git a/rustfs.spec b/rustfs.spec new file mode 100644 index 00000000..33bca9e3 --- /dev/null +++ b/rustfs.spec @@ -0,0 +1,58 @@ +%global _enable_debug_packages 0 +%global _empty_manifest_terminate_build 0 +Name: rustfs +Version: 1.0.0 +Release: alpha.36%{?dist} +Summary: High-performance distributed object storage for MinIO alternative + +License: Apache-2.0 +URL: https://github.com/rustfs/rustfs +Source0: https://github.com/rustfs/rustfs/archive/refs/tags/%{version}.tar.gz + +BuildRequires: cargo +BuildRequires: rust +BuildRequires: mold +BuildRequires: pango-devel +BuildRequires: cairo-devel +BuildRequires: cairo-gobject-devel +BuildRequires: gdk-pixbuf2-devel +BuildRequires: atk-devel +BuildRequires: gtk3-devel +BuildRequires: libsoup-devel +BuildRequires: cmake +BuildRequires: clang-devel +BuildRequires: webkit2gtk4.1-devel >= 2.40 + +%description +RustFS is a high-performance distributed object storage software built using Rust, one of the most popular languages worldwide. Along with MinIO, it shares a range of advantages such as simplicity, S3 compatibility, open-source nature, support for data lakes, AI, and big data. Furthermore, it has a better and more user-friendly open-source license in comparison to other storage systems, being constructed under the Apache license. As Rust serves as its foundation, RustFS provides faster speed and safer distributed features for high-performance object storage. + +%prep +%autosetup -n %{name}-%{version}-%{release} + +%build +# Set the target directory according to the schema +export CMAKE=$(which cmake3) +%ifarch x86_64 || aarch64 || loongarch64 + TARGET_DIR="target/%_arch" + PLATFORM=%_arch-unknown-linux-musl +%else + TARGET_DIR="target/unknown" + PLATFORM=unknown-platform +%endif + +# Set CARGO_TARGET_DIR and build the project +#CARGO_TARGET_DIR=$TARGET_DIR RUSTFLAGS="-C link-arg=-fuse-ld=mold" cargo build --release --package rustfs +CARGO_TARGET_DIR=$TARGET_DIR RUSTFLAGS="-C link-arg=-fuse-ld=mold" cargo build --release --target $PLATFORM -p rustfs --bins + +%install +mkdir -p %buildroot/usr/bin/ +install %_builddir/%{name}-%{version}-%{release}/target/%_arch/$PLATFORM/release/rustfs %buildroot/usr/bin/ + +%files +%license LICENSE +%doc docs +%_bindir/rustfs + +%changelog +* Tue Jul 08 2025 Wenlong Zhang +- Initial RPM package for RustFS 1.0.0-alpha.36