Fix swig syntax error
[platform/upstream/libzypp.git] / packaging / libzypp.spec
1 Name:           libzypp
2 License:        GPL-2.0+
3 Group:          System/Package Management
4 Summary:        Package, Patch, Pattern, and Product Management
5 Version:        17.23.7
6 Release:        1
7 Source:         %{name}-%{version}.tar.bz2
8 Source1:        %{name}-rpmlintrc
9 Source10:       Exclude_subdirectory.patch
10 Source11:       add_pie_compile_option.patch
11 Source12:       fix_swig_syntax_error.patch
12 Source1001:     libzypp.manifest
13
14 # Features we provide (update doc/autoinclude/FeatureTest.doc):
15 Provides:       libzypp(plugin) = 0.1
16 Provides:       libzypp(plugin:appdata) = 0
17 Provides:       libzypp(plugin:commit) = 1
18 Provides:       libzypp(plugin:services) = 1
19 Provides:       libzypp(plugin:system) = 1
20 Provides:       libzypp(plugin:urlresolver) = 0
21 Provides:       libzypp(repovarexpand) = 1.1
22
23 BuildRequires:  cmake
24 BuildRequires:  libgpgme-devel
25 BuildRequires:  libxslt-tools
26 BuildRequires:  asciidoc
27 BuildRequires:  pkgconfig(openssl1.1)
28 BuildRequires:  libudev-devel
29 BuildRequires:  boost-devel
30 BuildRequires:  doxygen
31 BuildRequires:  gcc-c++ >= 4.6
32 BuildRequires:  gettext-devel
33 BuildRequires:  libxml2-devel
34 BuildRequires:  pkgconfig(libproxy-1.0)
35 BuildRequires:  pkgconfig(sigc++-2.0)
36 BuildRequires:  libsolv-devel
37 Requires:       libsolv-tools
38
39 # should be recommends
40 Requires:       lsof
41
42 BuildRequires:  expat-devel
43
44 Requires:       rpm
45
46 BuildRequires:  rpm-devel
47
48 BuildRequires:  glib2-devel
49 BuildRequires:  popt-devel
50 BuildRequires:  rpm-devel
51
52 %define min_curl_version 7.19.4
53 BuildRequires:  libcurl-devel >= %{min_curl_version}
54 Requires:       libcurl   >= %{min_curl_version}
55
56 # Without gpg, any repos with public key sign will fail.
57 Requires:       gpg
58
59 %description
60 Package, Patch, Pattern, and Product Management
61
62 Authors:
63 --------
64     Michael Andres <ma@suse.de>
65     Jiri Srain <jsrain@suse.cz>
66     Stefan Schubert <schubi@suse.de>
67     Duncan Mac-Vicar <dmacvicar@suse.de>
68     Klaus Kaempf <kkaempf@suse.de>
69     Marius Tomaschewski <mt@suse.de>
70     Stanislav Visnovsky <visnov@suse.cz>
71     Ladislav Slezak <lslezak@suse.cz>
72
73 %package devel
74 Summary:        Package, Patch, Pattern, and Product Management - developers files
75 License:        GPL-2.0+
76 Requires:       libzypp = %{version}
77 Requires:       libxml2-devel
78 Requires:       pkgconfig(openssl1.1)
79 Requires:       rpm-devel
80 Requires:       glibc-devel
81 Requires:       zlib-devel
82 Requires:       bzip2
83 Requires:       popt-devel
84 Requires:       boost-devel
85 Requires:       libstdc++-devel
86 Requires:       libudev-devel
87 Requires:       cmake
88 Requires:       libcurl-devel >= %{min_curl_version}
89 Requires:       libsolv-devel
90 Group:          Development/Libraries
91
92 %description -n libzypp-devel
93 Package, Patch, Pattern, and Product Management - developers files
94
95 Authors:
96 --------
97     Michael Andres <ma@suse.de>
98     Jiri Srain <jsrain@suse.cz>
99     Stefan Schubert <schubi@suse.de>
100     Duncan Mac-Vicar <dmacvicar@suse.de>
101     Klaus Kaempf <kkaempf@suse.de>
102     Marius Tomaschewski <mt@suse.de>
103     Stanislav Visnovsky <visnov@suse.cz>
104     Ladislav Slezak <lslezak@suse.cz>
105
106 %prep
107 %setup -q
108 cp %{SOURCE1001} .
109 %{__patch} -p1 < %{SOURCE10}
110 %{__patch} -p1 < %{SOURCE11}
111 %{__patch} -p1 < %{SOURCE12}
112
113 %build
114 mkdir build
115 cd build
116 export CFLAGS="$RPM_OPT_FLAGS"
117 export CXXFLAGS="$RPM_OPT_FLAGS"
118 unset TRANSLATION_SET
119 unset EXTRA_CMAKE_OPTIONS
120 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
121       -DDOC_INSTALL_DIR=%{_docdir} \
122       -DLIB=%{_lib} \
123       -DCMAKE_BUILD_TYPE=Release \
124       -DCMAKE_SKIP_RPATH=1 \
125       -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
126       ${EXTRA_CMAKE_OPTIONS} \
127       ..
128 make %{?_smp_mflags} VERBOSE=1
129 # make -C doc/autodoc %{?_smp_mflags}
130 make -C po %{?_smp_mflags} translations
131
132 %install
133 rm -rf "$RPM_BUILD_ROOT"
134 cd build
135 make install DESTDIR=$RPM_BUILD_ROOT
136 # make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
137 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
138 ln -s %{_sysconfdir}/yum.repos.d $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
139 %else
140 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
141 %endif
142 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/services.d
143 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/systemCheck.d
144 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vars.d
145 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vendors.d
146 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/multiversion.d
147 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/needreboot.d
148 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/credentials.d
149 mkdir -p %{buildroot}/%{_prefix}/lib/zypp
150 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins
151 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/appdata
152 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/commit
153 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/services
154 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/system
155 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/urlresolver
156 mkdir -p %{buildroot}/%{_var}/lib/zypp
157 mkdir -p %{buildroot}/%{_var}/log/zypp
158 mkdir -p %{buildroot}/%{_var}/cache/zypp
159
160 make -C po install DESTDIR=$RPM_BUILD_ROOT
161 # Create filelist with translations
162 cd ..
163 %{find_lang} zypp
164
165 %{remove_docs}
166
167 %post
168 /sbin/ldconfig
169 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
170
171 # convert old lock file to new
172 # TODO make this a separate file?
173 # TODO run the sript only when updating form pre-11.0 libzypp versions
174 LOCKSFILE=%{_sysconfdir}/zypp/locks
175 OLDLOCKSFILE=%{_sysconfdir}/zypp/locks.old
176
177 is_old(){
178   # if no such file, exit with false (1 in bash)
179   test -f ${LOCKSFILE} || return 1
180   TEMP_FILE=`mktemp`
181   cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
182   if [ -s ${TEMP_FILE} ]
183   then
184     RES=0
185   else
186     RES=1
187   fi
188   rm -f ${TEMP_FILE}
189   return ${RES}
190 }
191
192 append_new_lock(){
193   case "$#" in
194     1 )
195   echo "
196 solvable_name: $1
197 match_type: glob
198 " >> ${LOCKSFILE}
199 ;;
200     2 ) #TODO version
201   echo "
202 solvable_name: $1
203 match_type: glob
204 version: $2
205 " >> ${LOCKSFILE}
206 ;;
207     3 ) #TODO version
208   echo "
209 solvable_name: $1
210 match_type: glob
211 version: $2 $3
212 " >> ${LOCKSFILE}
213   ;;
214 esac
215 }
216
217 die() {
218   echo $1
219   exit 1
220 }
221
222 if is_old ${LOCKSFILE}
223   then
224   mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
225   cat ${OLDLOCKSFILE}| sed "/^\#.*/d"| while read line
226   do
227     append_new_lock $line
228   done
229 fi
230
231 %postun -p /sbin/ldconfig
232
233 %lang_package -f zypp
234
235 %files
236 %manifest %{name}.manifest
237 %license           COPYING
238 %dir               %{_sysconfdir}/zypp
239 %dir               %{_sysconfdir}/zypp/repos.d
240 %dir               %{_sysconfdir}/zypp/services.d
241 %dir               %{_sysconfdir}/zypp/systemCheck.d
242 %dir               %{_sysconfdir}/zypp/vars.d
243 %dir               %{_sysconfdir}/zypp/vendors.d
244 %dir               %{_sysconfdir}/zypp/multiversion.d
245 %config(noreplace) %{_sysconfdir}/zypp/needreboot
246 %dir               %{_sysconfdir}/zypp/needreboot.d
247 %dir               %{_sysconfdir}/zypp/credentials.d
248 %config(noreplace) %{_sysconfdir}/zypp/zypp.conf
249 %config(noreplace) %{_sysconfdir}/zypp/systemCheck
250 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
251 %dir               %{_var}/lib/zypp
252 %dir %attr(750,root,root) %{_var}/log/zypp
253 %dir               %{_var}/cache/zypp
254 %{_prefix}/lib/zypp
255 %{_datadir}/zypp
256 %{_bindir}/*
257 %{_libdir}/libzypp*so.*
258
259 %files devel
260 %manifest %{name}.manifest
261 %license           COPYING
262 %{_libdir}/libzypp.so
263 %{_includedir}/zypp
264 %{_datadir}/cmake/Modules/*
265 %{_libdir}/pkgconfig/libzypp.pc
266
267 %changelog