mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Start working to a full meson build.
One build system instead of three for Make + Meson + build_win.bat.
This commit is contained in:
		
							
								
								
									
										6
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
									
									
									
									
								
							| @@ -37,7 +37,7 @@ MANPATH?=$(PREFIX)/share/man/man1/ | |||||||
| PKG_CONFIG_PATH?=$(PREFIX)/lib/pkgconfig | PKG_CONFIG_PATH?=$(PREFIX)/lib/pkgconfig | ||||||
| DEBUGGER=gdb | DEBUGGER=gdb | ||||||
|  |  | ||||||
| CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -O2 -fvisibility=hidden \ | CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fpic -O2 -fvisibility=hidden \ | ||||||
| 	   -DJANET_BUILD=$(JANET_BUILD) | 	   -DJANET_BUILD=$(JANET_BUILD) | ||||||
| LDFLAGS=-rdynamic | LDFLAGS=-rdynamic | ||||||
|  |  | ||||||
| @@ -60,7 +60,7 @@ all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) | |||||||
| ##### Name Files ##### | ##### Name Files ##### | ||||||
| ###################### | ###################### | ||||||
|  |  | ||||||
| JANET_HEADERS=src/include/janet.h src/include/janetconf.h | JANET_HEADERS=src/include/janet.h src/conf/janetconf.h | ||||||
|  |  | ||||||
| JANET_LOCAL_HEADERS=src/core/util.h \ | JANET_LOCAL_HEADERS=src/core/util.h \ | ||||||
| 					src/core/state.h \ | 					src/core/state.h \ | ||||||
| @@ -252,7 +252,7 @@ callgrind: $(JANET_TARGET) | |||||||
| dist: build/janet-dist.tar.gz | dist: build/janet-dist.tar.gz | ||||||
|  |  | ||||||
| build/janet-%.tar.gz: $(JANET_TARGET) \ | build/janet-%.tar.gz: $(JANET_TARGET) \ | ||||||
| 	src/include/janet.h src/include/janetconf.h \ | 	src/include/janet.h src/conf/janetconf.h \ | ||||||
| 	janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \ | 	janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \ | ||||||
| 	build/doc.html README.md build/janet.c | 	build/doc.html README.md build/janet.c | ||||||
| 	tar -czvf $@ $^ | 	tar -czvf $@ $^ | ||||||
|   | |||||||
							
								
								
									
										44
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								meson.build
									
									
									
									
									
								
							| @@ -18,8 +18,11 @@ | |||||||
| # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||||||
| # IN THE SOFTWARE. | # IN THE SOFTWARE. | ||||||
|  |  | ||||||
| project('janet', 'c', default_options : ['c_std=c99', 'b_lundef=false', 'default_library=both'], | project('janet', 'c', | ||||||
|   version : '1.0.0') |   default_options : ['c_std=c99', 'b_lundef=false', 'default_library=both', | ||||||
|  |     'strip=true', 'optimization=2', 'werror=true', | ||||||
|  |     'debug=false'], | ||||||
|  |   version : '1.0.0-dev') | ||||||
|  |  | ||||||
| # Global settings | # Global settings | ||||||
| janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet') | janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet') | ||||||
| @@ -30,11 +33,42 @@ cc = meson.get_compiler('c') | |||||||
| m_dep = cc.find_library('m', required : false) | m_dep = cc.find_library('m', required : false) | ||||||
| dl_dep = cc.find_library('dl', required : false) | dl_dep = cc.find_library('dl', required : false) | ||||||
|  |  | ||||||
| # Some options | # Link options | ||||||
| add_project_link_arguments('-rdynamic', language : 'c') | add_project_link_arguments('-rdynamic', language : 'c') | ||||||
|  |  | ||||||
|  | # Generate custom janetconf.h | ||||||
|  | conf = configuration_data() | ||||||
|  | version_parts = meson.project_version().split('.') | ||||||
|  | last_parts = version_parts[2].split('-') | ||||||
|  | if last_parts.length() > 1 | ||||||
|  |   conf.set_quoted('JANET_VERSION_EXTRA', '-' + last_parts[1]) | ||||||
|  | else | ||||||
|  |   conf.set_quoted('JANET_VERSION_EXTRA', '') | ||||||
|  | endif | ||||||
|  | conf.set('JANET_VERSION_MAJOR', version_parts[0].to_int()) | ||||||
|  | conf.set('JANET_VERSION_MINOR', version_parts[1].to_int()) | ||||||
|  | conf.set('JANET_VERSION_PATCH', last_parts[0].to_int()) | ||||||
|  | conf.set_quoted('JANET_VERSION', meson.project_version()) | ||||||
|  | # Use options | ||||||
|  | conf.set_quoted('JANET_BUILD', get_option('build_hash')) | ||||||
|  | conf.set('JANET_NO_NANBOX', not get_option('nanbox')) | ||||||
|  | conf.set('JANET_SINGLE_THREADED', not get_option('single_threaded')) | ||||||
|  | conf.set('JANET_NO_DYNAMIC_MODULES', not get_option('dynamic_modules')) | ||||||
|  | conf.set('JANET_NO_DOCSTRINGS', not get_option('docstrings')) | ||||||
|  | conf.set('JANET_NO_SOURCEMAPS', not get_option('sourcemaps')) | ||||||
|  | conf.set('JANET_NO_ASSEMBLER', not get_option('assembler')) | ||||||
|  | conf.set('JANET_NO_PEG', not get_option('peg')) | ||||||
|  | conf.set('JANET_NO_TYPED_ARRAY', not get_option('typed_array')) | ||||||
|  | conf.set('JANET_NO_INT_TYPES', not get_option('int_types')) | ||||||
|  | conf.set('JANET_RECURSION_GUARD', get_option('recursion_guard')) | ||||||
|  | conf.set('JANET_MAX_PROTO_DEPTH', get_option('max_proto_depth')) | ||||||
|  | conf.set('JANET_MAX_MACRO_EXPAND', get_option('max_macro_expand')) | ||||||
|  | conf.set('JANET_STACK_MAX', get_option('stack_max')) | ||||||
|  | jconf = configure_file(output : 'janetconf.h', | ||||||
|  |   configuration : conf) | ||||||
|  |  | ||||||
| # Include directories | # Include directories | ||||||
| incdir = include_directories('src/include') | incdir = include_directories(['src/include', '.']) | ||||||
|  |  | ||||||
| # Building generated sources | # Building generated sources | ||||||
| xxd = executable('xxd', 'tools/xxd.c', native : true) | xxd = executable('xxd', 'tools/xxd.c', native : true) | ||||||
| @@ -186,7 +220,7 @@ janet_dep = declare_dependency(include_directories : incdir, | |||||||
|  |  | ||||||
| # Installation | # Installation | ||||||
| install_man('janet.1') | install_man('janet.1') | ||||||
| install_headers('src/include/janet.h', 'src/include/janetconf.h', subdir: 'janet') | install_headers(['src/include/janet.h', jconf], subdir: 'janet') | ||||||
| janet_libs = [ | janet_libs = [ | ||||||
|   'auxlib/cook.janet', |   'auxlib/cook.janet', | ||||||
|   'auxlib/path.janet' |   'auxlib/path.janet' | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								meson_options.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								meson_options.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | option('build_hash', type : 'string', value : 'meson') | ||||||
|  |  | ||||||
|  | option('single_threaded', type : 'boolean', value : false) | ||||||
|  | option('nanbox', type : 'boolean', value : true) | ||||||
|  | option('dynamic_modules', type : 'boolean', value : true) | ||||||
|  | option('docstrings', type : 'boolean', value : true) | ||||||
|  | option('sourcemaps', type : 'boolean', value : true) | ||||||
|  | option('reduced_os', type : 'boolean', value : true) | ||||||
|  | option('assembler', type : 'boolean', value : true) | ||||||
|  | option('peg', type : 'boolean', value : true) | ||||||
|  | option('typed_array', type : 'boolean', value : true) | ||||||
|  | option('int_types', type : 'boolean', value : true) | ||||||
|  |  | ||||||
|  | option('recursion_guard', type : 'integer', min : 10, max : 8000, value : 1024) | ||||||
|  | option('max_proto_depth', type : 'integer', min : 10, max : 8000, value : 200) | ||||||
|  | option('max_macro_expand', type : 'integer', min : 1, max : 8000, value : 200) | ||||||
|  | option('stack_max', type : 'integer', min : 8096, max : 1000000000, value : 16384) | ||||||
| @@ -20,7 +20,8 @@ | |||||||
| * IN THE SOFTWARE. | * IN THE SOFTWARE. | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| /* Configure Janet. Edit this file to customize the build */ | /* This is an example janetconf.h file. This will be usually generated
 | ||||||
|  |  * by the build system. */ | ||||||
| 
 | 
 | ||||||
| #ifndef JANETCONF_H | #ifndef JANETCONF_H | ||||||
| #define JANETCONF_H | #define JANETCONF_H | ||||||
| @@ -39,13 +40,17 @@ | |||||||
| /* #define JANET_NO_NANBOX */ | /* #define JANET_NO_NANBOX */ | ||||||
| /* #define JANET_API __attribute__((visibility ("default"))) */ | /* #define JANET_API __attribute__((visibility ("default"))) */ | ||||||
| 
 | 
 | ||||||
|  | /* These settings should be specified before amalgamation is
 | ||||||
|  |  * built. */ | ||||||
|  | /* #define JANET_NO_DOCSTRINGS */ | ||||||
|  | /* #define JANET_NO_SOURCEMAPS */ | ||||||
|  | /* #define JANET_REDUCED_OS */ | ||||||
|  | 
 | ||||||
|  | /* Other settings */ | ||||||
| /* #define JANET_NO_ASSEMBLER */ | /* #define JANET_NO_ASSEMBLER */ | ||||||
| /* #define JANET_NO_PEG */ | /* #define JANET_NO_PEG */ | ||||||
| /* #define JANET_NO_TYPED_ARRAY */ | /* #define JANET_NO_TYPED_ARRAY */ | ||||||
| /* #define JANET_NO_INT_TYPES */ | /* #define JANET_NO_INT_TYPES */ | ||||||
| /* #define JANET_NO_DOCSTRINGS */ |  | ||||||
| /* #define JANET_NO_SOURCEMAPS */ |  | ||||||
| /* #define JANET_REDUCED_OS */ |  | ||||||
| /* #define JANET_OUT_OF_MEMORY do { printf("janet out of memory\n"); exit(1); } while (0) */ | /* #define JANET_OUT_OF_MEMORY do { printf("janet out of memory\n"); exit(1); } while (0) */ | ||||||
| /* #define JANET_RECURSION_GUARD 1024 */ | /* #define JANET_RECURSION_GUARD 1024 */ | ||||||
| /* #define JANET_MAX_PROTO_DEPTH 200 */ | /* #define JANET_MAX_PROTO_DEPTH 200 */ | ||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose