Skip to content

Commit

Permalink
Don't compile PCRE2 JIT if tcc is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Feb 1, 2024
1 parent ab35867 commit 275b93c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 1 addition & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,7 @@ endif
# Handle PCRE2
pcre2_dep_opt = get_option('use_sys_pcre2')
pcre2_dep = disabler()
if cc.get_id() == 'tcc'
# We require the system library for tcc, because tcc doesn't support
# the MSVC asm syntax PCRE2 uses.
pcre2_dep = dependency('libpcre2-8', required: true, static: true)
elif pcre2_dep_opt.enabled() or pcre2_dep_opt.auto()
if pcre2_dep_opt.enabled() or pcre2_dep_opt.auto()
pcre2_dep = dependency('libpcre2-8', required: false, static: true)
if not pcre2_dep.found()
pcre2_dep = cc.find_library('pcre2', required: true, static: true)
Expand Down
13 changes: 11 additions & 2 deletions subprojects/packagefiles/pcre2/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
project('pcre2', 'c', version: '10.42')

cc = meson.get_compiler('c')

conf_data = configuration_data()

pcre2_chartables = configure_file(input : 'src/pcre2_chartables.c.dist',
Expand All @@ -18,7 +20,6 @@ libpcre2_c_args = [
'-DHAVE_CONFIG_H', # Default values from config.h
'-DPCRE2_CODE_UNIT_WIDTH=8',
'-DHAVE_MEMMOVE',
'-DSUPPORT_JIT',
'-DSUPPORT_PCRE2_8',
'-DSUPPORT_UNICODE',
'-fvisibility=default',
Expand All @@ -35,7 +36,6 @@ pcre2_files = [
'src/pcre2_error.c',
'src/pcre2_extuni.c',
'src/pcre2_find_bracket.c',
'src/pcre2_jit_compile.c',
'src/pcre2_maketables.c',
'src/pcre2_match.c',
'src/pcre2_match_data.c',
Expand All @@ -54,6 +54,15 @@ pcre2_files = [
'src/pcre2_xclass.c',
]

# tcc doesn't support the MSVC asm syntax PCRE2 uses (`__asm { ... }`).
# It is used in the JIT compiler code.
# Because we want to support stuff like tcc + RISC-V (which probably doesn't
# have a libpcre2 library, we exlcude JIT support for tcc in general).
if cc.get_id() != 'tcc'
libpcre2_c_args += ['-DSUPPORT_JIT']
pcre2_files += ['src/pcre2_jit_compile.c']
endif

pcre2_includes = [
'src/',
'src/sljit/',
Expand Down

0 comments on commit 275b93c

Please sign in to comment.