File dnsmasq.spec of Package dnsmasq
#
# spec file for package dnsmasq
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: dnsmasq
Version: 2.90
Release: 0
License: GPL-2.0 or GPL-3.0
Summary: Lightweight, Easy-to-Configure DNS Forwarder and DHCP Server
URL: http://www.thekelleys.org.uk/dnsmasq/
Source1: %name.changes
Source2: dnsmasq.service
#
%global _buildshell /bin/bash
#
BuildRequires: pkg-config
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libidn)
BuildRequires: pkgconfig(lua)
BuildRequires: pkgconfig(nettle)
BuildRequires: pkgconfig(hogweed)
BuildRequires: pkgconfig(libidn2)
BuildRequires: pkgconfig(libnftables)
BuildRequires: pkgconfig(libnetfilter_conntrack)
BuildRequires: systemd
BuildRequires: sysuser-tools
%?systemd_requires
#
Requires(pre): system-user-%name = %version-%release
Provides: %name-olh = %name-%version
%description
%package -n system-user-%name
Summary: System user %name
Requires(pre): group(tftp)
%?sysusers_requires
%description -n system-user-%name
System user %name
%prep
rm -rf %_builddir/%name-%version
mv %_sourcedir/%name-%version %_builddir/%name-%version
%setup -c -T -D
%build
echo '%version' > VERSION
%install
cat > dnsmasq.conf <<'__EOF__'
conf-dir=%_sysconfdir/dnsmasq.d/,*.conf
conf-dir=%_rundir/dnsmasq/,*.conf
__EOF__
COPTS=()
pkg-config --modversion 'dbus-1' && COPTS+=('-DHAVE_DBUS')
pkg-config --modversion 'libidn' && COPTS+=('-DHAVE_IDN')
pkg-config --modversion 'libidn2' && COPTS+=('-DHAVE_LIBIDN2')
pkg-config --modversion 'libnetfilter_conntrack' && COPTS+=('-DHAVE_CONNTRACK')
pkg-config --modversion 'lua' && COPTS+=('-DHAVE_LUASCRIPT')
pkg-config --modversion 'nettle hogweed' && COPTS+=('-DHAVE_DNSSEC')
pkg-config --modversion 'libnftables' && COPTS+=('-DHAVE_NFTSET')
cp -avLt . \
%SOURCE2 \
%nil
mv po/no.po po/nb.po
%make_build \
--no-print-directory \
install \
COPTS="${COPTS[*]}" \
CFLAGS='%optflags -std=gnu99' \
DESTDIR=%buildroot \
PREFIX=%_prefix \
AWK=gawk \
%nil
rm -rfv %buildroot%_mandir/??
mkdir -vp %buildroot%_sysconfdir/dnsmasq.d
#
install -m 444 -D dnsmasq.service %buildroot%_unitdir/%name.service
#
install -m 444 -D trust-anchors.conf %buildroot%_sysconfdir/dnsmasq.d/trust-anchors.conf
install -m 444 -D dnsmasq.conf %buildroot%_sysconfdir/%name.conf
#
install -m 444 -D dbus/dnsmasq.conf %buildroot%_datadir/dbus-1/system.d/%name.conf
#
suc='system-user-%name.conf'
tee "${suc}" <<'_EOC_'
u %name - "upstream %name" /var/lib/empty /bin/bash
m %name tftp
_EOC_
mkdir -p '%buildroot%_sysusersdir'
cp -avLt "$_" "${suc}"
%sysusers_generate_pre "${suc}" system-user-%name
%pre -n system-user-%name -f system-user-%name.pre
%files -n system-user-%name
%_sysusersdir/*.conf
%pre
%service_add_pre %name.service
%post
%service_add_post %name.service
%preun
%service_del_preun %name.service
%postun
%service_del_postun_without_restart %name.service
%files
%doc CHANGELOG FAQ doc.html setup.html dnsmasq.conf.example
%license COPYING
%config(noreplace) %_sysconfdir/%name.conf
%config(noreplace) %_sysconfdir/dnsmasq.d
%config %_unitdir/*
%_sbindir/*
%config %_datadir/dbus-1/system.d/*
%_mandir/man8/dnsmasq.8.gz