Prepare build system to produce RPMs
Add .spec file under extras/rpms and create targets to produce source and binary rpms
This commit is contained in:
parent
e7b1c0c38c
commit
1c187c5729
6 changed files with 135 additions and 7 deletions
35
extras/rpm/Makefile.in
Normal file
35
extras/rpm/Makefile.in
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
TARBALL=$(shell realpath ../../build-root/clixon-latest.tar.xz)
|
||||
BASENAME=$(shell basename $(TARBALL) | sed -e s/.tar.\*//)
|
||||
VERSION=$(shell echo $(BASENAME) | cut -f2 -d-)
|
||||
RELEASE=$(shell echo $(BASENAME) | cut -f3- -d- | sed -e s/-/_/g)
|
||||
BR=$(shell realpath $(CURDIR)/../../build-root)
|
||||
RPMBUILD=$(BR)/rpmbuild
|
||||
|
||||
all: RPM
|
||||
|
||||
spec:
|
||||
@echo $(TARBALL)
|
||||
mkdir -p $(RPMBUILD)/{RPMS,SRPMS,BUILD,SOURCES,SPECS}
|
||||
cp $(TARBALL) $(RPMBUILD)/SOURCES/clixon-$(VERSION)-$(RELEASE).tar.xz
|
||||
cp clixon.spec $(RPMBUILD)/SPECS
|
||||
|
||||
srpm: spec
|
||||
rpmbuild -bs \
|
||||
--define "cligen_prefix @CLIGEN_PREFIX@" \
|
||||
--define "_topdir $(RPMBUILD)" \
|
||||
--define "_version $(VERSION)" \
|
||||
--define "_release $(RELEASE)" \
|
||||
$(RPMBUILD)/SPECS/clixon.spec
|
||||
mv $$(find $(RPMBUILD)/SRPMS -name \*.src.rpm -type f) $(BR)
|
||||
|
||||
# Define DEVELOPER environmrnt variable to prevent .spec to add cligent to the
|
||||
# list of build requirements
|
||||
RPM: spec
|
||||
rpmbuild -bb \
|
||||
--define "cligen_prefix @CLIGEN_PREFIX@" \
|
||||
$${DEVELOPER:+--define "developer yes"} \
|
||||
--define "_topdir $(RPMBUILD)" \
|
||||
--define "_version $(VERSION)" \
|
||||
--define "_release $(RELEASE)" \
|
||||
$(RPMBUILD)/SPECS/clixon.spec
|
||||
mv $$(find $(RPMBUILD)/RPMS -name \*.rpm -type f) $(BR)
|
||||
72
extras/rpm/clixon.spec
Normal file
72
extras/rpm/clixon.spec
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
%{!?_topdir: %define _topdir %(pwd)}
|
||||
%{!?cligen_prefix: %define cligen_prefix %{_prefix}}
|
||||
|
||||
Name: clixon
|
||||
Version: %{_version}
|
||||
Release: %{_release}
|
||||
Summary: The XML-based command line processing tool CLIXON
|
||||
Group: System Environment/Libraries
|
||||
License: ASL 2.0 or GPLv2
|
||||
URL: http://www.clicon.org
|
||||
AutoReq: no
|
||||
BuildRequires: flex, bison
|
||||
Requires: cligen, fcgi
|
||||
|
||||
# Sometimes developers want to build it without installing cligen but passing
|
||||
# path using --with-cligen and pointing it to cligen buildroot. Use %{developer}
|
||||
# macro for these cases
|
||||
%if 0%{!?developer:1}
|
||||
BuildRequires: cligen
|
||||
%endif
|
||||
|
||||
Source: %{name}-%{version}-%{release}.tar.xz
|
||||
|
||||
%description
|
||||
The XML-based command line processing tool CLIXON.
|
||||
|
||||
%package devel
|
||||
Summary: CLIXON header files
|
||||
Group: Development/Libraries
|
||||
Requires: clixon
|
||||
|
||||
%description devel
|
||||
This package contains header files for CLIXON.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
%configure --with-cligen=%{cligen_prefix} --without-keyvalue
|
||||
make
|
||||
|
||||
%install
|
||||
make DESTDIR=${RPM_BUILD_ROOT} install install-include
|
||||
|
||||
%files
|
||||
%{_libdir}/*
|
||||
%{_bindir}/*
|
||||
%{_sbindir}/*
|
||||
#%{_sysconfdir}/*
|
||||
%{_datadir}/%{name}/*
|
||||
/www-data/clixon_restconf
|
||||
|
||||
%files devel
|
||||
%{_includedir}/%{name}/*
|
||||
|
||||
%clean
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
|
||||
caps="cap_setuid,cap_fowner,cap_chown,cap_dac_override"
|
||||
caps="${caps},cap_kill,cap_net_admin,cap_net_bind_service"
|
||||
caps="${caps},cap_net_broadcast,cap_net_raw"
|
||||
|
||||
if [ -x /usr/sbin/setcap ]; then
|
||||
/usr/sbin/setcap ${caps}=ep %{_bindir}/clixon_cli
|
||||
/usr/sbin/setcap ${caps}=ep %{_bindir}/clixon_netconf
|
||||
/usr/sbin/setcap ${caps}=ep %{_sbindir}/clixon_backend
|
||||
fi
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
Loading…
Add table
Add a link
Reference in a new issue