-
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cross build - add copy of PCRE2 dependecy
Meson currently doesn't support subprojects to be native and non-native at the same time. See: mesonbuild/meson#10947 Unfortunately, sdb depends on rz_util which in turn depends on PCRE2. Excluding PCRE2 from the native build makes linking of rz_util not possible anymore. Adding it, will make Meson complain that the dependencies cannot be mixed. Hence, we compile a copy of PCRE2 for the native build if required.
- Loading branch information
Showing
4 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Copy of PCRE2 library for the native version if a cross build happens. | ||
# Because Meson currently doesn't support subprojects to be native and non-native: | ||
# https://github.com/mesonbuild/meson/issues/10947 | ||
|
||
project('pcre2_cross_native', 'c', version: '10.42') | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
conf_data = configuration_data() | ||
|
||
pcre2_chartables = configure_file(input : 'src/pcre2_chartables.c.dist', | ||
output : 'pcre2_chartables.c', | ||
configuration : conf_data) | ||
|
||
pcre2_h = configure_file(input : 'src/pcre2.h.generic', | ||
output : 'pcre2.h', | ||
configuration : conf_data) | ||
|
||
config_h = configure_file(input : 'src/config.h.generic', | ||
output : 'config.h', | ||
configuration : conf_data) | ||
|
||
libpcre2_c_args = [ | ||
'-DHAVE_CONFIG_H', # Default values from config.h | ||
'-DPCRE2_CODE_UNIT_WIDTH=8', | ||
'-DHAVE_MEMMOVE', | ||
'-DSUPPORT_PCRE2_8', | ||
'-DSUPPORT_UNICODE', | ||
'-fvisibility=default', | ||
] | ||
|
||
pcre2_files = [ | ||
'src/pcre2_auto_possess.c', | ||
pcre2_chartables, | ||
'src/pcre2_compile.c', | ||
'src/pcre2_config.c', | ||
'src/pcre2_context.c', | ||
'src/pcre2_convert.c', | ||
'src/pcre2_dfa_match.c', | ||
'src/pcre2_error.c', | ||
'src/pcre2_extuni.c', | ||
'src/pcre2_find_bracket.c', | ||
'src/pcre2_maketables.c', | ||
'src/pcre2_match.c', | ||
'src/pcre2_match_data.c', | ||
'src/pcre2_newline.c', | ||
'src/pcre2_ord2utf.c', | ||
'src/pcre2_pattern_info.c', | ||
'src/pcre2_script_run.c', | ||
'src/pcre2_serialize.c', | ||
'src/pcre2_string_utils.c', | ||
'src/pcre2_study.c', | ||
'src/pcre2_substitute.c', | ||
'src/pcre2_substring.c', | ||
'src/pcre2_tables.c', | ||
'src/pcre2_ucd.c', | ||
'src/pcre2_valid_utf.c', | ||
'src/pcre2_xclass.c', | ||
] | ||
|
||
cpu_jit_supported = [ 'aarch64', 'arm', 'mips', 'mips64', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'x86', 'x86_64' ] | ||
|
||
# tcc doesn't support the MSVC asm syntax PCRE2 uses (`__asm { ... }`). | ||
# It is used in the JIT compiler code. | ||
if cc.get_id() != 'tcc' and target_machine.cpu_family() in cpu_jit_supported | ||
libpcre2_c_args += ['-DSUPPORT_JIT'] | ||
pcre2_files += ['src/pcre2_jit_compile.c'] | ||
endif | ||
|
||
if target_machine.system() == 'openbsd' or target_machine.system() == 'netbsd' | ||
# jit compilation fails with "no more memory" if wx allocations are allowed. | ||
libpcre2_c_args += ['-DSLJIT_WX_EXECUTABLE_ALLOCATOR'] | ||
endif | ||
|
||
pcre2_includes = [ | ||
include_directories('.'), | ||
include_directories('src/'), | ||
] | ||
|
||
libpcre2_cross_native = static_library('pcre2_cross_native', pcre2_files, | ||
c_args: libpcre2_c_args, | ||
include_directories: pcre2_includes, | ||
install: false, | ||
native: true, | ||
) | ||
|
||
pcre2_cross_native_dep = declare_dependency( | ||
link_with: libpcre2_cross_native, | ||
include_directories: pcre2_includes, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[wrap-git] | ||
url = https://github.com/PCRE2Project/pcre2.git | ||
revision = 52c08847921a324c804cabf2814549f50bce1265 | ||
directory = pcre2_cross_native | ||
patch_directory = pcre2_cross_native | ||
|
||
[provide] | ||
dependency_names = pcre2_cross_native | ||
pcre2_cross_native = pcre2_cross_native_dep |