1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00
Commit Graph

116 Commits

Author SHA1 Message Date
Nick Wellnhofer
da68639926 io: Fix return value of xmlFileRead
This broke in commit 6d27c54.

Fixes #766.
2024-07-09 13:02:31 +02:00
Nick Wellnhofer
e2a49afe3e build: Read version number from VERSION file 2024-07-03 20:32:23 +02:00
Nick Wellnhofer
c3731347c4 build: Introduce LIBXML_MINOR_COMPAT
This is set to 0 for now but could be used to avoid ABI stability
issues.
2024-07-03 18:33:16 +02:00
Nick Wellnhofer
64b0c64ed6 cmake: Don't install man pages if LIBXML2_WITH_PROGRAMS=OFF 2024-07-01 18:03:06 +02:00
Nick Wellnhofer
c195f06fac autotools: Use AX_GCC_FUNC_ATTRIBUTE from autoconf archives 2024-06-25 22:19:47 +02:00
Nick Wellnhofer
1afaa37128 build: Move definition of ATTRIBUTE_DESTRUCTOR to libxml.h 2024-06-25 22:06:36 +02:00
Nick Wellnhofer
7655ed2cc0 cmake: Implement dependent options
This should make sure that configurations are valid but doesn't warn
about invalid configurations.

CMake only supports boolean options and I have no idea how features
like "minimal" or "legacy" that change default values of other options
could be supported.

Fixes #551.
2024-06-23 21:48:16 +02:00
Daniel E
600c6ca4bc cmake: Don't install meson build scripts in documentation
Add meson.build files as exclusions
2024-06-23 12:16:47 +00:00
Nick Wellnhofer
4b6e68282b cmake: Stop using win32config.h
Move this file to the win32 subdirectory.
2024-06-22 18:41:00 +02:00
Nick Wellnhofer
84a4f84c1c build: Don't check for required headers and functions
Unless we are on Windows, the following POSIX headers are required.
They're part of the earliest POSIX specs and it doesn't make sense to
check for them.

- fcntl.h
- unistd.h
- sys/stat.h
- sys/time.h

On Windows, io.h, fcntl.h and sys/stat.h are always available.
2024-06-22 18:41:00 +02:00
Nick Wellnhofer
02326d72d3 build: Remove socklen_t checks
socklen_t has been mandated by POSIX for ages. Always use "socklen_t" or
"int" on Win32.
2024-06-22 00:40:40 +02:00
Nick Wellnhofer
c106455c25 build: Set Cflags.private on Windows 2024-06-21 13:51:09 +02:00
Nick Wellnhofer
4c1b88513f autotools: Move MODULE_PLATFORM_LIBS into NON_PC_LIBS 2024-06-21 13:48:22 +02:00
Nick Wellnhofer
33a1f8978d legacy: Merge SAX.c into legacy.c 2024-06-16 19:17:41 +02:00
Nick Wellnhofer
1341deac13 xmllint: Move shell to xmllint
Move source code for xmllint shell to shell.c and move it from the
libxml2 library to the xmllint executable.

Also allow shell to run without XPath and debug modules.

Add stubs for old shell API functions in legacy build mode.
2024-06-16 18:47:12 +02:00
Nick Wellnhofer
481fd6bbee tests: Remove testThreads.c
This was merged into runtest.c some time ago.
2024-06-16 18:47:12 +02:00
Nick Wellnhofer
b0fc67aa22 build: Remove --with-tree configuration option
This option would allow for a smaller, but mostly useless minimal build.
But it complicates the symbol availability logic in an insane way and
requires specialized tools like our custom C parser in doc/apibuild.py.

See #717.
2024-06-16 18:47:12 +02:00
Nick Wellnhofer
7cf7a54aea build: Only enable linker version script in legacy mode
The version script is deprecated but required for backward
compatibility.
2024-06-16 18:47:12 +02:00
Nick Wellnhofer
e714f506e4 build: Stop installing libxml.m4
This file is deprecated and unmaintained. It will be kept in the source
tree for a while.
2024-06-15 20:14:03 +02:00
Nick Wellnhofer
669bd34993 xpointer: Remove support for XPointer locations
The latest spec for what it essentially an XPath extension seems to be
this working draft from 2002:

    https://www.w3.org/TR/xptr-xpointer/

The xpointer() scheme is listed as "being reviewed" in the XPointer
registry since at least 2006. libxml2 seems to be the only modern
software that tries to implement this spec, but the code has many bugs
and quality issues.

If you configure --with-legacy, old symbols are retained for ABI
compatibility.
2024-06-12 18:20:01 +02:00
Nick Wellnhofer
dba1ed85a3 ftp: Remove FTP support
Remove the built-in FTP client. If you configure --with-legacy, old
symbols are retained for ABI compatibility.
2024-06-12 18:19:55 +02:00
Nick Wellnhofer
11ce63f02b build: Don't check for isascii 2024-05-21 20:40:30 +02:00
Nick Wellnhofer
e80f27fc81 build: Don't check for inttypes.h
This header isn't used.
2024-05-21 18:37:57 +02:00
Nick Wellnhofer
3018842c07 build: Disable HTTP support by default 2024-05-20 23:59:55 +02:00
Nick Wellnhofer
609d2666fa Stop defining _REENTRANT
This macro is obsolete, see `man feature_test_macros`.
2024-05-13 13:08:14 +02:00
Nick Wellnhofer
1cdfece12b memory: Remove memory debugging
This is useless compared to sanitizers or valgrind and has a
considerable performance impact if enabled accidentally.
2024-04-28 20:42:55 +02:00
Nick Wellnhofer
00336f0fee cmake: Don't use tabs in CMakeLists.txt
Always use spaces and indent_size=4 except for Makefiles.
2024-04-23 18:16:03 +02:00
Nick Wellnhofer
f7f1453772 build: Disable support for compression libraries by default
libxml2 has limited support for reading and writing compressed data
with the help of zlib and liblzma which used to be enabled by default.
This only works for files read from the file system and never worked
with memory buffers. My guess is that this feature is virtually unused.

In light of the recently discovered xz backdoor, it's a good time to
disable these features by default to reduce attack surface and prepare
for eventual removal.

If --with-legacy is passed to the Autotools build, compression will
be enabled by default as before.
2024-04-02 13:25:56 +02:00
Nick Wellnhofer
2e9e758d1e dict: Get random seed from system PRNG 2023-12-24 16:24:34 +01:00
Nick Wellnhofer
cf6e58d63c build: Disable compiler TLS by default
The global struct is quite large (~700 bytes on 64-bit systems which
will be allocated for each thread whether it uses libxml2 or not) and
already close to the total size limit on some platforms.

Disable compiler TLS by default.
2023-12-05 21:07:00 +01:00
Nick Wellnhofer
e2ce828c9b cmake: Update config.h.cmake.in
This should enable TLS and destructors.
2023-11-28 16:51:06 +01:00
Nick Wellnhofer
5cffba8381 Rework va_copy fallback
va_copy is a macro, so it can be detected without a feature test.
Fallback to __va_copy or memcpy.
2023-11-28 15:59:40 +01:00
Nick Wellnhofer
7d6969d955 Remove Trio
Trio is a rather old cross-platform printf library which was bundled with
libxml2. It was needed for ancient pre-C99 systems without snprintf and
should be safe to remove these days.
2023-11-23 15:48:52 +01:00
Nick Wellnhofer
a9ada18352 tests: Start with testparser.c for extra tests
Several issues require customized tests. Start with a test that push
parses large documents. See #539.
2023-10-22 14:24:43 +02:00
Nick Wellnhofer
19161bab15 dict: Internal API to look up hash values 2023-09-29 12:43:08 +02:00
James Le Cuirot
c7ff438b83
cmake: Only use pkg-config for .pc files, not for building binaries
Using `pkg_check_modules(FOO IMPORTED_TARGET foo)` with
`target_link_libraries()` leads to `INTERFACE_LINK_LIBRARIES` in the
resulting export file having `\$<LINK_ONLY:PkgConfig::FOO>` rather than
the currently expected `\$<LINK_ONLY:FOO::FOO>`, leading to breakage.
This can be worked around like so:

    target_link_libraries(UseFoo
      PUBLIC "$<BUILD_INTERFACE:PkgConfig::FOO>"
      INTERFACE "$<INSTALL_INTERFACE:FOO::FOO>"
    )

However, following some discussion, it is preferable to primarily use
find modules as before and only use `pkg_check_modules` for correctly
populating the .pc file.

Also move `find_package()` calls earlier so that builds fail faster when
dependencies are missing.
2023-09-23 16:48:57 +01:00
James Le Cuirot
8617d8aa10
cmake: Find threads dep early as it may be needed for later checks 2023-09-23 16:48:51 +01:00
Nick Wellnhofer
e7f0d88ba4 build: Remove some GCC warnings
-Wnested-externs produces spurious warnings after implicit
declaration of functions.

-Winline is useless since we don't use inlines.

-Wredundant-decls was already removed for autotools.
2023-09-21 02:26:43 +02:00
James Le Cuirot
f369154fce
cmake: Generate better pkg-config file for SYSROOT builds under CMake
I recently fixed this for Autotools but said that fixing this for CMake
was not feasible due to it using `find_package` rather than
`pkg_check_modules`. I then thought about it and couldn't find any
reason why CMake couldn't try `pkg_check_modules` first and then fall
back to `find_package`, as that's basically what Autotools does.

I had wanted to use the linker flags generated by CMake when it does
fall back to `find_package`, but it only returns direct paths to the
libraries, as opposed to `-l` flags. Baking these library paths into the
pkg-config and xml2-config files would break static linking and
cross-compiling, so I've stuck with the `-l` flags we already have.

There is no need to set `CMAKE_REQUIRED_LIBRARIES` because we already
add the dependencies to the library target.
2023-09-04 22:14:16 +01:00
James Le Cuirot
93e8bb2a40
build: Generate better pkg-config files for static-only builds
pkg-config supports `Requires.private` and `Libs.private` fields for
static linking. However, if you're building a dynamic binary, then
pkg-config will use the non-private fields, even if just the static
libxml2 is available. This will result in libxml2 being underlinked,
causing the build to fail. The solution is to fold the private fields
into the non-private fields when the shared libxml2 is not being built.

This works for Autotools and CMake. Meson also knows how to handle this
when it automatically generates pkg-config files.
2023-09-03 08:52:36 +01:00
James Le Cuirot
4640ccac85
build: Generate better pkg-config file for SYSROOT builds
The -I and -L flags you use to build should not necessarily be the same
ones you bake into installed files. If you are building with
dependencies located under a SYSROOT then the installed files should
have no knowledge of that SYSROOT. For example, if the build requires
`-L/path/to/sysroot/usr/lib/foo` then only `-L/usr/lib/foo` should be
baked into the installed files.

pkg-config is SYSROOT-aware, so this issue can be sidestepped by using
the `Requires` field rather than the `Libs` and `Cflags` fields. This is
easily resolved if you rely solely on pkg-config, but this project falls
back to standard Autoconf checks, so a little more effort is required.

Unfortunately, this issue cannot feasibly be resolved for CMake.
`find_package` is used rather than `pkg_check_modules`, so we cannot
tell whether a pkg-config file for each dependency is present or not,
even if `find_package` uses pkg-config behind the scenes. The CMake
build does not record any dependency -I or -L flags into the pkg-config
file anyway. This is a problem in itself, although these dependencies
are most likely installed to standard locations.

Meson is very much better at handling this, as it generates the
pkg-config file automatically using the correct logic.
2023-09-03 08:52:22 +01:00
Nick Wellnhofer
c5989473b9 dict: Use thread-local storage for PRNG state 2023-09-01 14:52:11 +02:00
Nick Wellnhofer
57cfd221a6 dict: Use xoroshiro64** as PRNG
Stop using rand_r. This enables hash randomization on all platforms.
2023-09-01 14:52:04 +02:00
Nick Wellnhofer
cb8ccb1078 testapi: Don't set http_proxy environment variable
We already disable network access, so this has no effect.
2023-05-25 03:17:45 +02:00
Luca Niccoli
fdc9cfaa14 cmake: Fix va_copy detection
va_copy is defined by the standard as a macro, so check_function_exists
will not detect it; check_symbol_exists will.

Fixes #528.
2023-04-30 13:18:17 +02:00
Nick Wellnhofer
a5bc460583 cmake: Link with --undefined-version 2023-04-29 20:43:54 +02:00
Alexander Kutelev
f931178e5f cmake: Link against dl and dld only when LIBXML2_WITH_MODULES is enabled 2023-02-24 12:45:01 +00:00
Nick Wellnhofer
b92768cd62 tests: Enable "runsuite" test
This enables some tests with testcases in

- test/xsdtest
- test/relaxng/OASIS/spectest.xml
- test/relaxng/testsuite.xml

The XML Schema Test Suite will also be run it was downloaded, see
xstc/Makefile.am. Gitlab CI should be updated to fetch these files.

There are 10 expected errors in the XSD test suite. This seems to be the
case since at least version 2.9.0 from 2012.
2022-12-08 00:24:53 +01:00
Nick Wellnhofer
530938b487 cmake: Build static library with -DLIBXML_STATIC
Fix scope of target_compile_definitions command.

Fixes #425.
2022-10-18 19:17:45 +02:00
Nick Wellnhofer
796c830a2f cmake: Set SOVERSION
Fixes #410.
2022-09-20 14:30:19 +02:00