Keep macro SIZEOF_VOID_P out of expat_config.h(.in) for multilib support

This commit is contained in:
Sebastian Pipping 2021-05-23 03:30:41 +02:00
parent fa12e73d05
commit 779d147681
3 changed files with 35 additions and 5 deletions

View File

@ -29,7 +29,6 @@ PACKAGE_STRING
PACKAGE_TARNAME PACKAGE_TARNAME
PACKAGE_URL PACKAGE_URL
PACKAGE_VERSION PACKAGE_VERSION
SIZEOF_VOID_P
size_t size_t
STDC_HEADERS STDC_HEADERS
VERSION VERSION

View File

@ -2,6 +2,14 @@ NOTE: We are looking for help with a few things:
https://github.com/libexpat/libexpat/labels/help%20wanted https://github.com/libexpat/libexpat/labels/help%20wanted
If you can help, please get in touch. Thanks! If you can help, please get in touch. Thanks!
Release 2.4.1 xxx xxx xx xxxx
Bug fixes:
#488 #490 Autotools: Fix installed header expat_config.h for multilib
systems; regression introduced in 2.4.0 by pull request #486
Special thanks to:
Gentoo's QA check "multilib_check_headers"
Release 2.4.0 Sun May 23 2021 Release 2.4.0 Sun May 23 2021
Security fixes: Security fixes:
#34 #466 #484 CVE-2013-0340/CWE-776 -- Protect against billion laughs attacks #34 #466 #484 CVE-2013-0340/CWE-776 -- Protect against billion laughs attacks

View File

@ -1,4 +1,4 @@
#! /bin/sh #! /usr/bin/env bash
# __ __ _ # __ __ _
# ___\ \/ /_ __ __ _| |_ # ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __| # / _ \\ /| '_ \ / _` | __|
@ -6,7 +6,7 @@
# \___/_/\_\ .__/ \__,_|\__| # \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser # |_| XML parser
# #
# Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org> # Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
# Copyright (c) 2018 Marco Maggi <marco.maggi-ipsu@poste.it> # Copyright (c) 2018 Marco Maggi <marco.maggi-ipsu@poste.it>
# Licensed under the MIT license: # Licensed under the MIT license:
# #
@ -29,4 +29,27 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE. # USE OR OTHER DEALINGS IN THE SOFTWARE.
exec autoreconf --warnings=all --install --verbose "$@" set -e
# File expat_config.h.in (as generated by autoheader by autoreconf) contains
# macro SIZEOF_VOID_P which is (1) not really needed by Expat as of today and
# (2) a problem to "multilib" systems with one shared installed
# /usr/include/expat_config.h for two Expats with different "void *" sizes
# installed in e.g. /usr/lib32 and /usr/lib64. Hence we patch macro
# SIZEOF_VOID_P out of template expat_config.h.in so that configure will
# not put SIZEOF_VOID_P in the eventual expat_config.h.
patch_expat_config_h_in() {
local filename="$1"
local sizeof_void_p_line_number="$(fgrep -n SIZEOF_VOID_P "${filename}" | awk -F: '{print $1}')"
[[ ${sizeof_void_p_line_number} =~ ^[0-9]+$ ]] # cheap assert
local first_line_to_delete=$(( sizeof_void_p_line_number - 1 ))
local last_line_to_delete=$(( sizeof_void_p_line_number + 1 ))
# Note: Avoiding "sed -i" only for macOS portability.
local tempfile="$(mktemp)"
sed "${first_line_to_delete},${last_line_to_delete}d" "${filename}" > "${tempfile}"
mv "${tempfile}" "${filename}"
}
autoreconf --warnings=all --install --verbose "$@"
patch_expat_config_h_in expat_config.h.in