pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/callcc: import callcc-0.3 as wip/callcc



Module Name:	pkgsrc-wip
Committed By:	Yorick Hardy <yorickhardy%gmail.com@localhost>
Pushed By:	yhardy
Date:		Wed Jul 22 22:43:08 2026 +0000
Changeset:	0f9b3236c30b451da3a800b98522aa1d83416b41

Modified Files:
	Makefile
Added Files:
	callcc/DESCR
	callcc/Makefile
	callcc/PLIST
	callcc/distinfo
	callcc/patches/patch-Makefile
	callcc/patches/patch-c_runtime.c
	callcc/patches/patch-compiler_bc.scm

Log Message:
wip/callcc: import callcc-0.3 as wip/callcc

An r7rs scheme compiler with an LLVM backend.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=0f9b3236c30b451da3a800b98522aa1d83416b41

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                             |  1 +
 callcc/DESCR                         |  1 +
 callcc/Makefile                      | 29 +++++++++++++++++
 callcc/PLIST                         | 61 ++++++++++++++++++++++++++++++++++++
 callcc/distinfo                      |  8 +++++
 callcc/patches/patch-Makefile        | 37 ++++++++++++++++++++++
 callcc/patches/patch-c_runtime.c     | 19 +++++++++++
 callcc/patches/patch-compiler_bc.scm | 23 ++++++++++++++
 8 files changed, 179 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 66a5c0cb66..4a880ed2ca 100644
--- a/Makefile
+++ b/Makefile
@@ -435,6 +435,7 @@ SUBDIR+=	cairo-dock
 SUBDIR+=	cairo-dock-plugins
 SUBDIR+=	cairo-java
 SUBDIR+=	calibre
+SUBDIR+=	callcc
 SUBDIR+=	calypso-git
 SUBDIR+=	canna
 SUBDIR+=	canna-canuum
diff --git a/callcc/DESCR b/callcc/DESCR
new file mode 100644
index 0000000000..0cbda1ab75
--- /dev/null
+++ b/callcc/DESCR
@@ -0,0 +1 @@
+An r7rs scheme compiler with an LLVM backend.
diff --git a/callcc/Makefile b/callcc/Makefile
new file mode 100644
index 0000000000..eb17cc3d44
--- /dev/null
+++ b/callcc/Makefile
@@ -0,0 +1,29 @@
+# $NetBSD$
+
+DISTNAME=	callcc-0.3
+CATEGORIES=	lang
+MASTER_SITES=	${MASTER_SITE_GITHUB:=djwatson/}
+GITHUB_TAG=	v${PKGVERSION_NOREV}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/djwatson/callcc/
+COMMENT=	R7RS scheme compiler with LLVM backend
+LICENSE=	mit
+
+WRKSRC=	${WRKDIR}/${DISTNAME}
+
+# Uses clang specific features
+PKGSRC_COMPILER=	clang
+USE_TOOLS+=		gmake pkg-config
+INSTALL_MAKE_FLAGS+=	PREFIX=${DESTDIR}${PREFIX}
+
+pre-build:
+	LIBS=`pkg-config --libs gmp libutf8proc`; \
+	${ECHO} "(define callcc-link-libs \"$${LIBS}\")" > ${WRKSRC}/compiler/bc-libs.scm
+
+.include "../../converters/utf8proc/buildlink3.mk"
+.include "../../devel/gmp/buildlink3.mk"
+BUILDLINK_DEPMETHOD.Gauche=	build
+.include "../../lang/gauche/buildlink3.mk"
+.include "../../lang/clang/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/callcc/PLIST b/callcc/PLIST
new file mode 100644
index 0000000000..8472fe15ec
--- /dev/null
+++ b/callcc/PLIST
@@ -0,0 +1,61 @@
+@comment $NetBSD$
+bin/callcc
+lib/callcc/compiler/bc-libs.scm
+lib/callcc/compiler/bc.chez.scm
+lib/callcc/compiler/bc.chicken.scm
+lib/callcc/compiler/bc.profile.chez.scm
+lib/callcc/compiler/bc.scm
+lib/callcc/compiler/bc.sld
+lib/callcc/compiler/expand.scm
+lib/callcc/compiler/expand.sld
+lib/callcc/compiler/fix-letrec.scm
+lib/callcc/compiler/format.scm
+lib/callcc/compiler/format.sld
+lib/callcc/compiler/headers/flow/all.sld
+lib/callcc/compiler/headers/scheme/base.sld
+lib/callcc/compiler/headers/scheme/case-lambda.sld
+lib/callcc/compiler/headers/scheme/char.sld
+lib/callcc/compiler/headers/scheme/complex.sld
+lib/callcc/compiler/headers/scheme/cxr.sld
+lib/callcc/compiler/headers/scheme/eval.sld
+lib/callcc/compiler/headers/scheme/file.sld
+lib/callcc/compiler/headers/scheme/inexact.sld
+lib/callcc/compiler/headers/scheme/lazy.sld
+lib/callcc/compiler/headers/scheme/load.sld
+lib/callcc/compiler/headers/scheme/process-context.sld
+lib/callcc/compiler/headers/scheme/r5rs.sld
+lib/callcc/compiler/headers/scheme/read.sld
+lib/callcc/compiler/headers/scheme/repl.sld
+lib/callcc/compiler/headers/scheme/syntax-case.sld
+lib/callcc/compiler/headers/scheme/time.sld
+lib/callcc/compiler/headers/scheme/write.sld
+lib/callcc/compiler/library-manager.scm
+lib/callcc/compiler/library-manager.sld
+lib/callcc/compiler/match.scm
+lib/callcc/compiler/match.sld
+lib/callcc/compiler/memory_layout.scm
+lib/callcc/compiler/passes.scm
+lib/callcc/compiler/passes.sld
+lib/callcc/compiler/qq.scm
+lib/callcc/compiler/stdlib.scm
+lib/callcc/compiler/sua.scm
+lib/callcc/compiler/util.scm
+lib/callcc/compiler/util.sld
+lib/callcc/lib/equal.scm
+lib/callcc/lib/eval.scm
+lib/callcc/lib/hashtable.scm
+lib/callcc/lib/read.scm
+lib/callcc/lib/runtime.scm
+lib/callcc/lib/srfi/1.sld
+lib/callcc/lib/srfi/151.sld
+lib/callcc/lib/srfi/2.sld
+lib/callcc/lib/srfi/28.sld
+lib/callcc/lib/srfi/37.sld
+lib/callcc/lib/srfi/64.sld
+lib/callcc/lib/srfi/69.sld
+lib/callcc/lib/srfi/bitwise-33.scm
+lib/callcc/lib/srfi/bitwise-60.scm
+lib/callcc/lib/srfi/bitwise-core.scm
+lib/callcc/lib/srfi/bitwise-other.scm
+lib/callcc/lib/str2num.scm
+lib/callcc/libcallcc.a
diff --git a/callcc/distinfo b/callcc/distinfo
new file mode 100644
index 0000000000..e646ecaeff
--- /dev/null
+++ b/callcc/distinfo
@@ -0,0 +1,8 @@
+$NetBSD$
+
+BLAKE2s (callcc-0.3.tar.gz) = 04f744818acc47174e318f7fecb19af323fc1d4cdfbd0e4b844a800f4c788399
+SHA512 (callcc-0.3.tar.gz) = 7bf9bf811cd8c8b4a5caa01442b725e97ea1d48fa7351e54784d90643ea1ece8e0bd76c5da5909a61df90a2bc16a769eab2312b8bc771ab374f84621dabccf5a
+Size (callcc-0.3.tar.gz) = 431285 bytes
+SHA1 (patch-Makefile) = 18b8d0080241ac013594b6904f43e6b6da0fc22b
+SHA1 (patch-c_runtime.c) = 5cb007aaecc23f0cafdfd243179d4a9db400f128
+SHA1 (patch-compiler_bc.scm) = 468c4493f111ddfb844ca15ad7b5b37fd47790cd
diff --git a/callcc/patches/patch-Makefile b/callcc/patches/patch-Makefile
new file mode 100644
index 0000000000..a9cbd259fc
--- /dev/null
+++ b/callcc/patches/patch-Makefile
@@ -0,0 +1,37 @@
+$NetBSD$
+
+Add linker flags for libgmp anf libutf8proc.
+
+--- Makefile.orig	2025-03-28 15:28:03.000000000 +0000
++++ Makefile
+@@ -1,11 +1,11 @@ CFLAGS = -O3 -flto=full -DNDEBUG -g  -std=gnu23 -Wall 
+ # callcc requires clang/llvm.
+ CC = clang
+ CFLAGS = -O3 -flto=full -DNDEBUG -g  -std=gnu23 -Wall  -march=native -mtune=native -ffat-lto-objects -Wextra -Wnull-dereference  -Wshadow -Wno-unused-parameter
+-LIBS = -lm -lgmp -lutf8proc
++LIBS = -lm -lgmp -lutf8proc ${LDFLAGS} $(shell pkg-config --libs gmp libutf8proc)
+ SRCS = c/alloc_table.c c/gc.c c/runtime.c c/util/list.c c/util/bitset.c c/callcc.S c/rodata_handler.c
+ OBJECTS = $(patsubst %, %.o, $(basename $(SRCS)))
+ SCM_LIB_SRCS = lib/runtime.scm lib/eval.scm lib/read.scm lib/equal.scm lib/hashtable.scm lib/str2num.scm  
+-SCM_COMPILER_SRCS = compiler/bc.scm compiler/expand.scm compiler/fix-letrec.scm compiler/library-manager.scm compiler/match.scm compiler/memory_layout.scm compiler/passes.scm compiler/qq.scm compiler/sua.scm compiler/util.scm compiler/gen-libraries.scm compiler/callcc.scm
++SCM_COMPILER_SRCS = compiler/bc.scm compiler/bc-libs.scm compiler/expand.scm compiler/fix-letrec.scm compiler/library-manager.scm compiler/match.scm compiler/memory_layout.scm compiler/passes.scm compiler/qq.scm compiler/sua.scm compiler/util.scm compiler/gen-libraries.scm compiler/callcc.scm
+ SCM_SRCS = ${SCM_LIB_SRCS} ${SCM_COMPILER_SRCS}
+ SRFI_SRCS = lib/srfi2/srfi/*.scm
+ PREFIX ?= /usr
+@@ -60,12 +60,14 @@ install: bin/callcc
+ 	install -d ${PREFIX}/lib/callcc/lib
+ 	install -d ${PREFIX}/lib/callcc/compiler
+ 	install libcallcc.a ${PREFIX}/lib/callcc/
+-	install -m644 compiler/bc.* ${PREFIX}/lib/callcc/compiler
++	install -m644 compiler/bc*scm ${PREFIX}/lib/callcc/compiler
++	install -m644 compiler/bc*sld ${PREFIX}/lib/callcc/compiler
+ 	install -m644 compiler/passes.* ${PREFIX}/lib/callcc/compiler
+ 	install -m644 compiler/fix-letrec.scm ${PREFIX}/lib/callcc/compiler
+ 	install -m644 compiler/qq.scm ${PREFIX}/lib/callcc/compiler
+ 	install -m644 compiler/sua.scm ${PREFIX}/lib/callcc/compiler
+-	install -m644 lib/runtime2.scm ${PREFIX}/lib/callcc/lib
++	# runtime2.scm does not exist? and runtime.scm is missing
++	install -m644 lib/runtime.scm ${PREFIX}/lib/callcc/lib
+ 	install -m644 lib/eval.scm ${PREFIX}/lib/callcc/lib
+ 	install -m644 compiler/memory_layout.scm ${PREFIX}/lib/callcc/compiler
+ 	install -m644 lib/str2num.scm ${PREFIX}/lib/callcc/lib
diff --git a/callcc/patches/patch-c_runtime.c b/callcc/patches/patch-c_runtime.c
new file mode 100644
index 0000000000..b7cdb7542c
--- /dev/null
+++ b/callcc/patches/patch-c_runtime.c
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Only use CLOCK_TAI (International Atomic Time) if it is available,
+otherwise fall back to CLOCK_REALTIME.
+
+--- c/runtime.c.orig	2026-07-21 21:08:06.697230118 +0000
++++ c/runtime.c
+@@ -2088,7 +2088,11 @@ gc_obj SCM_CURRENT_SECOND() {
+ 
+ gc_obj SCM_CURRENT_SECOND() {
+   struct timespec ts;
++#ifdef CLOCK_TAI
+   clock_gettime(CLOCK_TAI, &ts);
++#else
++  clock_gettime(CLOCK_REALTIME, &ts);
++#endif
+   double offset = 37; // TODO should be based on leap seconds.
+   double f = (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0) + offset;
+   return double_to_gc_slow(f);
diff --git a/callcc/patches/patch-compiler_bc.scm b/callcc/patches/patch-compiler_bc.scm
new file mode 100644
index 0000000000..e9bd509f48
--- /dev/null
+++ b/callcc/patches/patch-compiler_bc.scm
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Pass the pkg-config flags to the compiler. The flags are stored in
+"bc-libs.scm" at build time.
+
+--- compiler/bc.scm.orig	2026-07-22 19:24:59.899424994 +0000
++++ compiler/bc.scm
+@@ -1,3 +1,5 @@
++(include "bc-libs.scm")
++
+ (define next-id (make-counter 0))
+ 
+ (define-record-type fun (%make-fun code name last-label args thunk debug-id debug-loc-id) fun?
+@@ -589,7 +591,7 @@ attributes #0 = { returns_twice}
+        (display line) (newline)))
+ 
+ (define (get-link-command output output-file opts)
+-  (let ((link (format "clang ~a -g -o ~a ~a ~alibcallcc.a -lm -lgmp -lutf8proc"
+-		      opts output-file output (get-compile-path))))
++  (let ((link (format "clang ~a -g -o ~a ~a ~alibcallcc.a -lm ~a"
++		      opts output-file output (get-compile-path) callcc-link-libs)))
+     (display (format "Running link: ~a\n" link) (current-error-port))
+     link))


Home | Main Index | Thread Index | Old Index