diff mbox series

[bug#36477,27/31] gnu: pkg-config: Fix cross-compilation.

Message ID 20190708095913.3460-28-m.othacehe@gmail.com
State Accepted
Headers show
Series Fix cross-compilation issues | expand

Commit Message

Mathieu Othacehe July 8, 2019, 9:59 a.m. UTC
* gnu/packages/pkg-config.scm (%pkg-config)[arguments]: Add configure-flags
to disable tests that fail when cross-compiling.
---
 gnu/packages/pkg-config.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Marius Bakke July 8, 2019, 6:29 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> writes:

> * gnu/packages/pkg-config.scm (%pkg-config)[arguments]: Add configure-flags
> to disable tests that fail when cross-compiling.
> ---
>  gnu/packages/pkg-config.scm | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/pkg-config.scm b/gnu/packages/pkg-config.scm
> index 6fc19a975d..0425854a75 100644
> --- a/gnu/packages/pkg-config.scm
> +++ b/gnu/packages/pkg-config.scm
> @@ -1,5 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
> +;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -48,7 +49,15 @@
>               (base32
>                "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"))))
>     (build-system gnu-build-system)
> -   (arguments `(#:configure-flags '("--with-internal-glib")))
> +   (arguments
> +    `(#:configure-flags
> +      '("--with-internal-glib"
> +        ,@(if (%current-target-system)
> +              '("glib_cv_stack_grows=no"
> +                "glib_cv_uscore=no"
> +                "ac_cv_func_posix_getpwuid_r=yes"
> +                "ac_cv_func_posix_getgrgid_r=yes")
> +              '()))))

Are these indicative of a problem in our cross stack, or a bug in the
pkg-config build system/code?

LGTM anyway.
Mathieu Othacehe July 25, 2019, 3:27 p.m. UTC | #2
> Are these indicative of a problem in our cross stack, or a bug in the
> pkg-config build system/code?
>
> LGTM anyway.

No those bits seems to be needed because of a problem in pkg-config
itself. See this nixpkg pkg-config package snippet:

--8<---------------cut here---------------start------------->8---
  configureFlags = [ "--with-internal-glib" ]
    ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ]
       # Can't run these tests while cross-compiling
    ++ optional (stdenv.hostPlatform != stdenv.buildPlatform)
       [ "glib_cv_stack_grows=no"
         "glib_cv_uscore=no"
         "ac_cv_func_posix_getpwuid_r=yes"
         "ac_cv_func_posix_getgrgid_r=yes"
       ];
--8<---------------cut here---------------end--------------->8---

Mathieu
Ricardo Wurmus July 25, 2019, 7:04 p.m. UTC | #3
Mathieu Othacehe <m.othacehe@gmail.com> writes:

>> Are these indicative of a problem in our cross stack, or a bug in the
>> pkg-config build system/code?
>>
>> LGTM anyway.
>
> No those bits seems to be needed because of a problem in pkg-config
> itself. See this nixpkg pkg-config package snippet:
>
> --8<---------------cut here---------------start------------->8---
>   configureFlags = [ "--with-internal-glib" ]
>     ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ]
>        # Can't run these tests while cross-compiling
>     ++ optional (stdenv.hostPlatform != stdenv.buildPlatform)
>        [ "glib_cv_stack_grows=no"
>          "glib_cv_uscore=no"
>          "ac_cv_func_posix_getpwuid_r=yes"
>          "ac_cv_func_posix_getgrgid_r=yes"
>        ];
> --8<---------------cut here---------------end--------------->8---

In this case it would be good to add a comment so that our future selves
won’t be confused.

Thanks!
diff mbox series

Patch

diff --git a/gnu/packages/pkg-config.scm b/gnu/packages/pkg-config.scm
index 6fc19a975d..0425854a75 100644
--- a/gnu/packages/pkg-config.scm
+++ b/gnu/packages/pkg-config.scm
@@ -1,5 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -48,7 +49,15 @@ 
              (base32
               "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"))))
    (build-system gnu-build-system)
-   (arguments `(#:configure-flags '("--with-internal-glib")))
+   (arguments
+    `(#:configure-flags
+      '("--with-internal-glib"
+        ,@(if (%current-target-system)
+              '("glib_cv_stack_grows=no"
+                "glib_cv_uscore=no"
+                "ac_cv_func_posix_getpwuid_r=yes"
+                "ac_cv_func_posix_getgrgid_r=yes")
+              '()))))
    (native-search-paths
     (list (search-path-specification
            (variable "PKG_CONFIG_PATH")