%global udev_dir %{_prefix}/lib/udev
%global nmlibdir %{_prefix}/lib/%{name}
-%global with_adsl 1
-%global with_bluetooth 1
-%global with_team 1
-%global with_wifi 1
-%global with_wwan 1
-%global with_nmtui 1
-%global regen_docs 1
+%global _hardened_build 1
+
+%global git_sha_version %(test -n '%{git_sha}' && echo '.%{git_sha}')
+
+###############################################################################
+
+%bcond_without adsl
+
+%global default_with_bluetooth 1
+%global default_with_wwan 1
# ModemManager on Fedora < 20 too old for Bluetooth && wwan
%if (0%{?fedora} && 0%{?fedora} < 20)
-%global with_bluetooth 0
-%global with_wwan 0
+%global default_with_bluetooth 0
+%global default_with_wwan 0
%endif
# Bluetooth requires the WWAN plugin
-%if 0%{?with_bluetooth}
-%global with_wwan 1
+%if 0%{?default_with_bluetooth}
+%global default_with_wwan 1
+%endif
+
+%if 0%{?default_with_bluetooth}
+%bcond_without bluetooth
+%else
+%bcond_with bluetooth
+%endif
+
+%if 0%{?default_with_wwan}
+%bcond_without wwan
+%else
+%bcond_with wwan
%endif
%if (0%{?fedora} && 0%{?fedora} <= 19)
-%global with_team 0
+%bcond_with team
+%else
+%bcond_without team
%endif
-%if 0%{?with_bluetooth} || (0%{?with_wwan} && (0%{?rhel} || (0%{?fedora} && 0%{?fedora} > 19)))
+%bcond_without wifi
+
+%bcond_without nmtui
+%bcond_without regen_docs
+%bcond_with debug
+%bcond_without test
+
+###############################################################################
+
+%if %{with bluetooth} || (%{with wwan} && (0%{?rhel} || (0%{?fedora} && 0%{?fedora} > 19)))
%global with_modem_manager_1 1
%else
%global with_modem_manager_1 0
%endif
-%global _hardened_build 1
-
-%global git_sha_version %(test -n '%{git_sha}' && echo '.%{git_sha}')
+###############################################################################
Name: NetworkManager
Summary: Network connection manager and user applications
BuildRequires: dhclient
BuildRequires: readline-devel
BuildRequires: audit-libs-devel
-%if %{regen_docs}
+%if %{with regen_docs}
BuildRequires: gtk-doc
%endif
BuildRequires: libudev-devel
BuildRequires: libgudev1-devel >= 143
BuildRequires: vala-tools
BuildRequires: iptables
-%if 0%{?with_bluetooth}
+%if %{with bluetooth}
BuildRequires: bluez-libs-devel
%endif
BuildRequires: systemd >= 200-3 systemd-devel
%if 0%{?with_modem_manager_1}
BuildRequires: ModemManager-glib-devel >= 1.0
%endif
-%if 0%{?with_nmtui}
+%if %{with nmtui}
BuildRequires: newt-devel
%endif
BuildRequires: /usr/bin/dbus-launch
services.
-%if 0%{?with_adsl}
+%if %{with adsl}
%package adsl
Summary: ADSL device plugin for NetworkManager
Group: System Environment/Base
%endif
-%if 0%{?with_bluetooth}
+%if %{with bluetooth}
%package bluetooth
Summary: Bluetooth device plugin for NetworkManager
Group: System Environment/Base
%endif
-%if 0%{?with_team}
+%if 0%{with team}
%package team
Summary: Team device plugin for NetworkManager
Group: System Environment/Base
%endif
-%if 0%{?with_wifi}
+%if %{with wifi}
%package wifi
Summary: Wifi plugin for NetworkManager
Group: System Environment/Base
%endif
-%if 0%{?with_wwan}
+%if %{with wwan}
%package wwan
Summary: Mobile broadband device plugin for NetworkManager
Group: System Environment/Base
%build
-%if %{regen_docs}
+%if %{with regen_docs}
# back up pristine docs and use them instead of generated ones, which make
# multilib unhappy due to different timestamps in the generated content
cp -R docs ORIG-docs
--with-dhcpcd=no \
--with-crypto=nss \
--enable-more-warnings=error \
+%if %{with debug}
+ --with-more-logging \
+ --with-more-asserts=10000 \
+%endif
--enable-ppp=yes \
--with-libaudit=yes-disabled-by-default \
%if 0%{?with_modem_manager_1}
%else
--with-modem-manager-1=no \
%endif
-%if 0%{?with_wifi}
+%if %{with wifi}
--enable-wifi=yes \
%if 0%{?fedora}
--with-wext=yes \
--enable-wifi=no \
%endif
--enable-vala=yes \
-%if 0%{?regen_docs}
+%if %{with regen_docs}
--enable-gtk-doc \
%else
--disable-gtk-doc \
%endif
-%if 0%{?with_team}
+%if %{with team}
--enable-teamdctl=yes \
%else
--enable-teamdctl=no \
rm -f %{buildroot}%{_libdir}/pppd/%{ppp_version}/*.la
rm -f %{buildroot}%{_libdir}/NetworkManager/*.la
-%if %{regen_docs}
+%if %{with regen_docs}
# install the pristine docs
cp ORIG-docs/libnm-glib/html/* %{buildroot}%{_datadir}/gtk-doc/html/libnm-glib/
cp ORIG-docs/libnm-util/html/* %{buildroot}%{_datadir}/gtk-doc/html/libnm-util/
%check
+%if %{with test}
make check
+%endif
%post
%{_libexecdir}/nm-iface-helper
%dir %{_libdir}/NetworkManager
%{_libdir}/NetworkManager/libnm-settings-plugin*.so
-%if 0%{?with_nmtui}
+%if %{with nmtui}
%exclude %{_mandir}/man1/nmtui*
%endif
%dir %{_sysconfdir}/%{name}
%doc NEWS AUTHORS README CONTRIBUTING TODO
%license COPYING
-%if 0%{?with_adsl}
+%if %{with adsl}
%files adsl
%{_libdir}/%{name}/libnm-device-plugin-adsl.so
%else
%exclude %{_libdir}/%{name}/libnm-device-plugin-adsl.so
%endif
-%if 0%{?with_bluetooth}
+%if %{with bluetooth}
%files bluetooth
%{_libdir}/%{name}/libnm-device-plugin-bluetooth.so
%endif
-%if 0%{?with_team}
+%if %{with team}
%files team
%{_libdir}/%{name}/libnm-device-plugin-team.so
%endif
-%if 0%{?with_wifi}
+%if %{with wifi}
%files wifi
%{_libdir}/%{name}/libnm-device-plugin-wifi.so
%endif
-%if 0%{?with_wwan}
+%if %{with wwan}
%files wwan
%{_libdir}/%{name}/libnm-device-plugin-wwan.so
%{_libdir}/%{name}/libnm-wwan.so
%dir %{nmlibdir}/conf.d
%{nmlibdir}/conf.d/00-server.conf
-%if 0%{?with_nmtui}
+%if %{with nmtui}
%files tui
%{_bindir}/nmtui
%{_bindir}/nmtui-edit