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

88 Commits

Author SHA1 Message Date
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
Nick Wellnhofer
5ff3baf0dc python: Create .pyd on Windows 2022-09-06 19:33:32 +02:00
Nick Wellnhofer
a41878bd4c build: Remove check for broken ss_family
This only seemed to affect ancient AIX systems.
2022-09-06 01:07:24 +02:00
Nick Wellnhofer
30c8d9bb23 http: Simplify IPv6 checks
This should also enable IPv6 support on Windows. Untested and mostly
useless anyway, since we don't support HTTPS.
2022-09-05 02:26:13 +02:00
Nick Wellnhofer
02e1237196 cmake: Fix Python installation
Don't install into ${Python_SITEARCH} for now.
2022-09-04 20:27:27 +02:00
Nick Wellnhofer
243fdbc31c cmake: Don't check for Python 2 2022-09-04 20:27:27 +02:00
Nick Wellnhofer
fe02289fa5 Remove arg cast configure checks
We can simply cast to non-const char * unconditionally.
2022-09-04 03:19:01 +02:00
Nick Wellnhofer
1e60c76821 Remove HAVE_WIN32_THREADS configuration flag
Check for LIBXML_THREAD_ENABLED and _WIN32 instead.
2022-09-04 01:49:41 +02:00
Nick Wellnhofer
202b8e1954 cmake: Enable GCC compiler warnings 2022-09-02 18:44:59 +02:00
Nick Wellnhofer
caef85633e Move automata test to runtest.c 2022-09-02 18:33:36 +02:00
Nick Wellnhofer
513d65fee8 Use AM_CFLAGS and AM_LDFLAGS consistently 2022-09-02 18:33:36 +02:00
Nick Wellnhofer
75bd98a5ef Remove unused code in nanohttp.c
This was hidden behind an undocumented flag RES_USE_INET6.
2022-09-02 18:33:36 +02:00
Nick Wellnhofer
5bffa33a12 Stop including sys/types.h 2022-09-02 18:33:36 +02:00
Nick Wellnhofer
59f2f60e3e Remove "runtime debugging"
This doesn't seem useful as configuration option.
2022-09-02 18:33:35 +02:00
Nick Wellnhofer
484efeb607 cmake: Disable version script on macOS
Fixes #400
2022-08-23 20:07:39 +02:00
Daniel E
eab0ce8ff7 cmake: Install libxml.m4 on UNIX-like platforms
Install libxml.m4 to follow GNU Autotools more closely
2022-07-14 22:15:28 +00:00
Daniel E
88012a3879 cmake: Use symbol versioning on UNIX-like platforms
Use symbol versioning to follow GNU Autotools more closely
2022-07-14 22:33:22 +02:00
Nick Wellnhofer
670701075b Add configuration flag for XPointer locations support
Add a new configuration flag that controls whether the outdated support
for XPointer locations (ranges and points) is enabled.

    --with-xptr-locs          # Autotools
    LIBXML2_WITH_XPTR_LOCS    # CMake

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.

The flag defaults to "off" and support for this extensions has to be
requested explicitly. The relevant API functions are deprecated.
2022-04-21 02:41:58 +02:00
Nick Wellnhofer
02709d0f67 Remove remaining definitions of STDC_HEADERS
Sync with Autotools build.
2022-04-20 19:18:17 +02:00
Nick Wellnhofer
270eb712bf cmake: Run all tests when threads are disabled 2022-04-20 14:28:38 +02:00
Nick Wellnhofer
18bcced9d7 cmake: Fix build with thread support
Move configure_file(config.h) below pthreads check.

Fix regression caused by commit f5659a1.
2022-04-20 13:36:02 +02:00
Nick Wellnhofer
776b00284d cmake: Disable FTP and legacy modules by default
Sync with Autotools build.
2022-04-13 16:47:54 +02:00
Nick Wellnhofer
f5659a122d cmake: Fix build without thread support
Only check for pthread.h if threads are enabled.

Fixes #367.
2022-04-13 14:30:54 +02:00
Nick Wellnhofer
a5724a3b4a cmake: Install documentation in CMAKE_INSTALL_DOCDIR
Sync with recent Autotools change.
2022-04-08 15:47:45 +02:00
Daniel E
4d98f6f9c5 cmake: Remove more unnecessary files installed in docs dir
Sync with commit 9576654162
Don't install man pages in docs directory, these are already installed
in the correct path and while at it sort list
2022-04-08 12:11:39 +00:00
Nick Wellnhofer
94ac5e61f3 CMakeLists.txt: Fix LIBXML_VERSION_NUMBER
Also fix LIBXML_VERSION and remove LIBXML_VERSION_STRING.

Fixes #365.
2022-04-07 02:09:48 +02:00
Daniel E
f2987a295f cmake: Remove non needed files in docs dir
Don't install files that are used to generate the documentation
2022-04-04 12:04:21 +00:00
Nick Wellnhofer
5ce893c0c4 Move regexp tests to runtest 2022-04-04 04:28:15 +02:00
Nick Wellnhofer
48b03c8479 Remove major parts of old test suite
Remove all the parts of the old test suite which are covered by
runtest.c for quite some time.

The following test programs are removed:

- testC14N
- testHTML
- testReader
- testRelax
- testSAX
- testSchemas
- testURI
- testXPath

This also removes a few results of unimportant tests only run by the old
test suite.
2022-04-04 04:14:55 +02:00