From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eAI7O6nbeGF3bgAAgWs5BA (envelope-from ) for ; Wed, 27 Oct 2021 06:55:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id oAfbNqnbeGEiOQAAB5/wlQ (envelope-from ) for ; Wed, 27 Oct 2021 04:55:05 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A42588F0E for ; Wed, 27 Oct 2021 06:55:05 +0200 (CEST) Received: from localhost ([::1]:39678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfaxs-0003gn-R7 for larch@yhetil.org; Wed, 27 Oct 2021 00:55:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfawy-0001wn-NV for guix-patches@gnu.org; Wed, 27 Oct 2021 00:54:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfawy-0003pG-Fa for guix-patches@gnu.org; Wed, 27 Oct 2021 00:54:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfawy-0005A9-FF for guix-patches@gnu.org; Wed, 27 Oct 2021 00:54:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51428] [PATCH core-update-frozen 16/20] build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file in a phase. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 27 Oct 2021 04:54:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51428 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 51428@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 51428-submit@debbugs.gnu.org id=B51428.163531041819671 (code B ref 51428); Wed, 27 Oct 2021 04:54:08 +0000 Received: (at 51428) by debbugs.gnu.org; 27 Oct 2021 04:53:38 +0000 Received: from localhost ([127.0.0.1]:48148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfawT-000576-GX for submit@debbugs.gnu.org; Wed, 27 Oct 2021 00:53:37 -0400 Received: from mail-qk1-f177.google.com ([209.85.222.177]:37757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfawA-00054D-CW for 51428@debbugs.gnu.org; Wed, 27 Oct 2021 00:53:19 -0400 Received: by mail-qk1-f177.google.com with SMTP id bl14so1350158qkb.4 for <51428@debbugs.gnu.org>; Tue, 26 Oct 2021 21:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lcJyvTDuX1Mct9JWU1O38Y0Gv546sTduEy0txgkIzc8=; b=pH9Ft0HaaJO3gon2zGXmN3ryf8hPWBuLL1ywcdUHYOcfgwLPNadguStUaPBU3hAw1z HQ+ahH2uRR/5GKBiP/YdE+OSw+kCXSe8FuYXzBy/lOpkx1ynEgoyRj0BGFqS0s+1/wqG OrNsdyixyBv8vovrcGhNN/MOa2Q3h3qNohP14CjVyPTUiJGnU7OpyWV9GqvZ+pvAZICB Dzv0WmUpFDXjbvdYqe3IgnkaNTEP6vOYkDY0HIhuY4Lz+3UwUpGpcOtUaN1MU+ZyD2fM ubFsf6w/S2KBwn+OlVo6Hox6YwGmsds6vo4nNF+dIfLgYOBb6iE0aLGyvk+0cddYaFDG 4Ayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lcJyvTDuX1Mct9JWU1O38Y0Gv546sTduEy0txgkIzc8=; b=XchTZT0Y9wQjOmc8P+tdyIyu9BAxbbsWPA35o19vQHA1guZ8xUCojmfsgIcdbSjCvO dLj/aNKf0RGzmmA7bLdO9XIr34hUMYAhmVwTmekUcP0o3sJotqn0VzaaVi9OTC3RS1my Iz1S34Q6QC8eSHKgHwPg22/7ex9mxESuxYAMkOzQDK5kh6fyCZmjfNzRa9magVRa6ufZ t4y2ba7Ptx1XVPDnyPbA2V9OgtXmD9VOthObM8Pepw5epmNVXy1Hvf5JaqZvYyTWwnAc DeXkqB3S7Lt+PFbehGyYgWglfl80tpU+2/F3pA+GR5qtmJWPWTkcf0Q0njhMvgTaCKx/ /oOg== X-Gm-Message-State: AOAM532h9pC4BdEL+bp21UuGRTXsAqYLc3qjlpuJojRrXmNX9O+s0TVI 3e7hwpSud758wWCyEsCwcMYlx+khdHM= X-Google-Smtp-Source: ABdhPJwUuN8usioYLtTm3ZmC139yeVWgxXRHKlsfnTpK6rUWoljPn2mGBBhL8w3VTpNHuWRtYeWNtw== X-Received: by 2002:a37:b045:: with SMTP id z66mr22883336qke.271.1635310392631; Tue, 26 Oct 2021 21:53:12 -0700 (PDT) Received: from localhost.localdomain (dsl-10-133-98.b2b2c.ca. [72.10.133.98]) by smtp.gmail.com with ESMTPSA id bk13sm11868197qkb.58.2021.10.26.21.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 21:53:12 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 27 Oct 2021 00:51:47 -0400 Message-Id: <20211027045151.9889-16-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211027045151.9889-1-maxim.cournoyer@gmail.com> References: <20211027045151.9889-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635310505; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lcJyvTDuX1Mct9JWU1O38Y0Gv546sTduEy0txgkIzc8=; b=QAOhMfz78qipi4vx1eRWiDpEiIRLLV6Y7SwH0REKCT0NosJQ1ZEF3F8HDIXLTsTl7e6jLC YpltS0WbP/LGHetSF4mKEmoqr2PIdkTxREylDycn/f5hY2RlA1t4wYvorJ/va0ZQq5LhY0 FsWYVAXe5o4XpRsEHSuQDuFhNuGjzc3kEm28ck6nzoalEkjDFJbTpHEPbbQHVi45s3ZL0V zZbb9P06Nv0zQ4vF35tqZkb/mY3ekB5az1Hyc2SkbWvf2YhH96pgpQuUHpW/hiwNr7CkNl j6++5ZvhZJJhWPwRpKFw+UMFucQzRwM9L9VEiM/1jJkp3lj3wjnbP30e0JF9Rg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635310505; a=rsa-sha256; cv=none; b=Q83IY0Rk902vovAB0a0U8Sc0T/FojulUmwbZlK2nVaZ4eeNQJFSuOrfRTJpS5zUUzXQ3U8 37V+2Gz8jZiabxEZBuPfKkyCyPxoWR5ZmNHX2DmzjNcQ+uXeNXmD+b0kPEuQg1zdABbVaa lvVtuB4aZzl+4LQ/PnhqfgELPIrFJKBtQcswYcXI0tV95rf+bquvDgdHz96w3bWTvi6D1i NEalzcMLPlghr2gzcXECah8/OB7uH/TYumSdp4LQoyPCCtSPHgQrzViFXdohUzAZ5A4gNa YZtXjOlW+FgsXxS1aZzDPlqnhspX88GAOA6llVCnmhsq0FEZvrFwqPhCUTejRA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=pH9Ft0Ha; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 0.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=pH9Ft0Ha; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: A42588F0E X-Spam-Score: 0.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5tkGkt4rE1Jt Adding a profile hook to do so covers most use cases, but it is still necessary to have the gdk-pixbuf loaders cache file computed at build time, as software may expect to find loaders support at that time. * guix/build/glib-or-gtk-build-system.scm: Delete trailing #t. (%gdk-pixbuf-loaders-cache-file-prefix): New variable. (generate-gdk-pixbuf-loaders-cache): New procedure. (generate-gdk-pixbuf-loaders-cache-file): Add procedure... (%standard-phases): ... and register it as a build phase. --- guix/build-system/glib-or-gtk.scm | 5 ++- guix/build/glib-or-gtk-build-system.scm | 55 +++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm index 0c88f039d2..aa9703829b 100644 --- a/guix/build-system/glib-or-gtk.scm +++ b/guix/build-system/glib-or-gtk.scm @@ -26,6 +26,8 @@ (define-module (guix build-system glib-or-gtk) #:use-module (guix monads) #:use-module (guix derivations) #:use-module (guix search-paths) + #:use-module ((guix build glib-or-gtk-build-system) + #:select (%gdk-pixbuf-loaders-cache-file)) #:use-module (guix build-system) #:use-module (guix build-system gnu) #:use-module (guix packages) @@ -33,7 +35,8 @@ (define-module (guix build-system glib-or-gtk) #:export (%glib-or-gtk-build-system-modules glib-or-gtk-build glib-or-gtk-cross-build - glib-or-gtk-build-system)) + glib-or-gtk-build-system) + #:re-export (%gdk-pixbuf-loaders-cache-file)) ;for convenience ;; Commentary: ;; diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm index c2f814eaeb..785eb54fdc 100644 --- a/guix/build/glib-or-gtk-build-system.scm +++ b/guix/build/glib-or-gtk-build-system.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014, 2015 Ludovic Courtès ;;; Copyright © 2018 Mark H Weaver ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +29,8 @@ (define-module (guix build glib-or-gtk-build-system) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases + %gdk-pixbuf-loaders-cache-file + generate-gdk-pixbuf-loaders-cache glib-or-gtk-build)) ;; Commentary: @@ -183,8 +186,7 @@ (define handle-output (apply wrap-program program #:sh (sh) env-vars)) bin-list)))))) - (for-each handle-output outputs) - #t) + (for-each handle-output outputs)) (define* (compile-glib-schemas #:key outputs #:allow-other-keys) "Implement phase \"glib-or-gtk-compile-schemas\": compile \"glib\" schemas @@ -197,11 +199,56 @@ (define* (compile-glib-schemas #:key outputs #:allow-other-keys) (not (file-exists? (string-append schemasdir "/gschemas.compiled")))) (invoke "glib-compile-schemas" schemasdir))))) - outputs) - #t) + outputs)) + +(define %gdk-pixbuf-loaders-cache-file + "lib/gdk-pixbuf-2.0/2.10.0/loaders.cache") + +(define (generate-gdk-pixbuf-loaders-cache directories outputs) + "Generate the loaders.cache file used by gdk-pixbuf to locate the available +loaders among DIRECTORIES, and set the GDK_PIXBUF_MODULE_FILE environment +variable. The cache file is installed under OUTPUTS. Return the first cache +file name if one was created else #f." + (let* ((loaders (append-map + (cut find-files <> "^libpixbufloader-.*\\.so$") + directories)) + (outputs* (map (cut string-append <> "/" + %gdk-pixbuf-loaders-cache-file) + outputs)) + (loaders.cache (first outputs*)) + (loaders.cache-copies (cdr outputs*))) + (if (not (null? loaders)) + (begin + (mkdir-p (dirname loaders.cache)) + (setenv "GDK_PIXBUF_MODULE_FILE" loaders.cache) + (apply invoke "gdk-pixbuf-query-loaders" "--update-cache" loaders) + (for-each (lambda (f) + (mkdir-p (dirname f)) + (copy-file loaders.cache f)) + loaders.cache-copies) + loaders.cache) + #f))) + +(define* (generate-gdk-pixbuf-loaders-cache-file #:key inputs outputs + #:allow-other-keys) + "Build phase that Wraps the GENERATE-GDK-PIXBUF-LOADERS-CACHE procedure." + ;; Conditionally compute the cache file if the gdk-pixbuf command is + ;; available on PATH (it comes with gdk-pixbuf). + (when (which "gdk-pixbuf-query-loaders") + (let ((loaders.cache (generate-gdk-pixbuf-loaders-cache + (map cdr inputs) + (filter-map identity + (list + (assoc-ref outputs "out") + (assoc-ref outputs "bin") + (assoc-ref outputs "lib")))))) + (when loaders.cache + (format #t "GDK_PIXBUF_MODULE_FILE set to `~a'~%" loaders.cache))))) (define %standard-phases (modify-phases gnu:%standard-phases + (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file + generate-gdk-pixbuf-loaders-cache-file) (add-after 'install 'glib-or-gtk-compile-schemas compile-glib-schemas) (add-after 'install 'glib-or-gtk-wrap wrap-all-programs))) -- 2.33.1