guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 2372afa29586ac92a2e163a1136b7a77edbdc910
Author: AwesomeAdam54321 <[email protected]>
AuthorDate: Sat Nov 1 23:02:08 2025 +0800
gnu: Add ypsilon.
* gnu/packages/patches/ypsilon-Use-GNU-toolchain-as-default.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
Merges: https://codeberg.org/guix/guix/pulls/3994
Change-Id: I33a3ffd2ca1e5a3cd789cf9a1e50d8824a156404
Reviewed-by: Zhu Zihao <[email protected]>
Signed-off-by: Sharlatan Hellseher <[email protected]>
---
gnu/local.mk | 1 +
.../ypsilon-Use-GNU-toolchain-as-default.patch | 62 +++++++++++++++++++
gnu/packages/scheme.scm | 70 ++++++++++++++++++++++
3 files changed, 133 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index eed6ddf1b7..60892e32e7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2610,6 +2610,7 @@ dist_patch_DATA =
\
%D%/packages/patches/xygrib-newer-proj.patch \
%D%/packages/patches/yajl-CVE-2023-33460.patch \
%D%/packages/patches/yggdrasil-extra-config.patch \
+ %D%/packages/patches/ypsilon-Use-GNU-toolchain-as-default.patch \
%D%/packages/patches/zabbix-agent2-test-timezone-fix.patch \
%D%/packages/patches/zig-0.9-build-respect-PKG_CONFIG-env-var.patch \
%D%/packages/patches/zig-0.9-fix-runpath.patch \
diff --git a/gnu/packages/patches/ypsilon-Use-GNU-toolchain-as-default.patch
b/gnu/packages/patches/ypsilon-Use-GNU-toolchain-as-default.patch
new file mode 100644
index 0000000000..82a73fe2b8
--- /dev/null
+++ b/gnu/packages/patches/ypsilon-Use-GNU-toolchain-as-default.patch
@@ -0,0 +1,62 @@
+From bb45dc3a0ae24f383c401fa0a191c84797557391 Mon Sep 17 00:00:00 2001
+From: AwesomeAdam54321 <[email protected]>
+Date: Sat, 1 Nov 2025 20:00:21 +0800
+Subject: [PATCH] ypsilon: Use GNU toolchain as default.
+
+This is hacky, but it works. Ideally, the defaults should be adjusted
+according to the configuration.
+---
+ CMakeLists.txt | 10 +++++-----
+ Makefile | 6 +++---
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4aa2a75..d495e3d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,12 +23,12 @@ include_directories(${LLVM_INCLUDE_DIRS})
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+ add_definitions(${LLVM_DEFINITIONS_LIST})
+
+-set(CMAKE_C_COMPILER "clang")
+-set(CMAKE_CXX_COMPILER "clang++")
++set(CMAKE_C_COMPILER "gcc")
++set(CMAKE_CXX_COMPILER "g++")
+
+-if(NOT APPLE)
+- add_link_options("-fuse-ld=lld")
+-endif(NOT APPLE)
++#if(NOT APPLE)
++# add_link_options("-fuse-ld=lld")
++#endif(NOT APPLE)
+
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
+ set(CMAKE_LINKER_FLAGS_RELEASE "${CMAKE_LINKER_FLAGS_RELEASE} -flto")
+diff --git a/Makefile b/Makefile
+index 09b7a50..dd2eb1b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -8,9 +8,9 @@ PREFIX = /usr/local
+
+ CPPFLAGS = -DNDEBUG -DSYSTEM_SHARE_PATH='"$(DESTDIR)$(PREFIX)/share/$(PROG)"'
-DSYSTEM_EXTENSION_PATH='"$(DESTDIR)$(PREFIX)/lib/$(PROG)"'
+
+-CXX = clang++
++CXX = g++
+
+-CXXFLAGS = `llvm-config --cxxflags` -fcxx-exceptions
++CXXFLAGS = `llvm-config --cxxflags` -fexceptions
+
+ SRCS = file.cpp main.cpp object_heap_compact.cpp subr_flonum.cpp vm0.cpp
vm1.cpp vm2.cpp vm3.cpp object_set.cpp \
+ object_slab.cpp subr_list.cpp serialize.cpp vm3.cpp port.cpp
subr_others.cpp arith.cpp printer.cpp \
+@@ -45,7 +45,7 @@ ifneq (,$(findstring Linux, $(UNAME)))
+ endif
+ endif
+ CXXFLAGS += -O3 -pthread -fomit-frame-pointer -momit-leaf-frame-pointer
+- LDFLAGS = -fuse-ld=lld
++ #LDFLAGS = -fuse-ld=lld
+ LDLIBS = -Wl,--as-needed $(shell llvm-config --ldflags --system-libs --libs
all) -pthread -Wl,--no-as-needed -ldl
+ endif
+
+--
+2.51.0
+
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 0b886ca61e..fdeafdda1a 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -55,6 +55,7 @@
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix build-system asdf)
+ #:use-module (guix build-system cmake)
#:use-module (guix build-system copy)
#:use-module (guix build-system emacs)
#:use-module (guix build-system gnu)
@@ -87,6 +88,7 @@
#:use-module (gnu packages linux)
#:use-module (gnu packages lisp-check)
#:use-module (gnu packages lisp-xyz)
+ #:use-module (gnu packages llvm)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
#:use-module (gnu packages multiprecision)
@@ -667,6 +669,74 @@ syntactic extensions. The resulting expression or program
is then evaluated
by an existing Scheme implementation.")
(license license:expat))))
+(define-public ypsilon
+ (let ((commit "9982a834cd08bfa45e7db33b6a7b7d39c03f5632")
+ (revision "0"))
+ (package
+ (name "ypsilon")
+ (version "2.0.8")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/fujita-y/ypsilon")
+ (commit commit)))
+ (sha256
+ (base32 "199bggcdgww2c3r5fzlhzx7mdwl3l579skraar09bpjzp6kcxk1n"))
+ (patches (search-patches "ypsilon-Use-GNU-toolchain-as-default.patch"))
+ (file-name (git-file-name name version))))
+ (build-system cmake-build-system)
+ (inputs (list llvm-15 libffi))
+ (arguments
+ (list
+ #:out-of-source? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-asan
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ ;; TODO: Fix reported memory leak when rebuilding heap files
+ (("-fsanitize=address") ""))))
+ (add-after 'disable-asan 'disable-march
+ (lambda _
+ (substitute* "Makefile"
+ (("-march=x86") "")
+ (("-march=x86-64") ""))))
+ (add-after 'disable-march 'fix-test-sitelib
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("--sitelib=./test:./sitelib")
+ "--sitelib=./source/test:./source/sitelib"))
+ (substitute* '("CMakeLists.txt" "test/r6rs-lib.scm")
+ (("./test/") "./source/test/"))
+ (substitute* "test/r4rstest.scm"
+ (("(current-directory )\"test\"" all _)
+ (string-append _ "\"source/test\"")))))
+ (add-before 'configure 'set-home
+ (lambda _
+ (setenv "HOME"
+ (getcwd))))
+ (add-after 'build 'rebuild-heap-files
+ (lambda _
+ (substitute* "src/core.h"
+ (("(#define UNBOUND_GLOC_RETURN_UNSPEC )0" all _)
+ (string-append _ "1")))
+ (with-directory-excursion "heap"
+ (invoke "make"))
+ (invoke "make")
+ (with-directory-excursion "heap"
+ (invoke "make"))
+ (substitute* "src/core.h"
+ (("(#define UNBOUND_GLOC_RETURN_UNSPEC )1" all _)
+ (string-append _ "0")))
+ (invoke "make"))))))
+ (synopsis "R7RS/R6RS Scheme Implementation")
+ (description
+ "Ypsilon Scheme is an R7RS/R6RS Scheme implementation with
+on-the-fly FFI and native stub code generation, making use of the LLVM.")
+ (home-page "https://github.com/fujita-y/ypsilon")
+ (license license:bsd-2))))
+
(define-public scheme48-rx
(let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
(revision "2"))