unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: 宋文武 <iyzsong@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 18926@debbugs.gnu.org
Subject: bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
Date: Mon, 03 Nov 2014 21:44:54 +0800	[thread overview]
Message-ID: <87sii02yax.fsf@gmail.com> (raw)
In-Reply-To: <87d295i556.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 4917 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> if CMAKE_INSTALL_LIBDIR not set to `lib`, GNUInstallDirs.cmake will install
>> libraries files to $out/lib64.
>
> I found several CMake-built libraries on x86_64 (graphite2, openjpeg,
> qjson) that all use lib/, not lib64/.
>
> Then I found one counterexample, libftdi; however, setting
> CMAKE_INSTALL_LIBDIR=lib doesn’t make any different: it still installs
> libraries in $out/lib64.  Any idea?
libftdi (not using GNUInstallDirs.cmake) handle this itself by
set LIB_SUFFIX, look like we have to set it specifically.
>
> Here’s the patch I tried:
>
> diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
> index 74b4f01..b1598dd 100644
> --- a/guix/build/cmake-build-system.scm
> +++ b/guix/build/cmake-build-system.scm
> @@ -53,6 +53,8 @@
>                                               build-type))
>                          '())
>                    ,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
> +                  ;; Install libraries to $prefix/lib, not $prefix/lib64.
> +                  "-DCMAKE_INSTALL_LIBDIR=lib"
>                    ;; add input libraries to rpath
>                    "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
>                    ;; add (other) libraries of the project itself to rpath
>
> According to <http://www.cmake.org/Wiki/CMake_Useful_Variables>,
> LIBRARY_OUTPUT_PATH might be better for this, no?
no, this is for build phase.
>
>> if CMAKE_PREFIX_PATH not set to PATH of `inputs`, cmake will unable to
>> find cmake modules of inputs.
>
> You’re talking about .cmake files, right?
yes, but now I find out that they can under both lib/cmake and share/cmake.
>
> Could you try the attached patch and report back?
>
> From 536c143997fa146dc77d6e8defc24032452e5a4c Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
> Date: Sun, 2 Nov 2014 23:54:28 +0100
> Subject: [PATCH] gnu: cmake: Add search paths for
>  CMAKE_{INCLUDE,LIBRARY,MODULE}_PATH.
>
> * gnu/packages/cmake.scm (cmake)[native-search-paths]: New field.
> * guix/build/cmake-build-system.scm (configure): Remove 'setenv' calls
>   for "CMAKE_LIBRARY_PATH" and "CMAKE_INCLUDE_PATH".
> ---
>  gnu/packages/cmake.scm            | 19 +++++++++++++++++++
>  guix/build/cmake-build-system.scm |  2 --
>  2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
> index 63805ef..e0349be 100644
> --- a/gnu/packages/cmake.scm
> +++ b/gnu/packages/cmake.scm
> @@ -100,6 +100,25 @@
>         ("expat"      ,expat)
>         ("bzip2"      ,bzip2)
>         ("libarchive" ,libarchive)))
> +
> +    (native-search-paths
> +     (list
> +      ;; Search path used by the 'FIND_XXX' functions.
> +      (search-path-specification
> +       (variable "CMAKE_PROGRAM_PATH")
> +       (directories '("bin")))
> +      (search-path-specification
> +       (variable "CMAKE_INCLUDE_PATH")
> +       (directories '("include")))
> +      (search-path-specification
> +       (variable "CMAKE_LIBRARY_PATH")
> +       (directories '("lib" "lib64")))
> +
> +      ;; Search path used by 'FIND_PACKAGE' and 'INCLUDE'.
> +      (search-path-specification
> +       (variable "CMAKE_MODULE_PATH")
> +       (directories '("lib/cmake")))))
> +
>      (home-page "http://www.cmake.org/")
>      (synopsis "Cross-platform build system")
>      (description
> diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
> index b1598dd..766797e 100644
> --- a/guix/build/cmake-build-system.scm
> +++ b/guix/build/cmake-build-system.scm
> @@ -60,8 +60,6 @@
>                    ;; add (other) libraries of the project itself to rpath
>                    ,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
>                    ,@configure-flags)))
> -      (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
> -      (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))
>        (format #t "running 'cmake' with arguments ~s~%" args)
>        (zero? (apply system* "cmake" args)))))
>  
> -- 
> 2.1.2
thanks for the patch, I have apply it, but it does not work.
because libqtxdg have qtxdg-config.cmake in $out/share/cmake/qt5xdg.

after add CMAKE_PREFIX_PATH with:

  (search-path-specification
    (variable "CMAKE_PREFIX_PATH")
    (directories '("")))

I could get liblxqt(use libqtxdg) build ok.

and by setting CMAKE_PREFIX_PATH, I think we can get rid of
CMAKE_PROGRAM_PATH, CMAKE_INCLUDE_PATH, and maybe CMAKE_LIBRARY_PATH.
see: http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html.
>
>
>> I find this when packaging https://github.com/lxdg/libqtxdg.
>
> It’s 404.
oh, sorry, it's https://github.com/lxde/libqtxdg

and here is the packages I'm working on:

[-- Attachment #2: lxqt.scm --]
[-- Type: application/octet-stream, Size: 1817 bytes --]

(define-module (lxqt)
  #:use-module (guix licenses)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix utils)
  #:use-module (guix build-system cmake)
  #:use-module (gnu packages)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages pkg-config))

(define-public libqtxdg
  (package
    (name "libqtxdg")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://lxqt.org/downloads/" name "/" version "/"
                           name "-" version ".tar.xz"))
       (sha256
        (base32
         "1qg2hjd0ybglvpxyx351lxms25nciipyilwpf7g42z5wg62j2xad"))))
    (build-system cmake-build-system)
    (arguments
     `(#:tests? #f ; failed
       #:configure-flags '("-DCMAKE_INSTALL_LIBDIR=lib"
                           "-DUSE_QT5=ON"
                           "-DBUILD_TESTS=ON")))
    (inputs
     `(("qt" ,qt)))
    (home-page "http://lxqt.org/")
    (synopsis "Qt implementation of freedesktop xdg specs")
    (description "FIXME")
    (license lgpl2.1+)))
  

(define-public liblxqt
  (package
    (name "liblxqt")
    (version "0.8.0")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://lxqt.org/downloads/lxqt/" version "/"
                           name "-" version ".tar.xz"))
       (sha256
        (base32
         "0kp36vb8zcaa1rkkdpqm966wh74l9jdla2mhrcw38hma1kiaf54r"))))
    (build-system cmake-build-system)
    (arguments
     `(#:tests? #f ; no check target
       #:configure-flags '("-DUSE_QT5=ON")))
    (native-inputs `(("pkg-config" ,pkg-config)))
    (inputs
     `(("qt" ,qt)
       ("libqtxdg" ,libqtxdg)))
    (home-page "http://lxqt.org/")
    (synopsis "Core utility library for all LXDE-Qt components")
    (description "FIXME")
    (license lgpl2.1+)))


  reply	other threads:[~2014-11-03 13:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-02 13:24 bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH 宋文武
2014-11-02 22:55 ` Ludovic Courtès
2014-11-03 13:44   ` 宋文武 [this message]
2014-11-03 16:53     ` Ludovic Courtès
2014-11-04 12:42       ` 宋文武
2015-01-04 17:06         ` Ludovic Courtès
2015-02-08 18:14           ` Ludovic Courtès
2015-03-01  9:58             ` Andreas Enge
2015-03-01 14:35               ` Ludovic Courtès
2015-03-01 20:11                 ` Andreas Enge
2015-03-14 15:11                   ` Andreas Enge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sii02yax.fsf@gmail.com \
    --to=iyzsong@gmail.com \
    --cc=18926@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).