diff options
Diffstat (limited to 'recipes/libxml2/0001-Add-Meson-build.patch')
-rw-r--r-- | recipes/libxml2/0001-Add-Meson-build.patch | 537 |
1 files changed, 537 insertions, 0 deletions
diff --git a/recipes/libxml2/0001-Add-Meson-build.patch b/recipes/libxml2/0001-Add-Meson-build.patch new file mode 100644 index 00000000..dcde568c --- /dev/null +++ b/recipes/libxml2/0001-Add-Meson-build.patch @@ -0,0 +1,537 @@ +From 089ef2cf86b2f7b5266a07b6b538799c82e89abe Mon Sep 17 00:00:00 2001 +From: "L. E. Segovia" <amy@amyspark.me> +Date: Wed, 21 Feb 2024 11:02:25 -0300 +Subject: [PATCH 1/1] Add Meson build + +Source: https://wrapdb.mesonbuild.com/v2/libxml2_2.11.6-3/libxml2.wrap +--- + LICENSE.build | 19 ++ + include/libxml/meson.build | 55 +++++ + meson.build | 397 +++++++++++++++++++++++++++++++++++++ + meson_options.txt | 1 + + win32/meson.build | 13 ++ + 5 files changed, 485 insertions(+) + create mode 100644 LICENSE.build + create mode 100644 include/libxml/meson.build + create mode 100644 meson.build + create mode 100644 meson_options.txt + create mode 100644 win32/meson.build + +diff --git a/LICENSE.build b/LICENSE.build +new file mode 100644 +index 0000000..b59833d +--- /dev/null ++++ b/LICENSE.build +@@ -0,0 +1,19 @@ ++Copyright (c) 2021 The Meson development team ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is ++furnished to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++SOFTWARE. +diff --git a/include/libxml/meson.build b/include/libxml/meson.build +new file mode 100644 +index 0000000..22e5637 +--- /dev/null ++++ b/include/libxml/meson.build +@@ -0,0 +1,55 @@ ++configure_file( ++ input: 'xmlversion.h.in', ++ output: 'xmlversion.h', ++ configuration: withcdata, ++ install_dir: get_option('includedir') / 'libxml2' / 'libxml', ++) ++ ++libxml_headers = files( ++ 'HTMLparser.h', ++ 'HTMLtree.h', ++ 'SAX.h', ++ 'SAX2.h', ++ 'c14n.h', ++ 'catalog.h', ++ 'chvalid.h', ++ 'debugXML.h', ++ 'dict.h', ++ 'encoding.h', ++ 'entities.h', ++ 'globals.h', ++ 'hash.h', ++ 'list.h', ++ 'nanoftp.h', ++ 'nanohttp.h', ++ 'parser.h', ++ 'parserInternals.h', ++ 'pattern.h', ++ 'relaxng.h', ++ 'schemasInternals.h', ++ 'schematron.h', ++ 'threads.h', ++ 'tree.h', ++ 'uri.h', ++ 'valid.h', ++ 'xinclude.h', ++ 'xlink.h', ++ 'xmlIO.h', ++ 'xmlautomata.h', ++ 'xmlerror.h', ++ 'xmlexports.h', ++ 'xmlmemory.h', ++ 'xmlmodule.h', ++ 'xmlreader.h', ++ 'xmlregexp.h', ++ 'xmlsave.h', ++ 'xmlschemas.h', ++ 'xmlschemastypes.h', ++ 'xmlstring.h', ++ 'xmlunicode.h', ++ 'xmlwriter.h', ++ 'xpath.h', ++ 'xpathInternals.h', ++ 'xpointer.h', ++) ++install_headers(libxml_headers, subdir: 'libxml2/libxml') +diff --git a/meson.build b/meson.build +new file mode 100644 +index 0000000..99b7cfe +--- /dev/null ++++ b/meson.build +@@ -0,0 +1,397 @@ ++project( ++ 'libxml2', ++ 'c', ++ version: '2.11.6', ++ meson_version: '>=0.54.1', ++ license: 'MIT', ++) ++ ++add_project_arguments('-D_GNU_SOURCE', language: 'c') ++ ++cc = meson.get_compiler('c') ++if host_machine.system() == 'windows' ++ if cc.get_argument_syntax() == 'gcc' ++ #hack to get rand_r working on windows ++ add_project_arguments('-D_POSIX_THREAD_SAFE_FUNCTIONS', language: 'c') ++ else ++ add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', cc.get_supported_arguments('-Wno-deprecated-declarations'), language: 'c') ++ endif ++endif ++ ++cdata = configuration_data() ++ ++cdata.set('PACKAGE', meson.project_name()) ++cdata.set('PACKAGE_NAME', meson.project_name()) ++cdata.set('PACKAGE_TARNAME', meson.project_name()) ++cdata.set('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version())) ++cdata.set('PACKAGE_URL', 'https://gitlab.gnome.org/GNOME/libxml2') ++cdata.set('PACKAGE_BUGREPORT', 'xml@gnome.org') ++cdata.set('PACKAGE_VERSION', meson.project_version()) ++cdata.set('VERSION', meson.project_version()) ++ ++if cc.has_function_attribute('destructor') ++ cdata.set('ATTRIBUTE_DESTRUCTOR', '__attribute__((destructor))') ++endif ++ ++if cc.has_header_symbol('sys/socket.h', 'AF_INET6') or cc.has_header_symbol('winsock2.h', 'AF_INET6') ++ cdata.set('SUPPORT_IP6', 1) ++endif ++ ++if cc.compiles('#include <stdarg.h> void a(va_list*) {}int main(){va_list ap1,ap2;a(&ap1);ap2=(va_list)ap1;return 0;}') ++ cdata.set('VA_LIST_IS_ARRAY', 1) ++endif ++ ++if cc.compiles('#include <sys/socket.h> int main(){send(1,(const char*)"",1,1);}') or cc.compiles('#include <winsock2.h> int main(){send(1,(const char*)"",1,1);}') ++ cdata.set('SEND_ARG2_CAST', '/**/') ++else ++ cdata.set('SEND_ARG2_CAST', '(char *)') ++endif ++ ++if cc.compiles('#include <netdb.h> int main(){gethostbyname((const char*)"");}') or cc.compiles('#include <ws2tcpip.h> int main(){gethostbyname((const char*)"");}') ++ cdata.set('GETHOSTBYNAME_ARG_CAST', '/**/') ++else ++ cdata.set('GETHOSTBYNAME_ARG_CAST', '(char *)') ++endif ++ ++if cc.has_header_symbol('stdlib.h', 'rand_r', args: '-D_POSIX_THREAD_SAFE_FUNCTIONS') ++ cdata.set('HAVE_RAND_R', 1) ++endif ++ ++if cc.has_header_symbol('stdarg.h', 'va_copy') ++ cdata.set('HAVE_VA_COPY', 1) ++endif ++ ++if cc.has_header_symbol('stdarg.h', '__va_copy') ++ cdata.set('HAVE___VA_COPY', 1) ++endif ++ ++deps = [] ++ ++if meson.version().version_compare('>= 0.62') ++ dl_lib = dependency('dl', disabler: true, required: false) ++else ++ dl_lib = cc.find_library('dl', disabler: true, required: false) ++endif ++if dl_lib.found() ++ cdata.set('HAVE_DLOPEN', 1) ++ cdata.set('HAVE_DLFCN_H', 1) ++ deps += dl_lib ++endif ++ ++math_lib = cc.find_library('m', required: false) ++if math_lib.found() ++ deps += math_lib ++endif ++ ++if meson.version().version_compare('>= 0.60') ++ iconv_lib = dependency('iconv', required: get_option('iconv')) ++else ++ if get_option('iconv').disabled() ++ iconv_lib = dependency('', required: false) ++ else ++ iconv_check = ''' ++ #include <iconv.h> ++ int main() { ++ iconv_open("", ""); ++ } ++ ''' ++ if cc.links(iconv_check, name: 'iconv_open') ++ iconv_lib = declare_dependency() ++ else ++ iconv_lib = cc.find_library('iconv', required: false) ++ if not cc.links(iconv_check, name: 'iconv_open in libiconv', dependencies: iconv_lib) ++ iconv_lib = dependency('', required: false) ++ if get_option('iconv').enabled() ++ error('iconv enabled and not found') ++ endif ++ endif ++ endif ++ endif ++endif ++if iconv_lib.found() ++ deps += iconv_lib ++endif ++ ++if host_machine.system() == 'windows' ++ pthread_dep = disabler() ++ with_threads = true ++else ++ pthread_dep = dependency('threads', disabler: true, required: false) ++ with_threads = pthread_dep.found() ++ if with_threads ++ deps += pthread_dep ++ endif ++endif ++ ++lzma_dep = dependency('liblzma', required: false) ++if lzma_dep.found() ++ cdata.set('HAVE_LIBLZMA', 1) ++ deps += lzma_dep ++endif ++ ++zlib_dep = dependency('zlib', disabler: true, required: false) ++if zlib_dep.found() ++ cdata.set('HAVE_LIBZ', 1) ++ cdata.set('HAVE_ZLIB_H', 1) ++ deps += zlib_dep ++endif ++ ++readline_lib = cc.find_library('readline', required: false) ++if cc.has_header('readline/readline.h', dependencies: readline_lib) ++ cdata.set('HAVE_LIBREADLINE', 1) ++ deps += readline_lib ++endif ++ ++history_lib = cc.find_library('history', required: false) ++if cc.has_header('readline/history.h', dependencies: history_lib) ++ cdata.set('HAVE_LIBHISTORY', 1) ++ deps += history_lib ++endif ++ ++ws2_dep = cc.find_library('ws2_32', required: host_machine.system() == 'windows') ++if ws2_dep.found() ++ deps += ws2_dep ++endif ++ ++foreach t : ['socklen_t', 'size_t', 'int'] ++ if cc.compiles('#include <sys/socket.h> int main(){getsockopt(1,1,1,0,(@0@*)0);}'.format(t)) ++ cdata.set('XML_SOCKLEN_T', t) ++ break ++ endif ++ if cc.compiles('#include <winsock2.h> int main(){getsockopt(1,1,1,0,(@0@*)0);}'.format(t), dependencies: ws2_dep) ++ cdata.set('XML_SOCKLEN_T', t) ++ break ++ endif ++endforeach ++ ++checked_headers = { ++ 'arpa/inet.h': [], ++ 'arpa/nameser.h': [], ++ 'dl.h': [], ++ 'fcntl.h': [], ++ 'float.h': [], ++ 'inttypes.h': [], ++ 'netdb.h': [], ++ 'netinet/in.h': [], ++ 'poll.h': [], ++ 'pthread.h': pthread_dep, ++ 'resolv.h': [], ++ 'stdint.h': [], ++ 'sys/mman.h': [], ++ 'sys/select.h': [], ++ 'sys/socket.h': [], ++ 'sys/stat.h': [], ++ 'sys/time.h': [], ++ 'sys/timeb.h': [], ++ 'sys/types.h': [], ++ 'unistd.h': [], ++} ++ ++foreach h, d : checked_headers ++ if cc.has_header(h, dependencies: d) ++ cdata.set('HAVE_@0@'.format(h.underscorify().to_upper()), 1) ++ endif ++endforeach ++ ++checked_funcs = { ++ 'ftime': [], ++ 'getaddrinfo': ws2_dep, ++ 'gettimeofday': [], ++ 'isascii': [], ++ 'mmap': [], ++ 'munmap': [], ++ 'putenv': [], ++ 'stat': [], ++} ++ ++foreach f, d : checked_funcs ++ if cc.has_function(f, dependencies: d) ++ cdata.set('HAVE_@0@'.format(f.underscorify().to_upper()), 1) ++ endif ++endforeach ++ ++cdata.set('LT_OBJDIR', '.libs/') ++ ++configure_file( ++ input: 'config.h.cmake.in', ++ output: 'config.h', ++ format: 'cmake@', ++ configuration: cdata, ++) ++ ++withcdata = configuration_data() ++withcdata.set10('HAVE_LIBLZMA', lzma_dep.found()) ++version = meson.project_version() ++version_array = version.split('.') ++major = version_array[0].to_int() ++minor = version_array[1].to_int() ++micro = version_array[2].to_int() ++version_number = major * 10000 + minor * 100 + micro ++withcdata.set('VERSION', version) ++withcdata.set('LIBXML_VERSION_NUMBER', version_number) ++withcdata.set('LIBXML_VERSION_STRING', '@0@'.format(version_number)) ++withcdata.set('LIBXML_VERSION_EXTRA', '') ++ ++need_trio = false ++foreach f : ['printf', 'sprintf', 'fprintf', 'snprintf', 'vfprintf', 'vsprintf', 'vsnprintf', 'sscanf'] ++ if not cc.has_function(f, prefix: '#include <stdio.h>') ++ need_trio = true ++ break ++ endif ++endforeach ++withcdata.set10('WITH_TRIO', need_trio) ++ ++withcdata.set10('WITH_THREADS', with_threads) ++withcdata.set10('WITH_THREAD_ALLOC', false) ++withcdata.set10('WITH_TREE', true) ++withcdata.set10('WITH_OUTPUT', true) ++withcdata.set10('WITH_PUSH', true) ++withcdata.set10('WITH_READER', true) ++withcdata.set10('WITH_PATTERN', true) ++withcdata.set10('WITH_WRITER', true) ++withcdata.set10('WITH_SAX1', true) ++withcdata.set10('WITH_FTP', false) ++withcdata.set10('WITH_HTTP', true) ++withcdata.set10('WITH_VALID', true) ++withcdata.set10('WITH_HTML', true) ++withcdata.set10('WITH_LEGACY', false) ++withcdata.set10('WITH_C14N', true) ++withcdata.set10('WITH_CATALOG', true) ++withcdata.set10('WITH_DOCB', true) ++withcdata.set10('WITH_XPATH', true) ++withcdata.set10('WITH_XPTR', true) ++withcdata.set10('WITH_XPTR_LOCS', false) ++withcdata.set10('WITH_XINCLUDE', true) ++withcdata.set10('WITH_ICONV', iconv_lib.found()) ++withcdata.set10('WITH_ICU', false) ++withcdata.set10('WITH_ISO8859X', true) ++withcdata.set10('WITH_DEBUG', true) ++withcdata.set10('WITH_MEM_DEBUG', false) ++withcdata.set10('WITH_RUN_DEBUG', false) ++withcdata.set10('WITH_REGEXPS', true) ++withcdata.set10('WITH_SCHEMAS', true) ++withcdata.set10('WITH_SCHEMATRON', true) ++withcdata.set10('WITH_MODULES', dl_lib.found()) ++ ++system = target_machine.system() ++if system == 'cygwin' ++ module_ext = '.cygdll' ++elif system == 'darwin' ++ module_ext = '.bundle' ++elif system == 'windows' ++ module_ext = '.dll' ++else ++ module_ext = '.so' ++endif ++ ++withcdata.set('MODULE_EXTENSION', module_ext) ++ ++withcdata.set10('WITH_ZLIB', zlib_dep.found()) ++withcdata.set10('WITH_LZMA', lzma_dep.found()) ++ ++subdir('include/libxml') ++ ++sources = files( ++ 'HTMLparser.c', ++ 'HTMLtree.c', ++ 'SAX.c', ++ 'SAX2.c', ++ 'buf.c', ++ 'c14n.c', ++ 'catalog.c', ++ 'chvalid.c', ++ 'debugXML.c', ++ 'dict.c', ++ 'encoding.c', ++ 'entities.c', ++ 'error.c', ++ 'globals.c', ++ 'hash.c', ++ 'legacy.c', ++ 'list.c', ++ 'nanoftp.c', ++ 'nanohttp.c', ++ 'parser.c', ++ 'parserInternals.c', ++ 'pattern.c', ++ 'relaxng.c', ++ 'schematron.c', ++ 'threads.c', ++ 'tree.c', ++ 'uri.c', ++ 'valid.c', ++ 'xinclude.c', ++ 'xlink.c', ++ 'xmlIO.c', ++ 'xmlmemory.c', ++ 'xmlmodule.c', ++ 'xmlreader.c', ++ 'xmlregexp.c', ++ 'xmlsave.c', ++ 'xmlschemas.c', ++ 'xmlschemastypes.c', ++ 'xmlstring.c', ++ 'xmlunicode.c', ++ 'xmlwriter.c', ++ 'xpath.c', ++ 'xpointer.c', ++ 'xzlib.c', ++) ++ ++if need_trio ++ sources += files('trio.c', 'trionan.c', 'triostr.c') ++endif ++ ++if host_machine.system() == 'windows' ++ subdir('win32') ++endif ++ ++cargs = with_threads ? ['-D_REENTRANT'] : [] ++cargs += get_option('default_library') == 'static' ? '-DLIBXML_STATIC' : [] ++ ++link_args = cc.get_supported_link_arguments( ++ [ ++ # lld 16 defaults to --no-undefined-version but the version script ++ # can contain symbols disabled by configuration options. ++ '-Wl,--undefined-version', ++ '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'libxml2.syms') ++ ] ++) ++ ++incdir = include_directories('include') ++xml2lib = library( ++ 'xml2', ++ sources, ++ c_args: cargs, ++ link_args: link_args, ++ include_directories: incdir, ++ dependencies: deps, ++ version: meson.project_version(), ++ gnu_symbol_visibility: 'default', ++ install: true, ++) ++ ++libxml2_dep = declare_dependency( ++ link_with: xml2lib, ++ include_directories: incdir, ++ dependencies: deps, ++ variables: 'modules=@0@'.format(withcdata.get('WITH_MODULES')), ++ compile_args: get_option('default_library') == 'static' ? '-DLIBXML_STATIC' : [], ++) ++ ++pkg = import('pkgconfig') ++pkg.generate( ++ xml2lib, ++ name: 'libXML', ++ description: 'libXML library version2.', ++ filebase: 'libxml-2.0', ++ subdirs: 'libxml2', ++ variables: 'modules=@0@'.format(withcdata.get('WITH_MODULES')), ++ extra_cflags: get_option('default_library') == 'static' ? '-DLIBXML_STATIC' : [], ++) ++ ++executable('xmllint', 'xmllint.c', dependencies: libxml2_dep, install: true) ++ ++dictexe = executable('testdict', 'testdict.c', dependencies: libxml2_dep) ++ ++test('dict', dictexe) +diff --git a/meson_options.txt b/meson_options.txt +new file mode 100644 +index 0000000..4545f8e +--- /dev/null ++++ b/meson_options.txt +@@ -0,0 +1 @@ ++option('iconv', type: 'feature', description: 'Build with iconv support') +diff --git a/win32/meson.build b/win32/meson.build +new file mode 100644 +index 0000000..db16c9f +--- /dev/null ++++ b/win32/meson.build +@@ -0,0 +1,13 @@ ++rcvdata = configuration_data() ++rcvdata.set('LIBXML_MAJOR_VERSION', major) ++rcvdata.set('LIBXML_MINOR_VERSION', minor) ++rcvdata.set('LIBXML_MICRO_VERSION', micro) ++rcvdata.set_quoted('LIBXML_DOTTED_VERSION', meson.project_version()) ++configure_file( ++ output: 'rcVersion.h', ++ configuration: rcvdata, ++) ++ ++rcfile = configure_file(input: 'libxml2.rc', output: 'libxml2.rc', copy: true) ++windows = import('windows') ++sources += windows.compile_resources(rcfile) +-- +2.42.0.windows.2 + |