File conmon.spec of Package conmon

%define realname conmon
%define srcext   tar.bz2

# Common info
Name:          %{realname}
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         System/Management
URL:           https://github.com/containers/conmon
Summary:       An OCI container runtime monitor

# Build-time parameters
BuildRequires: meson >= 0.46 ninja
BuildRequires: pkg-config
BuildRequires: pkgconfig(glib-2.0)
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}.%{srcext}

%description
Conmon is a monitoring program and communication tool between a container
manager (like podman or CRI-O) and an OCI runtime (like runc or crun) for
a single container.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}

# Build step (compile/build binaries, documentation, etc)
%build
export LC_ALL=en_US.UTF-8
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--strip-all -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
meson setup build \
 --buildtype=release \
 --strip \
 --optimization=2 \
 \
 --prefix=%{_prefix} \
 --libexecdir=%{_libexecdir} \
 \
 -Db_lto=%{?gcc_lto:true}%{!?gcc_lto:false} \
 -Db_ndebug=if-release \
 -Dc_args="$_CFLAGS" \
 -Dc_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}

# Install built stuff
%install
DESTDIR=%{buildroot} ninja -v -C build install

# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

# Files list for the main package
%files
%defattr(-,root,root)
%doc LICENSE README.md
%dir %{_libexecdir}/podman
%{_libexecdir}/podman/conmon

%changelog
openSUSE Build Service is sponsored by