Rewrite optional builds with bcond rules

This commit is contained in:
Andrey Bondrov 2015-02-02 22:03:13 +10:00
parent 112ac7b55c
commit 4a343a4e9b

View file

@ -45,44 +45,29 @@
%define lib_ui_gtk3_name %mklibname %{ui_gtk3_name}_ %{ui_gtk3_major}
%define develnameui_gtk3 %mklibname %{ui_gtk3_name} -d
%define build_mono 1
%{?_with_mono: %{expand: %%global build_mono 1}}
%{?_without_mono: %{expand: %%global build_mono 0}}
%{?build_mono}%{?!build_mono:%bcond_without mono}
%{?build_qt3}%{?!build_qt3:%bcond_with qt3}
%{?build_qt4}%{?!build_qt4:%bcond_without qt4}
%{?build_gtk3}%{?!build_gtk3:%bcond_without gtk3}
%{?build_systemd}%{?!build_systemd:%bcond_without systemd}
%ifarch %{arm} %{mips} aarch64
%define build_mono 0
%bcond_with mono
%endif
%define build_qt3 0
%{?_with_qt3: %{expand: %%global build_qt3 1}}
%{?_without_qt3: %{expand: %%global build_qt3 0}}
%define build_qt4 1
%{?_with_qt4: %{expand: %%global build_qt4 1}}
%{?_without_qt4: %{expand: %%global build_qt4 0}}
%define build_gtk3 1
%{?_with_gtk3: %{expand: %%global build_gtk3 1}}
%{?_without_gtk3: %{expand: %%global build_gtk3 0}}
%define build_systemd 1
%{?_with_systemd: %{expand: %%global build_systemd 1}}
%{?_without_systemd: %{expand: %%global build_systemd 0}}
%define build_bootstrap 0
%{?_with_bootstrap: %{expand: %%global build_bootstrap 1}}
%if %{build_bootstrap}
%define build_mono 0
%define build_qt3 0
%define build_qt4 0
%define build_gtk3 0
%define build_systemd 0
%bcond_with mono
%bcond_with qt3
%bcond_with qt4
%bcond_with gtk3
%bcond_with systemd
%endif
Summary: Avahi service discovery (mDNS/DNS-SD) suite
Name: avahi
Version: 0.6.31
Release: 16
Release: 17
License: LGPLv2+
Group: System/Servers
Url: http://avahi.org/
@ -100,16 +85,16 @@ BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dbus-python)
BuildRequires: pkgconfig(libdaemon)
BuildRequires: pkgconfig(libglade-2.0)
%if %{build_qt3}
%if %{with qt3}
BuildRequires: pkgconfig(qt-mt)
%endif
%if %{build_qt4}
%if %{with qt4}
BuildRequires: pkgconfig(QtCore)
%endif
%if %{build_gtk3}
%if %{with gtk3}
BuildRequires: pkgconfig(gtk+-3.0)
%endif
%if %{build_systemd}
%if %{with systemd}
BuildRequires: systemd-units
%endif
@ -137,7 +122,7 @@ of technology is already found in MacOS X (branded 'Rendezvous',
%config(noreplace) %{_sysconfdir}/%{name}/%{name}-daemon.conf
%config(noreplace) %{_sysconfdir}/%{name}/avahi-autoipd.action
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/%{name}-dbus.conf
%if !%{build_systemd}
%if %{without systemd}
%{_initrddir}/%{name}-daemon
%endif
%attr(0755,avahi,avahi) %dir %{_localstatedir}/avahi
@ -172,7 +157,7 @@ of technology is already found in MacOS X (branded 'Rendezvous',
%{_mandir}/man8/avahi-autoipd*
%dir %{_libdir}/avahi
%{_libdir}/avahi/service-types.db
%if %{build_systemd}
%if %{with systemd}
%{_unitdir}/avahi-daemon.service
%{_unitdir}/avahi-daemon.socket
%{_datadir}/dbus-1/system-services/org.freedesktop.Avahi.service
@ -208,7 +193,7 @@ Especially useful on IPv6.
%files dnsconfd
%{_sysconfdir}/%{name}/%{name}-dnsconfd.action
%if !%{build_systemd}
%if %{without systemd}
%{_initrddir}/%{name}-dnsconfd
%else
%{_unitdir}/avahi-dnsconfd.service
@ -272,7 +257,7 @@ It includes avahi-bookmarks and avahi-discover.
#----------------------------------------------------------------------------
%if %{build_mono}
%if %{with mono}
%package sharp
Summary: Mono bindings for Avahi
Group: System/Libraries
@ -299,7 +284,7 @@ Mono bindings for Avahi.
#----------------------------------------------------------------------------
%if %{build_mono}
%if %{with mono}
%package sharp-doc
Summary: Development documentation for avahi-sharp
Group: Development/Other
@ -524,7 +509,7 @@ Avahi devel compatibility library for libdns_sd for howl.
#----------------------------------------------------------------------------
%if %{build_qt3}
%if %{with qt3}
%package -n %{lib_qt3_name}
Summary: Library for avahi-qt3
Group: System/Libraries
@ -540,7 +525,7 @@ Library for avahi-qt3.
#----------------------------------------------------------------------------
%if %{build_qt3}
%if %{with qt3}
%package -n %{develnameqt3}
Summary: Devel library for avahi-qt3
Group: Development/C
@ -558,7 +543,7 @@ Devel library for avahi-qt3.
#----------------------------------------------------------------------------
%if %{build_qt4}
%if %{with qt4}
%package -n %{lib_qt4_name}
Summary: Library for avahi-qt4
Group: System/Libraries
@ -572,7 +557,7 @@ Library for avahi-qt4.
#----------------------------------------------------------------------------
%if %{build_qt4}
%if %{with qt4}
%package -n %{develnameqt4}
Summary: Devel library for avahi-qt4
Group: Development/C
@ -619,7 +604,7 @@ Devel library for avahi-ui.
#----------------------------------------------------------------------------
%if %{build_gtk3}
%if %{with gtk3}
%package -n %{lib_ui_gtk3_name}
Summary: Library for avahi-gtk3
Group: System/Libraries
@ -633,7 +618,7 @@ Library for avahi-gtk3.
#----------------------------------------------------------------------------
%if %{build_gtk3}
%if %{with gtk3}
%package -n %{develnameui_gtk3}
Summary: Devel library for avahi-gtk3
Group: Development/C
@ -667,13 +652,13 @@ autoconf
export PKG_CONFIG_PATH=/usr/lib/qt4/%{_lib}/pkgconfig
%configure2_5x \
--disable-static \
%if !%{build_mono}
%if %{without mono}
--disable-mono \
%endif
%if !%{build_qt3}
%if %{without qt3}
--disable-qt3 \
%endif
%if !%{build_qt4}
%if %{without qt4}
--disable-qt4 \
%endif
--localstatedir=/run \
@ -681,10 +666,10 @@ export PKG_CONFIG_PATH=/usr/lib/qt4/%{_lib}/pkgconfig
--enable-compat-libdns_sd \
--enable-compat-howl \
--enable-introspection=no \
%if %{build_systemd}
%if %{with systemd}
--with-systemdsystemunitdir=%{_unitdir} \
%endif
%if !%{build_gtk3}
%if %{without gtk3}
--disable-gtk3
%endif
@ -697,7 +682,7 @@ mkdir -p %{buildroot}%{_localstatedir}/avahi
rm -f %{buildroot}/%{_sysconfdir}/%{name}/services/ssh.service
ln -s avahi-compat-howl.pc %{buildroot}%{_libdir}/pkgconfig/howl.pc
%if "%{_lib}" != "lib" && %{build_mono}
%if "%{_lib}" != "lib" && %{with mono}
mkdir -p %{buildroot}%{_prefix}/lib
mv %{buildroot}%{_libdir}/mono %{buildroot}%{_prefix}/lib
perl -pi -e "s/%{_lib}/lib/" %{buildroot}%{_libdir}/pkgconfig/avahi-{,ui-}sharp.pc
@ -707,7 +692,7 @@ perl -pi -e "s/%{_lib}/lib/" %{buildroot}%{_libdir}/pkgconfig/avahi-{,ui-}sharp.
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/hostname.d/
install -m755 avahi-hostname.sh %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/hostname.d/avahi
%if %{build_systemd}
%if %{with systemd}
rm -rf %{buildroot}%{_initrddir}/%{name}-daemon
rm -rf %{buildroot}%{_initrddir}/%{name}-dnsconfd
%endif