MT#55283 RPM packaging: update for EL8/EL9

- add example mock chroots
- update for nftables, iptables deprecation in EL9
- ensure distro build flags are used %[set_build_flags}, especially
  -fPIE

closes #1753

Change-Id: I11ef5791885fc6129f528ad0425c679ee26e5a08
mr12.1
S-P Chan 1 year ago committed by Richard Fuchs
parent ecb70a24c5
commit 47740eb35c

@ -0,0 +1,35 @@
#! /bin/bash
# Sample build script to package RPM using mock
# Usage: el/build-with-mock.sh <package-version> <git-commit>
#
# el/build-with-mock.sh 12.1.0.0+0~mr12.1.0.0 master
set -e
if [[ -z $1 || -z $2 ]]; then
echo $0: Require package version and git commit
echo "Usage: build-with-mock.sh <version> <commit>"
exit 1
fi
RTPENGINE_VERSION=$1
GIT_COMMIT=$2
mkdir -p rpmbuild/{SOURCES,SPECS}
git archive --format=tar --prefix=ngcp-rtpengine-${RTPENGINE_VERSION}/ $2 | gzip -c > rpmbuild/SOURCES/ngcp-rtpengine-${RTPENGINE_VERSION}.tar.gz
sed /^Version/s"/^Version:.*/Version: ${RTPENGINE_VERSION}/" el/rtpengine.spec > rpmbuild/SPECS/rtpengine.spec
rm -f rpmbuild/SRPMS/*.src.rpm
rpmbuild --define "_topdir $PWD/rpmbuild" -bs rpmbuild/SPECS/rtpengine.spec
echo =======================================
echo "You may now build for EL8/EL9"
echo "EL8: mock -r el/rtpengine-8-x86_64.cfg $(ls rpmbuild/SRPMS/*.src.rpm)"
echo "EL9: mock -r el/rtpengine-9-x86_64.cfg $(ls rpmbuild/SRPMS/*.src.rpm)"
echo =======================================

@ -0,0 +1,35 @@
include('templates/almalinux-8.tpl')
include('templates/epel-8.tpl')
config_opts['dnf.conf'] += """
[rpmfusion-free-updates]
name=RPM Fusion for EL $releasever - Free - Updates
#baseurl=https://download1.rpmfusion.org/free/el/updates/$releasever/$basearch/
metalink=https://mirrors.rpmfusion.org/metalink?repo=free-el-updates-released-$releasever&arch=$basearch
enabled=1
[rpmfusion-nonfree-updates]
name=RPM Fusion for EL $releasever - Nonfree - Updates
#baseurl=https://download1.rpmfusion.org/nonfree/el/updates/$releasever/$basearch/
metalink=https://mirrors.rpmfusion.org/metalink?repo=nonfree-el-updates-released-$releasever&arch=$basearch
enabled=1
[copr:copr.fedorainfracloud.org:beaveryoga:broadvoice]
name=Copr repo for broadvoice owned by beaveryoga
baseurl=https://download.copr.fedorainfracloud.org/results/beaveryoga/broadvoice/epel-8-$basearch/
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/beaveryoga/broadvoice/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
"""
config_opts['chroot_additional_packages'] = "perl-interpreter libdb-devel gdbm-devel libuuid-devel speexdsp-devel"
config_opts['chroot_additional_packages'] += " spandsp3-devel perl-podlators pandoc"
config_opts['root'] = 'rtpengine-8-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)

@ -0,0 +1,36 @@
include('templates/almalinux-9.tpl')
include('templates/epel-9.tpl')
config_opts['dnf.conf'] += """
[rpmfusion-free-updates]
name=RPM Fusion for EL $releasever - Free - Updates
#baseurl=https://download1.rpmfusion.org/free/el/updates/$releasever/$basearch/
metalink=https://mirrors.rpmfusion.org/metalink?repo=free-el-updates-released-$releasever&arch=$basearch
enabled=1
[rpmfusion-nonfree-updates]
name=RPM Fusion for EL $releasever - Nonfree - Updates
baseurl=https://download1.rpmfusion.org/nonfree/el/updates/$releasever/$basearch/
#metalink=https://mirrors.rpmfusion.org/metalink?repo=nonfree-el-updates-released-$releasever&arch=$basearch
enabled=1
[copr:copr.fedorainfracloud.org:beaveryoga:broadvoice]
name=Copr repo for broadvoice owned by beaveryoga
baseurl=https://download.copr.fedorainfracloud.org/results/beaveryoga/broadvoice/epel-8-$basearch/
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/beaveryoga/broadvoice/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
"""
config_opts['chroot_additional_packages'] = "perl-interpreter libdb-devel gdbm-devel libuuid-devel speexdsp-devel"
config_opts['chroot_additional_packages'] += " spandsp3-devel perl-podlators pandoc"
config_opts['chroot_additional_packages'] += " gcc make autoconf automake gcc-c++ libtool"
config_opts['root'] = 'rtpengine-9-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)

@ -14,7 +14,7 @@ Conflicts: %{name}-kernel < %{version}-%{release}
BuildRequires: gcc make pkgconfig redhat-rpm-config
BuildRequires: glib2-devel libcurl-devel openssl-devel pcre-devel
BuildRequires: xmlrpc-c-devel zlib-devel hiredis-devel
BuildRequires: libpcap-devel libevent-devel json-glib-devel
BuildRequires: libpcap-devel libevent-devel json-glib-devel
BuildRequires: mosquitto-devel
BuildRequires: gperf perl-IPC-Cmd
BuildRequires: perl-podlators
@ -22,6 +22,12 @@ BuildRequires: pkgconfig(libwebsockets)
BuildRequires: pkgconfig(spandsp)
BuildRequires: pkgconfig(opus)
Requires(pre): shadow-utils
%if 0%{?rhel} >= 8
BuildRequires: pkgconfig(libmnl) pkgconfig(libnftnl) pandoc ncurses-devel
%endif
%if 0%{?rhel} >= 9
BuildRequires: pkgconfig(libiptc)
%endif
%if 0%{?with_transcoding} > 0
BuildRequires: ffmpeg-devel
@ -65,6 +71,13 @@ Requires(preun): dkms
%description dkms
%{summary}.
%package utils
Summary: Utilities and Perl modules for NGCP rtpengine
Requires: perl-interpreter
%description utils
%{summary}.
%if 0%{?rhel} >= 8
%define mysql_devel_pkg mariadb-devel
%else
@ -78,8 +91,8 @@ Group: System Environment/Daemons
BuildRequires: gcc make redhat-rpm-config %{mysql_devel_pkg} ffmpeg-devel
%description recording
The Sipwise rtpengine media proxy has support for exporting media (RTP) packets
that it forwards. The rtpengine-recording daemon collects these exported packets
The Sipwise rtpengine media proxy has support for exporting media (RTP) packets
that it forwards. The rtpengine-recording daemon collects these exported packets
and decodes them into an audio format that can be listened to.
%endif
@ -92,29 +105,28 @@ and decodes them into an audio format that can be listened to.
%build
# we don't run configure, so consume the default
# build flags set by the distro
%{set_build_flags}
echo ==== CFLAGS = $CFLAGS ====
echo ==== CXXFLAGS = $CXXFLAGS ====
echo ==== LDFLAGS = $LDFLAGS ====
%if 0%{?with_transcoding} > 0
cd daemon
RTPENGINE_VERSION="\"%{version}-%{release}\"" make
cd ../recording-daemon
RTPENGINE_VERSION="\"%{version}-%{release}\"" make
cd ..
RTPENGINE_VERSION="\"%{version}-%{release}\"" make all
%else
cd daemon
RTPENGINE_VERSION="\"%{version}-%{release}\"" make with_transcoding=no
cd ..
RTPENGINE_VERSION="\"%{version}-%{release}\"" make with_transcoding=no all
%endif
%install
# we don't run configure, so consume the default
# build flags set by the distro
%{set_build_flags}
echo ---- CFLAGS = $CFLAGS ----
echo ---- CXXFLAGS = $CXXFLAGS ----
echo ---- LDFLAGS = $LDFLAGS ----
# Install the userspace daemon
install -D -p -m755 daemon/%{binname} %{buildroot}%{_bindir}/%{binname}
# Install CLI (command line interface)
install -D -p -m755 utils/%{binname}-ctl %{buildroot}%{_bindir}/%{binname}-ctl
# Install helper
install -D -p -m755 utils/%{binname}-get-table %{buildroot}%{_sbindir}/%{binname}-get-table
# Install recording daemon
%if 0%{?with_transcoding} > 0
install -D -p -m755 recording-daemon/%{binname}-recording %{buildroot}%{_bindir}/%{binname}-recording
%endif
RTPENGINE_VERSION="\"%{version}-%{release}\"" make DESTDIR=%{buildroot} install
## Install the init.d script and configuration file
%if 0%{?has_systemd_dirs}
@ -163,6 +175,8 @@ install -D -p -m644 kernel-module/rtpengine_config.h \
%{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/rtpengine_config.h
install -D -p -m644 debian/ngcp-rtpengine-kernel-dkms.dkms %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/dkms.conf
sed -i -e "s/#MODULE_VERSION#/%{version}-%{release}/g" %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/dkms.conf
install -m755 -d %{buildroot}%{_datarootdir}/%{binname}-perftest
install -m444 fixtures/* %{buildroot}%{_datarootdir}/%{binname}-perftest
%pre
getent group %{name} >/dev/null || /usr/sbin/groupadd -r %{name}
@ -222,7 +236,6 @@ true
# CLI (command line interface)
%{_bindir}/%{binname}-ctl
# CLI table helper
%{_sbindir}/%{binname}-get-table
# init.d script and configuration file
%if 0%{?has_systemd_dirs}
%{_unitdir}/%{binname}.service
@ -236,15 +249,23 @@ true
%attr(0750,%{name},%{name}) %dir %{_var}/spool/%{binname}
# Documentation
%doc LICENSE README.md debian/changelog debian/copyright
%{_mandir}/man8/%{binname}.8*
%files kernel
/%{_lib}/xtables/libxt_RTPENGINE.so
%files dkms
%{_usrsrc}/%{name}-%{version}-%{release}/
%files utils
%{_bindir}/%{binname}-ctl
%{_bindir}/%{binname}-ng-client
%{_bindir}/%{binname}-perftest
%{_libexecdir}/%{binname}/%{binname}-get-table
%{_mandir}/man1/%{binname}-ctl.1*
%{_mandir}/man1/%{binname}-ng-client.1.*
%{_datarootdir}/%{binname}-perftest/*
%if 0%{?with_transcoding} > 0
%files recording
# Recording daemon
@ -261,6 +282,7 @@ true
%config(noreplace) %{_sysconfdir}/%{binname}/%{binname}-recording.conf
# recording directory
%attr(0750,%{name},%{name}) %dir %{_sharedstatedir}/%{binname}-recording
%{_mandir}/man8/%{binname}-recording.8*
%endif
%changelog
@ -272,10 +294,10 @@ true
- update to ngcp-rtpengine version 6.4.0.0
- add packet recording
* Thu Nov 24 2016 Marcel Weinberg <marcel@ng-voice.com>
- Updated to ngcp-rtpengine version 4.5.0 and CentOS 7.2
- Updated to ngcp-rtpengine version 4.5.0 and CentOS 7.2
- created a new variable "binname" to use rtpengine as name for the binaries
(still using ngcp-rtpenginge as name of the package and daemon - aligned to the .deb packages)
- fixed dependencies
- fixed dependencies
* Mon Nov 11 2013 Peter Dunkley <peter.dunkley@crocodilertc.net>
- Updated version to 2.3.2
- Set license to GPLv3

Loading…
Cancel
Save