summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-03-02 18:57:45 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-03-02 18:57:45 -0500
commit5625bc523861cf16c1aade7a4e7e6f8731a24b6e (patch)
treebfed6af1d5ddc60bbc22a1ab8d74036034c67db3
parentdd349c6c7e0eba659afc2149fd214f9972826052 (diff)
got OpenBSD build to work
-rw-r--r--Makefile11
-rw-r--r--README.md3
-rw-r--r--base.h5
-rw-r--r--main.c2
-rw-r--r--make.bat2
-rw-r--r--process-posix.c1
-rw-r--r--text.h2
7 files changed, 15 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 5894f73..c7559c0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
ALL_CFLAGS=$(CFLAGS) -Wall -Wextra -Wshadow -Wconversion -Wpedantic -pedantic -std=gnu11 \
-Wno-unused-function -Wno-fixed-enum-extension -Wimplicit-fallthrough -Wno-format-truncation -Wno-unknown-warning-option
-LIBS=-lSDL2 -lGL -ldl -lm libpcre2-32.a -Ipcre2-10.36/build
+LIBS=-lSDL2 -lGL -lm libpcre2-32.a
DEBUG_CFLAGS=$(ALL_CFLAGS) -DDEBUG -O0 -g
RELEASE_CFLAGS=$(ALL_CFLAGS) -O3 -g
PROFILE_CFLAGS=$(ALL_CFLAGS) -O3 -g -DPROFILE=1
@@ -10,7 +10,7 @@ INSTALL_BIN_DIR=/usr/bin
ted: *.[ch] libpcre2-32.a stb_truetype.o
$(CC) main.c stb_truetype.o -o ted $(DEBUG_CFLAGS) $(LIBS)
stb_truetype.o: stb_truetype.c
- $(CC) $< -c -o $@
+ $(CC) stb_truetype.c -c -o stb_truetype.o
release: *.[ch] libpcre2-32.a
$(CC) main.c -o ted $(RELEASE_CFLAGS) $(LIBS)
profile: *.[ch] libpcre2-32.a
@@ -28,10 +28,9 @@ install: release
install ted $(INSTALL_BIN_DIR)
libpcre2-32.a: pcre2-10.36.zip
rm -rf pcre2-10.36
- unzip $<
- mkdir pcre2-10.36/build
- cd pcre2-10.36/build && cmake -DPCRE2_BUILD_PCRE2_32=ON .. && $(MAKE) -j8
- cp pcre2-10.36/build/$@ ./
+ unzip pcre2-10.36.zip
+ cd pcre2-10.36 && cmake -DPCRE2_BUILD_PCRE2_32=ON . && $(MAKE) -j8
+ cp pcre2-10.36/libpcre2-32.a ./
ted.deb: release
rm -rf /tmp/ted
diff --git a/README.md b/README.md
index 027d736..f51ddab 100644
--- a/README.md
+++ b/README.md
@@ -35,11 +35,12 @@ To install `ted` on Linux, you will need:
- A C compiler
- The SDL2 development libraries
- wget, unzip (for downloading, extracting PCRE2)
+- cmake (for PCRE2)
These can be installed on Ubuntu/Debian with:
```
-sudo apt install gcc libsdl2-dev wget unzip
+sudo apt install gcc libsdl2-dev wget unzip cmake
```
Then run
diff --git a/base.h b/base.h
index 4cbb1dc..94ff2bf 100644
--- a/base.h
+++ b/base.h
@@ -31,7 +31,12 @@
#include <float.h>
#include <limits.h>
#include <assert.h>
+#if __linux__ || _WIN32
#include <uchar.h>
+#else
+// OpenBSD has uchar.h but it doesn't seem to define char32_t ?
+typedef uint32_t char32_t;
+#endif
#if !__TINYC__ && __STDC_VERSION__ >= 201112
#define static_assert_if_possible(cond) _Static_assert(cond, "Static assertion failed");
diff --git a/main.c b/main.c
index 849645b..7c5a672 100644
--- a/main.c
+++ b/main.c
@@ -28,7 +28,7 @@ no_warn_end
#endif
#define PCRE2_STATIC
#define PCRE2_CODE_UNIT_WIDTH 32
-#include "pcre2.h"
+#include "pcre2-10.36/pcre2.h"
#include "unicode.h"
#include "util.c"
diff --git a/make.bat b/make.bat
index 651ad52..92b0e63 100644
--- a/make.bat
+++ b/make.bat
@@ -10,7 +10,7 @@ if not exist pcre2-32.lib (
popd
copy pcre2-10.36\Release\pcre2-32.lib
)
-SET C_FLAGS=/nologo /W4 /MD /wd4200 /wd4204 /wd4221 /wd4706 /wd4214 /D_CRT_SECURE_NO_WARNINGS /I pcre2-10.36 /I SDL2/include SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib pcre2-32.lib
+SET C_FLAGS=/nologo /W4 /MD /wd4200 /wd4204 /wd4221 /wd4706 /wd4214 /D_CRT_SECURE_NO_WARNINGS /I SDL2/include SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib pcre2-32.lib
rc /nologo ted.rc
if _%1 == _ (
cl main.c stb_truetype.c ted.res /DDEBUG /DEBUG /Zi %C_FLAGS% /Fe:ted
diff --git a/process-posix.c b/process-posix.c
index 8bfe036..1236323 100644
--- a/process-posix.c
+++ b/process-posix.c
@@ -2,6 +2,7 @@
#include <fcntl.h>
#include <sys/wait.h>
+#include <signal.h>
struct Process {
pid_t pid;
diff --git a/text.h b/text.h
index a60047f..cfd70e7 100644
--- a/text.h
+++ b/text.h
@@ -1,8 +1,6 @@
#ifndef TEXT_H_
#define TEXT_H_
-#include <uchar.h>
-
// A text-rendering interface.
// Example usage:
// Font *font = text_font_load("font.ttf", 18);