mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-10 05:37:25 +00:00
scoutfs-utils: add rpm build make dist helpers
Add make targets to build a spec file and tarball with a version based on a git tag. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
2
utils/.gitignore
vendored
2
utils/.gitignore
vendored
@@ -5,3 +5,5 @@ src/scoutfs
|
||||
.sparse*
|
||||
.mock.build*
|
||||
cscope.*
|
||||
scoutfs-utils.spec
|
||||
scoutfs-utils-*.tar
|
||||
|
||||
@@ -33,6 +33,22 @@ $(BIN): $(OBJ)
|
||||
$(QU) [SP $<]
|
||||
$(VE)./sparse.sh -Wbitwise -D__CHECKER__ $(CFLAGS) $<
|
||||
|
||||
.PHONY: clean
|
||||
.PHONY: .FORCE
|
||||
|
||||
# - We use the git describe from tags to set up the RPM versioning
|
||||
RPM_VERSION := $(shell git describe --long --tags | awk -F '-' '{gsub(/^v/,""); print $$1}')
|
||||
RPM_GITHASH := $(shell git rev-parse --short HEAD)
|
||||
|
||||
%.spec: %.spec.in .FORCE
|
||||
sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' \
|
||||
-e 's/@@GITHASH@@/$(RPM_GITHASH)/g' < $< > $@+
|
||||
mv $@+ $@
|
||||
|
||||
TARFILE = scoutfs-utils-$(RPM_VERSION).tar
|
||||
|
||||
dist: $(RPM_DIR) scoutfs-utils.spec
|
||||
git archive --format=tar --prefix scoutfs-utils-$(RPM_VERSION)/ HEAD^{tree} > $(TARFILE)
|
||||
@ tar rf $(TARFILE) --transform="s@\(.*\)@scoutfs-utils-$(RPM_VERSION)/\1@" scoutfs-utils.spec
|
||||
|
||||
clean:
|
||||
@rm -f $(BIN) $(OBJ) $(DEPS) .sparse.*
|
||||
|
||||
66
utils/scoutfs-utils.spec.in
Normal file
66
utils/scoutfs-utils.spec.in
Normal file
@@ -0,0 +1,66 @@
|
||||
%define pkg_version @@VERSION@@
|
||||
%define pkg_git_hash @@GITHASH@@
|
||||
%define pkg_date %(date +%%Y%%m%%d)
|
||||
|
||||
%{!?_release: %global _release 0.%{pkg_date}git%{pkg_git_hash}}
|
||||
|
||||
Name: scoutfs-utils
|
||||
Summary: scoutfs user space utilities
|
||||
Version: %{pkg_version}
|
||||
Release: %{_release}%{?dist}
|
||||
License: GPLv2
|
||||
Group: System Environment/Base
|
||||
URL: http://scoutfs.org/
|
||||
|
||||
BuildRequires: git
|
||||
BuildRequires: gzip
|
||||
BuildRequires: libuuid-devel
|
||||
BuildRequires: openssl-devel
|
||||
|
||||
#Requires: kmod-scoutfs = %{version}
|
||||
|
||||
Source: scoutfs-utils-%{pkg_version}.tar
|
||||
|
||||
# Disable the building of the debug package(s).
|
||||
%define debug_package %{nil}
|
||||
|
||||
%description
|
||||
scoutfs - user space utilities
|
||||
|
||||
%package -n scoutfs-devel
|
||||
Summary: scoutfs devel headers
|
||||
Version: %{pkg_version}
|
||||
Release: %{_release}%{?dist}
|
||||
License: GPLv2
|
||||
Group: Development/Libraries
|
||||
URL: http://scoutfs.org/
|
||||
|
||||
%description -n scoutfs-devel
|
||||
scoutfs - development headers
|
||||
|
||||
%prep
|
||||
%setup -q -n scoutfs-utils-%{pkg_version}
|
||||
|
||||
%build
|
||||
make
|
||||
gzip man/*.7
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man7
|
||||
cp man/*.7.gz $RPM_BUILD_ROOT%{_mandir}/man7/.
|
||||
install -m 755 -D src/scoutfs $RPM_BUILD_ROOT%{_sbindir}/scoutfs
|
||||
install -m 644 -D src/ioctl.h $RPM_BUILD_ROOT%{_includedir}/scoutfs/ioctl.h
|
||||
install -m 644 -D src/format.h $RPM_BUILD_ROOT%{_includedir}/scoutfs/format.h
|
||||
|
||||
%files
|
||||
%defattr(644,root,root,755)
|
||||
%{_mandir}/man7/scoutfs-corruption.7.gz
|
||||
%{_sbindir}/scoutfs
|
||||
|
||||
%files -n scoutfs-devel
|
||||
%defattr(644,root,root,755)
|
||||
%{_includedir}/scoutfs
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
Reference in New Issue
Block a user