.gitlab-ci.yml | 106 ++++++++++++++++++++++++++++++++++++++++++++++- .gitlab-ci/build.sh | 6 +- .gitlab-ci/config.yml | 19 +++++++- .gitlab-ci/other.yml | 2 meson.build | 32 ++++++++++---- meson_options.txt | 2 subprojects/libxml2.wrap | 13 +++++ 7 files changed, 166 insertions(+), 14 deletions(-) New commits: commit a9e27a6f07be7a3559cc124fe157eb6f860e1dd0 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Mon Apr 8 15:43:47 2024 +0900 ci: Workaround an error with libxml2 on Android diff --git a/.gitlab-ci/other.yml b/.gitlab-ci/other.yml index 42caf1c..59cae9c 100644 --- a/.gitlab-ci/other.yml +++ b/.gitlab-ci/other.yml @@ -138,5 +138,5 @@ meson android arm64 fedora: ar = toolchain + '-ar' strip = toolchain + '-strip' EOF - - meson setup --werror --cross-file android-cross-file.txt build + - meson setup --werror -Dxml-backend=expat --cross-file android-cross-file.txt build - meson compile --verbose -C build commit 6c22d41ac39435f5ab8ac38b699b619f311c1d59 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Mon Apr 8 15:42:25 2024 +0900 meson: Workaround an exception diff --git a/meson.build b/meson.build index c228988..42feb13 100644 --- a/meson.build +++ b/meson.build @@ -37,6 +37,7 @@ endif xml_dep = dependency('', required: false) xmlbackend = get_option('xml-backend') +xmltype = '' if xmlbackend == 'auto' or xmlbackend == 'expat' # Linking expat should not be so difficult... see: https://github.com/mesonbuild/meson/issues/10516 xml_dep = dependency('expat', required: false) @@ -44,6 +45,8 @@ if xmlbackend == 'auto' or xmlbackend == 'expat' xml_dep = cc.find_library('expat', required : false) if not xml_dep.found() and xmlbackend == 'expat' xml_dep = dependency('expat', method: 'system', required: true, fallback: ['expat', 'expat_dep']) + else + xmltype = 'expat' endif endif endif @@ -51,6 +54,9 @@ if (xmlbackend == 'auto' and not xml_dep.found()) or xmlbackend == 'libxml2' xml_dep = dependency('libxml-2.0', required: true) conf.set('ENABLE_LIBXML2', 1) endif +if xmltype == '' + xmltype = xml_dep.name() +endif pkgmod = import('pkgconfig') python3 = import('python').find_installation() @@ -512,7 +518,7 @@ summary({ 'Tests': not get_option('tests').disabled(), 'Tools': not get_option('tools').disabled(), 'iconv': found_iconv == 1, - 'XML backend': xml_dep.name(), + 'XML backend': xmltype, }, section: 'General', bool_yn: true, list_sep: ', ') summary({ 'Hinting': preferred_hinting, commit 29040154dba4f985bb7b4111aa377dc559196a88 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Mon Apr 8 13:23:48 2024 +0900 ci: Add libxml2 build for meson diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9bc320..ea74e42 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,8 +41,8 @@ variables: # changing these will force rebuilding the associated image # Note: these tags have no meaning and are not tied to a particular # fontconfig version - FEDORA_TAG: '2024-04-06.2-5d3fdc50a3d1' - FREEBSD_TAG: '2024-04-06.2-cc62efaaea62' + FEDORA_TAG: '2024-04-08.1-ec786b3b9ef2' + FREEBSD_TAG: '2024-04-08.1-b5edf8602f60' FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh' FREEBSD_EXEC: 'bash .gitlab-ci/freebsd-install.sh' @@ -391,6 +391,22 @@ t_fedora:rawhide:meson shared expat: - 'fedora:rawhide@container-prep' +t_fedora:rawhide:meson shared libxml2: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: 'rawhide' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + needs: + - 'fedora:rawhide@container-prep' + + t_fedora:rawhide:autotools static expat: extends: - .build@template @@ -439,6 +455,22 @@ t_fedora:rawhide:meson static expat: - 'fedora:rawhide@container-prep' +t_fedora:rawhide:meson static libxml2: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: 'rawhide' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 + needs: + - 'fedora:rawhide@container-prep' + + t_fedora:rawhide:mingw autotools static libxml2: extends: - .build@template @@ -525,6 +557,24 @@ t_fedora:39:meson shared expat: - 'fedora:39@container-prep' +t_fedora:39:meson shared libxml2: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: '39' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + needs: + - 'fedora:39@container-prep' + + + + @@ -584,6 +634,24 @@ t_fedora:38:meson shared expat: - 'fedora:38@container-prep' +t_fedora:38:meson shared libxml2: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: '38' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + needs: + - 'fedora:38@container-prep' + + + + @@ -647,6 +715,23 @@ t_freebsd:14.0:meson shared expat: - 'freebsd:14.0@container-prep' +t_freebsd:14.0:meson shared libxml2: + extends: + - .build-in-qemu@template + - .fdo.distribution-image@freebsd + - .fc_artifacts + variables: + FC_DISTRO_NAME: freebsd + FDO_DISTRIBUTION_VERSION: '14.0' + FDO_DISTRIBUTION_TAG: $FREEBSD_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_NO_CHECK: 1 + needs: + - 'freebsd:14.0@container-prep' + + t_freebsd:13.2:autotools shared expat: extends: - .build-in-qemu@template @@ -700,6 +785,23 @@ t_freebsd:13.2:meson shared expat: - 'freebsd:13.2@container-prep' +t_freebsd:13.2:meson shared libxml2: + extends: + - .build-in-qemu@template + - .fdo.distribution-image@freebsd + - .fc_artifacts + variables: + FC_DISTRO_NAME: freebsd + FDO_DISTRIBUTION_VERSION: '13.2' + FDO_DISTRIBUTION_TAG: $FREEBSD_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_NO_CHECK: 1 + needs: + - 'freebsd:13.2@container-prep' + + ####################################### # # # deploy stage # diff --git a/.gitlab-ci/build.sh b/.gitlab-ci/build.sh index 6929af7..d3b2c1b 100755 --- a/.gitlab-ci/build.sh +++ b/.gitlab-ci/build.sh @@ -114,9 +114,11 @@ elif [ x"$buildsys" == "xmeson" ]; then done case x"$backend" in 'xexpat') - ;; + buildopt+=(-Dxml-backend=expat) + ;; 'xlibxml2') - ;; + buildopt+=(-Dxml-backend=libxml2) + ;; esac if [ $cross -eq 1 -a -n "$arch" ]; then buildopt+=(--cross-file) diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 8f05bbb..3ff2ffa 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -1,4 +1,4 @@ -.default_tag: &default_tag "2024-04-06.2" +.default_tag: &default_tag "2024-04-08.1" distributions: - name: fedora @@ -26,6 +26,11 @@ distributions: FC_BUILDSYS: meson FC_BUILD_TYPE: shared FC_XML_BACKEND: expat + - name: "meson shared libxml2" + variables: + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 - name: "autotools static expat" build_only: "rawhide" variables: @@ -44,6 +49,12 @@ distributions: FC_BUILDSYS: meson FC_BUILD_TYPE: static FC_XML_BACKEND: expat + - name: "meson static libxml2" + build_only: "rawhide" + variables: + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 - name: "mingw autotools static libxml2" build_only: "rawhide" variables: @@ -89,6 +100,12 @@ distributions: FC_BUILD_TYPE: shared FC_XML_BACKEND: expat FC_BUILD_NO_CHECK: 1 + - name: "meson shared libxml2" + variables: + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_NO_CHECK: 1 packages: fedora: commit b112572140082b54ba88415d76c37bbe6ac56ce2 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Mon Apr 8 13:13:10 2024 +0900 meson: Add libxml2 support 'xml-backend' a new build option to choose the xml backend. Currently three options are available: expat, libxml2 and auto. 'auto' tries to find out expat first and then libxml2. If you don't like to fallback to subprojects, try --wrap-mode=nodownload or nofallback. diff --git a/meson.build b/meson.build index e04b13a..c228988 100644 --- a/meson.build +++ b/meson.build @@ -25,6 +25,8 @@ freetype_req_cmake = '>= 2.8.1' cc = meson.get_compiler('c') math_dep = cc.find_library('m', required: false) +conf = configuration_data() + freetype_dep = dependency('freetype2', method: 'pkg-config', version: freetype_req, required: false) # Give another shot using CMake @@ -33,14 +35,22 @@ if not freetype_dep.found() fallback: ['freetype2', 'freetype_dep'], default_options: 'werror=false') endif -# Linking expat should not be so difficult... see: https://github.com/mesonbuild/meson/issues/10516 -expat_dep = dependency('expat', required: false) -if not expat_dep.found() - expat_dep = cc.find_library('expat', required : false) - if not expat_dep.found() - expat_dep = dependency('expat', method: 'system', fallback: ['expat', 'expat_dep']) +xml_dep = dependency('', required: false) +xmlbackend = get_option('xml-backend') +if xmlbackend == 'auto' or xmlbackend == 'expat' + # Linking expat should not be so difficult... see: https://github.com/mesonbuild/meson/issues/10516 + xml_dep = dependency('expat', required: false) + if not xml_dep.found() + xml_dep = cc.find_library('expat', required : false) + if not xml_dep.found() and xmlbackend == 'expat' + xml_dep = dependency('expat', method: 'system', required: true, fallback: ['expat', 'expat_dep']) + endif endif endif +if (xmlbackend == 'auto' and not xml_dep.found()) or xmlbackend == 'libxml2' + xml_dep = dependency('libxml-2.0', required: true) + conf.set('ENABLE_LIBXML2', 1) +endif pkgmod = import('pkgconfig') python3 = import('python').find_installation() @@ -133,8 +143,7 @@ add_project_arguments('-DHAVE_CONFIG_H', language: 'c') c_args = [] -conf = configuration_data() -deps = [freetype_dep, expat_dep] +deps = [freetype_dep, xml_dep] incbase = include_directories('.') # For compatibility to autoconf (regardless of the usage in fontconfig) @@ -503,6 +512,7 @@ summary({ 'Tests': not get_option('tests').disabled(), 'Tools': not get_option('tools').disabled(), 'iconv': found_iconv == 1, + 'XML backend': xml_dep.name(), }, section: 'General', bool_yn: true, list_sep: ', ') summary({ 'Hinting': preferred_hinting, diff --git a/meson_options.txt b/meson_options.txt index ab4f3b9..49c6dad 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,6 +14,8 @@ option('tools', type : 'feature', value : 'auto', yield : true, option('cache-build', type : 'feature', value : 'enabled', description: 'Run fc-cache on install') option('iconv', type: 'feature', value: 'disabled') +option('xml-backend', type: 'combo', choices: ['auto', 'expat', 'libxml2'], value: 'auto', + description: 'Select xml backend to read config') # Defaults option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight', diff --git a/subprojects/libxml2.wrap b/subprojects/libxml2.wrap new file mode 100644 index 0000000..b4cbc42 --- /dev/null +++ b/subprojects/libxml2.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = libxml2-2.12.6 +source_url = https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.6.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libxml2_2.12.6-1/libxml2-2.12.6.tar.xz +source_filename = libxml2-2.12.6.tar.xz +source_hash = 889c593a881a3db5fdd96cc9318c87df34eb648edfc458272ad46fd607353fbb +patch_filename = libxml2_2.12.6-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libxml2_2.12.6-1/get_patch +patch_hash = 777be7ffdc4167e4d0b3f405e13492664cbdef2e6cf6f6a88cc55ec80112614c +wrapdb_version = 2.12.6-1 + +[provide] +libxml-2.0 = libxml2_dep