File numactl.spec of Package numactl

%define realname numactl
%define realver  2.0.12
%define srcext   tar.gz

%define so_ver   1

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       GPL-2.0
Group:         System/Management
Summary:       Program to control NUMA policy for processes or shared memory

# Build-time parameters
BuildRequires: pkg-config
BuildRoot:     %{_tmppath}/%{name}-root

numactl runs processes with a specific NUMA scheduling or memory
placement policy. The policy is set for command and inherited by all
of its children. In addition it can set persistent policy for shared
memory segments or files.

%package -n %{?suse_version:libnuma%{?so_ver}}%{!?suse_version:numactl-libs}
License:       LGPL-2.1
Group:         System/Libraries
Summary:       NUMA policy library

%description -n %{?suse_version:libnuma%{?so_ver}}%{!?suse_version:numactl-libs}
The libnuma library offers a simple programming interface to the
NUMA (Non Uniform Memory Access) policy supported by the Linux kernel.

The libnuma library provides convenient ways for you to add NUMA memory policies
into your own program.

%package -n %{?suse_version:lib}numa%{!?suse_version:ctl}-devel
License:       LGPL-2.1
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{?suse_version:libnuma%{?so_ver}}%{!?suse_version:numactl-libs} = %{version}-%{release}
Provides:      %{!?suse_version:lib}numa-devel

%description -n %{?suse_version:lib}numa%{!?suse_version:ctl}-devel
Development files for %{name}

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

%configure \
 --disable-static \
 CFLAGS="%{optflags}" \
 CXXFLAGS="%{optflags}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,-z,now -Wl,-z,relro"
%{__make} %{?_smp_mflags}

%{__make} install DESTDIR=%{buildroot}

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

%doc %{_mandir}/man8/*

%files -n %{?suse_version:libnuma%{?so_ver}}%{!?suse_version:numactl-libs}

# Development stuff
%files -n %{?suse_version:lib}numa%{!?suse_version:ctl}-devel
%exclude %{_libdir}/*.la
%doc %{_mandir}/man2/*
%doc %{_mandir}/man3/*

%post   -n %{?suse_version:libnuma%{?so_ver}}%{!?suse_version:numactl-libs} -p /sbin/ldconfig
%postun -n %{?suse_version:libnuma%{?so_ver}}%{!?suse_version:numactl-libs} -p /sbin/ldconfig