Make build of xml library part optional
[libi2ncommon] / libi2ncommon.spec
1 %bcond_with Intra2net
2 %bcond_with xmllib
3
4 # Detect Intra2net build environment
5 %if %{with Intra2net}
6     %define with_xmllib 1
7 %endif
8
9 Summary:   library with functions common in Intra2net programs
10 Name:      libi2ncommon
11 Version:   ##VERSION##
12 Release:   1
13 License:   GPLv2 + linking exception
14 Group:     Intranator
15 Vendor:    Intra2net AG
16 Source:    %{name}-%{version}.tar.gz
17 Buildroot: /tmp/%{name}-%{version}-root
18 Prefix:    /usr/intranator
19 Requires:  libi2ncommon-utils = %{version}
20 BuildPrereq: libtool
21 BuildRequires: boost-devel >= 1.32.0
22 Obsoletes: libgettext
23
24
25 %description 
26 library with functions common in Intra2net programs
27
28 %package   devel
29 Summary:   library with functions common in Intra2net programs
30 Group:     Intranator/Development
31 Requires:  libi2ncommon = %{version}
32 Requires: boost-devel >= 1.32.0
33
34
35 %description devel
36 library with functions common in Intra2net programs
37
38
39 %package config
40 Summary:    library with a config module
41 Group:      Intranator
42 Requires:   libi2ncommon = %{version}
43
44 %description config
45 library with a config module.
46 The config module provides a global configuration system with decentralized
47 declaration of the config variables.
48
49 %if %{with xmllib}
50 %package xml
51 Summary:    library with a xml module
52 Group:      Intranator
53 Requires:   libi2ncommon = %{version}
54
55 %description xml
56 The xml module provides common xml functions.
57 %endif
58
59 %package utils
60 Summary:    library with open source utility modules
61 Group:      Intranator
62 License:    GPL version 2 + linking exception
63
64 %description utils
65 Library with open source utility modules.
66
67 %prep
68 %setup -q
69
70 %build
71 export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/intranator/lib/pkgconfig
72
73 mkdir build
74 cd build
75
76 export CFLAGS="$RPM_OPT_FLAGS"
77 export CXXFLAGS="$RPM_OPT_FLAGS"
78
79 CMAKE_OPTS=""
80 %if %{with xmllib}
81     CMAKE_OPTS="$CMAKE_OPTS -DBUILD_XMLLIB=ON"
82 %endif
83
84 cmake -DCMAKE_INSTALL_PREFIX="%{prefix}" $CMAKE_OPTS ../
85
86 make %{?_smp_mflags} VERBOSE=1
87
88 %check
89 cd build
90 make check
91
92 %install
93
94 cd build
95 make DESTDIR=$RPM_BUILD_ROOT install
96
97 %clean
98 rm -fr $RPM_BUILD_ROOT
99
100 %post
101 /sbin/ldconfig
102
103 %files
104 %defattr(-,root,root)
105 %doc COPYING.GPL
106 %{prefix}/lib/libi2ncommon.so*
107
108 %files devel
109 %defattr(-,root,root)
110 # No static library for now
111 #%{prefix}/lib/*.*a*
112 %{prefix}/lib/pkgconfig/*.pc
113 %{prefix}/include/
114
115 %files config
116 %defattr(-,root,root)
117 %doc COPYING.GPL
118 %{prefix}/lib/libi2ncommon_config.so*
119
120 %if %{with xmllib}
121 %files xml
122 %defattr(-,root,root)
123 %doc COPYING.GPL
124 %{prefix}/lib/libi2ncommon_xml.so*
125 %endif
126
127 %files utils
128 %defattr(-,root,root)
129 %doc COPYING.GPL
130 %{prefix}/lib/libi2ncommon_utils.so*