diff options
| author | 2020-11-17 09:48:31 -0600 | |
|---|---|---|
| committer | 2020-11-17 09:53:12 -0600 | |
| commit | 2dc04d2957ef2f93aea1a83f4f55d11fbeebc6e2 (patch) | |
| tree | 78c152bcd5b9f783aa0288976f91c69676ec54ee | |
| parent | Merge branch 'master' of github.com:janet-lang/janet (diff) | |
On install, merge janetconf.h into janet.h
This results in a cleaner amalgmated build
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | Makefile | 16 | ||||
| -rw-r--r-- | appveyor.yml | 3 | ||||
| -rw-r--r-- | build_win.bat | 4 | ||||
| -rw-r--r-- | meson.build | 8 | ||||
| -rw-r--r-- | src/include/janet.h | 4 | ||||
| -rw-r--r-- | tools/msi/janet.wxs | 3 | ||||
| -rw-r--r-- | tools/patch-header.janet | 12 |
8 files changed, 32 insertions, 19 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3de62c6e..c13352e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ All notable changes to this project will be documented in this file. ## Unreleased - ??? +- During installation and release, merge janetconf.h into janet.h for easier install. - Add `upscope` special form. - `os/execute` and `os/spawn` can take streams for redirecting IO. - Add `;parser` and `:read` parameters to `run-context`. @@ -67,7 +67,7 @@ ifeq ($(UNAME), Haiku) endif $(shell mkdir -p build/core build/mainclient build/webclient build/boot) -all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) +all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.h ###################### ##### Name Files ##### @@ -162,16 +162,16 @@ SONAME=libjanet.so.1.12 build/shell.c: src/mainclient/shell.c cp $< $@ -build/janet.h: src/include/janet.h - cp $< $@ +build/janet.h: $(JANET_TARGET) src/include/janet.h src/conf/janetconf.h + ./$(JANET_TARGET) tools/patch-header.janet src/include/janet.h src/conf/janetconf.h $@ build/janetconf.h: src/conf/janetconf.h cp $< $@ -build/janet.o: build/janet.c build/janet.h build/janetconf.h +build/janet.o: build/janet.c src/include/janet.h src/conf/janetconf.h $(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@ -I build -build/shell.o: build/shell.c build/janet.h build/janetconf.h +build/shell.o: build/shell.c src/include/janet.h src/conf/janetconf.h $(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@ -I build $(JANET_TARGET): build/janet.o build/shell.o @@ -222,7 +222,7 @@ callgrind: $(JANET_TARGET) dist: build/janet-dist.tar.gz build/janet-%.tar.gz: $(JANET_TARGET) \ - src/include/janet.h src/conf/janetconf.h \ + build/janet.h \ jpm.1 janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \ build/doc.html README.md build/janet.c build/shell.c jpm $(eval JANET_DIST_DIR = "janet-$(shell basename $*)") @@ -262,11 +262,11 @@ build/janet.pc: $(JANET_TARGET) echo 'Libs: -L$${libdir} -ljanet' >> $@ echo 'Libs.private: $(CLIBS)' >> $@ -install: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.pc build/jpm +install: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.pc build/jpm build/janet.h mkdir -p '$(DESTDIR)$(BINDIR)' cp $(JANET_TARGET) '$(DESTDIR)$(BINDIR)/janet' mkdir -p '$(DESTDIR)$(INCLUDEDIR)/janet' - cp -rf $(JANET_HEADERS) '$(DESTDIR)$(INCLUDEDIR)/janet' + cp -r build/janet.h '$(DESTDIR)$(INCLUDEDIR)/janet' mkdir -p '$(DESTDIR)$(JANET_PATH)' mkdir -p '$(DESTDIR)$(LIBDIR)' cp $(JANET_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)')' diff --git a/appveyor.yml b/appveyor.yml index 60986965..c0ee8e3f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,9 +35,6 @@ artifacts: - name: janet.h path: dist\janet.h type: File - - name: janetconf.h - path: dist\janetconf.h - type: File - name: shell.c path: dist\shell.c type: File diff --git a/build_win.bat b/build_win.bat index ed51829f..d625950e 100644 --- a/build_win.bat +++ b/build_win.bat @@ -113,8 +113,8 @@ copy README.md dist\README.md copy janet.lib dist\janet.lib copy janet.exp dist\janet.exp -copy src\include\janet.h dist\janet.h -copy src\conf\janetconf.h dist\janetconf.h +janet.exe tools\patch-header.janet src\include\janet.h src\conf\janetconf.h build\janet.h +copy build\janet.h dist\janet.h copy build\libjanet.lib dist\libjanet.lib copy .\jpm dist\jpm diff --git a/meson.build b/meson.build index 6e09b77f..8745bf02 100644 --- a/meson.build +++ b/meson.build @@ -248,8 +248,14 @@ pkg.generate(libjanet, # Installation install_man('janet.1') -install_headers(['src/include/janet.h', jconf], subdir: 'janet') install_data(sources : ['tools/.keep'], install_dir : join_paths(get_option('libdir'), 'janet')) +patched_janet = custom_target('patched-janeth', + input : ['tools/patch-header.janet', 'src/include/janet.h', jconf], + install : true, + install_dir : join_paths(get_option('includedir'), 'janet'), + build_by_default : true, + output : ['janet.h'], + command : [janet_nativeclient, '@INPUT@', '@OUTPUT@']) if get_option('peg') and not get_option('reduced_os') and get_option('processes') install_man('jpm.1') patched_jpm = custom_target('patched-jpm', diff --git a/src/include/janet.h b/src/include/janet.h index a9912cd6..6ee1f769 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -20,6 +20,8 @@ * IN THE SOFTWARE. */ +#include "janetconf.h" + #ifndef JANET_H_defined #define JANET_H_defined @@ -35,8 +37,6 @@ extern "C" { /***** START SECTION CONFIG *****/ -#include "janetconf.h" - #ifndef JANET_VERSION #define JANET_VERSION "latest" #endif diff --git a/tools/msi/janet.wxs b/tools/msi/janet.wxs index c747b0d4..80a0b7e4 100644 --- a/tools/msi/janet.wxs +++ b/tools/msi/janet.wxs @@ -127,9 +127,6 @@ <RemoveFolder Id="RemoveCDir" On="uninstall" /> </Component> <Component Directory="CDir"> - <File Source="dist\janetconf.h"/> - </Component> - <Component Directory="CDir"> <File Source="dist\janet.lib"/> </Component> <Component Directory="CDir"> diff --git a/tools/patch-header.janet b/tools/patch-header.janet new file mode 100644 index 00000000..bbc86653 --- /dev/null +++ b/tools/patch-header.janet @@ -0,0 +1,12 @@ +# Patch janet.h + +(def [_ janeth janetconf output] (dyn :args)) + +(def- replace-peg + (peg/compile + ~(% (* '(to `#include "janetconf.h"`) + (constant ,(slurp janetconf)) + (thru `#include "janetconf.h"`) + '(any 1))))) + +(spit output (first (peg/match replace-peg (slurp janeth)))) |
