summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-07-30 11:30:53 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2023-07-30 11:30:53 +0200
commit256ff5cbbe6ad3512ea3dd412ec955ff1cde15a2 (patch)
treeffeddf07c7ae20b74b33e195de2a95718d91d562
parenteb5c641694a65fe5edec5fabeb088a83d534d595 (diff)
downloadi486tcc-linux-256ff5cbbe6ad3512ea3dd412ec955ff1cde15a2.tar.gz
i486tcc-linux-256ff5cbbe6ad3512ea3dd412ec955ff1cde15a2.tar.bz2
tried to make wordwrinder work, some issues around lua
-rw-r--r--README4
-rw-r--r--configs/versions1
-rw-r--r--patches/wordgrinder-tcc.patch87
-rwxr-xr-xscripts/build.sh19
-rwxr-xr-xscripts/download.sh5
5 files changed, 115 insertions, 1 deletions
diff --git a/README b/README
index 20bc037..2842086 100644
--- a/README
+++ b/README
@@ -480,7 +480,9 @@ notion: Caught signal 2. Dying.
Segmentation fault
=> xrandr is a dummy module (but the shared library should be loaded by lua?)
=> xmessage: do we really want to install that Xorg app?
-
+- wordgrinder: segfaults in luapeg on first script, probably a static linking
+ issue or a tcc issue?
+
tools
-----
diff --git a/configs/versions b/configs/versions
index fba68e1..7485a85 100644
--- a/configs/versions
+++ b/configs/versions
@@ -28,3 +28,4 @@ FONT_MISC_MISC_VERSION="1.1.3"
RXVT_VERSION="2.6.4"
LUA_VERSION="5.1.5"
NOTION_VERSION="435631f"
+WORDGRINDER_VERSION="0.8"
diff --git a/patches/wordgrinder-tcc.patch b/patches/wordgrinder-tcc.patch
new file mode 100644
index 0000000..cad4140
--- /dev/null
+++ b/patches/wordgrinder-tcc.patch
@@ -0,0 +1,87 @@
+diff -rauN wordgrinder/build.lua wordgrinder-tcc-patch/build.lua
+--- wordgrinder/build.lua 2020-10-23 23:48:53.000000000 +0200
++++ wordgrinder-tcc-patch/build.lua 2023-07-30 11:21:52.270479062 +0200
+@@ -107,8 +107,8 @@
+ "-Wno-unused-function",
+ "-ffunction-sections",
+ "-fdata-sections",
+- "-Werror=implicit-function-declaration",
+- "--std=gnu99",
++ "-Werror=implicit-function-declaration"
++-- "--std=gnu99",
+ }
+ local ldflags = {
+ "$LDFLAGS",
+diff -rauN wordgrinder/Makefile wordgrinder-tcc-patch/Makefile
+--- wordgrinder/Makefile 2020-10-23 23:48:53.000000000 +0200
++++ wordgrinder-tcc-patch/Makefile 2023-07-30 10:56:28.258243808 +0200
+@@ -114,7 +114,8 @@
+
+ hide = @
+
+-LUA_INTERPRETER = $(OBJDIR)/lua
++#LUA_INTERPRETER = $(OBJDIR)/lua
++LUA_INTERPRETER = @@BASE@@/build/stage1/bin/lua
+
+ NINJABUILD = \
+ $(hide) $(NINJA) -f $(OBJDIR)/build.ninja $(NINJAFLAGS)
+diff -rauN wordgrinder/src/c/arch/unix/cursesw/dpy.c wordgrinder-tcc-patch/src/c/arch/unix/cursesw/dpy.c
+--- wordgrinder/src/c/arch/unix/cursesw/dpy.c 2020-10-23 23:48:53.000000000 +0200
++++ wordgrinder-tcc-patch/src/c/arch/unix/cursesw/dpy.c 2023-07-30 09:58:16.533122528 +0200
+@@ -113,7 +113,7 @@
+ mvaddnstr(y, x, &cc, 1);
+ }
+
+-uni_t dpy_getchar(double timeout)
++uni_t dpy_getchar(double t)
+ {
+ struct timeval then;
+ gettimeofday(&then, NULL);
+@@ -122,13 +122,13 @@
+ for (;;)
+ {
+
+- if (timeout != -1)
++ if (t != -1)
+ {
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ u_int64_t nowms = (now.tv_usec/1000) + ((u_int64_t) now.tv_sec*1000);
+
+- int delay = ((u_int64_t) (timeout*1000)) + nowms - thenms;
++ int delay = ((u_int64_t) (t*1000)) + nowms - thenms;
+ if (delay <= 0)
+ return -KEY_TIMEOUT;
+
+diff -rauN wordgrinder/src/c/emu/lpeg/makefile wordgrinder-tcc-patch/src/c/emu/lpeg/makefile
+--- wordgrinder/src/c/emu/lpeg/makefile 2020-10-23 23:48:53.000000000 +0200
++++ wordgrinder-tcc-patch/src/c/emu/lpeg/makefile 2023-07-30 07:54:41.402246826 +0200
+@@ -22,14 +22,15 @@
+ # -Wunreachable-code \
+
+
+-CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
+-CC = gcc
++CFLAGS = $(CWARNS) $(COPT) -I$(LUADIR)
++CC = @@BASE@@/build/stage1/bin/i386-tcc
+
+ FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
+
+ # For Linux
+ linux:
+- $(MAKE) lpeg.so "DLLFLAGS = -shared -fPIC"
++# $(MAKE) lpeg.so "DLLFLAGS = -shared -fPIC"
++ $(MAKE) lpeg.a "DLLFLAGS = -static"
+
+ # For Mac OS
+ macosx:
+@@ -38,6 +39,9 @@
+ lpeg.so: $(FILES)
+ env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
+
++lpeg.a: $(FILES)
++ env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
++
+ $(FILES): makefile
+
+ test: test.lua re.lua lpeg.so
diff --git a/scripts/build.sh b/scripts/build.sh
index adf6c47..9d073ea 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -561,6 +561,25 @@ else
echo "stage1 notion exists"
fi
+#~ if [ ! -f "${BASE}/build/stage1/bin/wg" ]; then
+ #~ rm -rf "wordgrinder-${WORDGRINDER_VERSION}"
+ #~ tar xf "${BASE}/downloads/wordgrinder-${WORDGRINDER_VERSION}.tar.gz"
+ #~ cd "wordgrinder-${WORDGRINDER_VERSION}"
+ #~ patch -Np1 < "${BASE}/patches/wordgrinder-tcc.patch"
+ #~ sed -i "s|@@BASE@@|${BASE}|g" Makefile src/c/emu/lpeg/makefile
+ #~ make -j$CPUS \
+ #~ LUA_PACKAGE="--cflags={-I${BASE}/build/stage1/include} --libs={${BASE}/build/stage1/lib/liblua.a}" \
+ #~ CURSES_PACKAGE="--cflags={-I${BASE}/build/stage1/include} --libs={${BASE}/build/stage1/lib/libncurses.a ${BASE}/build/stage1/lib/libtermcap.a}" \
+ #~ XFT_PACKAGE="none" \
+ #~ NINJA="${BASE}/build/stage1/bin/samu" \
+ #~ CC="${BASE}/build/stage1/bin/i386-tcc" \
+ #~ LDFLAGS="-static"
+ #~ make -j$CPUS install PREFIX= DESTDIR="${BASE}/build/stage1"
+ #~ cd ..
+#~ else
+ #~ echo "stage1 lua exists"
+#~ fi
+
# TODO FROM HERE
# TODO: have some way to deal with dependencies and with the user
diff --git a/scripts/download.sh b/scripts/download.sh
index 746ddfe..be7a057 100755
--- a/scripts/download.sh
+++ b/scripts/download.sh
@@ -175,6 +175,11 @@ if [ ! -f "${BASE}/downloads/notion-${NOTION_VERSION}.tar.gz" ]; then
rm -rf "notion-${NOTION_VERSION}"
fi
+if [ ! -f "${BASE}/downloads/wordgrinder-${WORDGRINDER_VERSION}.tar.gz" ]; then
+ wget -O "${BASE}/downloads/wordgrinder-${WORDGRINDER_VERSION}.tar.gz" \
+ "https://github.com/davidgiven/wordgrinder/archive/refs/tags/${WORDGRINDER_VERSION}.tar.gz"
+fi
+
if [ ! -f "${BASE}/downloads/uflbbl-${UFLBBL_VERSION}.tar.gz" ]; then
git clone git://git.andreasbaumann.cc/uflbbl.git "uflbbl-${UFLBBL_VERSION}"
git -C "uflbbl-${UFLBBL_VERSION}" checkout "${UFLBBL_VERSION}"