From 53c653ea7e2f4eb7b7de1fab25102506dae66529 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20Kjellstr=C3=B6m?= Date: Fri, 12 Feb 2010 12:31:13 +0100 Subject: [PATCH] Change handling of conditional builds in the spec file Change handling of build options from using simple define statements to using the RPMs bcond_without functionality. bcond_without instead of bcond_with ensures that the old behaviour is preserved (all options are still enabled by default). This change allows the convenient "rpmbuild --without xxx" and is in line with: http://www.rpm.org/wiki/PackagerDocs/ConditionalBuilds --- redhat/lldpd.spec | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/redhat/lldpd.spec b/redhat/lldpd.spec index feadaeab..8861759d 100644 --- a/redhat/lldpd.spec +++ b/redhat/lldpd.spec @@ -1,12 +1,15 @@ # configure options -%define with_snmp 1 -%define with_cdp 1 -%define with_edp 1 -%define with_sonmp 1 -%define with_fdp 1 -%define with_lldpmed 1 -%define with_dot1 1 -%define with_dot3 1 + +# Conditional build options, disable with "--without xxx" +%bcond_without snmp +%bcond_without cdp +%bcond_without edp +%bcond_without sonmp +%bcond_without fdp +%bcond_without lldpmed +%bcond_without dot1 +%bcond_without dot3 + %define lldpd_user _lldpd %define lldpd_group _lldpd %define lldpd_chroot /var/run/lldpd @@ -22,7 +25,7 @@ Source0: http://www.luffy.cx/lldpd/%{name}-%{version}.tar.gz Source1: lldpd.init Source2: lldpd.sysconfig -%if %with_snmp +%if %{with snmp} BuildRequires: net-snmp-devel Requires: net-snmp %endif @@ -47,40 +50,40 @@ protocol. It also handles LLDP-MED extension. %setup -q %build %configure \ -%if %with_snmp +%if %{with snmp} --with-snmp \ %endif -%if %with_cdp +%if %{with cdp} --enable-cdp \ %else --disable-cdp \ %endif -%if %with_edp +%if %{with edp} --enable-edp \ %else --disable-edp \ %endif -%if %with_sonmp +%if %{with sonmp} --enable-sonmp \ %else --disable-sonmp \ %endif -%if %with_fdp +%if %{with fdp} --enable-fdp \ %else --disable-fdp \ %endif -%if %with_lldpmed +%if %{with lldpmed} --enable-lldpmed \ %else --disable-lldpmed \ %endif -%if %with_dot1 +%if %{with dot1} --enable-dot1 \ %else --disable-dot1 \ %endif -%if %with_dot3 +%if %{with dot3} --enable-dot3 \ %else --disable-dot3 \ -- 2.39.5