blob: 9241b279e4d99bba54a11f0739764ff1a737916e [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001SUMMARY = "XML C Parser Library and Toolkit"
2DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat."
3HOMEPAGE = "https://gitlab.gnome.org/GNOME/libxml2"
4BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2"
5SECTION = "libs"
6LICENSE = "MIT"
7LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \
8 file://hash.c;beginline=6;endline=15;md5=e77f77b12cb69e203d8b4090a0eee879 \
9 file://list.c;beginline=4;endline=13;md5=b9c25b021ccaf287e50060602d20f3a7 \
10 file://trio.c;beginline=5;endline=14;md5=cd4f61e27f88c1d43df112966b1cd28f"
11
12DEPENDS = "zlib virtual/libiconv"
13
14inherit gnomebase
15
Patrick Williams821a8592023-05-02 15:26:54 -050016SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar;subdir=${BP};name=testtar \
Andrew Geissler9aee5002022-03-30 16:27:02 +000017 file://libxml-64bit.patch \
18 file://runtest.patch \
19 file://run-ptest \
20 file://python-sitepackages-dir.patch \
21 file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
22 file://fix-execution-of-ptests.patch \
23 file://remove-fuzz-from-ptests.patch \
24 file://libxml-m4-use-pkgconfig.patch \
Patrick Williamsc67ef222022-10-18 12:51:29 -050025 file://0001-Port-gentest.py-to-Python-3.patch \
Patrick Williams821a8592023-05-02 15:26:54 -050026 file://CVE-2022-40303.patch \
27 file://CVE-2022-40304.patch \
Patrick Williams91c40602023-06-15 05:43:17 -050028 file://CVE-2023-28484.patch \
29 file://CVE-2023-29469.patch \
Andrew Geissler9aee5002022-03-30 16:27:02 +000030 "
Andrew Geissler9aee5002022-03-30 16:27:02 +000031
Patrick Williamscb2a94c2022-07-29 10:24:38 -050032SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
Patrick Williams821a8592023-05-02 15:26:54 -050033SRC_URI[testtar.sha256sum] = "9b2c865aba66c6429ca301a7ef048d7eca2cdb7a9106184416710853c7b37d0d"
Andrew Geissler9aee5002022-03-30 16:27:02 +000034
35BINCONFIG = "${bindir}/xml2-config"
36
Patrick Williamsc67ef222022-10-18 12:51:29 -050037# Fixed since 2.9.11 via
38# https://gitlab.gnome.org/GNOME/libxml2/-/commit/c1ba6f54d32b707ca6d91cb3257ce9de82876b6f
39CVE_CHECK_IGNORE += "CVE-2016-3709"
40
Andrew Geissler9aee5002022-03-30 16:27:02 +000041PACKAGECONFIG ??= "python \
42 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
43"
44PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3"
45PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
46
47inherit autotools pkgconfig binconfig-disabled ptest
48
49inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)}
50
51RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}"
52
53RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}"
54
55RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-ebcdic-us \
56 glibc-gconv-ibm1141 \
57 glibc-gconv-iso8859-5 \
58 glibc-gconv-euc-jp \
59 locale-base-en-us \
60 "
61
62export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
63
64# WARNING: zlib is required for RPM use
65EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
66EXTRA_OECONF:class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
67EXTRA_OECONF:class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
68EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
69
70python populate_packages:prepend () {
71 # autonamer would call this libxml2-2, but we don't want that
72 if d.getVar('DEBIAN_NAMES'):
73 d.setVar('PKG:libxml2', '${MLPREFIX}libxml2')
74}
75
76PACKAGE_BEFORE_PN += "${PN}-utils"
77PACKAGES += "${PN}-python"
78
79FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
80FILES:${PN}-dev += "${libdir}/xml2Conf.sh"
81FILES:${PN}-utils = "${bindir}/*"
82FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
83
84do_configure:prepend () {
85 # executables take longer to package: these should not be executable
86 find ${S}/xmlconf/ -type f -exec chmod -x {} \+
87}
88
89do_compile_ptest() {
Patrick Williamsc67ef222022-10-18 12:51:29 -050090 # Make sure that testapi.c is newer than gentests.py, because
91 # with reproducible builds, they will both get e.g. Jan 1 1970
92 # modification time from SOURCE_DATE_EPOCH and then check-am
93 # might try to rebuild_testapi, which will fail even with
94 # 0001-Port-gentest.py-to-Python-3.patch, because it needs
95 # libxml2 module (libxml2-native dependency and correctly
96 # set PYTHON_SITE_PACKAGES), it's easier to
97 # just rely on pre-generated testapi.c from the release
98 touch ${S}/testapi.c
99
Andrew Geissler9aee5002022-03-30 16:27:02 +0000100 oe_runmake check-am
101}
102
103do_install_ptest () {
104 cp -r ${S}/xmlconf ${D}${PTEST_PATH}
105 if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
106 sed -i -e 's|^\(PYTHON = \).*|\1${USRBINPATH}/${PYTHON_PN}|' \
107 ${D}${PTEST_PATH}/python/tests/Makefile
108 grep -lrZ '#!/usr/bin/python' ${D}${PTEST_PATH}/python |
109 xargs -0 sed -i -e 's|/usr/bin/python|${USRBINPATH}/${PYTHON_PN}|'
110 fi
111 #Remove build host references from various Makefiles
112 find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
113 sed -i \
114 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
115 -e 's|${DEBUG_PREFIX_MAP}||g' \
116 -e 's:${HOSTTOOLS_DIR}/::g' \
117 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
118 -e 's:${RECIPE_SYSROOT}::g' \
119 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
120 -e '/^RELDATE/d' \
121 {} +
122}
123
124do_install:append:class-native () {
125 # Docs are not needed in the native case
126 rm ${D}${datadir}/gtk-doc -rf
127}
128
129BBCLASSEXTEND = "native nativesdk"