Files
packages/libs/libxerces-c/Makefile
T
Alexandru Ardelean 68de1450cc libxerces-c: fix CI build/test failures for apk + samples
Two unrelated issues both fixed here so the package + its samples
sub-package land in CI green:

1. PKG_CPE_ID escaping.
   apk's ADB binary package format rejects both the backslash-escape
   and the percent-encoding variants of the previous CPE id:

     cpe:/a:apache:xerces-c\+\+     ERROR: info field 'tags' has invalid value
     cpe:/a:apache:xerces-c%2B%2B   ERROR: info field 'tags' has invalid value

   apk's tag value parser only accepts a restricted alphabet for ADB
   package format and neither '\' nor '%' make the cut. With xerces-c
   unable to build, downstream consumers (notably sumo) also fail at
   cmake configure time with "Failed to find XercesC".

   Drop the '++' suffix entirely and use cpe:/a:apache:xerces-c, which
   matches the higher-level Apache Xerces-C CPE entry. cve scanners
   that walked the more specific xerces-c++ entry will fall back to
   this one.

2. Generic version-check override for libxerces-c-samples.
   The samples sub-package ships upstream demo programs
   (CreateDOMDocument, DOMCount, DOMPrint, SAX2Count, ...) which do
   not accept --version / -v / -V and therefore fail the framework's
   "executable prints PKG_VERSION" probe, making the package overall
   report "Generic tests failed". Add a minimal test-version.sh that
   exits 0 so the version-probe is skipped and the remaining generic
   checks (executable, no hardcoded paths, stripped, linked libs)
   still run for every binary.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-05-24 15:57:48 +03:00

92 lines
2.8 KiB
Makefile

#
# Copyright (C) 2015-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=xerces-c
PKG_VERSION:=3.2.5
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@APACHE/xerces/c/3/sources
PKG_HASH:=6239e6035645b21bc9bf7f02004db334dce3fe6d85428ee4fe7e180c2d948230
PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:apache:xerces-c
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libxerces-c/Default
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Validating XML parser library for C++
URL:=https://xerces.apache.org/
endef
define Package/libxerces-c
$(call Package/libxerces-c/Default)
DEPENDS:=$(ICONV_DEPENDS) +libstdcpp
endef
define Package/libxerces-c-samples
$(call Package/libxerces-c/Default)
TITLE+= (samples)
DEPENDS+=+libxerces-c
endef
define Package/libxerces-c/description
Xerces-C++ is a validating XML parser written in a portable subset of
C++. Xerces-C++ makes it easy to give your application the ability
to read and write XML data. A shared library is provided for parsing,
generating, manipulating, and validating XML documents. Xerces-C++ is
faithful to the XML 1.0 recommendation and associated standards (DOM
1.0, DOM 2.0, SAX 1.0, SAX 2.0, Namespaces, XML Schema Part 1 and
Part 2). It also provides experimental implementations of XML 1.1
and DOM Level 3.0. The parser provides high performance, modularity,
and scalability.
endef
define Package/libxerces-c-samples/description
Validating XML parser library for C++ (samples)
endef
CMAKE_OPTIONS += \
-DCMAKE_DISABLE_FIND_PACKAGE_ICU=ON \
-Dmessage-loader=inmemory \
-Dnetwork-accessor=socket \
-Dtranscoder=iconv
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/xercesc
$(CP) $(PKG_INSTALL_DIR)/usr/include/xercesc/* $(1)/usr/include/xercesc/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/cmake/XercesC
$(CP) $(PKG_INSTALL_DIR)/usr/lib/cmake/XercesC/* $(1)/usr/lib/cmake/XercesC
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xerces-c.pc $(1)/usr/lib/pkgconfig/xerces-c.pc
$(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/xerces-c.pc
$(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/xerces-c.pc
endef
define Package/libxerces-c/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib/
endef
define Package/libxerces-c-samples/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libxerces-c))
$(eval $(call BuildPackage,libxerces-c-samples))