Hi, I was unlucky enough to handle cmake+multiarch issue for ibus-qt (*). Since there were no support from dh, I used override to do it.
>From that practical experience and some experiments and reading of cmake documentations lead me to propose two possible patches. I attach these 2 patches to debhelper (9.20131227) here for your review. Patch #1 (CMAKE_INSTALL_LIBDIR): The seemingly correct approach is the one with CMAKE_INSTALL_LIBDIR. This is also proposed by Chow Loong Jin in merged bug#722697. But this one requires me to patch the upstream src/CMakeLists.txt. Patch #2 (LIBDIR): The practical solution with LIBDIR inspired by the SPEC file handling of ${_libdir} will work on ibus-qt well but may not be safe solution. Other approaches: As I read my old http://bugs.debian.org/704812 , it seems I originally used bug fix proposed by Miura-san of setting -DCMAKE_LIBRARY_ARCHITECTURE=$(DEB_HOST_MULTIARCH). This seems to be another approach other than moving library by the brute-force mentioned in the bug #704812 report. (Thanks Scott helping out multiarch issues for ibus-qt in the past.) So many ways to address this issue and I am snot sure which one is the right one for debhelper. I also found the following info which seems to be interesting. (but beyond what I can make out of.) http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43f83d2ee523a38648322f629559694c71d5bb52 I think it is about time to have *recommended* and sane way to fix multiarch for cmake in debhelper. Since Alex made the Debian multiarch patch committed to cmake, I am wondering if Alex can also help Debian on how packages with cmake should be packaged? Regards, Osamu (*) ibus-qt: http://packages.qa.debian.org/i/ibus-qt.html http://anonscm.debian.org/gitweb/?p=pkg-ime/ibus-qt.git
>From 40672c0dfc569099f682f38078497768838c9fe5 Mon Sep 17 00:00:00 2001 From: Osamu Aoki <os...@debian.org> Date: Sat, 8 Feb 2014 16:54:20 +0900 Subject: [PATCH] pass multiarch path to -DCMAKE_INSTALL_LIBDIR == pros == This use of CMAKE_INSTALL_LIBDIR seems to be correct solution as suggested by http://bugs.debian.org/722697 This seems good solution as I read the source. http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs GNUInstallDirs: Define GNU standard installation directories Provides install directory variables as defined for GNU software: http://www.gnu.org/prep/standards/html_node/Directory-Variables.html Inclusion of this module defines the following variables: CMAKE_INSTALL_<dir> - destination for files of a given type CMAKE_INSTALL_FULL_<dir> - corresponding absolute path where <dir> is one of: ... LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian) ... Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of install() commands for the corresponding file type. If the includer does not define a value the above-shown default will be used and the value will appear in the cache for editing by the user. Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed from the corresponding destination by prepending (if necessary) the value of CMAKE_INSTALL_PREFIX. == cons == It does not work on some packages (ibus-qt) if no change is made. In order this to work, following patch was required in upstream source: | --- a/src/CMakeLists.txt | +++ b/src/CMakeLists.txt | @@ -104,7 +104,7 @@ | ) | | install(TARGETS ibus-qt | - LIBRARY DESTINATION ${LIBDIR}) | + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | install(FILES ${ibus_qt_HDRS} | DESTINATION include/ibus-qt COMPONENT Devel) | --- | Debian/Debhelper/Buildsystem/cmake.pm | 1 + | 1 file changed, 1 insertion(+) diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm index db971db..133e558 100644 --- a/Debian/Debhelper/Buildsystem/cmake.pm +++ b/Debian/Debhelper/Buildsystem/cmake.pm @@ -42,6 +42,7 @@ sub configure { # Standard set of cmake flags push @flags, "-DCMAKE_INSTALL_PREFIX=/usr"; + push @flags, "-DCMAKE_INSTALL_LIBDIR=lib/$multiarch"; push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON"; push @flags, "-DCMAKE_BUILD_TYPE=None"; -- 1.9.rc1
>From 92d3437e4e7179364519da8e9d30ed5cc29feb12 Mon Sep 17 00:00:00 2001 From: Osamu Aoki <os...@debian.org> Date: Sat, 8 Feb 2014 16:54:20 +0900 Subject: [PATCH] pass multiarch path to -DLIBDIR This is approach actually used to package ibus-qt. == pros == It works for me :-) (ibus-qt) This approach actually comes from : * how upstream CMakefile.txt sets default path * how rpm package sets installation path In CMakefile.txt: Define variables if(NOT LIBDIR) if( $ENV{MACHTYPE} MATCHES "64") set(LIBDIR lib64) else() set(LIBDIR lib) endif() endif(NOT LIBDIR) In ibus-qt.spec.in: %build %cmake \ -DCMAKE_INSTALL_PREFIX=%{_usr} \ -DLIBDIR=%{_libdir} == cons == This LIBDIR aproach does not seem to be official way to set it. It seems something internal to CMake. --- Debian/Debhelper/Buildsystem/cmake.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm index db971db..3a0888a 100644 --- a/Debian/Debhelper/Buildsystem/cmake.pm +++ b/Debian/Debhelper/Buildsystem/cmake.pm @@ -42,6 +42,7 @@ sub configure { # Standard set of cmake flags push @flags, "-DCMAKE_INSTALL_PREFIX=/usr"; + push @flags, "-DLIBDIR=/usr/lib/$multiarch"; push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON"; push @flags, "-DCMAKE_BUILD_TYPE=None"; -- 1.9.rc1