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/.guix/modules/fibers-package.scm b/.guix/modules/fibers-package.scm new file mode 100644 index 0000000..d6c7736 --- /dev/null +++ b/.guix/modules/fibers-package.scm @@ -0,0 +1,75 @@ +;; 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 +;;;; 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 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) "../..")) + +(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 + (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") + (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.") + (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 diff --git a/Makefile.am b/Makefile.am index f7aafd7..50ec67b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -138,6 +138,9 @@ EXTRA_DIST += \ $(bin_SCRIPTS) \ $(TESTS) \ env.in \ + guix.scm \ + .guix/manifest.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