1%define pref /usr
2%define ver  2.8.12
3%define ver2 2.8
4%define rel  0
5
6# Configurable settings (use --with(out) unicode on rpmbuild cmd line):
7%define unicode 0
8%{?_with_unicode: %{expand: %%define unicode 1}}
9%{?_without_unicode: %{expand: %%define unicode 0}}
10
11%define portname x11univ
12
13%if %{unicode}
14    %define wxbasename   wx-base-unicode
15    %define name         wx-%{portname}-unicode
16    %define wxconfig     %{portname}-unicode-release-%{ver2}
17    %define wxconfiglink wx%{portname}u-%{ver2}-config
18%else
19    %define wxbasename   wx-base
20    %define name         wx-%{portname}
21    %define wxconfig     %{portname}-ansi-release-%{ver2}
22    %define wxconfiglink wx%{portname}-%{ver2}-config
23%endif
24
25Summary: The X11 port of the wxWidgets library
26Name: %{name}
27Version: %{ver}
28Release: %{rel}
29License: wxWindows Licence
30Group: X11/Libraries
31Source: wxX11-%{ver}.tar.bz2
32URL: http://www.wxwidgets.org
33Packager: Vadim Zeitlin <vadim@wxwindows.org>
34Prefix: %{pref}
35BuildRoot: %{_tmppath}/%{name}-root
36Requires: %{wxbasename} = %{ver}
37
38# all packages providing an implementation of wxWidgets library (regardless of
39# the toolkit used) should provide the (virtual) wxwin package, this makes it
40# possible to require wxwin instead of requiring "wxgtk or wxmotif or wxuniv..."
41Provides: wxwin
42Provides: wxX11
43
44%description
45wxWidgets is a free C++ library for cross-platform GUI development.
46With wxWidgets, you can create applications for different GUIs (GTK+,
47Motif/LessTif, MS Windows, Mac) from the same source code.
48
49%package devel
50Summary: The X11 port of the wxWidgets library
51Group: X11/Libraries
52Requires: %{name} = %{ver}
53Requires: %{wxbasename}-devel = %{ver}
54
55%description devel
56Header files for wxX11, the X11 port of the wxWidgets library.
57
58%package gl
59Summary: The X11 port of the wxWidgets library, OpenGL add-on.
60Group: X11/Libraries
61Requires: %{name} = %{ver}
62
63%description gl
64OpenGL add-on library for wxX11, the X11 port of the wxWidgets library.
65
66%package static
67Summary: wxX11 static libraries
68Group: Development/Libraries
69Requires: %{wxbasename}-static
70Requires: %{name}-devel = %{ver}
71
72%description static
73Static libraries for wxX11. You need them if you want to link statically against wxX11.
74
75%package contrib
76Summary: Contrib libraries for wxX11.
77Group: X11/Libraries
78Requires: %{name} = %{ver}
79
80%description contrib
81Contributed libraries for wxX11.
82
83%package contrib-devel
84Summary: Contrib libraries for wxX11.
85Group: X11/Libraries
86Requires: %{name}-contrib = %{ver}
87Requires: %{name}-devel = %{ver}
88
89%description contrib-devel
90Header files for contributed libraries for wxX11.
91
92%prep
93%setup -q -n wxX11-%{ver}
94
95%build
96if [ "$SMP" != "" ]; then
97    export MAKE="make -j$SMP"
98else
99    export MAKE="make"
100fi
101
102mkdir obj-shared
103cd obj-shared
104../configure --prefix=%{pref} --with-x11 \
105%if %{unicode}
106                              --enable-unicode \
107%else
108                              --with-odbc \
109%endif
110                              --with-opengl
111$MAKE
112
113cd contrib/src
114$MAKE
115cd ../../..
116
117mkdir obj-static
118cd obj-static
119../configure --prefix=%{pref} --with-x11 --disable-shared \
120%if %{unicode}
121                              --enable-unicode \
122%else
123                              --with-odbc \
124%endif
125                              --with-opengl
126$MAKE
127cd ..
128
129%install
130rm -rf $RPM_BUILD_ROOT
131(cd obj-static; make prefix=$RPM_BUILD_ROOT%{pref} install)
132(cd obj-shared; make prefix=$RPM_BUILD_ROOT%{pref} install)
133
134# Remove headers that are part of wx-base-devel:
135
136# --- wxBase headers list begins here ---
137cat <<EOF >wxbase-headers.files
138wx/afterstd.h
139wx/app.h
140wx/apptrait.h
141wx/archive.h
142wx/arrimpl.cpp
143wx/arrstr.h
144wx/beforestd.h
145wx/buffer.h
146wx/build.h
147wx/chkconf.h
148wx/clntdata.h
149wx/cmdline.h
150wx/confbase.h
151wx/config.h
152wx/convauto.h
153wx/containr.h
154wx/cpp.h
155wx/datetime.h
156wx/datstrm.h
157wx/dde.h
158wx/debug.h
159wx/defs.h
160wx/dir.h
161wx/dlimpexp.h
162wx/dynarray.h
163wx/dynlib.h
164wx/dynload.h
165wx/encconv.h
166wx/event.h
167wx/except.h
168wx/features.h
169wx/ffile.h
170wx/file.h
171wx/fileconf.h
172wx/filefn.h
173wx/filename.h
174wx/filesys.h
175wx/fontenc.h
176wx/fontmap.h
177wx/fs_arc.h
178wx/fs_filter.h
179wx/fs_mem.h
180wx/fs_zip.h
181wx/hash.h
182wx/hashmap.h
183wx/hashset.h
184wx/html/forcelnk.h
185wx/iconloc.h
186wx/init.h
187wx/intl.h
188wx/iosfwrap.h
189wx/ioswrap.h
190wx/ipc.h
191wx/ipcbase.h
192wx/isql.h
193wx/isqlext.h
194wx/link.h
195wx/list.h
196wx/listimpl.cpp
197wx/log.h
198wx/longlong.h
199wx/math.h
200wx/memconf.h
201wx/memory.h
202wx/memtext.h
203wx/mimetype.h
204wx/module.h
205wx/msgout.h
206wx/mstream.h
207wx/object.h
208wx/platform.h
209wx/platinfo.h
210wx/power.h
211wx/process.h
212wx/ptr_scpd.h
213wx/recguard.h
214wx/regex.h
215wx/scopeguard.h
216wx/snglinst.h
217wx/sstream.h
218wx/stack.h
219wx/stackwalk.h
220wx/stdpaths.h
221wx/stockitem.h
222wx/stopwatch.h
223wx/strconv.h
224wx/stream.h
225wx/string.h
226wx/sysopt.h
227wx/tarstrm.h
228wx/textbuf.h
229wx/textfile.h
230wx/thread.h
231wx/thrimpl.cpp
232wx/timer.h
233wx/tokenzr.h
234wx/txtstrm.h
235wx/types.h
236wx/uri.h
237wx/utils.h
238wx/variant.h
239wx/vector.h
240wx/version.h
241wx/volume.h
242wx/wfstream.h
243wx/wx.h
244wx/wxchar.h
245wx/wxprec.h
246wx/xti.h
247wx/xtistrm.h
248wx/zipstrm.h
249wx/zstream.h
250wx/unix/apptbase.h
251wx/unix/apptrait.h
252wx/unix/execute.h
253wx/unix/mimetype.h
254wx/unix/pipe.h
255wx/unix/private.h
256wx/unix/stackwalk.h
257wx/unix/stdpaths.h
258wx/fs_inet.h
259wx/gsocket.h
260wx/protocol/file.h
261wx/protocol/ftp.h
262wx/protocol/http.h
263wx/protocol/protocol.h
264wx/sckaddr.h
265wx/sckipc.h
266wx/sckstrm.h
267wx/socket.h
268wx/url.h
269wx/unix/gsockunx.h
270wx/xml/xml.h
271wx/xtixml.h
272wx/db.h
273wx/dbkeyg.h
274wx/dbtable.h
275EOF
276# --- wxBase headers list ends here ---
277for f in `cat wxbase-headers-list` ; do
278  rm -f $RPM_BUILD_ROOT%{_includedir}/wx-%{ver2}/$f
279done
280
281# list of all core headers:
282find $RPM_BUILD_ROOT%{_includedir}/wx-%{ver2} -type f | sed -e "s,$RPM_BUILD_ROOT,,g" >core-headers.files
283
284# contrib stuff:
285(cd obj-shared/contrib/src; make prefix=$RPM_BUILD_ROOT%{pref} install)
286(cd obj-shared/utils/wxrc; make prefix=$RPM_BUILD_ROOT%{pref} install)
287
288# remove wxBase files so that RPM doesn't complain about unpackaged files:
289rm -f $RPM_BUILD_ROOT%{_libdir}/libwx_base*
290%if %{unicode}
291    rm -f $RPM_BUILD_ROOT%{_libdir}/libwxregexu-%{ver2}.a
292%endif
293rm -f $RPM_BUILD_ROOT%{_datadir}/aclocal/*
294rm -f $RPM_BUILD_ROOT%{_datadir}/locale/*/*/*
295
296%clean
297rm -rf $RPM_BUILD_ROOT
298
299%post
300/sbin/ldconfig
301
302%postun
303/sbin/ldconfig
304
305%post devel
306# link wx-config when you install RPM.
307ln -sf %{_libdir}/wx/config/%{wxconfig} %{_bindir}/wx-config
308# link wx-config with explicit name.
309ln -sf %{_libdir}/wx/config/%{wxconfig} %{_bindir}/%{wxconfiglink}
310/sbin/ldconfig
311
312%postun devel
313/sbin/ldconfig
314
315%preun devel
316if test -f %{_bindir}/wx-config -a -f /usr/bin/md5sum ; then
317    SUM1=`md5sum %{_libdir}/wx/config/%{wxconfig} | cut -c 0-32`
318    SUM2=`md5sum %{_bindir}/wx-config | cut -c 0-32`
319    if test "x$SUM1" = "x$SUM2" ; then
320        rm -f %{_bindir}/wx-config
321    fi
322fi
323rm -f %{_bindir}/%{wxconfiglink}
324
325%post gl
326/sbin/ldconfig
327
328%postun gl
329/sbin/ldconfig
330
331%post contrib
332/sbin/ldconfig
333
334%postun contrib
335/sbin/ldconfig
336
337%post contrib-devel
338/sbin/ldconfig
339
340%postun contrib-devel
341/sbin/ldconfig
342
343%files
344%defattr(-,root,root)
345%doc COPYING.LIB *.txt
346%{_libdir}/libwx_%{portname}*_adv-%{ver2}.so.*
347%{_libdir}/libwx_%{portname}*_core-%{ver2}.so.*
348%if !%{unicode}
349    %{_libdir}/libwx_%{portname}*_dbgrid-%{ver2}.so.*
350%endif
351%{_libdir}/libwx_%{portname}*_html-%{ver2}.so.*
352%{_libdir}/libwx_%{portname}*_media-%{ver2}.so.*
353%{_libdir}/libwx_%{portname}*_qa-%{ver2}.so.*
354%{_libdir}/libwx_%{portname}*_xrc-%{ver2}.so.*
355
356
357%files devel -f core-headers.files
358%defattr(-,root,root)
359%{_libdir}/libwx_%{portname}*_adv-%{ver2}.so
360%{_libdir}/libwx_%{portname}*_core-%{ver2}.so
361%if !%{unicode}
362    %{_libdir}/libwx_%{portname}*_dbgrid-%{ver2}.so
363%endif
364%{_libdir}/libwx_%{portname}*_gl-%{ver2}.so
365%{_libdir}/libwx_%{portname}*_html-%{ver2}.so
366%{_libdir}/libwx_%{portname}*_media-%{ver2}.so
367%{_libdir}/libwx_%{portname}*_qa-%{ver2}.so
368%{_libdir}/libwx_%{portname}*_xrc-%{ver2}.so
369%dir %{_libdir}/wx
370%{_libdir}/wx/*
371%{_bindir}/wxrc*
372
373%files gl
374%defattr(-,root,root)
375%{_libdir}/libwx_%{portname}*_gl-%{ver2}.so.*
376
377%files static
378%defattr (-,root,root)
379%{_libdir}/libwx_%{portname}*_*-%{ver2}.a
380
381%files contrib
382%defattr(-,root,root)
383%{_libdir}/libwx_%{portname}*_animate-%{ver2}.so.*
384%{_libdir}/libwx_%{portname}*_deprecated-%{ver2}.so.*
385%{_libdir}/libwx_%{portname}*_fl-%{ver2}.so.*
386%{_libdir}/libwx_%{portname}*_gizmos-%{ver2}.so.*
387%{_libdir}/libwx_%{portname}*_mmedia-%{ver2}.so.*
388%{_libdir}/libwx_%{portname}*_ogl-%{ver2}.so.*
389%{_libdir}/libwx_%{portname}*_plot-%{ver2}.so.*
390%{_libdir}/libwx_%{portname}*_stc-%{ver2}.so.*
391%{_libdir}/libwx_%{portname}*_svg-%{ver2}.so.*
392
393%files contrib-devel
394%defattr(-,root,root)
395%dir %{_includedir}/wx-%{ver2}/wx/animate
396%{_includedir}/wx-%{ver2}/wx/animate/*
397%{_libdir}/libwx_%{portname}*_animate-%{ver2}.so
398
399%dir %{_includedir}/wx-%{ver2}/wx/deprecated
400%{_includedir}/wx-%{ver2}/wx/deprecated/*
401%{_libdir}/libwx_%{portname}*_deprecated-%{ver2}.so
402
403%dir %{_includedir}/wx-%{ver2}/wx/fl
404%{_includedir}/wx-%{ver2}/wx/fl/*
405%{_libdir}/libwx_%{portname}*_fl-%{ver2}.so
406
407%dir %{_includedir}/wx-%{ver2}/wx/gizmos
408%{_includedir}/wx-%{ver2}/wx/gizmos/*
409%{_libdir}/libwx_%{portname}*_gizmos-%{ver2}.so
410
411%dir %{_includedir}/wx-%{ver2}/wx/mmedia
412%{_includedir}/wx-%{ver2}/wx/mmedia/*
413%{_libdir}/libwx_%{portname}*_mmedia-%{ver2}.so
414
415%dir %{_includedir}/wx-%{ver2}/wx/ogl
416%{_includedir}/wx-%{ver2}/wx/ogl/*
417%{_libdir}/libwx_%{portname}*_ogl-%{ver2}.so
418
419%dir %{_includedir}/wx-%{ver2}/wx/plot
420%{_includedir}/wx-%{ver2}/wx/plot/*
421%{_libdir}/libwx_%{portname}*_plot-%{ver2}.so
422
423%dir %{_includedir}/wx-%{ver2}/wx/stc
424%{_includedir}/wx-%{ver2}/wx/stc/*
425%{_libdir}/libwx_%{portname}*_stc-%{ver2}.so
426
427%dir %{_includedir}/wx-%{ver2}/wx/svg
428%{_includedir}/wx-%{ver2}/wx/svg/*
429%{_libdir}/libwx_%{portname}*_svg-%{ver2}.so
430