From patchwork Mon Jul 19 06:31:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 31493 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 91A6D27BC78; Mon, 19 Jul 2021 07:42:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5BD5627BC6B for ; Mon, 19 Jul 2021 07:42:15 +0100 (BST) Received: from localhost ([::1]:39032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Myk-00079M-C4 for patchwork@mira.cbaines.net; Mon, 19 Jul 2021 02:42:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Mpq-0006wH-1G for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5Mpp-00068g-Ot for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m5Mpp-0005i5-J4 for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49280] [PATCH v2 1/3] gnu: racket: Update to 8.2. 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.162667633721872 (code B ref 49280); Mon, 19 Jul 2021 06:33:01 +0000 Received: (at 49280) by debbugs.gnu.org; 19 Jul 2021 06:32:17 +0000 Received: from localhost ([127.0.0.1]:57895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5Mp7-0005gi-4a for submit@debbugs.gnu.org; Mon, 19 Jul 2021 02:32:17 -0400 Received: from mail-qk1-f170.google.com ([209.85.222.170]:46773) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5Mp5-0005gU-44 for 49280@debbugs.gnu.org; Mon, 19 Jul 2021 02:32:15 -0400 Received: by mail-qk1-f170.google.com with SMTP id k4so4773152qkj.13 for <49280@debbugs.gnu.org>; Sun, 18 Jul 2021 23:32:15 -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=vMsKNo2za+eT1rGqIPuUYMvhQu0c3btldwMi9wUHMMw=; b=AIups6S+ItHcXaktFB4qcgYo5w9Iegr030n5PNj2Gs+rk4f/zDmL14tX9JbJOqajNx c3W7QSFx409a1Ci5R7s9e8THhoC5c6CGyU80eYbet49t+y///GooIvdYsZJHQuPNewPg Kn0mEaSAR2jgfX/Mt09/ePUneUcU6Wu3P0BgnQGjAwQwBCzBeWW2HFHrNsY/A3ezHlS1 QzWmHKV0qQams1YRGi4NVf0WpxtZC5lIBsWZYIgHPktQtpgiWWNs0WoqH30WqvcbHeWN cb8xEeg3OX3w0MPdVKc+86xZUEoyRKnKfXgEKr4eK5cs8M03J+LhS7+hhGDYxyCr6iLU SD3w== 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=vMsKNo2za+eT1rGqIPuUYMvhQu0c3btldwMi9wUHMMw=; b=TvCQvxFDv2bMJPyD/5dn530Rg2ewlkWRig6S6McfV4KEDqFultyCYh2zCGb/0mU0X7 UNuZQe907Oe166DbFbs+uqEekfIFOObnTA6UF7CYjPuoc5r1BIegrotRUXrpbs0j/LhX f6etUyxJG6hMPiIm3jmY7nBGBdUbXH5LOdKNobpbDMW7x1z9kpeWggz9vZHHhWTmSn7p b1blUS5GsusbI/fxnVoN9Cd95Duk/LrufR2211GVmsuTAShkM0tvEziyFLIG+KaH/Cmq Gdb6CMZn0zDo+E67ZIVrdPxeH3e2tIRGz5MfF8TiArvX7Mon04Zec5b3aM6WynPt9Cip D+og== X-Gm-Message-State: AOAM531IsLHrw4vcAv6E+V2mDCVNR0l0k6DbsuJQCKK8h7OE73lC6iHg OSoR5beTeqLfv4Q6x9GOOd56+UlRinTI0dMQERw= X-Google-Smtp-Source: ABdhPJzvwsz/DP+u25yOmDjKDhy+7/zUAMiVw0XnjdqYMKjfgCejGdnJPMoKW6kfs2vpCjFdK3rqEg== X-Received: by 2002:a37:5d46:: with SMTP id r67mr22797494qkb.12.1626676329180; Sun, 18 Jul 2021 23:32:09 -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 b25sm7603573qkk.111.2021.07.18.23.32.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Jul 2021 23:32:08 -0700 (PDT) From: Philip McGrath Date: Mon, 19 Jul 2021 02:31:41 -0400 Message-Id: <20210719063143.788661-1-philip@philipmcgrath.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <270db91e-24f6-2754-7164-d0406aeebc60@philipmcgrath.com> References: <270db91e-24f6-2754-7164-d0406aeebc60@philipmcgrath.com> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/racket.scm (racket-minimal, racket): Update to 8.2. * gnu/packages/racket.scm (racket-minimal)[#:arguments]: Fix patch-config.rktd-lib-search-dirs phase. When a config.rktd file doesn't contain an entry for `lib-search-dirs`, the default is equivalent to `'(#f)`, not `'()`. --- gnu/packages/racket.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 2d606071fe..6b2a011d51 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -64,14 +64,14 @@ (define-public racket-minimal (package (name "racket-minimal") - (version "8.1") ; note: remember to also update racket! + (version "8.2") ; note: remember to also update racket! (source (origin (method url-fetch) (uri (map (lambda (base) (string-append base version "/racket-minimal-src.tgz")) %installer-mirrors)) - (sha256 "04zzqybpxss50n1jrwwq98539gw0y0ygpw9civl2sq3s4ww7m8l3") + (sha256 "13qfg56w554vdj5iwa8lpacy83s7bzhhyr44pjns68mkhj69ring") (patches (search-patches "racket-sh-via-rktio.patch")))) (home-page "https://racket-lang.org") @@ -125,7 +125,7 @@ 'lib-search-dirs (lambda (dirs) (append dirs extra-lib-search-dirs)) - null) + '(#f)) #:exists 'truncate/replace file))) "--" @@ -183,7 +183,7 @@ DrRacket IDE, are not included.") %installer-mirrors)) (sha256 (base32 - "0xdqwrwm604bbnr97h75dps2ixxz2svlw0fn0f674bn04dcfd60f")))) + "10sgzsraxzxp1k2y2wvz8rcjwvhbcd6k72l9lyqr34yazlwfdz26")))) (inputs `(;; sqlite and libraries for `racket/draw' are needed to build the doc. ("cairo" ,cairo) From patchwork Mon Jul 19 06:31:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 31494 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 1804027BC78; Mon, 19 Jul 2021 07:42:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6F6B427BC6B for ; Mon, 19 Jul 2021 07:42:37 +0100 (BST) Received: from localhost ([::1]:39622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Mz6-0007XQ-HT for patchwork@mira.cbaines.net; Mon, 19 Jul 2021 02:42:36 -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 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" X-getmail-retrieved-from-mailbox: Patches 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)))))))) From patchwork Mon Jul 19 06:31:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 31495 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 8A98327BC78; Mon, 19 Jul 2021 07:43:47 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4DA2027BC6B for ; Mon, 19 Jul 2021 07:43:46 +0100 (BST) Received: from localhost ([::1]:41226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5N0D-0000BS-8T for patchwork@mira.cbaines.net; Mon, 19 Jul 2021 02:43:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Mpq-0006zi-QA for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5Mpq-00069B-GD 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-0005iK-EZ for guix-patches@gnu.org; Mon, 19 Jul 2021 02:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49280] [PATCH v2 3/3] gnu: racket-minimal: Bootstrap from C. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 19 Jul 2021 06:33:02 +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.162667635721918 (code B ref 49280); Mon, 19 Jul 2021 06:33:02 +0000 Received: (at 49280) by debbugs.gnu.org; 19 Jul 2021 06:32:37 +0000 Received: from localhost ([127.0.0.1]:57901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5MpL-0005hM-2r for submit@debbugs.gnu.org; Mon, 19 Jul 2021 02:32:36 -0400 Received: from mail-qk1-f173.google.com ([209.85.222.173]:46790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5MpH-0005gv-Qc for 49280@debbugs.gnu.org; Mon, 19 Jul 2021 02:32:29 -0400 Received: by mail-qk1-f173.google.com with SMTP id k4so4773499qkj.13 for <49280@debbugs.gnu.org>; Sun, 18 Jul 2021 23:32:27 -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=1WqOxOGkqa3KOCsUbo3GPku8ondikjN87V0Z1yKWg4A=; b=PaSKZFU6zDu+Pgv+DOHbqMr0Am4Oxm6lDd79ZKjV8uwV3emx4OHc/1iIrrJ9UXdohP H7CGJjr42gGL4KG6jmIljHGUkcWOMkaSqilIT4DZNzhBtK9YZmt5MwKbplwUfttq8cSE OvsVYcxzMhncwIZuYbQ6ywNs9piMNuQ4rPhOJJbuOfcLXX/Boeg89dz/ofy5a+1Y3Sce 0wB4oyQ37YOCtUT3fZlrRRjKB0OLJcZebyqfNZhQQKxGsroa5uxYLg1rxpubpsZy1SX2 4jgfQDyUZt3Fz/EQN5NfH1cFnMBiTH8lbwnEfIYlW8s2HYMZIymFprfTtv3IeTN0KbdI 2f2A== 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=1WqOxOGkqa3KOCsUbo3GPku8ondikjN87V0Z1yKWg4A=; b=hEUKYhelpyAq2Qa4Kz+3i948Jl4nXJ4iXHgeSxDD6d8aXkEDaXnbFc8sEeSLnny/fk HHCRlQYrey8cEhBSKvzrb9Mmpamfb4HNbh4JnbQg/7BROHmuuhrADOIBGDalMxVXFxUi xzr8eNevJBbfRSBDewjTY2t2Qtc4fSVVkiloVX6EwkwkHyWE3huQKDoPko2wSAmJxwDS gSYVVbxPOZLS/ce37h/njM1E4Ukw15niOx5De2FrVtFkGI254Dli/J5MOZJW0H7r8xCX aBkbsp2ZwjRR0OSab6r5Gis4vr87fgQ6afN3SlXuhYHa1aXYSZcTD7M3nqkbIAqKT/6b ieUQ== X-Gm-Message-State: AOAM532etQUSilEyqG6MKKHYpiHpJOKuThozPjSRr7sBjWNoIvavIcZ0 6NcqmLUPmhWk63PvewlhgzSsk4c9N/vQnxXcjeA= X-Google-Smtp-Source: ABdhPJx8KU42ieT20jndHICgNk+3aRAZUFwWB/9G/K4iUhQWDOkAlgcst1qJe7OJpeMhE79V3OFKig== X-Received: by 2002:ae9:dd46:: with SMTP id r67mr21879339qkf.380.1626676342057; Sun, 18 Jul 2021 23:32:22 -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 m23sm6143092qtq.53.2021.07.18.23.32.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Jul 2021 23:32:21 -0700 (PDT) From: Philip McGrath Date: Mon, 19 Jul 2021 02:31:43 -0400 Message-Id: <20210719063143.788661-3-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 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" X-getmail-retrieved-from-mailbox: Patches This commit bootstraps the Racket compiler and runtime system from source, including Racket CS as well as both variants of Racket BC. (One remaining limitation is discussed in comments added to gnu/packages/racket.scm.) In the process, it moves to building minimal Racket from the Git repository, rather than the packaged source tarballs. The Git repository is slightly better as the ``corresponding source'': 1. A few packages especially closely tied to the Racket core implementation (like "compiler-lib", "base", and "racket-doc") are developed in the same Git repository. Having them use the same Guix origin, too, will help to keep them in sync. 2. The top-level Makefile in the Git repository is an important ``script[] used to control compilation and installation.'' In particular, it cooperates with the "distro-build" package to create the source tarballs and installers for a Racket distribution. (Racket supports a notion of custom distributions.) 3. It is ``the preferred form ... for making modifications'' to the core Racket implementation. Racket releases are tagged in the Git repository (e.g. "v8.1"). At the beginning of each release cycle, a branch is created to stabilizer a version for extra testing. Active development happens on the "master" branch. * gnu/packages/racket-minimal-sh-via-rktio.patch: Adjust for extra directory layer. * gnu/local/racket.scm (cfg-flag:sh-for-rktio, cfg-flag:enable-lt, cfg-flag:enable-racket, unpack-nanopass+stex, %main-repo-main-distribution-pkgs): New private variables. * gnu/local/racket.scm (racket-minimal)[source]: Use Git. [source](snippet): Unbundle nanopass, stex, and libffi. [native-inputs]: Use racket-bootstrap-chez-bootfiles, plus its dependencies (for Chez, plus a Racket for bootstrap pig). [arguments]: Revise extensively. * gnu/local/racket.scm (racket-minimal-bc-3m, racket-minimal-bc-cgc): New packages, hidden at least for now. (racket-bootstrap-chez-bootfiles): Another new package, but this one is especially likely to stay hidden. * gnu/local/racket.scm (racket)[origin](snippet): Unbundle packages developed in the main Git repository, but leave their links.rktd and pkgs.rktd entries in place. [native-inputs]: Add the main Racket Git repository. [arguments](#:phases): Adjust 'unpack-packages to also unpack package sources from the main Racket Git repository. --- .../patches/racket-minimal-sh-via-rktio.patch | 8 +- gnu/packages/racket.scm | 488 +++++++++++++----- 2 files changed, 359 insertions(+), 137 deletions(-) diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-minimal-sh-via-rktio.patch index b4fefd1514..6bc2ee8331 100644 --- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch +++ b/gnu/packages/patches/racket-minimal-sh-via-rktio.patch @@ -35,13 +35,13 @@ making this change at the C level is both: conditional and a runtime check that the file in the store exists, we make it much less likely that it will "leak" out of Guix. --- - src/rktio/rktio_process.c | 21 ++++++++++++++++++++- + racket/src/rktio/rktio_process.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) -diff --git a/src/rktio/rktio_process.c b/src/rktio/rktio_process.c +diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c index 89202436c0..465ebdd5c5 100644 ---- a/src/rktio/rktio_process.c -+++ b/src/rktio/rktio_process.c +--- a/racket/src/rktio/rktio_process.c ++++ b/racket/src/rktio/rktio_process.c @@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) /*========================================================================*/ diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index c095de42b3..0349b77704 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -31,7 +31,9 @@ #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (gnu packages) + #:use-module (gnu packages autotools) #:use-module (gnu packages bash) + #:use-module (gnu packages chez) #:use-module (gnu packages compression) #:use-module (gnu packages databases) #:use-module (gnu packages fontutils) @@ -40,25 +42,87 @@ #:use-module (gnu packages gtk) #:use-module (gnu packages image) #:use-module (gnu packages libedit) + #:use-module (gnu packages libffi) #:use-module (gnu packages multiprecision) #:use-module (gnu packages sqlite) #:use-module (gnu packages tls) #:use-module (gnu packages xorg)) +;; Commentary: +;; +;; Here's how bootstrapping minimal Racket works: +;; +;; - Racket BC [CGC] can be built with only a C compiler (except for +;; one caveat discussed below). +;; - Racket BC [3M] needs an existing Racket to run "xform", +;; which transforms its own C source code to add additional annotations +;; for the precise garbage collector. +;; - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme. +;; It also needs an existing Racket to compile Racket-implemented +;; parts of the runtime system to R6RS libraries. +;; - Chez Scheme also needs bootfiles for itself, but Racket can simulate +;; enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler +;; purely from source into Racket and apply the compiler to itself, +;; producing the needed bootfiles (albeit very slowly). +;; Any variant of Racket since version 7.1 can run the simulation. +;; +;; So, we build CGC to build 3M to build bootfiles and CS. +;; +;; One remaining bootstrapping limitation is that Racket's reader, module +;; system, and macro expander are implemented in Racket. For Racket CS, +;; they are compiled to R6RS libraries as discussed above. This note from the +;; README file applies to all such subsystems: +;; +;; The Racket version must be practically the same as the current Racket +;; verson, although it can be the Racket BC implementation (instead of +;; the Racket CS implementation). +;; +;; Unlike Chez Scheme boot files, the files generated in "schemified" +;; are human-readable and -editable Scheme code. That provides a way +;; out of bootstrapping black holes, even without BC. +;; +;; However, other Racket subsystems implemented in Racket for Racket CS +;; use older C implementations for Racket BC, whereas the reader, expander, +;; and module system were completely replaced with the Racket implementation +;; as of Racket 7.0. +;; +;; For Racket BC, the compiled "linklet" s-expressions (primitive modules) +;; are embeded in C as a static string constant. Eventually, they are further +;; compiled by the C-implemented Racket BC bytecode and JIT compilers. +;; (On platforms where Racket BC's JIT is not supported, yet another compiler +;; instead compiles the linklets to C code, but this is not a bootstrapping +;; issue.) +;; +;; Code: -(define %installer-mirrors - ;; Source: - ;; https://github.com/racket/racket-lang-org/blob/master/download/data.rkt#L58 - ;; Matthew Flatt says: "note that many are commented out" - ;; INVARIANT: End with a trailing "/"! - '("https://mirror.racket-lang.org/installers/" - "https://www.cs.utah.edu/plt/installers/" - "https://plt.cs.northwestern.edu/racket-mirror/" - "https://mirror.csclub.uwaterloo.ca/racket/racket-installers/" - ;; Universität Tübingen is using a self-signed HTTPS certificate: - "http://mirror.informatik.uni-tuebingen.de/mirror/racket/" - "https://racket.infogroep.be/" - )) +(define cfg-flag:sh-for-rktio + `(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" + (assoc-ref %build-inputs "sh") + "/bin/sh")) +(define cfg-flag:enable-lt + `(string-append "--enable-lt=" + (assoc-ref %build-inputs "libtool") + "/bin/libtool")) +(define cfg-flag:enable-racket + `(let ((racket (assoc-ref %build-inputs "racket"))) + (string-append "--enable-racket=" + racket + "/bin/racket"))) + +(define unpack-nanopass+stex + ;; Copied from chez-scheme. + ;; TODO: Eventually, we should refactor Chez Scheme + ;; enough to share more directly, so that we can make + ;; Racket's version of Chez avalable as a Guix package, + ;; e.g. for architectures not supported upstream. + ;; For now, we let Racket drive the Chez build process + ;; other than this step. + `(for-each (lambda (dep) + (define src + (assoc-ref (or native-inputs inputs) dep)) + (copy-recursively src dep + #:keep-mtime? #t)) + '("nanopass" "stex"))) (define-public racket-minimal @@ -67,96 +131,113 @@ (version "8.2") ; note: remember to also update racket! (source (origin - (method url-fetch) - (uri (map (lambda (base) - (string-append base version "/racket-minimal-src.tgz")) - %installer-mirrors)) - (sha256 "13qfg56w554vdj5iwa8lpacy83s7bzhhyr44pjns68mkhj69ring") - (patches (search-patches - "racket-minimal-sh-via-rktio.patch")))) - (home-page "https://racket-lang.org") - (synopsis "Racket without bundled packages such as DrRacket") + (method git-fetch) + (uri (git-reference + (url "https://github.com/racket/racket") + (commit (string-append "v" version)))) + (sha256 + "061bhiyjlvazph0dj9i3i3x2q5z53rp8h5cjwg3frjimkr45lncn") + (file-name (git-file-name name version)) + (patches (search-patches "racket-minimal-sh-via-rktio.patch")) + (snippet + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + ;; unbundle Chez submodules + (with-directory-excursion "racket/src/ChezScheme" + #$(origin-snippet (package-source chez-scheme))) + ;; unbundle libffi + (for-each + delete-file-recursively + '("racket/src/bc/foreign/libffi"))))))) (inputs - `(("openssl" ,openssl) + `(;; common to all racket-minimal variants: + ("openssl" ,openssl) ("sqlite" ,sqlite) ("sh" ,bash-minimal) + ;; only for CS ("zlib" ,zlib) ("zlib:static" ,zlib "static") ("lz4" ,lz4) ("lz4:static" ,lz4 "static"))) + (native-inputs + `(("bootfiles" ,racket-bootstrap-chez-bootfiles) + ,@(package-native-inputs racket-bootstrap-chez-bootfiles))) (build-system gnu-build-system) (arguments `(#:configure-flags - `(,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" - (assoc-ref %build-inputs "sh") - "/bin/sh") - "--enable-libz" - "--enable-liblz4") - #:modules - ((guix build gnu-build-system) - (guix build utils) - (srfi srfi-1)) + (list "--enable-csonly" + "--enable-libz" + "--enable-liblz4" + ,cfg-flag:enable-racket + ,cfg-flag:sh-for-rktio) + #:out-of-source? #true + ;; Tests are in packages like racket-test-core and + ;; main-distribution-test that aren't part of the main distribution. + #:tests? #f + #:modules ((ice-9 match) + (guix build gnu-build-system) + (guix build utils)) #:phases (modify-phases %standard-phases - (add-before 'configure 'pre-configure-minimal + (add-after 'unpack 'unpack-nanopass+stex + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (with-directory-excursion "racket/src/ChezScheme" + ,unpack-nanopass+stex) + #t)) + (add-after 'unpack-nanopass+stex 'unpack-bootfiles + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "racket/src/ChezScheme" + (copy-recursively + (string-append (assoc-ref inputs "bootfiles") "/boot") + "boot")) + #t)) + (add-before 'configure 'initialize-config.rktd (lambda* (#:key inputs #:allow-other-keys) - (chdir "src") + (define (write-racket-hash alist) + ;; inside must use dotted pair notation + (display "#hash(") + (for-each (match-lambda + ((k . v) + (format #t "(~s . ~s)" k v))) + alist) + (display ")\n")) + (mkdir-p "racket/etc") + (with-output-to-file "racket/etc/config.rktd" + (lambda () + (write-racket-hash + `((lib-search-dirs + . (#f ,@(map (lambda (lib) + (string-append (assoc-ref inputs lib) + "/lib")) + '("openssl" + "sqlite")))) + (catalogs + . (,(string-append + "https://download.racket-lang.org/releases/" + ,version + "/catalog/") + #f)))))) #t)) - (add-after 'build 'patch-config.rktd-lib-search-dirs - (lambda* (#:key inputs outputs #:allow-other-keys) - ;; We do this between the `build` and `install` phases - ;; so that we have racket to read and write the hash table, - ;; but it comes before `raco setup`, when foreign libraries - ;; are needed to build the documentation. - (define out (assoc-ref outputs "out")) - (apply invoke - "./cs/c/racketcs" - "-e" - ,(format #f - "~s" - '(let* ((args - (vector->list - (current-command-line-arguments))) - (file (car args)) - (extra-lib-search-dirs (cdr args))) - (write-to-file - (hash-update - (file->value file) - 'lib-search-dirs - (lambda (dirs) - (append dirs extra-lib-search-dirs)) - '(#f)) - #:exists 'truncate/replace - file))) - "--" - "../etc/config.rktd" - (filter-map (lambda (lib) - (cond - ((assoc-ref inputs lib) - => (lambda (pth) - (string-append pth "/lib"))) - (else - #f))) - '("cairo" - "fontconfig" - "glib" - "glu" - "gmp" - "gtk+" - "libjpeg" - "libpng" - "libx11" - "mesa" - "mpfr" - "openssl" - "pango" - "sqlite" - "unixodbc" - "libedit"))) - #t))) - ;; Tests are in packages like racket-test-core and - ;; main-distribution-test that aren't part of the main distribution. - #:tests? #f)) + (add-before 'configure 'change-directory + (lambda _ + (chdir "racket/src") + #t)) + (add-after 'install 'remove-pkgs-directory + ;; If the configured pkgs-dir exists, "pkgs.rktd" does not + ;; exist, and a lock file does not exist, commands like + ;; `raco pkg show` will try to create a lock file and fail + ;; due to the read-only store. + ;; Arguably this may be a bug in `pkg/private/lock`: + ;; see . + ;; As a workaround, remove the directory. + (lambda* (#:key outputs #:allow-other-keys) + ;; rmdir because we want an error if it isn't empty + (rmdir (string-append (assoc-ref outputs "out") + "/share/racket/pkgs")) + #t))))) + (home-page "https://racket-lang.org") + (synopsis "Racket without bundled packages such as DrRacket") (description "Racket is a general-purpose programming language in the Scheme family, with a large set of libraries and a compiler based on Chez Scheme. Racket is @@ -167,7 +248,164 @@ The ``minimal Racket'' distribution includes just enough of Racket for you to use @command{raco pkg} to install more. Bundled packages, such as the DrRacket IDE, are not included.") ;; https://download.racket-lang.org/license.html - (license (list lgpl3+ asl2.0 expat)))) + ;; The LGPL components are only used by Racket BC. + (license (list asl2.0 expat)))) + + +(define-public racket-minimal-bc-3m + (hidden-package + (package + (inherit racket-minimal) + (name "racket-minimal-bc-3m") + (inputs + `(("libffi" ,libffi) ;; <- only for BC variants + ,@(fold alist-delete + (package-inputs racket-minimal) + '("zlib" "zlib:static" "lz4" "lz4:static")))) + (native-inputs + `(("libtool" ,libtool) + ("racket" ,(if (%current-target-system) + racket-minimal + racket-minimal-bc-cgc)))) + (arguments + (substitute-keyword-arguments (package-arguments racket-minimal) + ((#:configure-flags _ '()) + `(list "--enable-bconly" + ,cfg-flag:enable-racket + ,cfg-flag:enable-lt + ,cfg-flag:sh-for-rktio)) + ((#:phases usual-phases) + `(modify-phases ,usual-phases + (delete 'unpack-nanopass+stex) + (delete 'unpack-bootfiles))))) + (synopsis "Minimal Racket with the BC [3M] runtime system") + (description "The Racket BC (``before Chez'' or ``bytecode'') +implementation was the default before Racket 8.0. It uses a compiler written +in C targeting architecture-independent bytecode, plus a JIT compiler on most +platforms. Racket BC has a different C API and supports a slightly different +set of architectures than the current default runtime system, Racket CS (based +on ``Chez Scheme''). + +This package is the normal implementation of Racket BC with a precise garbage +collector, 3M (``Moving Memory Manager'').") + ;; https://download.racket-lang.org/license.html + ;; The LGPL components are only used by Racket BC. + (license (list lgpl3+ asl2.0 expat))))) + + +(define-public racket-minimal-bc-cgc + (package + (inherit racket-minimal-bc-3m) + (name "racket-minimal-bc-cgc") + (native-inputs + (alist-delete "racket" (package-native-inputs racket-minimal-bc-3m))) + (arguments + (substitute-keyword-arguments (package-arguments racket-minimal-bc-3m) + ((#:configure-flags _ '()) + `(list "--enable-cgcdefault" + ,cfg-flag:enable-lt + ,cfg-flag:sh-for-rktio)))) + (synopsis "Old Racket implementation used for bootstrapping") + (description "This variant of the Racket BC (``before Chez'' or +``bytecode'') implementation is not recommended for general use. It uses +CGC (a ``Conservative Garbage Collector''), which was succeeded as default in +PLT Scheme version 370 (which translates to 3.7 in the current versioning +scheme) by the 3M variant, which in turn was succeeded in version 8.0 by the +Racket CS implementation. + +Racket BC [CGC] is primarily used for bootstrapping Racket BC [3M]. It may +also be used for embedding applications without the annotations needed in C +code to use the 3M garbage collector."))) + + +(define-public racket-bootstrap-chez-bootfiles + (hidden-package + (package + (inherit racket-minimal) + (name "racket-bootstrap-chez-bootfiles") + (inputs `()) + (native-inputs + `(("racket" ,(if (%current-target-system) + racket-minimal + racket-minimal-bc-3m)) + ("stex" ,@(assoc-ref (package-native-inputs chez-scheme) "stex")) + ("nanopass" ,@(assoc-ref (package-native-inputs chez-scheme) + "nanopass")))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'unpack-nanopass+stex + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (with-directory-excursion "racket/src/ChezScheme" + ,unpack-nanopass+stex) + #t)) + (delete 'configure) + (delete 'patch-generated-file-shebangs) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (with-directory-excursion "racket/src/ChezScheme" + (invoke (string-append (assoc-ref inputs "racket") + "/bin/racket") + "rktboot/main.rkt" + "--dest" (assoc-ref outputs "out"))) + #t)) + (delete 'check) + (delete 'install)))) + (synopsis "Chez Scheme bootfiles bootstrapped by Racket") + (description "Chez Scheme is a self-hosting compiler: building it +requires ``bootfiles'' containing the Scheme-implemented portions compiled for +the current platform. (Chez can then cross-compile bootfiles for all other +supported platforms.) + +The Racket package @code{cs-bootstrap} (part of the main Racket Git +repository) implements enough of a Chez Scheme simulation to load the Chez +Scheme compiler purely from source into Racket and apply the compiler to +itself, thus bootstrapping Chez Scheme. Bootstrapping takes about 10 times as +long as using an existing Chez Scheme, but @code{cs-bootstrap} supports Racket +7.1 and later, including the Racket BC variant. + +Note that the generated bootfiles are specific to Racket's fork of Chez +Scheme, and @code{cs-bootstrap} does not currently support building upstream +Chez Scheme.") + (license (list asl2.0))))) + + +(define %installer-mirrors + ;; Source: + ;; https://github.com/racket/racket-lang-org/blob/master/download/data.rkt#L58 + ;; Matthew Flatt says: "note that many are commented out" + ;; INVARIANT: End with a trailing "/"! + '("https://mirror.racket-lang.org/installers/" + "https://www.cs.utah.edu/plt/installers/" + "https://plt.cs.northwestern.edu/racket-mirror/" + "https://mirror.csclub.uwaterloo.ca/racket/racket-installers/" + ;; Universität Tübingen is using a self-signed HTTPS certificate: + "http://mirror.informatik.uni-tuebingen.de/mirror/racket/" + "https://racket.infogroep.be/" + )) + +(define %main-repo-main-distribution-pkgs + ;; These are the packages developed in the main Racket Git repository + ;; that are part of the main distribution. + '("at-exp-lib" + "base" + "compiler-lib" + ;; NOT "compiler-test" + "compiler" + "net-doc" + "net-lib" + ;; NOT "net-test" + "net" + ;; NOT "plt-services" + ;; NOT "racket-benchmarks" + ;; NOT "racket-build-guide" + "racket-doc" + "racket-index" + "racket-lib" + ;; NOT "racket-test-core" + ;; NOT "racket-test-extra" + ;; NOT "racket-test" + "zo-lib")) (define-public racket @@ -177,7 +415,7 @@ DrRacket IDE, are not included.") (version (package-version racket-minimal)) ; needed for origin uri to work (source (origin - (inherit (package-source racket-minimal)) + (method url-fetch) (uri (map (lambda (base) (string-append base version "/racket-src.tgz")) %installer-mirrors)) @@ -200,36 +438,10 @@ DrRacket IDE, are not included.") "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")))))) + (with-directory-excursion "share/pkgs" + (for-each delete-file-recursively + '#+%main-repo-main-distribution-pkgs)) + #t))))) (inputs `(("cairo" ,cairo) ("fontconfig" ,fontconfig) @@ -247,22 +459,32 @@ DrRacket IDE, are not included.") ("libedit" ,libedit))) (native-inputs `(("racket" ,racket-minimal) - ("extend-layer" ,extend-layer))) + ("extend-layer" ,extend-layer) + ("main-repo" ,(package-source racket-minimal)))) (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))) + (let ((unpack (assoc-ref %standard-phases 'unpack))) + (lambda* (#:key native-inputs inputs outputs #:allow-other-keys) + (let* ((racket (assoc-ref (or native-inputs inputs) "racket")) + (prefix (assoc-ref outputs "out")) + (pkgs-dir (string-append prefix "/share/racket/pkgs"))) + (mkdir-p pkgs-dir) + (copy-recursively + "share/links.rktd" + (string-append prefix "/share/racket/links.rktd")) + (copy-recursively "share/pkgs" pkgs-dir) + ;; NOTE: unpack changes the working directory + (unpack #:source (assoc-ref (or native-inputs inputs) + "main-repo")) + (for-each (lambda (pkg) + (define dest (string-append pkgs-dir "/" pkg)) + (mkdir-p dest) + (copy-recursively (string-append "pkgs/" pkg) + dest)) + ',%main-repo-main-distribution-pkgs) + #t)))) (replace 'configure (lambda* (#:key native-inputs inputs outputs #:allow-other-keys) (let ((racket (assoc-ref (or native-inputs inputs) "racket"))