Set module/*headerpath* during bootstrap

Cook also uses module/*headerpath* for finding headers
rather than using module/*syspath*.
This commit is contained in:
Calvin Rose 2019-05-15 10:49:16 -04:00
parent 8359044408
commit f35b5765d6
4 changed files with 12 additions and 8 deletions

View File

@ -133,7 +133,7 @@ build/janet_boot: $(JANET_BOOT_OBJECTS)
# Now the reason we bootstrap in the first place
build/core_image.c: build/janet_boot
build/janet_boot $@ JANET_PATH $(JANET_PATH)
build/janet_boot $@ JANET_PATH $(JANET_PATH) JANET_HEADERPATH $(INCLUDEDIR)/janet
##########################################################
##### The main interpreter program and shared object #####
@ -282,8 +282,8 @@ SONAME=libjanet.so.0
install: $(JANET_TARGET) build/version.txt
mkdir -p $(BINDIR)
cp $(JANET_TARGET) $(BINDIR)/janet
mkdir -p $(INCLUDEDIR)
cp -rf $(JANET_HEADERS) $(INCLUDEDIR)
mkdir -p $(INCLUDEDIR)/janet
cp -rf $(JANET_HEADERS) $(INCLUDEDIR)/janet
mkdir -p $(JANET_PATH)
cp -rf $(JANET_HEADERS) $(JANET_PATH)
mkdir -p $(LIBDIR)

View File

@ -22,6 +22,7 @@ project('janet', 'c', default_options : ['c_std=c99'])
# Global settings
janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet')
header_path = join_paths(get_option('prefix'), get_option('includedir'), 'janet')
# Link math library on all systems
cc = meson.get_compiler('c')
@ -119,7 +120,7 @@ janet_boot = executable('janet-boot', core_src, boot_src, boot_gen,
core_image = custom_target('core_image',
input : [janet_boot],
output : 'core_image.gen.c',
command : [janet_boot, '@OUTPUT@', 'JANET_PATH', janet_path])
command : [janet_boot, '@OUTPUT@', 'JANET_PATH', janet_path, 'JANET_HEADERPATH', header_path])
libjanet = shared_library('janet', core_src, core_image,
include_directories : incdir,
@ -169,10 +170,8 @@ run_target('repl', command : [janet_mainclient])
# Installation
install_man('janet.1')
install_headers('src/include/janet.h', 'src/include/janetconf.h')
install_headers('src/include/janet.h', 'src/include/janetconf.h', subdir: 'janet')
janet_libs = [
'src/include/janet.h',
'src/include/janetconf.h',
'tools/bars.janet',
'tools/cook.janet',
'tools/highlight.janet'

View File

@ -1597,6 +1597,11 @@
on Windows is C:/Janet/Library."
(or (process/opts "JANET_PATH") ""))
(var module/*headerpath*
"The path where the janet headers are installed. Useful for building
native modules or compiling code at runtime."
(process/opts "JANET_HEADERPATH"))
# Version of fexists that works even with a reduced OS
(if-let [has-stat (_env 'os/stat)]
(let [stat (has-stat :value)]

View File

@ -103,7 +103,7 @@
(if is-mac " -undefined dynamic_lookup" ""))))
(def CFLAGS (string
(if is-win "/I" "-I")
module/*syspath*
module/*headerpath*
(if is-win " /O" " -std=c99 -Wall -Wextra -fpic -O")
OPTIMIZE))