Ports: Update the citron patches after upstreaming a few

This also switches to checking out a specific commit instead of just the
master HEAD, as the port linter requires a hash (which is imo pointless
in this case), and we can't provide a stable hash for the master branch
HEAD.
This commit is contained in:
Ali Mohammad Pur 2022-02-13 17:06:03 +03:30 committed by Ali Mohammad Pur
parent 4b412e8fee
commit b760a1a4ba
23 changed files with 135 additions and 529 deletions

View file

@ -3,9 +3,11 @@ port=citron
version=0.0.9.3
useconfigure=false
depends=(sparsehash libffi)
files="https://github.com/alimpfard/citron/archive/refs/heads/master.tar.gz citron.tar.gz d2a607bb662e2d862503a5eeb034ae65ce0bb9da5ad48c289d5325f2d0e14167"
commit_hash=d28b7d62bd61397e46152aa6e4ee59b115c0e2d7
archive_hash=0e31ab638c4fd1438f68fdf069336e2541eb4cfc5db2f55888f6175e0171a2ef
files="https://github.com/alimpfard/citron/archive/$commit_hash.tar.gz citron.tar.gz $archive_hash"
auth_type=sha256
workdir=citron-master
workdir="citron-$commit_hash"
pre_install() {
pushd "$workdir"

View file

@ -1,7 +1,7 @@
From ce1879683b5eaeca9695356098ceabec779eaf5a Mon Sep 17 00:00:00 2001
From 55c1e96ff844e75a9bf07114e00e27fabb7f54ee Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:13:52 +0330
Subject: [PATCH 03/18] Get rid of wordexp on serenity
Subject: [PATCH 1/9] Get rid of wordexp on serenity
---
src/file.c | 15 ++++++++++++++-

View file

@ -1,28 +0,0 @@
From a83779c90a4a76df21f81d70874997e5a318a95a Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:01:11 +0330
Subject: [PATCH 01/18] Remove -m(tune arch)=native
---
makefile | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/makefile b/makefile
index 5bcbf50..681859d 100644
--- a/makefile
+++ b/makefile
@@ -16,9 +16,8 @@ enable_inject ?= true
enable_ctypes ?= true
enable_inline_asm ?= false
-CFLAGS += -Wall -Wextra -Wno-unused-parameter -mtune=native\
- -march=native -D withTermios -D forLinux\
- -D CTR_STD_EXTENSION_PATH=\"$(DATADIR)\"
+CFLAGS += -Wall -Wextra -Wno-unused-parameter\
+ -D withTermios -D CTR_STD_EXTENSION_PATH=\"$(DATADIR)\"
ifeq ($(enable_inject),true)
CFLAGS += -DwithInjectNative=1
--
2.34.1

View file

@ -1,41 +0,0 @@
From 9041ece3381c69e9dbcc3c4b695e2fdad294f96b Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:12:15 +0330
Subject: [PATCH 02/18] Don't use execinfo on serenity
---
src/memory.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/memory.c b/src/memory.c
index cf30afe..f221e06 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -1,6 +1,8 @@
#include "citron.h"
#include <ctype.h>
+#ifndef __serenity__
#include <execinfo.h>
+#endif
#include <math.h>
#include <stdarg.h>
#include <stdint.h>
@@ -39,6 +41,7 @@ void sttrace_print(void* ptr)
{
if (likely(ptr))
return;
+#ifndef __serenity__
printf("MEMORY ALLOC %p\n", ptr);
void* array[99999];
size_t size;
@@ -52,6 +55,7 @@ void sttrace_print(void* ptr)
printf("%s\n", strings[i]);
free(strings);
+#endif
}
/**
--
2.34.1

View file

@ -1,7 +1,7 @@
From 5c9f017251de00b017b415cf58098b9719334206 Mon Sep 17 00:00:00 2001
From 9dd73dc37156e39a03cbf4c2af0d754bf84882ab Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:32:42 +0330
Subject: [PATCH 07/18] Make fiber a noop
Subject: [PATCH 2/9] Make fiber a noop
Serenity doesn't have ucontext.
---

View file

@ -1,7 +1,7 @@
From 77e316512a96d452446331bbb82799c70873a6bd Mon Sep 17 00:00:00 2001
From ee5ca4723aa24d850d13c9a3fcbf7f23250cc4b7 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:37:54 +0330
Subject: [PATCH 08/18] Make coroutines a noop
Subject: [PATCH 3/9] Make coroutines a noop
Serenity doesn't have ucontext.
---

View file

@ -1,14 +1,14 @@
From e4f3c3f40517f72440f575d2ea09aa9a8c3245fe Mon Sep 17 00:00:00 2001
From 3f73149c75a5755c2b45334abe682dd4b970144b Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:46:16 +0330
Subject: [PATCH 10/18] Don't mess with libsocket
Subject: [PATCH 4/9] Don't mess with libsocket
---
makefile | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
makefile | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/makefile b/makefile
index 681859d..7c0fbff 100644
index ded4d5a..b262cd0 100644
--- a/makefile
+++ b/makefile
@@ -2,7 +2,6 @@ DEBUG_VERSION := 1603
@ -17,30 +17,18 @@ index 681859d..7c0fbff 100644
new_makefile_l1 := $(shell perl -ne '/((DEBUG_VERSION := )(\d+))/ && print (sprintf("%s%s", "$$2", "$$3"+1));' $(location))
-LIBSOCKETDIR = src/lib/libsocket
BUILDDIR ?= build
BINDIR ?= /usr/local/bin
DATADIR ?= /usr/share/Citron
@@ -48,7 +47,7 @@ LEXTRACF += $(LDFLAGS) -flto -lstdc++
DESTDIR ?= /
BINDIR ?= $(DESTDIR)/usr/local/bin
@@ -57,7 +56,7 @@ LEXTRACF += $(LDFLAGS) -flto -lstdc++
OBJS = siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
lexer.o lexer_plug.o parser.o walker.o marshal.o reflect.o fiber.o \
importlib.o coroutine.o symbol.o generator.o base_extensions.o citron.o \
- promise.o symbol_cxx.o world.o libsocket.so
+ promise.o symbol_cxx.o world.o
EXTRAOBJS =
TCC_STATICS =
ifneq ($(findstring withInjectNative=1,$(CFLAGS)),)
@@ -74,10 +73,7 @@ COBJS := $(foreach obj,$(COBJS),$(BUILDDIR)/$(obj))
EXTRAOBJS := $(foreach obj,$(EXTRAOBJS),$(BUILDDIR)/$(obj))
all: CFLAGS += -O3 -fpic
-all: remove_libsocket_build cxx ctr ctrconfig
-
-remove_libsocket_build:
- @ rm -rf src/lib/libsocket/libsocket/build/
+all: cxx ctr ctrconfig
ctrconfig:
$(CC) src/ctrconfig.c -o $(BUILDDIR)/ctrconfig
@@ -120,7 +116,6 @@ debug: cxx ctr
@@ -131,7 +130,6 @@ debug: cxx ctr
clean:
rm -rf $(BUILDDIR)
@ -48,7 +36,7 @@ index 681859d..7c0fbff 100644
$(MAKE) -C src/lib/tcc clean
cxx:
@@ -135,10 +130,6 @@ build_tcc_statics:
@@ -146,10 +144,6 @@ build_tcc_statics:
$(BUILDDIR)/%.a: src/lib/tcc/%.a
cp $< $@

View file

@ -1,28 +0,0 @@
From 5198e9f4d722e94cbfa08e2833837b593857b63a Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:17:46 +0330
Subject: [PATCH 04/18] Use <fcntl.h> on serenity
---
src/system.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/system.c b/src/system.c
index 3b395bd..a117498 100644
--- a/src/system.c
+++ b/src/system.c
@@ -10,7 +10,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef __serenity__
+#include <fcntl.h>
+#else
#include <sys/fcntl.h>
+#endif
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>
--
2.34.1

View file

@ -1,7 +1,7 @@
From fc4aa62143b0b40fdff6beb224827121e8994378 Mon Sep 17 00:00:00 2001
From 345758e53e21b23c716c2efccdaccf5434f16f0e Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:49:59 +0330
Subject: [PATCH 11/18] Disable inject
Subject: [PATCH 5/9] Disable inject
tcc requires ucontext.
---
@ -9,10 +9,10 @@ tcc requires ucontext.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makefile b/makefile
index 7c0fbff..16c2c89 100644
index b262cd0..2e05795 100644
--- a/makefile
+++ b/makefile
@@ -11,7 +11,7 @@ INCLUDE_DIR ?= /usr/local/include/Citron
@@ -12,7 +12,7 @@ INCLUDE_DIR ?= $(DESTDIR)/usr/local/include/Citron
.PHONY: all ctrconfig libctr ctr install cxx
@ -20,7 +20,7 @@ index 7c0fbff..16c2c89 100644
+enable_inject ?= false
enable_ctypes ?= true
enable_inline_asm ?= false
enable_boehm_gc ?= true
--
2.34.1

View file

@ -1,25 +0,0 @@
From 669cb84c24184df7912ea5065d731f12191b5e67 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:27:38 +0330
Subject: [PATCH 05/18] Pull arc4random from stdlib.h
---
src/system.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/system.c b/src/system.c
index a117498..e42d09a 100644
--- a/src/system.c
+++ b/src/system.c
@@ -35,6 +35,8 @@ static struct termios oldTermios, newTermios;
#ifdef forLinux
# include <bsd/stdlib.h>
+#elif defined(__serenity__)
+// Nothing, they're in stdlib.h.
#else
// Arc4random
--
2.34.1

View file

@ -0,0 +1,34 @@
From e4b172e0a9db3eaa0c9c14c477e26185a2a596de Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:52:51 +0330
Subject: [PATCH 6/9] Disable openmp
---
makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
index 2e05795..d916511 100644
--- a/makefile
+++ b/makefile
@@ -96,7 +96,7 @@ $(BUILDDIR):
mkdir -p $@
$(BUILDDIR)/ctr: $(TCC_STATICS) $(BUILDDIR) $(OBJS) $(EXTRAOBJS)
- $(CXX) -fopenmp $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) $(LIBS) $(LEXTRACF) -o $@
+ $(CXX) $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) $(LIBS) $(LEXTRACF) -o $@
ctr: $(BUILDDIR)/ctr
@@ -145,7 +145,7 @@ $(BUILDDIR)/%.a: src/lib/tcc/%.a
cp $< $@
$(BUILDDIR)/%.o: src/%.c
- $(CC) -fopenmp $(CFLAGS) -c $< -o $@
+ $(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: src/%.cpp
$(CXX) -g $(CFLAGS) -c $< $(CXXFLAGS) -o $@
--
2.34.1

View file

@ -1,56 +0,0 @@
From 5af77986e0c5c7344fbb326cd319d086e25321c3 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:29:30 +0330
Subject: [PATCH 06/18] Don't use prctl
---
src/compcompat_pthread.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/compcompat_pthread.h b/src/compcompat_pthread.h
index bbdd063..1146b43 100644
--- a/src/compcompat_pthread.h
+++ b/src/compcompat_pthread.h
@@ -10,11 +10,19 @@
int pthread_getname_np(pthread_t pth, char* buf, size_t len)
{
+#ifdef __serenity__
+ return 0;
+#else
return prctl(PR_GET_NAME, buf);
+#endif
}
int pthread_setname_np(pthread_t pth, const char* buf)
{
+#ifdef __serenity__
+ return 0;
+#else
return prctl(PR_SET_NAME, buf);
+#endif
}
# else //__has_include
@@ -30,11 +38,19 @@ int pthread_setname_np(pthread_t pth, const char* buf) { return 1; }
int pthread_getname_np(pthread_t pth, char* buf, size_t len)
{
+#ifdef __serenity__
+ return 0;
+#else
return prctl(PR_GET_NAME, buf);
+#endif
}
int pthread_setname_np(pthread_t pth, const char* buf)
{
+#ifdef __serenity__
+ return 0;
+#else
return prctl(PR_SET_NAME, buf);
+#endif
}
# endif // ifdef __has_include
#endif // ifndef _GNU_SOURCE
--
2.34.1

View file

@ -1,7 +1,7 @@
From 499ffaffb70ee9e58014eadf903063fa4d5c79b2 Mon Sep 17 00:00:00 2001
From 88242bebd8381deef7598470ed74c23dbffaacb4 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 18:29:07 +0330
Subject: [PATCH 18/18] Disable GC on serenity
Subject: [PATCH 7/9] Disable GC on serenity
---
src/memory.c | 4 ++++

View file

@ -0,0 +1,27 @@
From 6e802d3d52c160ca31bc9f7d1b9bb875569e3417 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Sun, 13 Feb 2022 17:03:21 +0330
Subject: [PATCH 8/9] Don't use libbsd on serenity
arc4random exists on serenity, there's no need to pull libbsd in for
functionality that already exists.
---
makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makefile b/makefile
index d916511..d1ce70d 100644
--- a/makefile
+++ b/makefile
@@ -16,7 +16,7 @@ enable_inject ?= false
enable_ctypes ?= true
enable_inline_asm ?= false
enable_boehm_gc ?= true
-use_libbsd ?= true
+use_libbsd ?= false
CFLAGS += -Wall -Wextra -Wno-unused-parameter\
-D withTermios -D CTR_STD_EXTENSION_PATH=\"$(DATADIR)\"
--
2.34.1

View file

@ -0,0 +1,26 @@
From adb932228a5b24159d98c53c51281cfae238b57b Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Sun, 13 Feb 2022 17:04:46 +0330
Subject: [PATCH 9/9] Disable boehm GC on serenity
Serenity doesn't have a bdwgc port, so disable it here.
---
makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makefile b/makefile
index d1ce70d..307bf1c 100644
--- a/makefile
+++ b/makefile
@@ -15,7 +15,7 @@ INCLUDE_DIR ?= $(DESTDIR)/usr/local/include/Citron
enable_inject ?= false
enable_ctypes ?= true
enable_inline_asm ?= false
-enable_boehm_gc ?= true
+enable_boehm_gc ?= false
use_libbsd ?= false
CFLAGS += -Wall -Wextra -Wno-unused-parameter\
--
2.34.1

View file

@ -1,26 +0,0 @@
From 1ecf9016d5802aafb51a0ae224724db7f8be79a3 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:39:23 +0330
Subject: [PATCH 09/18] Use setjmp for callcc
---
src/base_extensions.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/base_extensions.c b/src/base_extensions.c
index aa746f0..1aefc28 100644
--- a/src/base_extensions.c
+++ b/src/base_extensions.c
@@ -6,7 +6,9 @@
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#ifndef __serenity__
#define WITH_UCONTEXT
+#endif
#ifdef WITH_UCONTEXT
# include <ucontext.h>
#else
--
2.34.1

View file

@ -1,34 +0,0 @@
From 5535c5453bd5cc043f5293d51a3244c644f07064 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:51:57 +0330
Subject: [PATCH 12/18] Use unsigned (short int) instead of u(short int)
---
src/ctypes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ctypes.c b/src/ctypes.c
index d472595..f22cb9b 100644
--- a/src/ctypes.c
+++ b/src/ctypes.c
@@ -706,7 +706,7 @@ CTR_CT_SIMPLE_TYPE_FUNC_TSTR(ushort)
{
char buf[1024];
sprintf(buf, "<CTypes ushort at: %p value: %ui>", myself->value.rvalue->ptr,
- *(ushort*)myself->value.rvalue->ptr);
+ *(unsigned short*)myself->value.rvalue->ptr);
return ctr_build_string_from_cstring(buf);
}
@@ -779,7 +779,7 @@ CTR_CT_SIMPLE_TYPE_FUNC_TSTR(uint)
{
char buf[1024];
sprintf(buf, "<CTypes uint at: %p value: %ui>", myself->value.rvalue->ptr,
- *(uint*)myself->value.rvalue->ptr);
+ *(unsigned int*)myself->value.rvalue->ptr);
return ctr_build_string_from_cstring(buf);
}
--
2.34.1

View file

@ -1,34 +0,0 @@
From 2f0a2a9ead96f9e5e345d6ae0dd7e5181208c406 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:52:51 +0330
Subject: [PATCH 13/18] Disable openmp
---
makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
index 16c2c89..0d7d7f0 100644
--- a/makefile
+++ b/makefile
@@ -82,7 +82,7 @@ $(BUILDDIR):
mkdir -p $@
$(BUILDDIR)/ctr: build_tcc_statics $(BUILDDIR) $(OBJS) $(EXTRAOBJS)
- $(CXX) -fopenmp $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) -lm -ldl -lbsd -lpcre -lffi -lpthread $(LEXTRACF) -o $@
+ $(CXX) $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) -lm -ldl -lbsd -lpcre -lffi -lpthread $(LEXTRACF) -o $@
ctr: $(BUILDDIR)/ctr
@@ -131,7 +131,7 @@ $(BUILDDIR)/%.a: src/lib/tcc/%.a
cp $< $@
$(BUILDDIR)/%.o: src/%.c
- $(CC) -fopenmp $(CFLAGS) -c $< -o $@
+ $(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: src/%.cpp
$(CXX) -g $(CFLAGS) -c $< $(CXXFLAGS) -o $@
--
2.34.1

View file

@ -1,49 +0,0 @@
From f222a3a3977516ec408d5c8e55899dd0d3995a2d Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 16:55:43 +0330
Subject: [PATCH 14/18] Yoink out libs
---
makefile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/makefile b/makefile
index 0d7d7f0..9b9a02c 100644
--- a/makefile
+++ b/makefile
@@ -43,6 +43,7 @@ endif
CFLAGS += -Isrc/lib/
LEXTRACF += $(LDFLAGS) -flto -lstdc++
+LIBS = -lm -ldl -lpcre -pthread -lffi -lc
OBJS = siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
lexer.o lexer_plug.o parser.o walker.o marshal.o reflect.o fiber.o \
@@ -82,13 +83,13 @@ $(BUILDDIR):
mkdir -p $@
$(BUILDDIR)/ctr: build_tcc_statics $(BUILDDIR) $(OBJS) $(EXTRAOBJS)
- $(CXX) $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) -lm -ldl -lbsd -lpcre -lffi -lpthread $(LEXTRACF) -o $@
+ $(CXX) $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) $(LIBS) $(LEXTRACF) -o $@
ctr: $(BUILDDIR)/ctr
$(BUILDDIR)/libctr.so: CFLAGS += -fPIC -DCITRON_LIBRARY
$(BUILDDIR)/libctr.so: $(OBJS)
- $(CC) $(OBJS) -fpic -shared -export-dynamic -ldl -lbsd -lpcre -lffi -lpthread -o $@
+ $(CC) $(OBJS) -fpic -shared -export-dynamic $(LIBS) -o $@
libctr: $(BUILDDIR)/libctr.so
@@ -96,7 +97,7 @@ libctr: $(BUILDDIR)/libctr.so
# compiler: cxx
# compiler: $(COBJS)
# cd $(BUILDDIR)
-# $(CC) $< -lm -ldl -lbsd -lpcre -lffi -lprofiler -lpthread $(LEXTRACF) -o ctrc
+# $(CC) $< $(LIBS) -lprofiler $(LEXTRACF) -o ctrc
# cd -
install: $(BUILDDIR)/ctr $(BUILDDIR)/libctr.so $(BUILDDIR)/ctrconfig Library mods extensions
--
2.34.1

View file

@ -1,36 +0,0 @@
From 909199b4839bd8c9377f150eed8557635e137d91 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 17:25:23 +0330
Subject: [PATCH 15/18] Make boehm gc optional
---
makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
index 9b9a02c..9c74e16 100644
--- a/makefile
+++ b/makefile
@@ -14,6 +14,7 @@ INCLUDE_DIR ?= /usr/local/include/Citron
enable_inject ?= false
enable_ctypes ?= true
enable_inline_asm ?= false
+enable_boehm_gc ?= false
CFLAGS += -Wall -Wextra -Wno-unused-parameter\
-D withTermios -D CTR_STD_EXTENSION_PATH=\"$(DATADIR)\"
@@ -35,9 +36,9 @@ ifneq ($(strip $(WITH_ICU)),)
LEXTRACF += -L/usr/lib -licui18n -licuuc -licudata
endif
-ifeq ($(strip $(WITHOUT_BOEHM_GC)),)
+ifeq ($(enable_boehm_gc),true)
fv := $(strip $(shell ldconfig -p | grep libgc.so | cut -d ">" -f2 | head -n1))
- CFLAGS += "-D withBoehmGC"
+ CFLAGS += -D withBoehmGC
LEXTRACF += $(fv)
endif
--
2.34.1

View file

@ -1,38 +0,0 @@
From 5883d528ce21d7780ee2bd364ee9f29d0f0a6b73 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 17:27:59 +0330
Subject: [PATCH 16/18] don't build tcc for no reason
---
makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/makefile b/makefile
index 9c74e16..aad2844 100644
--- a/makefile
+++ b/makefile
@@ -51,10 +51,12 @@ OBJS = siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
importlib.o coroutine.o symbol.o generator.o base_extensions.o citron.o \
promise.o symbol_cxx.o world.o
EXTRAOBJS =
+TCC_STATICS =
ifneq ($(findstring withInjectNative=1,$(CFLAGS)),)
OBJS += inject.o libtcc1.a libtcc.a
CFLAGS += -DwithCTypesNative=1
+ TCC_STATICS = build_tcc_statics
endif
ifneq ($(findstring withCTypesNative=1,$(CFLAGS)),)
@@ -83,7 +85,7 @@ ctrconfig:
$(BUILDDIR):
mkdir -p $@
-$(BUILDDIR)/ctr: build_tcc_statics $(BUILDDIR) $(OBJS) $(EXTRAOBJS)
+$(BUILDDIR)/ctr: $(TCC_STATICS) $(BUILDDIR) $(OBJS) $(EXTRAOBJS)
$(CXX) $(EXTRAOBJS) $(OBJS) $(CXXFLAGS) $(CFLAGS) $(LIBS) $(LEXTRACF) -o $@
ctr: $(BUILDDIR)/ctr
--
2.34.1

View file

@ -1,34 +0,0 @@
From 1849b95d960f66398bfa1f064c674c5fdcf8ad9b Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 17:30:28 +0330
Subject: [PATCH 17/18] Respect DESTDIR
---
makefile | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/makefile b/makefile
index aad2844..b33d716 100644
--- a/makefile
+++ b/makefile
@@ -3,11 +3,12 @@ DEBUG_BUILD_VERSION := "\"$(DEBUG_VERSION)\""
location = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
new_makefile_l1 := $(shell perl -ne '/((DEBUG_VERSION := )(\d+))/ && print (sprintf("%s%s", "$$2", "$$3"+1));' $(location))
BUILDDIR ?= build
-BINDIR ?= /usr/local/bin
-DATADIR ?= /usr/share/Citron
-HEADERDIR ?= /usr/local/include/Citron
-DLLDIR ?= /usr/local/lib
-INCLUDE_DIR ?= /usr/local/include/Citron
+DESTDIR ?= /
+BINDIR ?= ${DESTDIR}/usr/local/bin
+DATADIR ?= ${DESTDIR}/usr/share/Citron
+HEADERDIR ?= ${DESTDIR}/usr/local/include/Citron
+DLLDIR ?= ${DESTDIR}/usr/local/lib
+INCLUDE_DIR ?= ${DESTDIR}/usr/local/include/Citron
.PHONY: all ctrconfig libctr ctr install cxx
--
2.34.1

View file

@ -1,95 +1,53 @@
# Patches for citron on SerenityOS
## `0001-Remove-m-tune-arch-native.patch`
Remove -m(tune arch)=native
## `0002-Don-t-use-execinfo-on-serenity.patch`
Don't use execinfo on serenity
## `0003-Get-rid-of-wordexp-on-serenity.patch`
## `0001-Get-rid-of-wordexp-on-serenity.patch`
Get rid of wordexp on serenity
## `0004-Use-fcntl.h-on-serenity.patch`
Use <fcntl.h> on serenity
## `0005-Pull-arc4random-from-stdlib.h.patch`
Pull arc4random from stdlib.h
## `0006-Don-t-use-prctl.patch`
Don't use prctl
## `0007-Make-fiber-a-noop.patch`
## `0002-Make-fiber-a-noop.patch`
Make fiber a noop
Serenity doesn't have ucontext.
## `0008-Make-coroutines-a-noop.patch`
## `0003-Make-coroutines-a-noop.patch`
Make coroutines a noop
Serenity doesn't have ucontext.
## `0009-Use-setjmp-for-callcc.patch`
Use setjmp for callcc
## `0010-Don-t-mess-with-libsocket.patch`
## `0004-Don-t-mess-with-libsocket.patch`
Don't mess with libsocket
## `0011-Disable-inject.patch`
## `0005-Disable-inject.patch`
Disable inject
tcc requires ucontext.
## `0012-Use-unsigned-short-int-instead-of-u-short-int.patch`
Use unsigned (short int) instead of u(short int)
## `0013-Disable-openmp.patch`
## `0006-Disable-openmp.patch`
Disable openmp
## `0014-Yoink-out-libs.patch`
Yoink out libs
## `0015-Make-boehm-gc-optional.patch`
Make boehm gc optional
## `0016-don-t-build-tcc-for-no-reason.patch`
don't build tcc for no reason
## `0017-Respect-DESTDIR.patch`
Respect DESTDIR
## `0018-Disable-GC-on-serenity.patch`
## `0007-Disable-GC-on-serenity.patch`
Disable GC on serenity
## `0008-Don-t-use-libbsd-on-serenity.patch`
Don't use libbsd on serenity
arc4random exists on serenity, there's no need to pull libbsd in for
functionality that already exists.
## `0009-Disable-boehm-GC-on-serenity.patch`
Disable boehm GC on serenity
Serenity doesn't have a bdwgc port, so disable it here.