From 04725cf90a3f7284d50a27ef4ebc440b95803448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 17 Nov 2024 11:06:05 +0100 Subject: [PATCH 1/5] guix: Add a Guile module to define the package. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This follows the guidelines in . * .guix/modules/fibers-package.scm: New file, based on… * guix.scm: … this. Turn into a symlink to the above. * Makefile.am (EXTRA_DIST): Add both files. --- .guix/modules/fibers-package.scm | 59 +++++++++++++++++++++++++++++ Makefile.am | 2 + guix.scm | 64 +------------------------------- 3 files changed, 62 insertions(+), 63 deletions(-) create mode 100644 .guix/modules/fibers-package.scm mode change 100644 => 120000 guix.scm diff --git a/.guix/modules/fibers-package.scm b/.guix/modules/fibers-package.scm new file mode 100644 index 0000000..14b46f8 --- /dev/null +++ b/.guix/modules/fibers-package.scm @@ -0,0 +1,59 @@ +;; Fibers: cooperative, event-driven user-space threads. + +;;;; Copyright (C) 2017 Christine Lemmer-Webber +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public License +;;;; along with this program. If not, see . + +(define-module (fibers-package) + #:use-module (guix) + #:use-module (guix build-system gnu) + #:use-module (guix gexp) + #:use-module (guix git-download) + #:use-module (guix licenses) + #:use-module (guix packages) + #:use-module (gnu packages) + #:use-module (gnu packages pkg-config)) + +(define %source-dir (in-vicinity (current-source-directory) "../..")) + +(define-public guile-fibers + (package + (name "guile-fibers") + (version "git") + (source (local-file %source-dir "guile-fibers-checkout" + #:recursive? #t + #:select? (git-predicate %source-dir))) + (build-system gnu-build-system) + (native-inputs + (append (list pkg-config) + (map S '("autoconf" "automake" "libtool" + "texinfo" "gettext-minimal")))) + (inputs + (list (S "guile"))) + (synopsis "Lightweight concurrency facility for Guile") + (description + "Fibers is a Guile library that implements a a lightweight concurrency +facility, inspired by systems like Concurrent ML, Go, and Erlang. A fiber is +like a \"goroutine\" from the Go language: a lightweight thread-like +abstraction. Systems built with Fibers can scale up to millions of concurrent +fibers, tens of thousands of concurrent socket connections, and many parallel +cores. The Fibers library also provides Concurrent ML-like channels for +communication between fibers. + +Note that Fibers makes use of some Guile 2.1/2.2-specific features and +is not available for Guile 2.0.") + (home-page "https://github.com/wingo/fibers") + (license lgpl3+))) + +guile-fibers diff --git a/Makefile.am b/Makefile.am index f7aafd7..925c09c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -138,6 +138,8 @@ EXTRA_DIST += \ $(bin_SCRIPTS) \ $(TESTS) \ env.in \ + guix.scm \ + .guix/modules/fibers-package.scm \ HACKING \ COPYING.LESSER \ README.md \ diff --git a/guix.scm b/guix.scm deleted file mode 100644 index 07dc954..0000000 --- a/guix.scm +++ /dev/null @@ -1,63 +0,0 @@ -;; Fibers: cooperative, event-driven user-space threads. - -;;;; Copyright (C) 2017 Christine Lemmer-Webber -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public License -;;;; along with this program. If not, see . - -(use-modules (ice-9 popen) - (ice-9 match) - (ice-9 rdelim) - (srfi srfi-1) - (srfi srfi-26) - (guix build-system gnu) - (guix gexp) - (guix git-download) - (guix licenses) - (guix packages) - (gnu packages) - (gnu packages pkg-config)) - -(define %source-dir (dirname (current-filename))) -(define S specification->package) - -(define guile-fibers - (package - (name "guile-fibers") - (version "git") - (source (local-file %source-dir - #:recursive? #t - #:select? (git-predicate %source-dir))) - (build-system gnu-build-system) - (native-inputs - (append (list pkg-config) - (map S '("autoconf" "automake" "libtool" - "texinfo" "gettext-minimal")))) - (inputs - (list (S "guile"))) - (synopsis "Lightweight concurrency facility for Guile") - (description - "Fibers is a Guile library that implements a a lightweight concurrency -facility, inspired by systems like Concurrent ML, Go, and Erlang. A fiber is -like a \"goroutine\" from the Go language: a lightweight thread-like -abstraction. Systems built with Fibers can scale up to millions of concurrent -fibers, tens of thousands of concurrent socket connections, and many parallel -cores. The Fibers library also provides Concurrent ML-like channels for -communication between fibers. - -Note that Fibers makes use of some Guile 2.1/2.2-specific features and -is not available for Guile 2.0.") - (home-page "https://github.com/wingo/fibers") - (license lgpl3+))) - -guile-fibers diff --git a/guix.scm b/guix.scm new file mode 120000 index 0000000..ed7260a --- /dev/null +++ b/guix.scm @@ -0,0 +1 @@ +.guix/modules/fibers-package.scm \ No newline at end of file From 50f0d979ac28916f7458f3f20e8d4873edb8a355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 17 Nov 2024 11:09:59 +0100 Subject: [PATCH 2/5] =?UTF-8?q?guix:=20Avoid=20=E2=80=98specification->pac?= =?UTF-8?q?kage=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is clearer and less ambiguous: if the person has additional channels providing same-named packages, it will still refer to the canonical packages under (gnu packages …). * .guix/modules/fibers-package.scm (S): Remove. (guile-fibers)[native-inputs, inputs]: Directly refer to the right (gnu packages …) variables. [synopsis]: Remove outdated sentence. --- .guix/modules/fibers-package.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.guix/modules/fibers-package.scm b/.guix/modules/fibers-package.scm index 14b46f8..333af0c 100644 --- a/.guix/modules/fibers-package.scm +++ b/.guix/modules/fibers-package.scm @@ -23,7 +23,12 @@ #:use-module (guix licenses) #:use-module (guix packages) #:use-module (gnu packages) - #:use-module (gnu packages pkg-config)) + #:use-module (gnu packages autotools) + #:use-module (gnu packages gettext) + #:use-module (gnu packages guile) + #:use-module (gnu packages libevent) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages texinfo)) (define %source-dir (in-vicinity (current-source-directory) "../..")) @@ -36,11 +41,9 @@ #:select? (git-predicate %source-dir))) (build-system gnu-build-system) (native-inputs - (append (list pkg-config) - (map S '("autoconf" "automake" "libtool" - "texinfo" "gettext-minimal")))) + (list autoconf automake libtool texinfo gettext-minimal pkg-config)) (inputs - (list (S "guile"))) + (list guile-3.0)) (synopsis "Lightweight concurrency facility for Guile") (description "Fibers is a Guile library that implements a a lightweight concurrency @@ -49,10 +52,7 @@ like a \"goroutine\" from the Go language: a lightweight thread-like abstraction. Systems built with Fibers can scale up to millions of concurrent fibers, tens of thousands of concurrent socket connections, and many parallel cores. The Fibers library also provides Concurrent ML-like channels for -communication between fibers. - -Note that Fibers makes use of some Guile 2.1/2.2-specific features and -is not available for Guile 2.0.") +communication between fibers.") (home-page "https://github.com/wingo/fibers") (license lgpl3+))) From 2211be788592eff452be86da1cf702109ff2889d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 17 Nov 2024 11:22:57 +0100 Subject: [PATCH 3/5] guix: Define variants for Guile 2.2 and libevent. * .guix/modules/fibers-package.scm (guile2.2-fibers) (guile-fibers/libevent): New variables. --- .guix/modules/fibers-package.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.guix/modules/fibers-package.scm b/.guix/modules/fibers-package.scm index 333af0c..f799dfa 100644 --- a/.guix/modules/fibers-package.scm +++ b/.guix/modules/fibers-package.scm @@ -1,6 +1,7 @@ ;; Fibers: cooperative, event-driven user-space threads. ;;;; Copyright (C) 2017 Christine Lemmer-Webber +;;;; Copyright (C) 2024 Ludovic Courtès ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -56,4 +57,18 @@ communication between fibers.") (home-page "https://github.com/wingo/fibers") (license lgpl3+))) +(define-public guile2.2-fibers + (package/inherit guile-fibers + (name "guile2.2-fibers") + (inputs (modify-inputs (package-inputs guile-fibers) + (replace "guile" guile-2.2))))) + +(define-public guile-fibers/libevent + (package/inherit guile-fibers + (name "guile-fibers-on-libevent") + (arguments + (list #:configure-flags #~(list "--disable-epoll"))) + (inputs (modify-inputs (package-inputs guile-fibers) + (append libevent))))) + guile-fibers From 0b6496e7b4c7ae7680892b1bec0636c59de87752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 17 Nov 2024 15:00:02 +0100 Subject: [PATCH 4/5] guix: Support cross-compilation. * .guix/modules/fibers-package.scm (guile-fibers)[native-inputs]: Add Guile. --- .guix/modules/fibers-package.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.guix/modules/fibers-package.scm b/.guix/modules/fibers-package.scm index f799dfa..d6c7736 100644 --- a/.guix/modules/fibers-package.scm +++ b/.guix/modules/fibers-package.scm @@ -42,7 +42,8 @@ #:select? (git-predicate %source-dir))) (build-system gnu-build-system) (native-inputs - (list autoconf automake libtool texinfo gettext-minimal pkg-config)) + (list autoconf automake libtool texinfo gettext-minimal pkg-config + (this-package-input "guile"))) ;for cross-compilation (inputs (list guile-3.0)) (synopsis "Lightweight concurrency facility for Guile") From 9dc3c95cc99d0bb0d0cbd95d0f0b74923a6f7397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 17 Nov 2024 17:17:20 +0100 Subject: [PATCH 5/5] guix: Add manifest to build relevant variants. * .guix/manifest.scm: New file. * Makefile.am (EXTRA_DIST): Add it. --- .guix/manifest.scm | 69 ++++++++++++++++++++++++++++++++++++++++++++++ Makefile.am | 1 + 2 files changed, 70 insertions(+) create mode 100644 .guix/manifest.scm diff --git a/.guix/manifest.scm b/.guix/manifest.scm new file mode 100644 index 0000000..8ce2ab7 --- /dev/null +++ b/.guix/manifest.scm @@ -0,0 +1,69 @@ +;; Fibers: cooperative, event-driven user-space threads. + +;;;; Copyright (C) 2024 Ludovic Courtès +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public License +;;;; along with this program. If not, see . + +(use-modules (guix) + (guix profiles) + (fibers-package) + (srfi srfi-1)) + +;;; Commentary: +;;; +;;; This file defines a manifest containing a configuration matrix for +;;; different native and cross-compilation targets and different variants. +;;; To build them, run: +;;; +;;; guix build -L .guix/modules -m manifest.scm +;;; +;;; Code: + +(define* (package->manifest-entry* package system + #:key target) + "Return a manifest entry for PACKAGE on SYSTEM, optionally cross-compiled to +TARGET." + (manifest-entry + (inherit (package->manifest-entry package)) + (name (string-append (package-name package) "." system + (if target + (string-append "." target) + ""))) + (item (with-parameters ((%current-system system) + (%current-target-system target)) + package)))) + +(define native-builds + (manifest + (append-map (lambda (system) + (map (lambda (package) + (package->manifest-entry* package system)) + (list guile-fibers + guile2.2-fibers + guile-fibers/libevent))) + '("x86_64-linux" + "i686-linux")))) + +(define cross-builds + (manifest + (map (lambda (target) + (package->manifest-entry* (if (string-contains target "linux") + guile-fibers + guile-fibers/libevent) + "x86_64-linux" + #:target target)) + '("i586-pc-gnu" + "aarch64-linux-gnu")))) + +(concatenate-manifests (list native-builds cross-builds)) diff --git a/Makefile.am b/Makefile.am index 925c09c..50ec67b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -139,6 +139,7 @@ EXTRA_DIST += \ $(TESTS) \ env.in \ guix.scm \ + .guix/manifest.scm \ .guix/modules/fibers-package.scm \ HACKING \ COPYING.LESSER \