openSUSE:Libzypp building
Building libzypp
Version: 10.3+ ZYPP builds this way only for the 10.3 codebase and beyond
Since version 3.x, libzypp uses cmake to build.
If you are using factory, cmake is available already. For releases, look into this Build Service repository.
If you don't work with the subversion repository, get the source as a compressed tar file and untar zypp-3.x.x.tar.bz2 tarball in /somewhere
cd /somewhere; tar -jxpvf /downloads/zypp-3.x.x.tar.bz2
create a directory for building, like /zypp-build
mkdir /zypp-build
Go to the build directory
cd /zypp-build
run cmake /somewhere/libzypp-3.x.x, e.g.
cmake -DCMAKE_INSTALL_PREFIX=/opt/zypp3 /somewhere/libzypp-3.x.x
By default cmake builds with rpath on the build tree. That way the executables work inside the build tree. This causes re-linking at installation time. Use -DCMAKE_BUILD_WITH_INSTALL_RPATH=1 or -DCMAKE_SKIP_RPATH=1 to skip rpath at all.
(You might need a couple of packages, like popt-devel, rpm-devel, dbus-1-devel, dbus-1-glib-devel, hal-devel, doxygen, graphviz, libxml2-devel, boost, boost-devel, gettext-devel, dejagnu, zlib-devel, libicu, glib2-devel, readline-devel, curl-devel, e2fsprogs-devel, libidn-devel, openssl-devel, libsatsolver-devel.)
You will see cmake configuring the build
-- Libraries will be installed in /opt/zypp3/lib -- rpm found: includes in /usr/include, library in /usr/lib/librpm.so -- boost found: includes in /usr/include, library in /usr/lib -- Found Gettext: -- hal found: includes in /usr/include, library in /usr/lib/libhal.so -- dbus found: includes in /usr/include/dbus-1.0, library in /usr/lib/libdbus-1.so -- glib found: includes in /opt/gnome/include/glib-2.0, library in /opt/gnome/lib/libglib.so -- glib found: includes in /opt/gnome/include/glib-2.0, library in /opt/gnome/lib/libglib.so -- curl found: includes in /usr/include, library in /usr/lib/libcurl.so -- libxml found: includes in /usr/include, library in /usr/lib/libxml2.so -- sqlite found: includes in /usr/include, library in /usr/lib/libsqlite3.so -- doxygen found: /usr/bin/doxygen -- soname: 300.0.0 -- version: 3.0.0 -- Writing spec file... -- Writing pkg-config file... -- FindZypp.cmake will be installed in /opt/zypp3/share/cmake/Modules -- Configuring done -- Generating done -- Build files have been written to: /build-zypp
run make
make
If you want full output, you can:
make VERBOSE=1
Testsuite
To run libzypp's testsuite, change into the zypp-build/tests directory and do
make make test
Translations
Go to the zypp-build/po directory
make translations make install
Creating a directory ready for mbuild, srcpackage or build service
Stand in the build directory
make srcpackage
Now you will find the tarball, spec and changes file in the build/package directory.
Developping a zypp based program using cmake
libzypp-devel includes a FindZypp.cmake
use:
FIND_PACKAGE(Zypp REQUIRED)
in your top-level CMakeLists.txt file and you will get the variables ZYPP_INCLUDE_DIR AND ZYPP_LIBRARY defined.
Developing with the zypp build system
Reading
References
ZYPP custom build system variables
The following additional variables are defined:
- LIB_INSTALL_DIR
Tips and tricks
Compile flags and defines
To set special compile flags for certain files add this in CMakeLists.txt, where the ${files} variable contains one or more source files and the ${value} variable any value:
SET_SOURCE_FILES_PROPERTIES( ${files} COMPILE_FLAGS -DSOMEDEFINE=\\"${value}\\" )
make uninstall?
See CMake FAQ.