Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Guix support #115

Merged
merged 5 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .guix/manifest.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
;; Fibers: cooperative, event-driven user-space threads.

;;;; Copyright (C) 2024 Ludovic Courtès <[email protected]>
;;;;
;;;; 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 <http://www.gnu.org/licenses/>.

(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))
civodul marked this conversation as resolved.
Show resolved Hide resolved
75 changes: 75 additions & 0 deletions .guix/modules/fibers-package.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
;; Fibers: cooperative, event-driven user-space threads.

;;;; Copyright (C) 2017 Christine Lemmer-Webber <[email protected]>
;;;; Copyright (C) 2024 Ludovic Courtès <[email protected]>
;;;;
;;;; 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 <http://www.gnu.org/licenses/>.

(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
civodul marked this conversation as resolved.
Show resolved Hide resolved
(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
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
63 changes: 0 additions & 63 deletions guix.scm

This file was deleted.

1 change: 1 addition & 0 deletions guix.scm
Loading