From 76362337b9f67fbe60de6c9288ab5ca054653d59 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Wed, 25 Aug 2021 14:37:39 +0200 Subject: gnu: xorg: Unify --disable-malloc0-returnsnull code. The idea is to keep the comments in one place, instead of copying them over and over. It's also documented more now. * gnu/packages/xorg.scm (malloc0-flags): New procedure. (libxext,libxrender,libx11,libxt): Use new procedures. --- gnu/packages/xorg.scm | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'gnu') diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm index 95d3442d36..1eaf95ff31 100644 --- a/gnu/packages/xorg.scm +++ b/gnu/packages/xorg.scm @@ -102,6 +102,16 @@ +;; When cross-compiling certain packages, "--disable-malloc0returnsnull" +;; needs to be passed. Otherwise, the configure script will try to run a +;; binary for the host on the build machine. +(define (malloc0-flags) + (if (%current-target-system) + ;; At least on glibc-based systems, malloc(0) evaluates to a non-NULL + ;; pointer (except in out-of-memory situations). On other systems, + ;; --enable-malloc0returnsnull might be required instead. + '("--disable-malloc0returnsnull") + '())) ;; packages without propagated input ;; (rationale for this separation: The packages in PROPAGATED_INPUTS need to @@ -4791,10 +4801,7 @@ cannot be adequately worked around on the client side of the wire.") (string-append "--mandir=" (assoc-ref %outputs "doc") "/share/man") - ;; Disable zero malloc check that fails when cross-compiling. - ,@(if (%current-target-system) - '("--disable-malloc0returnsnull") - '())))) + ,@(malloc0-flags)))) (propagated-inputs `(("xorgproto" ,xorgproto))) (inputs @@ -4884,11 +4891,7 @@ cannot be adequately worked around on the client side of the wire.") (build-system gnu-build-system) (arguments `(#:configure-flags - (list "--disable-static" - ;; Disable zero malloc check that fails when cross-compiling. - ,@(if (%current-target-system) - '("--disable-malloc0returnsnull") - '())))) + (list "--disable-static" ,@(malloc0-flags)))) (propagated-inputs `(("xorgproto" ,xorgproto))) (inputs @@ -5561,11 +5564,7 @@ draggable titlebars and borders.") (assoc-ref %outputs "doc") "/share/man") "--disable-static" - - ;; Disable zero malloc check that fails when cross-compiling. - ,@(if (%current-target-system) - '("--disable-malloc0returnsnull") - '())))) + ,@(malloc0-flags)))) (propagated-inputs `(("xorgproto" ,xorgproto) ("libxcb" ,libxcb))) @@ -5643,10 +5642,7 @@ draggable titlebars and borders.") (assoc-ref %outputs "doc") "/share/man") "--disable-static" - ;; Disable zero malloc check that fails when cross-compiling. - ,@(if (%current-target-system) - '("--disable-malloc0returnsnull") - '())))) + ,@(malloc0-flags)))) (propagated-inputs `(("libx11" ,libx11) ("libice" ,libice) -- cgit v1.2.3 '>...( 2023-01-11doc: contributing: Tweak the Commit Policy....Christopher Baines 2022-12-18doc: Fix typo....Tobias Geerinckx-Rice 2022-12-02doc: Recommend 'match-record'....Ludovic Courtès 2022-11-01doc: contributing: Use proper subsections....( 2022-10-28doc: contributing: Expand "Sending a Patch Series"....( 2022-10-27build-system: Add pyproject-build-system....Lars-Dominik Braun 2022-10-07doc: Add git send-email tip in 'Submitting Patches' section....Maxim Cournoyer 2022-09-25etc: teams: Add scope support....Mathieu Othacehe 2022-09-05doc: Add more info about commits signature local verification....Andrew Tropin 2022-08-30etc: Add tempel snippets....Nicolas Graves 2022-07-18doc: Fix the example of "Run `make` automatically"...Rostislav Svoboda 2022-07-15monad-repl: Add "build", "lower", and "verbosity" commands....Ludovic Courtès 2022-07-13doc: Prefer "guix show" over "guix package --show"....Ludovic Courtès 2022-07-11doc: Fix cross-reference to Git Info manual....Maxim Cournoyer 2022-07-07doc: Document the documentation process....jgart 2022-05-22doc: Fix typos....Tobias Geerinckx-Rice 2022-05-22import: Add Elm importer....Philip McGrath 2022-05-22guix: Add elm-build-system....Philip McGrath 2022-04-02doc: Document inclusion requirements for new translations....Julien Lepiller 2022-02-15doc: Move build commands to @example for clarity....Ludovic Courtès 2022-01-31doc: Add a rule of thumb to guide enabling new committers....Maxim Cournoyer 2022-01-28doc: Mention how to remedy "source file ... newer than compiled error"....Guix Together 2022-01-28doc: Explain the use of make clean-go when an ABI mismatch occurs....Guix Together 2022-01-10style: Add '--styling' option....Ludovic Courtès 2021-12-20doc: Remove extra closing paren....Ludovic Courtès 2021-12-02doc: Give more details about generating patches with base commit information....Leo Famulari 2021-11-17doc: Improve wording for param spec of `./configure`....Rostislav Svoboda 2021-10-25Add 'guix shell'....Ludovic Courtès