From patchwork Tue Feb 18 17:16:04 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: 38831 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 14BEC27BBEA; Tue, 18 Feb 2025 17:17:34 +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=ham 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 7BD3F27BBE2 for ; Tue, 18 Feb 2025 17:17:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tkRDf-0001XL-9y; Tue, 18 Feb 2025 12:17:15 -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 1tkRDT-0001Wa-KN for guix-patches@gnu.org; Tue, 18 Feb 2025 12:17: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 1tkRDT-0007IW-Be for guix-patches@gnu.org; Tue, 18 Feb 2025 12:17: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=iRc2i5A6xSAwqPY2bUHljdW/aum/2+0u8hu7gsAb41o=; b=pTW4d1LkLbyAn27ncJ2c12xC2bV1MgCTqXp36UHxwaHLk/Zkp+EPRKret4uETeoqJW9ir0hX7PVFDqhr3dIavp0Vl4RzKJ/G8G5sHSyeJTsNzT+Vr8ijuxVoJecCh/+HgOkFn3FyDcJj8XY7X4zIYzC3h1CqxXfJUnI5SXbRb216snCSkymFTUvrqacEec6JeJuaxzyrEjVx4adPFHRxgHm7gSRB8kirktglElnxP21SzZSVBLX4BsX+MO942OV9hd3W9nhpsoDKpc0dvMdv+50OqR1HQIIEBGiDTZqfeCztXNxg1SKi0lQiwqUC0OE0HMJ/Wlw07hhxLofibLdhfg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tkRDT-0000SX-5U for guix-patches@gnu.org; Tue, 18 Feb 2025 12:17:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76246] [PATCH v5 5/6] gnu: Add G-Golf's Adw-1 examples. Resent-From: Florian Pelz Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 18 Feb 2025 17:17:03 +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.17398990191724 (code B ref 76246); Tue, 18 Feb 2025 17:17:03 +0000 Received: (at 76246) by debbugs.gnu.org; 18 Feb 2025 17:16:59 +0000 Received: from localhost ([127.0.0.1]:60353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tkRDO-0000Rj-An for submit@debbugs.gnu.org; Tue, 18 Feb 2025 12:16:58 -0500 Received: from relay.yourmailgateway.de ([188.68.61.103]:58269) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tkRDK-0000RE-Iu for 76246@debbugs.gnu.org; Tue, 18 Feb 2025 12:16:56 -0500 Received: from mors-relay-8403.netcup.net (localhost [127.0.0.1]) by mors-relay-8403.netcup.net (Postfix) with ESMTPS id 4Yy5mP2SY8z8657 for <76246@debbugs.gnu.org>; Tue, 18 Feb 2025 18:16:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pelzflorian.de; s=key2; t=1739899013; bh=F1lJPQjvzXcD4XDrG2FyEaRK8OS8KgJfe3xnSQ/roAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SpsxpIqBJ/K0cjKip3vXBYCNmvStxcPpoEzD8VJPg+F0zsH1jfSL0wGlb9ZFnzG8f UrDgDHWHkIZ2XUBxAOWjCCLFtImb3KJhyjOjeC1KSSD4DhFYMt5OU6AD0FD/T6/l9L 6dbvMb1RS5avheOyUZzE3cjwvBTH/0AEjY1xMIs7kdrmnsi/DzoZyeDbFn8MtAE3l8 AOvimSrqcv5nEsvLlCv9ucuQhGPZ5W1AA4L7FpKQW6LrXmsb1H4qRPqSkf6EL01LvX I1WmfbU4Odux8DgxWV4nBGg5mlaQWQLt+HlmMHTYLgidh87Y+y9PPBS+88mAXgXyFR ugTlUn+HnIP0A== Received: from policy01-mors.netcup.net (unknown [46.38.225.35]) by mors-relay-8403.netcup.net (Postfix) with ESMTPS id 4Yy5mP249Nz8655 for <76246@debbugs.gnu.org>; Tue, 18 Feb 2025 18:16:53 +0100 (CET) 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 4Yy5mN49Ybz8tY3 for <76246@debbugs.gnu.org>; Tue, 18 Feb 2025 18:16:52 +0100 (CET) Received: from florianhp.fritz.box (ipb21a5dbf.dynamic.kabel-deutschland.de [178.26.93.191]) by mxe217.netcup.net (Postfix) with ESMTPSA id ED3A884631; Tue, 18 Feb 2025 18:16:46 +0100 (CET) From: Florian Pelz Date: Tue, 18 Feb 2025 18:16:04 +0100 Message-ID: <583fb5e4ad1bf844875ecf4c41d9e19afe8067ff.1739898237.git.pelzflorian@pelzflorian.de> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: ED3A884631 X-Rspamd-Server: rspamd-worker-8404 X-NC-CID: 2/KCI3+Hp3mAHg1R+QGlMOsPOWr4qPcjKF0zcP2Ss9GYzj6s200U2Kzu 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 | 135 +++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm index 0c7329c7ea..bac21afc4f 100644 --- a/gnu/packages/guile-xyz.scm +++ b/gnu/packages/guile-xyz.scm @@ -2813,6 +2813,141 @@ (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. We install to the + ;; documentation directory where examples are usually located, + ;; but we will later create a copy in /bin for `guix shell'. + (let ((port (open-file "Makefile" "al"))) + (format port " +prefix = ~a +bindir = $(prefix)/bin +examplesdir = $(prefix)/share/doc/g-golf/examples/adw-1 +.PHONY: install +install: + mkdir -p $(bindir) + mkdir -p $(examplesdir)/demo/icons + mkdir -p $(examplesdir)/demo/pages + for f in $(EXTRA_DIST); do \\ + cp -r $$f $(examplesdir)/$$f; \\ + done + cp demo/g-resources $(examplesdir)/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 "\ +/share/doc/g-golf/examples/adw-1/" 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 "\ +/share/doc/g-golf/examples/adw-1/" 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 'copy-binaries + (lambda _ + (copy-file (string-append + #$output "\ +/share/doc/g-golf/examples/adw-1/demo/adwaita-1-demo") + (string-append + #$output "/bin/adwaita-1-demo")) + (copy-file (string-append + #$output "\ +/share/doc/g-golf/examples/adw-1/hello-world") + (string-append + #$output "/bin/hello-world")))))))) + (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")