@@ -54,23 +54,45 @@ add_project_arguments('-DVERSION="'+meson.project_version() + '"', language : 'c
54
54
55
55
jose = dependency (' jose' , version : ' >=8' )
56
56
a2x = find_program (' a2x' , required : false )
57
- compiler = meson .get_compiler(' c' )
57
+ compiler = meson .get_compiler(' c' , native : true )
58
+
59
+ if meson .is_cross_build()
60
+ compiler = meson .get_compiler(' c' , native : false )
61
+ endif
62
+
63
+ message (compiler.version())
64
+ message (compiler.get_id())
58
65
59
66
http_lib = []
60
- if compiler.has_header(' llhttp.h' , args : ' -I/usr/local/include' )
67
+
68
+ inc_dir = meson .get_external_property(' inc_dir' , ' -I/usr/local/include' )
69
+ lib_dir = meson .get_external_property(' lib_dir' ,' /usr/local/lib' )
70
+
71
+ if meson .is_cross_build()
72
+ message (' ----------------' )
73
+ message (' *** THIS IS A CROSS BUILD ***' )
74
+ message (' Compiler version :' + compiler.version())
75
+ message (' Compiler ID :' + compiler.get_id())
76
+ message (' Library search directory :' + lib_dir)
77
+ message (' Include directory :' + inc_dir)
78
+ message (' ----------------' )
79
+ endif
80
+
81
+ if compiler.has_header(' llhttp.h' , args : inc_dir)
61
82
http_lib = ' llhttp'
62
83
add_project_arguments (' -DUSE_LLHTTP' , language : ' c' )
63
84
else
64
- if not compiler.has_header(' http_parser.h' , args : ' -I/usr/local/include ' )
85
+ if not compiler.has_header(' http_parser.h' , args : inc_dir )
65
86
error (' neither llhttp nor http-parser devel files found.' )
66
87
endif
88
+
67
89
http_lib = ' http_parser'
68
90
endif
69
91
70
92
if host_machine .system() == ' freebsd'
71
93
http_parser = compiler.find_library (http_lib, dirs : ' /usr/local/lib' )
72
94
else
73
- http_parser = compiler.find_library (http_lib)
95
+ http_parser = compiler.find_library (http_lib, dirs : [lib_dir] )
74
96
endif
75
97
76
98
licenses = [' COPYING' ]
@@ -82,7 +104,9 @@ units = []
82
104
subdir (' doc' )
83
105
subdir (' src' )
84
106
subdir (' units' )
85
- subdir (' tests' )
107
+ if not meson .is_cross_build()
108
+ subdir (' tests' )
109
+ endif
86
110
87
111
install_data (libexecbins, install_dir : libexecdir)
88
112
install_data (bins, install_dir : bindir)
0 commit comments