diff --git a/mingw-w64-rustfs/PKGBUILD b/mingw-w64-rustfs/PKGBUILD new file mode 100644 index 0000000000..c70afa8b0e --- /dev/null +++ b/mingw-w64-rustfs/PKGBUILD @@ -0,0 +1,69 @@ +# Maintainer: Konstantin Podsvirov + +_realname=rustfs +pkgbase=mingw-w64-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +_pkgver=1.0.0-alpha.76 +pkgver=${_pkgver//-/_} +_consolever=0.0.12 +pkgrel=1 +pkgdesc="High-performance, memory-safe distributed object storage (mingw-w64)" +arch=('any') +mingw_arch=('clang64' 'clangarm64') +url='https://rustfs.com/' +msys2_repository_url='https://github.com/rustfs' +license=('spdx:Apache-2.0') +makedepends=( + "${MINGW_PACKAGE_PREFIX}-rust" + "${MINGW_PACKAGE_PREFIX}-cc" + "${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-ninja" + "${MINGW_PACKAGE_PREFIX}-pkgconf" + "${MINGW_PACKAGE_PREFIX}-openssl" + "${MINGW_PACKAGE_PREFIX}-flatbuffers" + "${MINGW_PACKAGE_PREFIX}-protobuf" + 'git' + 'unzip' +) +source=( + "${msys2_repository_url}/rustfs/archive/${_pkgver}/rustfs-${_pkgver}.tar.gz" + "${msys2_repository_url}/console/releases/download/v${_consolever}/rustfs-console-v${_consolever}.zip" +) +noextract=("rustfs-console-v${_consolever}.zip") +sha256sums=('0cf3c075b8165608d972f6b5139c7dd48f3e4c6ca364fff8c91812cfa1072a3c' + '80daffe86d6d94736bfed13970b09f788bf691add1c8f53896ed7898d9f8451f') + +prepare() { + cd "${srcdir}/${_realname}-${_pkgver}" + + unzip -o "${srcdir}/rustfs-console-v${_consolever}.zip" -d rustfs/static + + export RUSTUP_TOOLCHAIN=stable-${RUST_CHOST} + + rm rust-toolchain.toml + + cargo fetch \ + --locked \ + --config='net.git-fetch-with-cli=true' \ + --target "${RUST_CHOST}" +} + +build() { + cd "${_realname}-${_pkgver}" + + export RUSTUP_TOOLCHAIN=stable-${RUST_CHOST} + + # Generate protobuf/flatbuffers code (uses protoc/flatc from distro) + cargo run --release --frozen --bin gproto + + # Build RustFS + cargo build --release --frozen -p rustfs --bins +} + +package() { + cd "${srcdir}/${_realname}-${_pkgver}" + + install -Dm755 target/release/rustfs.exe -t "${pkgdir}${MINGW_PREFIX}/bin/" + + install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" +}