Make build of xml library part optional
[libi2ncommon] / libi2ncommon.spec
index 583b1f9..7460fbc 100644 (file)
@@ -1,3 +1,11 @@
+%bcond_with Intra2net
+%bcond_with xmllib
+
+# Detect Intra2net build environment
+%if %{with Intra2net}
+    %define with_xmllib 1
+%endif
+
 Summary:   library with functions common in Intra2net programs
 Name:      libi2ncommon
 Version:   ##VERSION##
@@ -38,6 +46,7 @@ library with a config module.
 The config module provides a global configuration system with decentralized
 declaration of the config variables.
 
+%if %{with xmllib}
 %package xml
 Summary:    library with a xml module
 Group:      Intranator
@@ -45,6 +54,7 @@ Requires:   libi2ncommon = %{version}
 
 %description xml
 The xml module provides common xml functions.
+%endif
 
 %package utils
 Summary:    library with open source utility modules
@@ -65,7 +75,13 @@ cd build
 
 export CFLAGS="$RPM_OPT_FLAGS"
 export CXXFLAGS="$RPM_OPT_FLAGS"
-cmake -DCMAKE_INSTALL_PREFIX="%{prefix}" ../
+
+CMAKE_OPTS=""
+%if %{with xmllib}
+    CMAKE_OPTS="$CMAKE_OPTS -DBUILD_XMLLIB=ON"
+%endif
+
+cmake -DCMAKE_INSTALL_PREFIX="%{prefix}" $CMAKE_OPTS ../
 
 make %{?_smp_mflags} VERBOSE=1
 
@@ -101,10 +117,12 @@ rm -fr $RPM_BUILD_ROOT
 %doc COPYING.GPL
 %{prefix}/lib/libi2ncommon_config.so*
 
+%if %{with xmllib}
 %files xml
 %defattr(-,root,root)
 %doc COPYING.GPL
 %{prefix}/lib/libi2ncommon_xml.so*
+%endif
 
 %files utils
 %defattr(-,root,root)