[glib/wip/pwithnall/ci-image-updates] WIP




commit 970a6b332547f39a5c45210a9a76f9f97984a0b7
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Jun 24 14:28:22 2022 +0100

    WIP
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 .gitlab-ci/cache-subprojects.sh                  |   2 +-
 subprojects/packagefiles/pcre2/meson.build       | 181 +++++++++++++++++++++++
 subprojects/packagefiles/pcre2/meson_options.txt |   8 +
 subprojects/pcre2.wrap                           |  18 ++-
 4 files changed, 201 insertions(+), 8 deletions(-)
---
diff --git a/.gitlab-ci/cache-subprojects.sh b/.gitlab-ci/cache-subprojects.sh
index 0e69266059..c6da3676e2 100755
--- a/.gitlab-ci/cache-subprojects.sh
+++ b/.gitlab-ci/cache-subprojects.sh
@@ -2,7 +2,7 @@
 
 set -e
 
-git clone --depth 1 --no-tags https://gitlab.gnome.org/GNOME/glib.git
+git clone --depth 1 --no-tags https://gitlab.gnome.org/GNOME/glib.git --branch wip/pwithnall/ci-image-updates
 git -C glib submodule update --init
 meson subprojects download --sourcedir glib
 rm glib/subprojects/*.wrap
diff --git a/subprojects/packagefiles/pcre2/meson.build b/subprojects/packagefiles/pcre2/meson.build
new file mode 100644
index 0000000000..c7d2aefd43
--- /dev/null
+++ b/subprojects/packagefiles/pcre2/meson.build
@@ -0,0 +1,181 @@
+project('pcre2', 'c', version: '10.40', license: 'BSD-3')
+
+c_compiler = meson.get_compiler('c')
+
+pcre2_h = configure_file(input : 'src/pcre2.h.generic',
+  output : 'pcre2.h',
+  copy: true)
+
+chartables = configure_file(input : 'src/pcre2_chartables.c.dist',
+  output : 'pcre2_chartables.c',
+  copy: true)
+
+
+config_h = configure_file(input : 'src/config.h.generic',
+  output : 'config.h',
+  copy: true)
+
+sources = [
+  'src/pcre2_auto_possess.c',
+  chartables,
+  config_h, pcre2_h,
+  '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_jit_compile.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'
+]
+
+includes = [include_directories('.'), include_directories('src')]
+
+check_headers = [
+  'inttypes.h',
+  'bzlib.h',
+  'sys/stat.h',
+  'sys/types.h',
+  'sys/wait.h',
+  'inttypes.h',
+  'dirent.h',
+  'dlfcn.h',
+  'limits.h',
+  'stdint.h',
+  'stdlib.h',
+  'string.h',
+  'windows.h',
+  'unistd.h'
+]
+
+config_h_defs = []
+foreach h : check_headers
+  if c_compiler.has_header(h)
+    config_h_defs += ['-DHAVE_' + h.underscorify().to_upper()]
+  endif
+endforeach
+
+
+check_funs = [
+  ['HAVE_STRERROR', 'strerror'],
+]
+
+foreach f : check_funs
+  if c_compiler.has_function(f.get(1))
+    config_h_defs += ['-D' + f.get(0)]
+  endif
+endforeach
+
+
+config_h_defs += ['-DHAVE_MEMMOVE', '-DSTDC_HEADERS', '-DSUPPORT_PCRE2_8', '-DSUPPORT_UNICODE']
+
+pcre2_8_lib = library('pcre2-8', sources,
+  include_directories: includes,
+  c_args: config_h_defs + ['-DHAVE_CONFIG_H', '-DPCRE2_CODE_UNIT_WIDTH=8'],
+  install: true)
+
+pcre2_posix_lib = library('pcre2-posix', ['src/pcre2posix.c', 'src/pcre2posix.h'],
+  include_directories: includes,
+  link_with: pcre2_8_lib,
+  c_args: config_h_defs + ['-DHAVE_CONFIG_H', '-DPCRE2_CODE_UNIT_WIDTH=8'],
+  install: true)
+
+pcre2_16_lib = library('pcre2-16', sources,
+  include_directories: includes,
+  c_args: config_h_defs + ['-DHAVE_CONFIG_H', '-DPCRE2_CODE_UNIT_WIDTH=16'],
+  install: true)
+
+pcre2_32_lib = library('pcre2-32', sources,
+  include_directories: includes,
+  c_args: config_h_defs + ['-DHAVE_CONFIG_H', '-DPCRE2_CODE_UNIT_WIDTH=32'],
+  install: true)
+
+libpcre2_8 = declare_dependency(link_with: pcre2_8_lib,
+  include_directories: includes)
+libpcre2_posix = declare_dependency(link_with: pcre2_posix_lib,
+  include_directories: includes)
+libpcre2_16 = declare_dependency(link_with: pcre2_16_lib,
+  include_directories: includes)
+libpcre2_32 = declare_dependency(link_with: pcre2_32_lib,
+  include_directories: includes)
+
+if get_option('grep')
+  pcre2grep = executable('pcre2grep', ['src/pcre2grep.c'],
+    include_directories: includes,
+    link_with: [pcre2_8_lib],
+    c_args: config_h_defs + ['-DHAVE_CONFIG_H'],
+    install: true)
+endif
+
+install_headers([pcre2_h, 'src/pcre2posix.h'])
+
+########### pkg-config #############
+
+pkg = import('pkgconfig')
+
+pkg.generate(libraries : pcre2_8_lib,
+             name : 'libpcre2-8',
+             description: 'PCRE2 - Perl compatible regular expressions C library (2nd API) with 8 bit 
character support',
+             version: meson.project_version())
+
+pkg.generate(libraries : pcre2_16_lib,
+             name : 'libpcre2-16',
+             description: 'PCRE2 - Perl compatible regular expressions C library (2nd API) with 16 bit 
character support',
+             version: meson.project_version())
+
+pkg.generate(libraries : pcre2_32_lib,
+             name : 'libpcre2-32',
+             description: 'PCRE2 - Perl compatible regular expressions C library (2nd API) with 32 bit 
character support',
+             version: meson.project_version())
+
+
+#### tests
+
+if get_option('test') and not meson.is_cross_build() # wine wrappers are not bat-friendly, this would need 
better testing
+  link_args = []
+  if c_compiler.get_argument_syntax() == 'msvc'
+    link_args += '/STACK:2500000'
+  endif
+
+  pcre2test = executable('pcre2test', ['src/pcre2test.c'],
+    include_directories: includes,
+    link_with: [pcre2_8_lib, pcre2_posix_lib, pcre2_16_lib, pcre2_32_lib],
+    c_args: config_h_defs + ['-DHAVE_CONFIG_H'],
+    link_args: link_args)
+
+  if c_compiler.get_argument_syntax() == 'msvc'
+    runtest = find_program('RunTest.bat')
+    rungreptest = find_program('RunGrepTest.bat')
+  else
+    runtest = find_program('RunTest')
+    rungreptest = find_program('RunGrepTest')
+  endif
+
+  test('RunTest', runtest,
+    should_fail: host_machine.system() == 'windows' and c_compiler.get_argument_syntax() != 'msvc',
+    env : ['srcdir=@0@'.format(meson.current_source_dir())],
+    workdir: meson.current_build_dir())
+
+  test('RunGrepTest', rungreptest,
+    should_fail: host_machine.system() == 'windows',
+    env : ['srcdir=@0@'.format(meson.current_source_dir())],
+    workdir: meson.current_build_dir())
+endif
+
diff --git a/subprojects/packagefiles/pcre2/meson_options.txt 
b/subprojects/packagefiles/pcre2/meson_options.txt
new file mode 100644
index 0000000000..43eeab5b00
--- /dev/null
+++ b/subprojects/packagefiles/pcre2/meson_options.txt
@@ -0,0 +1,8 @@
+option(
+  'grep', type: 'boolean', value: true,
+  description: 'Compile the PCRE2 grep executable'
+)
+option(
+  'test', type: 'boolean', value: true,
+  description: 'Compile the test executable and enable tests'
+)
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
index 17a81c5498..b755e14afd 100644
--- a/subprojects/pcre2.wrap
+++ b/subprojects/pcre2.wrap
@@ -1,8 +1,12 @@
 [wrap-file]
-directory = pcre2-10.39
-source_url = https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.bz2
-source_filename = pcre2-10.39.tar.bz2
-source_hash = 0f03caf57f81d9ff362ac28cd389c055ec2bf0678d277349a1a4bee00ad6d440
-patch_filename = pcre2_10.39-2_patch.zip
-patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.39-2/get_patch
-patch_hash = c4cfffff83e7bb239c8c330339b08f4367b019f79bf810f10c415e35fb09cf14
\ No newline at end of file
+directory = pcre2-10.40
+source_url = https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2
+source_filename = pcre2-10.40.tar.bz2
+source_hash = 14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68
+patch_directory = pcre2
+
+[provide]
+libpcre2-8 =-libpcre2_8
+libpcre2-16 =-libpcre2_16
+libpcre2-32 =-libpcre2_32
+libpcre2-posix =-libpcre2_posix
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]