openSUSE:Packaging wxWidgets
tagline: From openSUSE
Build Service Tutorial · Tips & Tricks · Cross Distribution Howto · Packaging checks
Desktop menu categories · RPM Macros · Scriptlets · Init scripts · How to write good changes
Contents |
wxWidgets variants
wxWidgets can exist in several ABI and API incompatible variants. If you ignore this fact and build your own wxWidgets shared libraries, you risk clashes with the system libraries that will cause installation conflicts or application crashes. That is why you need to follow several extra steps.
Depending on the devel package you will pick, it will link against the
particular wxWidgets ABI variant. Starting with openSUSE 11.4, wxWidgets is distributed in three variants as separate packages.
STL variant
wxWidgets-devel with STL interface and Unicode is a new ABI recommended
by upstream.
wx container variant
wxWidgets-wxcontainer-devel with the old wx container interface and
Unicode support is now deprecated.
ANSI variant
wxWidgets-ansi-devel with the old wxcontainer interface and without
Unicode support is now strongly deprecated. (No package in Factory links
against that any more.) ANSI variant is built with wx container ABI only.
Python bindings
python-wxWidgets is now based on the STL variant. Other variants are not
built.
Other versions
You can also find other wxWidgets version branches on the
X11:wxWidgets OBS project repositories.
BuildRequires
You should try wxWidgets-devel first in order (it is a STL version,
which is preferred; clean code should compile without any problems).
Only if the package cannot be compiled (or does not work), use
wxWidgets-wxcontainer-devel. If the package expects that wxString is equal to char*,
then you need to use wxWidgets-ansi-devel. Both latter variants are
deprecated.
Note that Unicode/ANSI variants should be requested by the wx-config
parameters, but there is no way to detect, whether the package is STL
compatible, or it still needs old wx containers.
Special spec file requirements
Depending on STL/wxcontainer the variant, libraries change ABI but the library name does not change. It causes many ugly clashes.
That is why openSUSE moved libraries to a dedicated directory, so any package could depend on a particular library. Well, RPM does not like that and does not understand idea that more libraries have the same SONAME and binary picks the correct one using RPATH. That is why each wxWidgets based package must fix BuildRequires and include two lines to fix dependencies:
%define _use_internal_dependency_generator 0 %define __find_requires %wx_requires
It these two lines are missing, ZYPP and RPM does not know, which variant libraries should be installed for your package. You may get missing library errors.
Older openSUSE versions
Older openSUSE versions have had a single devel file - wxGTK-devel that covered wxcontainer and ANSI versions. STL version was not distributed due to ABI incompatibility. python-wxWidgets was called python-wxGTK.
Two lines mentioned above needs to be excluded for older openSUSE versions.
Third party packages
Third party packages can be linked against arbitrary ABI variant, and you probably doesn't know, which one is correct. They expect libraries in the standard library path. To make such libraries compatible with the openSUSE wxWidgets, there are compat</compat> packages that add particular ABI variant to the <code>ld.so path. You can install only one ABI variant third party packages.
If your openSUSE package needs these compat</compat>, you did something wrong. Most probably you forgot to add the two lines mentioned above into the spec file.
Examples
Excerpt of spec preamble for openSUSE 11.4 and later:
BuildRequires: wxWidgets-devel %define _use_internal_dependency_generator 0 %define __find_requires %wx_requires
Excerpt of spec preamble compatible with older openSUSE versions:
%if %suse_version >= 1140 BuildRequires: wxWidgets-devel %define _use_internal_dependency_generator 0 %define __find_requires %wx_requires %else BuildRequires: wxGTK-devel %endif
Excerpt of spec preamble compatible with older openSUSE versions that hide some complexity inside osc prjconf:
BuildRequires: wxWidgets-devel %if %suse_version >= 1140 %define _use_internal_dependency_generator 0 %define __find_requires %wx_requires %endif
And the related osc prjconf contents:
%if 0%{?suse_version} < 1140
Substitute: wxWidgets-devel wxGTK-devel
Substitute: wxWidgets-wxcontainer-devel wxGTK-devel
Substitute: wxWidgets-ansi-devel wxGTK-devel wxGTK-compat
Substitute: python-wxWidgets python-wxGTK
%endif
