From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KNJDK7Um9WB3NQEAgWs5BA (envelope-from ) for ; Mon, 19 Jul 2021 09:16:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yHQFJ7Um9WAhAgAAbx9fmQ (envelope-from ) for ; Mon, 19 Jul 2021 07:16: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 1C354C306 for ; Mon, 19 Jul 2021 09:16:05 +0200 (CEST) Received: from localhost ([::1]:39622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Myp-0007XQ-FL for larch@yhetil.org; Mon, 19 Jul 2021 02:42:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Mpq-0006xm-C8 for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5Mpq-00068l-2t for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m5Mpq-0005iC-1H for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49280] [PATCH v2 2/3] gnu: racket: Unbundle racket-minimal. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 19 Jul 2021 06:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49280 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49280@debbugs.gnu.org Cc: Philip McGrath Received: via spool by 49280-submit@debbugs.gnu.org id=B49280.162667634621895 (code B ref 49280); Mon, 19 Jul 2021 06:33:01 +0000 Received: (at 49280) by debbugs.gnu.org; 19 Jul 2021 06:32:26 +0000 Received: from localhost ([127.0.0.1]:57898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5MpF-0005h5-F8 for submit@debbugs.gnu.org; Mon, 19 Jul 2021 02:32:26 -0400 Received: from mail-qk1-f176.google.com ([209.85.222.176]:36684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5MpE-0005gr-7v for 49280@debbugs.gnu.org; Mon, 19 Jul 2021 02:32:24 -0400 Received: by mail-qk1-f176.google.com with SMTP id t185so15743036qkd.3 for <49280@debbugs.gnu.org>; Sun, 18 Jul 2021 23:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iW96FL7EK4CBlOJb96kjN+A4Q+pp07i4Dk2TCCho+sM=; b=A3cs/nm+hxqcIA9InS3HYf0y7csyqKWjBErTGuM9Xii9hKhrJXbBiB8QaIKSIcg7jJ 8nuLAH2GDQ6M7S4xbEUmQUckS9Nn5SbZGIbRCDhftn1JoKbTTJKBZt7KgyDtSV+Fzg5f ohnjWZzEb2ycCcLaduB3z4RjdaIe7koEBWOa+DdK0g1zw1L8R8WF6FtadJUQtp8d3fTM D6qrV/HUV3lPWAD6EF5j57MbofsJmC6gpKMPe8EVJIVwjy95IOiwTjss8CJ6/ljzsnGV tRVpu0Ut1ewaHYvWqpEA0qfrl1uovkieNiaqkW9iLGi5JcCDm7jl1MT6tgNMyGmjrFcX CIfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iW96FL7EK4CBlOJb96kjN+A4Q+pp07i4Dk2TCCho+sM=; b=ohBm40mlfbNSCDpq2cvoUZvFRfG5dlMkpB0A91VPR6RLbwanPCmEJ3MNRkTPueSaeM tuStt9imDYbIRz9Noi/jLjSIIQk+FqLaH4GITmJG1ofsIEJOTYacN6iAl5W1L+x8VfLw sAWKZ2ZFztkHk23V4Y8xdGnsFHOQ+PD5khaJUUd3CYt4wxceOApnJK/M3nqLlvHQLX5z 2BF5miqPYdWbhFdRgDMTPzmV75T7B8Iw2ncjtZpcEfk54hk34peJ5qjEXRSRTJ0cNko6 RuK0S/1hNp/L0xlTEDBRcI7CLdvK4CZp4+aabMg9tpp7Bb4H0NF4LUzdpyxu4N9OfGpQ sXmA== X-Gm-Message-State: AOAM532N4lMEqA4bta/7VijQIInYhGqCCC724exPx2ZF/MteGgg9tsHN BzbJCgTmGnxqKzZbTOfDn/HYTQTPeJCksiMI67s= X-Google-Smtp-Source: ABdhPJy5XIuikGlq0UDxErv6Vq0OXCFZ49041o3XSxO8YAJjo4sUfdCPTi7WIbUUKE0PBWfaztkuCQ== X-Received: by 2002:a37:66d3:: with SMTP id a202mr10561862qkc.262.1626676338605; Sun, 18 Jul 2021 23:32:18 -0700 (PDT) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id o27sm3590621qkk.124.2021.07.18.23.32.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Jul 2021 23:32:18 -0700 (PDT) From: Philip McGrath Date: Mon, 19 Jul 2021 02:31:42 -0400 Message-Id: <20210719063143.788661-2-philip@philipmcgrath.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210719063143.788661-1-philip@philipmcgrath.com> References: <270db91e-24f6-2754-7164-d0406aeebc60@philipmcgrath.com> <20210719063143.788661-1-philip@philipmcgrath.com> MIME-Version: 1.0 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=1626678965; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=iW96FL7EK4CBlOJb96kjN+A4Q+pp07i4Dk2TCCho+sM=; b=VXEudVCc1OI0s1TdTU5v/faLPup5UMoalTVGnrklJVPZal+AX2hvBCUjXoDu2SALrc5iKH lnSXzj9r7u/WUd3sLppc2YnTPARwv7BskyXzlkj6PX3dZpGNeJywxJwz04JbochWJZKU7X Ai503TUxO03sUrPRsz51KG9csgOwngZ2AcrvDhCLlnYdRXVvVthzc3MgZKuxDSlyZYj0Wg zYP+4jPIp6VxAUoYPm8Itj6nlewof/KuZLIo3dy+fCZFJ6Rlz0hLIGOT18ooErRiGFF3vZ NK+uvMCnq44ra3tbNrmPxts7DvDx6p6+O8qeiESPBBbo3uMpQHE1DmFitXl5tA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626678965; a=rsa-sha256; cv=none; b=GsMvcu6fn+zkhuyqQ7XS4VS2+rLBP/q4e1BrM2VRQqD0zMQ9DxOZhJIFMu7HvunqCUodZK BosqlcSWdm5cDdW8De0QegSXeYQwnLJMdJn9JEKbllwefoLfGN7IPkZcQXJbDGTE3rwaYt mjyEk85UuoYfffeXoPfjuieWltBd0D1zQoststEOjOjlP/hN+DskVzr1V6WFgq7X1cFPe5 KHwulW2Jv0NZYEdV69YHsKBpd7JRhVHTKuNlxp60jbD1z881IXu6tLOPGhEyx75MmrH1lA apoHdnwKUDIPT0FX8kvrJRYgWlXYO0nOtDyJfuzjSf1RJPcllIIVYM5nOBCs0g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b="A3cs/nm+"; dmarc=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: 5.09 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b="A3cs/nm+"; dmarc=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: 1C354C306 X-Spam-Score: 5.09 X-Migadu-Scanner: scn1.migadu.com X-TUID: RPkIpK/vvUK2 This change takes advantage of improved support for layered and tethered installations in Racket 8.2. * gnu/packages/racket.scm (extend-layer): New private variable. This is a script for configuring a new config-tethered layer chaining to an existing Racket installation. * gnu/packages/racket.scm (racket)[source](snippet): Unbundle `racket-minimal`. [inputs]: Remove inputs that properly belong to `racket-minimal`. [native-inputs]: Add `racket-minimal` and `extend-layer`. [arguments]: Stop inheriting from `racket-minimal`. Add phase 'unpack-packages to move the sources and links file into place. Replace 'configure phase using `extend-layer`. Replace 'build phase using `raco setup`. Delete 'install phase. * gnu/packages/patches/racket-sh-via-rktio.patch: Rename to ... * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: ... this file to placate `guix lint`. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/racket.scm (racket-minimal)[source]: Likewise. --- gnu/local.mk | 2 +- ...atch => racket-minimal-sh-via-rktio.patch} | 0 gnu/packages/racket.scm | 196 +++++++++++++++++- 3 files changed, 191 insertions(+), 7 deletions(-) rename gnu/packages/patches/{racket-sh-via-rktio.patch => racket-minimal-sh-via-rktio.patch} (100%) diff --git a/gnu/local.mk b/gnu/local.mk index 62a5e41a46..93c022d1b8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1673,7 +1673,7 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ - %D%/packages/patches/racket-sh-via-rktio.patch \ + %D%/packages/patches/racket-minimal-sh-via-rktio.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ %D%/packages/patches/rnp-add-version.cmake.patch \ diff --git a/gnu/packages/patches/racket-sh-via-rktio.patch b/gnu/packages/patches/racket-minimal-sh-via-rktio.patch similarity index 100% rename from gnu/packages/patches/racket-sh-via-rktio.patch rename to gnu/packages/patches/racket-minimal-sh-via-rktio.patch diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 6b2a011d51..c095de42b3 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -73,7 +73,7 @@ %installer-mirrors)) (sha256 "13qfg56w554vdj5iwa8lpacy83s7bzhhyr44pjns68mkhj69ring") (patches (search-patches - "racket-sh-via-rktio.patch")))) + "racket-minimal-sh-via-rktio.patch")))) (home-page "https://racket-lang.org") (synopsis "Racket without bundled packages such as DrRacket") (inputs @@ -183,10 +183,55 @@ DrRacket IDE, are not included.") %installer-mirrors)) (sha256 (base32 - "10sgzsraxzxp1k2y2wvz8rcjwvhbcd6k72l9lyqr34yazlwfdz26")))) + "10sgzsraxzxp1k2y2wvz8rcjwvhbcd6k72l9lyqr34yazlwfdz26")) + (snippet + (with-imported-modules '((guix build utils) + (ice-9 match) + (ice-9 regex)) + #~(begin + (use-modules (guix build utils) + (ice-9 match) + (ice-9 regex)) + ;; unbundle minimal Racket + (for-each delete-file-recursively + '("collects" + "doc" + "etc" + "README" + "src")) + ;; unbundle package sources included elsewhere + (define (substitute/delete file pattern) + (substitute + file + (list (cons pattern + (lambda (line matches) + ;; must match exactly once + (match matches + ((m) + (string-append (match:prefix m) + (match:suffix m))))))))) + (define (unbundle-pkg pkg) + (define quoted-pkg (regexp-quote pkg)) + (with-directory-excursion "share" + (substitute/delete + "links.rktd" + (string-append + "[(][^()]+[(]#\"pkgs\" #\"" + quoted-pkg + "\"[)][)]")) + (with-directory-excursion "pkgs" + (substitute/delete + "pkgs.rktd" + (string-append + "[(]\"" + quoted-pkg + "\" \\. #s[(]" + "(pkg-info|[(]sc-pkg-info pkg-info 3[)])" + " [(][^()]+[)] [^()]+[)][)]")) + (delete-file-recursively pkg)))) + (unbundle-pkg "racket-lib")))))) (inputs - `(;; sqlite and libraries for `racket/draw' are needed to build the doc. - ("cairo" ,cairo) + `(("cairo" ,cairo) ("fontconfig" ,fontconfig) ("glib" ,glib) ("glu" ,glu) @@ -199,8 +244,67 @@ DrRacket IDE, are not included.") ("mpfr" ,mpfr) ("pango" ,pango) ("unixodbc" ,unixodbc) - ("libedit" ,libedit) - ,@(package-inputs racket-minimal))) + ("libedit" ,libedit))) + (native-inputs + `(("racket" ,racket-minimal) + ("extend-layer" ,extend-layer))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'configure 'unpack-packages + (lambda* (#:key native-inputs inputs outputs #:allow-other-keys) + (let ((racket (assoc-ref (or native-inputs inputs) "racket")) + (prefix (assoc-ref outputs "out"))) + (mkdir-p (string-append prefix "/share/racket/pkgs")) + (copy-recursively + "share/links.rktd" + (string-append prefix "/share/racket/links.rktd")) + (copy-recursively + "share/pkgs" + (string-append prefix "/share/racket/pkgs")) + #t))) + (replace 'configure + (lambda* (#:key native-inputs inputs outputs #:allow-other-keys) + (let ((racket (assoc-ref (or native-inputs inputs) "racket")) + (prefix (assoc-ref outputs "out"))) + (apply invoke + (string-append racket "/bin/racket") + (assoc-ref inputs "extend-layer") + racket + prefix + (map + (lambda (lib) + (string-append (assoc-ref inputs lib) "/lib")) + '("cairo" + "fontconfig" + "glib" + "glu" + "gmp" + "gtk+" + "libjpeg" + "libpng" + "libx11" + "mesa" + "mpfr" + "pango" + "unixodbc" + "libedit"))) + #t))) + (replace 'build + (lambda* (#:key native-inputs inputs outputs #:allow-other-keys) + (invoke (string-append (assoc-ref (or native-inputs inputs) + "racket") + "/bin/racket") + "--config" + (string-append (assoc-ref outputs "out") + "/etc/racket") + "-l" + "raco" + "setup") + #t)) + (delete 'install)) + ;; we still don't have these: + #:tests? #f)) (synopsis "A programmable programming language in the Scheme family") (description "Racket is a general-purpose programming language in the Scheme family, @@ -211,3 +315,83 @@ languages to complete language implementations. The main Racket distribution comes with many bundled packages, including the DrRacket IDE, libraries for GUI and web programming, and implementations of languages such as Typed Racket, R5RS and R6RS Scheme, Algol 60, and Datalog."))) + + +(define extend-layer + (scheme-file + "extend-layer.rkt" + `(module + extend-layer racket/base + (require racket/cmdline + racket/match + racket/file + racket/list + racket/pretty) + (define config-file-pth + "etc/racket/config.rktd") + (define (build-path-string . args) + (path->string (apply build-path args))) + (define rx:racket + ;; Guile's reader doesn't support #rx"racket" + (regexp "racket")) + (command-line + #:args (parent-layer prefix . lib-dir*) + (let* ([config + (for/fold + ([config (file->value (build-path parent-layer + config-file-pth))]) + ([spec (in-list + '((lib-dir lib-search-dirs "lib/racket") + (share-dir share-search-dirs "share/racket") + (links-file + links-search-files + "share/racket/links.rktd") + (pkgs-dir pkgs-search-dirs "share/racket/pkgs") + (bin-dir bin-search-dirs "bin") + (man-dir man-search-dirs "share/man") + (doc-dir doc-search-dirs "share/doc/racket") + (include-dir + include-search-dirs + "include/racket")))]) + (match-define (list main-key search-key pth) spec) + (hash-set* + config + main-key + (build-path-string prefix pth) + search-key + (list* #f + (hash-ref config + main-key + (build-path-string parent-layer pth)) + (filter values (hash-ref config search-key null)))))] + [config + (hash-set config + 'apps-dir + (build-path-string prefix "share/applications"))] + [config + ;; place new foreign lib-search-dirs before old + ;; foreign dirs, but after Racket layers + (let-values + ([(rkt extra) + (partition (lambda (pth) + (or (not pth) + (regexp-match? rx:racket pth))) + (hash-ref config 'lib-search-dirs))]) + (hash-set config + 'lib-search-dirs + (append rkt + lib-dir* + extra)))] + [bin-dir + (hash-ref config 'bin-dir)] + [config + (hash-set* config + 'config-tethered-console-bin-dir bin-dir + 'config-tethered-gui-bin-dir bin-dir)] + [new-config-pth + (build-path prefix config-file-pth)]) + (make-parent-directory* new-config-pth) + (call-with-output-file* + new-config-pth + (lambda (out) + (pretty-write config out)))))))) -- 2.30.2