From patchwork Mon Feb 17 11:05:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pelzflorian (Florian Pelz)" X-Patchwork-Id: 38775 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 640E327BBE9; Mon, 17 Feb 2025 11:07:20 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E756C27BBE2 for ; Mon, 17 Feb 2025 11:07:18 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tjyxz-0007SH-1c; Mon, 17 Feb 2025 06:07:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tjyxr-0007Rp-Rd for guix-patches@gnu.org; Mon, 17 Feb 2025 06:07:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tjyxq-0003zF-H7 for guix-patches@gnu.org; Mon, 17 Feb 2025 06:07:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=gReLAyhurXpzzNhV1h4xh6dKm6ugelJ6sO1iWlGvv2M=; b=SsnDxAyrP6L2WYqJFX8vKXxMsF43jbnMyQwqw3K3D6CJQWY14IziCmRbH12bekBfOCKaJ+8ndDw/k7FhaHQ6LsazliHFiXXpa4Zbq48lHDSN1OOPvC/FGsMZlTacZddL/SOMqTmyx7CcU0td0LszGYbxsnUSCSg7WYXSOg0hX9gamNfv2zKDpJn2l1mI5V/w2T2ADAEJNIO3uWt2FF00QLegarnAlXpMGLY7N/tlE9TpR4nfHkhLuOnMUj43CyBzW9SakF+eof4wUSfy877CtbaOqXi30KyZiaAr3IPWq6NvPaFBorHBrmT15F0GFFRXO27CtcUbTTqvXqYVNtPYLg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tjyxq-0006vn-C2 for guix-patches@gnu.org; Mon, 17 Feb 2025 06:07:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76246] [PATCH v4 5/5] gnu: Add G-Golf's Adw-1 examples. Resent-From: Florian Pelz Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Feb 2025 11:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76246 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76246@debbugs.gnu.org Cc: Florian Pelz Received: via spool by 76246-submit@debbugs.gnu.org id=B76246.173979039426525 (code B ref 76246); Mon, 17 Feb 2025 11:07:02 +0000 Received: (at 76246) by debbugs.gnu.org; 17 Feb 2025 11:06:34 +0000 Received: from localhost ([127.0.0.1]:43745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tjyxO-0006ti-20 for submit@debbugs.gnu.org; Mon, 17 Feb 2025 06:06:34 -0500 Received: from relay.yourmailgateway.de ([188.68.63.174]:46615) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tjyxL-0006tQ-RB for 76246@debbugs.gnu.org; Mon, 17 Feb 2025 06:06:32 -0500 Received: from mors-relay8204.netcup.net (localhost [127.0.0.1]) by mors-relay8204.netcup.net (Postfix) with ESMTPS id 4YxKbV6LQcz8blq for <76246@debbugs.gnu.org>; Mon, 17 Feb 2025 11:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pelzflorian.de; s=key2; t=1739790390; bh=MZbb/ZzOteQAEoDShPvv7a6cwFIFEHbBfrHMYYZIvJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QSa7TQHkT9lFxpXxqcWegJuC+prakBOkdJuhw3CoYlfLsFgJR7yxSUvdF7XBImYW8 hnfJVGHUcTATGX638TVOKEKt2r7t4A9WSqhdylDa7eHz+f1PHwFS0Fe9hydOsBRvhs EOLaOMJZsk4S+flLql333Hf2wrlC6LsTKbdBXEALSXRYg/Rgc9x+QmfVyPjb4za6Uj UlMnmwxFr4fMm/SqgMSSKluOiOCWfr9lL3a3dWSGtJKAU9JHuzAuELFZUKqKstji8l F6VtvDzgUirAsN+UX9uQ4/P246Bl3XCX05X2nIzhhQkmhVZgMoUScjCJanhmdguX0V OPqihUMr6hdkw== Received: from policy01-mors.netcup.net (unknown [46.38.225.35]) by mors-relay8204.netcup.net (Postfix) with ESMTPS id 4YxKbV5dNyz8bdp for <76246@debbugs.gnu.org>; Mon, 17 Feb 2025 11:06:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at policy01-mors.netcup.net Received: from mxe217.netcup.net (unknown [10.243.12.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by policy01-mors.netcup.net (Postfix) with ESMTPS id 4YxKbV0qW3z8stl for <76246@debbugs.gnu.org>; Mon, 17 Feb 2025 12:06:29 +0100 (CET) Received: from florianhp.fritz.box (ipb21a5dbf.dynamic.kabel-deutschland.de [178.26.93.191]) by mxe217.netcup.net (Postfix) with ESMTPSA id 7C58F8323F; Mon, 17 Feb 2025 12:06:24 +0100 (CET) From: Florian Pelz Date: Mon, 17 Feb 2025 12:05:41 +0100 Message-ID: <5e935a85a1f3b8727b103905d550c09942788cc2.1739789645.git.pelzflorian@pelzflorian.de> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 7C58F8323F X-Rspamd-Server: rspamd-worker-8404 X-NC-CID: Q1btbXl4u40jtzYWaury8rFveVWTsA+TMaUtmS6ua8NUXRLdzP2SWuGT 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/guile-xyz.scm (g-golf-adw-1-examples): New variable. Change-Id: I160e58ceaeb4867f9b21a0a32f198113e36b5c88 --- gnu/packages/guile-xyz.scm | 126 +++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm index 6e53bc291f..130652fb23 100644 --- a/gnu/packages/guile-xyz.scm +++ b/gnu/packages/guile-xyz.scm @@ -2804,6 +2804,132 @@ (define-public g-golf-gtk-4-examples g-golf-gtk-4-examples} for inspiration how to wrap G-Golf applications when writing a Guix package."))) +(define-public g-golf-adw-1-examples + (package + (inherit guile-g-golf) + (name "g-golf-adw-1-examples") + (build-system glib-or-gtk-build-system) + (arguments + (list + #:tests? #f ;there are no tests for examples + #:modules `(((guix build guile-build-system) + #:select + (target-guile-effective-version)) + (guix build glib-or-gtk-build-system) + (srfi srfi-26) + ,@%default-gnu-modules) + #:phases + (with-imported-modules `((guix build guile-build-system) + ,@%default-gnu-imported-modules) + #~(modify-phases %standard-phases + (add-after 'unpack 'prepare-examples + (lambda _ + (chdir "examples/adw-1") + ;; Re-use the existing Makefile for its wildcard syntax. + (rename-file "Makefile.am" "Makefile") + (substitute* "Makefile" + ;; Fix syntax error. + (("hello-world") + "hello-world \\")) + ;; Add a rule to install the examples. This also + ;; installs UI, CSS and Scheme files to /bin, but + ;; better keep how G-Golf packages them. + (let ((port (open-file "Makefile" "al"))) + (format port " +prefix = ~a +bindir = $(prefix)/bin +.PHONY: install +install: + mkdir -p $(bindir)/demo/icons + mkdir -p $(bindir)/demo/pages + for f in $(EXTRA_DIST); do \\ + cp -r $$f $(bindir)/$$f; \\ + done + cp demo/g-resources $(bindir)/demo/g-resources +" #$output) + (close-port port)))) + (delete 'configure) + (replace 'build + (lambda _ + ;; Create files for adwaita-1-demo needed in install phase. + (with-directory-excursion "demo" + (system* "make") + (system* "glib-compile-resources" + "--target" "g-resources" + "g-resources.xml")))) + (add-before 'install 'patch-scm-files + (lambda* (#:key inputs #:allow-other-keys) + ;; `current-filename' calls in examples are broken. + (map (lambda (binary) + (let ((installed-binary (string-append + #$output "/bin/" binary))) + (substitute* binary + (("\\(current-filename\\)") + (string-append "\"" installed-binary "\"")) + (("^exec guile ") + (string-append + "exec " (search-input-file inputs "/bin/guile") + " "))))) + (map (cut string-drop <> 2) ;strip ./ prefix + (find-files "." (lambda (file stat) + ;executables or .scm modules + (or (= (stat:perms stat) #o755) + (string-suffix? ".scm" + file)))))))) + (add-after 'install 'wrap-binaries + (lambda* (#:key inputs #:allow-other-keys) + (let* ((version (target-guile-effective-version)) + (g-golf (assoc-ref inputs "guile-g-golf")) + (adwaita-icons (assoc-ref inputs "adwaita-icon-theme")) + (libadwaita-icons (assoc-ref inputs "libadwaita")) + (scm (string-append "/share/guile/site/" version)) + (go (string-append "/lib/guile/" + version "/site-ccache")) + (binaries + (find-files "." (lambda (file stat) ;executables + (= (stat:perms stat) #o755))))) + (map (lambda (binary) + (let ((installed-binary (string-append + #$output "/bin/" binary))) + (wrap-program installed-binary + `("GUILE_LOAD_PATH" prefix + (,(string-append g-golf scm))) + `("GUILE_LOAD_COMPILED_PATH" prefix + (,(string-append g-golf go))) + `("GI_TYPELIB_PATH" prefix + (,(getenv "GI_TYPELIB_PATH"))) + `("GUIX_GDK_PIXBUF_MODULE_FILES" suffix + (,(getenv "GUIX_GDK_PIXBUF_MODULE_FILES"))) + `("XDG_DATA_DIRS" suffix + (,(string-append #$output "/bin/demo") + ,(string-append adwaita-icons "/share") + ,(string-append libadwaita-icons "/share")))))) + binaries)))) + (add-after 'wrap-binaries 'move-binaries + (lambda _ + ;; Move the adwaita-1-demo wrapper to place it directly in /bin. + (rename-file (string-append + #$output "/bin/demo/adwaita-1-demo") + (string-append + #$output "/bin/adwaita-1-demo")))))))) + (inputs + (list adwaita-icon-theme + bash-minimal + libadwaita + (librsvg-for-system) + gtk + guile-3.0 + guile-g-golf)) + (native-inputs (list `(,glib "bin") ;for glib-compile-resources + guile-3.0)) + (propagated-inputs (list)) + (synopsis "Example Adwaita 1 apps written in Guile with G-Golf") + (description + "G-Golf port of (a subset of) the upstream @code{adwaita-1-demo} examples +in the @code{libadwaita} Guix package. Run @command{guix edit +g-golf-adw-1-examples} for inspiration how to wrap G-Golf applications when +writing a Guix package."))) + (define-public g-wrap (package (name "g-wrap")