fix & improve packaging
authorGerd von Egidy <gerd.von.egidy@intra2net.com>
Wed, 8 Apr 2015 08:44:38 +0000 (10:44 +0200)
committerGerd von Egidy <gerd.von.egidy@intra2net.com>
Wed, 8 Apr 2015 08:44:38 +0000 (10:44 +0200)
libi2ncommon.spec

index fefb2f0..880c803 100644 (file)
@@ -8,19 +8,27 @@
     %define with_imap_utf7_support 1
 %endif
 
+%if %{with xmllib}
+    %define with_xmllib 1
+%endif
+%if %{with imap_utf7_support}
+    %define with_imap_utf7_support 1
+%endif
+
 Summary:   library with functions common in Intra2net programs
 Name:      libi2ncommon
-Version:   ##VERSION##
+Version:   2.5
 Release:   1
 License:   GPLv2 + linking exception
 Group:     Development/Libraries
 Vendor:    Intra2net AG
-Source:    %{name}-%{version}.tar.gz
-Requires:  libi2ncommon-utils = %{version}
-BuildPrereq: libtool
+Source:    %{name}-%{version}.tar.bz2
 BuildRequires: boost-devel >= 1.32.0
-Obsoletes: libgettext
+BuildRequires: libtool
 
+%if "%{with_imap_utf7_support}" == "1"
+BuildRequires: libiconv
+%endif
 
 %description 
 library with functions common in Intra2net programs
@@ -46,11 +54,12 @@ library with a config module.
 The config module provides a global configuration system with decentralized
 declaration of the config variables.
 
-%if %{with xmllib}
+%if "%{with xmllib}" == "1"
 %package xml
 Summary:    library with a xml module
 Group:      Intranator
 Requires:   libi2ncommon = %{version}
+BuildRequires: libxml++-devel
 
 %description xml
 The xml module provides common xml functions.
@@ -68,8 +77,6 @@ Library with open source utility modules.
 %setup -q
 
 %build
-export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/intranator/lib/pkgconfig
-
 mkdir build
 cd build
 
@@ -77,14 +84,14 @@ export CFLAGS="$RPM_OPT_FLAGS"
 export CXXFLAGS="$RPM_OPT_FLAGS"
 
 CMAKE_OPTS=""
-%if %{with xmllib}
+%if "%{with_xmllib}" == "1"
     CMAKE_OPTS="$CMAKE_OPTS -DBUILD_XMLLIB=ON"
 %endif
-%if %{with imap_utf7_support}
+%if "%{with_imap_utf7_support}" == "1"
     CMAKE_OPTS="$CMAKE_OPTS -DIMAP_UTF7_SUPPORT=ON"
 %endif
 
-cmake -DCMAKE_INSTALL_PREFIX="%{prefix}" $CMAKE_OPTS ../
+cmake -DCMAKE_INSTALL_PREFIX="%{_prefix}" $CMAKE_OPTS ../
 
 make %{?_smp_mflags} VERBOSE=1
 
@@ -100,8 +107,9 @@ make DESTDIR=$RPM_BUILD_ROOT install
 %clean
 rm -fr $RPM_BUILD_ROOT
 
-%post
-/sbin/ldconfig
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
 
 %files
 %defattr(-,root,root)
@@ -114,14 +122,14 @@ rm -fr $RPM_BUILD_ROOT
 #%{prefix}/lib/*.*a*
 %{_libdir}/libi2ncommon.so
 %{_libdir}/pkgconfig/*.pc
-%{prefix}/include/
+%{_includedir}/*
 
 %files config
 %defattr(-,root,root)
 %doc COPYING.GPL
 %{_libdir}/libi2ncommon_config.so*
 
-%if %{with xmllib}
+%if "%{with xmllib}" == "1"
 %files xml
 %defattr(-,root,root)
 %doc COPYING.GPL