From 83bf9674c625ea6898707f97a60036e19ba94858 Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 1 Jan 2022 19:03:46 -0500 Subject: little fix to paths, update README for linux build --- Makefile | 11 +++++------ README.md | 22 ++++++++-------------- util.c | 2 ++ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 6fded04..94fa92c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +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 + -Wno-unused-function -Wno-fixed-enum-extension -Wimplicit-fallthrough -Wno-format-truncation -Wno-unknown-warning-option \ + -Ipcre2 LIBS=-lSDL2 -lGL -lm libpcre2-32.a DEBUG_CFLAGS=$(ALL_CFLAGS) -DDEBUG -O0 -g RELEASE_CFLAGS=$(ALL_CFLAGS) -O3 @@ -26,11 +27,9 @@ install: release cp -r assets $(GLOBAL_DATA_DIR) install -m 644 ted.cfg $(GLOBAL_DATA_DIR) install ted $(INSTALL_BIN_DIR) -libpcre2-32.a: pcre2-10.36.zip - rm -rf pcre2-10.36 - unzip pcre2-10.36.zip - cd pcre2-10.36 && cmake -DPCRE2_BUILD_PCRE2_32=ON . && $(MAKE) -j8 - cp pcre2-10.36/libpcre2-32.a ./ +libpcre2-32.a: pcre2 + cd pcre2 && cmake -DPCRE2_BUILD_PCRE2_32=ON . && $(MAKE) -j8 + cp pcre2/libpcre2-32.a ./ keywords.h: keywords.py ./keywords.py ted.deb: release diff --git a/README.md b/README.md index c6e7308..776c45e 100644 --- a/README.md +++ b/README.md @@ -99,34 +99,28 @@ variable names. Sorry. ## Building from source -To install `ted` from source on Linux, you will need: +First, you will need PCRE2: https://github.com/PhilipHazel/pcre2/releases. +Unzip it, put pcre2-10.X in the same folder as ted, and rename it to pcre2. + +To install `ted` from source on Linux, you will also 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 clang libsdl2-dev wget unzip cmake -``` - -Then run - -``` -wget https://ftp.pcre.org/pub/pcre/pcre2-10.36.zip -sudo make install -j4 +sudo apt install clang libsdl2-dev cmake ``` +Then run `make -j4 release` to build or `sudo make install -j4` to build and install. You can also run `make ted.deb` to build the .deb installer. -On Windows (64-bit), first you will need to install Microsoft Visual Studio, then find and add vcvarsall.bat to your PATH. +On Windows (64-bit), you will need to install Microsoft Visual Studio, then find and add vcvarsall.bat to your PATH. Next you will need the SDL2 VC development libraries: https://www.libsdl.org/download-2.0.php Extract the zip, copy SDL2-2.x.y into the ted directory, and rename it to SDL2. Also copy SDL2\\lib\\x64\\SDL2.dll -to the ted directory. -You will also need PCRE2. Download it here: https://github.com/PhilipHazel/pcre2/releases, -unzip it, put pcre2-10.X in the same folder as ted, and rename it to pcre2. +to the ted directory. Then run `make.bat release`. To build the .msi file, you will need Visual Studio, as well as the diff --git a/util.c b/util.c index 62dddd2..5008058 100644 --- a/util.c +++ b/util.c @@ -281,6 +281,8 @@ static void path_full(char const *dir, char const *relpath, char *abspath, size_ } else { str_cpy(abspath, abspath_size, dir); } + if (abspath[strlen(abspath) - 1] != PATH_SEPARATOR) + str_cat(abspath, abspath_size, PATH_SEPARATOR_STR); while (*relpath) { size_t component_len = strcspn(relpath, ALL_PATH_SEPARATORS); -- cgit v1.2.3