%global _hardened_build 1 %define relver 2019-08-07T01-59-21Z %define commit 930943f058f01f37cfbc2265d5f80ea7026ec55d %global shortcommit %(c=%{commit}; echo ${c:0:7}) %define minio_user minio %define minio_group minio %define minio_home /var/lib/minio Name: minio Version: 20190807 Release: 1%{?dist} Summary: bla Group: bla License: GPLv3 Source0: minio.service URL: https://min.io/ BuildRequires: golang %description A high performance, distributed object storage server, designed for large-scale data infrastructure. It is an ideal S3-compatible replacement for Hadoop HDFS for machine learning and other big data workloads. %prep %setup -q -T -c %{name}-%{version} export GOPATH=`pwd` mkdir -p src/github.com/minio/ cd src/github.com/minio/ git clone https://github.com/minio/minio/ %build export GOPATH=`pwd` export GO111MODULE=on cd src/github.com/minio/minio/ git checkout tags/RELEASE.%{relver} #%ifarch ppc64 #sed 's/ppc64le/ppc64/' -i buildscripts/checkdeps.sh #%endif #make go mod download export BUILD_LDFLAGS="-s -w -X github.com/minio/minio/cmd.Version=%{relver} -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.%{relver} -X github.com/minio/minio/cmd.CommitID=%{commit} -X github.com/minio/minio/cmd.ShortCommitID=%{shortcommit} -X github.com/minio/minio/cmd.GOPATH= -X github.com/minio/minio/cmd.GOROOT=" GOPROXY=https://proxy.golang.org GO111MODULE=on GOFLAGS="" CGO_ENABLED=0 go build -tags kqueue --ldflags "$BUILD_LDFLAGS" -o minio %install install -p -D -m 0555 src/github.com/minio/minio/minio %{buildroot}%{_bindir}/minio install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/minio.service %pre getent group %{minio_group} > /dev/null || groupadd -r %{minio_group} getent passwd %{minio_user} > /dev/null || \ useradd -r -d %{minio_home} -g %{minio_group} \ -s /bin/bash -c "Minio user" %{minio_user} exit 0 %post %systemd_post minio.service %preun %systemd_preun minio.service %postun %systemd_postun minio.service %files %{_bindir}/%{name} %{_unitdir}/%{name}.service %changelog