changes to how kdepimlibs and kdebase/workspace are installed and found

Maciej Mrozowski reavertm at poczta.fm
Tue Dec 9 18:56:13 CET 2008


On Tuesday 09 of December 2008 17:38:33 Brad King wrote:
> Maciej Mrozowski wrote:
> > On Tuesday 09 of December 2008 11:23:18 Modestas Vainius wrote:
> >> Okay, but then I wouldn't mind e.g. /usr/lib/kde4/cmake or something
> >> similar, just please do not pollute /usr/lib namespace directly.
> >> Likewise, pkg-config has /usr/lib/pkgconfig.
> >
> > In my opinion /usr/lib/cmake/ would be fine to place those files - even
> > without creating subdirs inside like KdepimLibs and similar.
>
> Many projects have a /usr/lib/<name>[-<version>] directory containing
> platform-specific data for the package.
>
> Placement of the files near to the libraries in the installation is a
> *feature* of the find_package command.  It avoids all problems with
> multiple installations and multiple versions.  The command magically
> finds the files burried in the installation instead of in some central
> place which can have conflicts.  Furthermore, the relative path from the
> config files to the libraries remains fixed no matter where the package
> is installed.  This ensures that the locations reported by the file are
> correct with no special packaging or versioning work.

I agree it may be very helpful, it just makes libdir look a bit cluttered.
On Gentoo we used to handle library dependencies in similar fashion. As we 
split KDE packages (by disabling other cmake targets, with some explicit 
exceptions, inter-module dependencies would need some love though, some 
packages fails to build in parallel mode, with - j3 for example, as cmake 
itself handles parallel builds well) - we can export dependencies to file, 
save them on disk, and inject them in CMakeLists.txt in packages that make use 
of them. This may be considered a hack, but it's at least upstream-independent 
and the most important - we can decide where to put those ".pc" files.

** adding out target to cmake - create dependency file

save_library_dependencies() {
	local depsfile="${T}/${PN}:${SLOT}"

	echo "Saving library dependendencies in ${depsfile##*/}"
	echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" 
|| \
		die "Failed to save the library dependencies."
}

** install command - put where we want it

install_library_dependencies() {
	local depsfile="${T}/${PN}:${SLOT}"
	echo "Installing library dependendencies as ${depsfile##*/}"
	insinto /var/lib/kde
	doins "${depsfile}" || die "Failed to install library dependencies."
}

** inject specified dependencies (file names in KMLOADLIBS) in package's 
CMakeLists.txt

load_library_dependencies() {
	local pn i depsfile
	echo "Injecting library dependendencies from '${KMLOADLIBS}'"

	i=0
	for pn in ${KMLOADLIBS} ; do
		((i++))
		depsfile="/var/lib/kde/${pn}:${SLOT}"
		[[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You 
probably need to reinstall ${pn}."
		sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
			die "Failed to include library dependencies for ${pn}"
	done
}

Example file with dependency is attached (it is versioned as well, but in our 
nomenclature).
As far as hack this is, it's quite convenient way to do it nearly 
automatically for every package we want without manually playing with 
CMakeLists.txt files.
No idea whether anyone else would like to use this idea, just throwing it 
here.

-- 
regards
MM


----------------------------------------------------------------------
W naszym konkursie SAM wybierasz sobie nagrode!
Sprawdz >>> http://link.interia.pl/f1fcc
-------------- next part --------------
# Generated by CMake 2.6-patch 2

IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
  # Information for CMake 2.6 and above.
  SET("akonadi-kabc_LIB_DEPENDS" "general;akonadi-kde;general;/usr/lib64/qt4/libQtGui.so;general;kdecore;")
  SET("akonadi-kde_LIB_DEPENDS" "general;solid;general;/usr/lib64/qt4/libQtNetwork.so;general;/usr/lib64/qt4/libQtDBus.so;general;/usr/lib64/qt4/libQtSql.so;general;kdeui;general;kio;general;/usr/lib64/libakonadiprotocolinternals.so;")
  SET("akonadi-kmime_LIB_DEPENDS" "general;akonadi-kde;general;kmime;general;/usr/lib64/qt4/libQtGui.so;general;kdecore;general;kio;")
  SET("gpgmepp-pthread_LIB_DEPENDS" "general;/usr/lib64/libgpgme-pthread.so;general;/usr/lib64/libpthread.so;general;/usr/lib64/libgpg-error.so;")
  SET("gpgmepp_LIB_DEPENDS" "general;/usr/lib64/libgpgme.so;general;/usr/lib64/libgpg-error.so;")
  SET("kabc_LIB_DEPENDS" "general;kresources;general;kldap;general;kdeui;general;kdecore;")
  SET("kabc_directory_LIB_DEPENDS" "general;kio;general;kabc;general;kresources;")
  SET("kabc_file_LIB_DEPENDS" "general;/usr/lib64/qt4/libQtGui.so;general;kdecore;general;kabc;general;kabc_file_core;general;kresources;")
  SET("kabc_file_core_LIB_DEPENDS" "general;kio;general;kabc;general;kcal;general;kresources;")
  SET("kabc_ldapkio_LIB_DEPENDS" "general;kio;general;kabc;general;kldap;general;kresources;")
  SET("kabc_net_LIB_DEPENDS" "general;kio;general;kabc;general;kresources;")
  SET("kabcformat_binary_LIB_DEPENDS" "general;kdecore;general;kabc;")
  SET("kblog_LIB_DEPENDS" "general;kxmlrpcclient;general;syndication;general;kio;general;kcal;")
  SET("kcal_LIB_DEPENDS" "general;kdeui;general;kio;general;/usr/lib64/qt4/libQtXml.so;general;kresources;general;kabc;general;kpimutils;general;/usr/lib64/libical.so;general;/usr/lib64/libicalss.so;")
  SET("kcal_local_LIB_DEPENDS" "general;/usr/lib64/qt4/libQtGui.so;general;kdecore;general;kcal;general;kresources;")
  SET("kcal_localdir_LIB_DEPENDS" "general;/usr/lib64/qt4/libQtGui.so;general;kdecore;general;kcal;general;kresources;")
  SET("kcm_kresources_LIB_DEPENDS" "general;kdeui;general;kresources;")
  SET("kcm_mailtransport_LIB_DEPENDS" "general;kdeui;general;mailtransport;")
  SET("kimap_LIB_DEPENDS" "general;kdecore;")
  SET("kio_imap4_LIB_DEPENDS" "general;kmime;general;kimap;general;kio;general;/usr/lib64/libsasl2.so;")
  SET("kio_ldap_LIB_DEPENDS" "general;kio;general;kldap;")
  SET("kio_mbox_LIB_DEPENDS" "general;kio;")
  SET("kio_nntp_LIB_DEPENDS" "general;kio;")
  SET("kio_pop3_LIB_DEPENDS" "general;kio;general;/usr/lib64/libsasl2.so;")
  SET("kio_sieve_LIB_DEPENDS" "general;kio;general;/usr/lib64/libsasl2.so;")
  SET("kio_smtp_LIB_DEPENDS" "general;kio;general;/usr/lib64/libsasl2.so;")
  SET("kldap_LIB_DEPENDS" "general;kio;general;kdecore;general;/usr/lib64/libsasl2.so;")
  SET("kmime_LIB_DEPENDS" "general;kdecore;")
  SET("kpimidentities_LIB_DEPENDS" "general;kpimutils;general;kio;")
  SET("kpimutils_LIB_DEPENDS" "general;kdeui;general;kutils;general;kmime;")
  SET("kresources_LIB_DEPENDS" "general;kio;")
  SET("ktnef_LIB_DEPENDS" "general;kio;general;kabc;general;kcal;")
  SET("kxmlrpcclient_LIB_DEPENDS" "general;kio;")
  SET("mailtransport_LIB_DEPENDS" "general;kio;")
  SET("qgpgme_LIB_DEPENDS" "general;/usr/lib64/qt4/libQtCore.so;general;-lpthread;general;gpgme++-pthread;")
  SET("syndication_LIB_DEPENDS" "general;kio;")
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
  # Information for CMake 2.4 and lower.
  SET("akonadi-kabc_LIB_DEPENDS" "akonadi-kde;/usr/lib64/qt4/libQtGui.so;kdecore;")
  SET("akonadi-kde_LIB_DEPENDS" "solid;/usr/lib64/qt4/libQtNetwork.so;/usr/lib64/qt4/libQtDBus.so;/usr/lib64/qt4/libQtSql.so;kdeui;kio;/usr/lib64/libakonadiprotocolinternals.so;")
  SET("akonadi-kmime_LIB_DEPENDS" "akonadi-kde;kmime;/usr/lib64/qt4/libQtGui.so;kdecore;kio;")
  SET("gpgmepp-pthread_LIB_DEPENDS" "/usr/lib64/libgpgme-pthread.so;/usr/lib64/libpthread.so;/usr/lib64/libgpg-error.so;")
  SET("gpgmepp_LIB_DEPENDS" "/usr/lib64/libgpgme.so;/usr/lib64/libgpg-error.so;")
  SET("kabc_LIB_DEPENDS" "kresources;kldap;kdeui;kdecore;")
  SET("kabc_directory_LIB_DEPENDS" "kio;kabc;kresources;")
  SET("kabc_file_LIB_DEPENDS" "/usr/lib64/qt4/libQtGui.so;kdecore;kabc;kabc_file_core;kresources;")
  SET("kabc_file_core_LIB_DEPENDS" "kio;kabc;kcal;kresources;")
  SET("kabc_ldapkio_LIB_DEPENDS" "kio;kabc;kldap;kresources;")
  SET("kabc_net_LIB_DEPENDS" "kio;kabc;kresources;")
  SET("kabcformat_binary_LIB_DEPENDS" "kdecore;kabc;")
  SET("kblog_LIB_DEPENDS" "kxmlrpcclient;syndication;kio;kcal;")
  SET("kcal_LIB_DEPENDS" "kdeui;kio;/usr/lib64/qt4/libQtXml.so;kresources;kabc;kpimutils;/usr/lib64/libical.so;/usr/lib64/libicalss.so;")
  SET("kcal_local_LIB_DEPENDS" "/usr/lib64/qt4/libQtGui.so;kdecore;kcal;kresources;")
  SET("kcal_localdir_LIB_DEPENDS" "/usr/lib64/qt4/libQtGui.so;kdecore;kcal;kresources;")
  SET("kcm_kresources_LIB_DEPENDS" "kdeui;kresources;")
  SET("kcm_mailtransport_LIB_DEPENDS" "kdeui;mailtransport;")
  SET("kimap_LIB_DEPENDS" "kdecore;")
  SET("kio_imap4_LIB_DEPENDS" "kmime;kimap;kio;/usr/lib64/libsasl2.so;")
  SET("kio_ldap_LIB_DEPENDS" "kio;kldap;")
  SET("kio_mbox_LIB_DEPENDS" "kio;")
  SET("kio_nntp_LIB_DEPENDS" "kio;")
  SET("kio_pop3_LIB_DEPENDS" "kio;/usr/lib64/libsasl2.so;")
  SET("kio_sieve_LIB_DEPENDS" "kio;/usr/lib64/libsasl2.so;")
  SET("kio_smtp_LIB_DEPENDS" "kio;/usr/lib64/libsasl2.so;")
  SET("kldap_LIB_DEPENDS" "kio;kdecore;/usr/lib64/libsasl2.so;")
  SET("kmime_LIB_DEPENDS" "kdecore;")
  SET("kpimidentities_LIB_DEPENDS" "kpimutils;kio;")
  SET("kpimutils_LIB_DEPENDS" "kdeui;kutils;kmime;")
  SET("kresources_LIB_DEPENDS" "kio;")
  SET("ktnef_LIB_DEPENDS" "kio;kabc;kcal;")
  SET("kxmlrpcclient_LIB_DEPENDS" "kio;")
  SET("mailtransport_LIB_DEPENDS" "kio;")
  SET("qgpgme_LIB_DEPENDS" "/usr/lib64/qt4/libQtCore.so;-lpthread;gpgme++-pthread;")
  SET("syndication_LIB_DEPENDS" "kio;")
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)


More information about the Kde-buildsystem mailing list