summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2021-05-23 03:30:41 +0200
committerSebastian Pipping <sebastian@pipping.org>2021-05-23 15:43:56 +0200
commit779d147681f4ff3bf399f5c4f2d77a8f0d266db4 (patch)
tree101a908468f80d933ee3740f094f36b70682b5e8
parentfa12e73d0526546de349661d2076a74fd9e9f93d (diff)
downloadlibexpat-git-779d147681f4ff3bf399f5c4f2d77a8f0d266db4.tar.gz
Keep macro SIZEOF_VOID_P out of expat_config.h(.in) for multilib support
-rw-r--r--.github/workflows/data/expat_config_h_in__expected.txt1
-rw-r--r--expat/Changes8
-rwxr-xr-xexpat/buildconf.sh31
3 files changed, 35 insertions, 5 deletions
diff --git a/.github/workflows/data/expat_config_h_in__expected.txt b/.github/workflows/data/expat_config_h_in__expected.txt
index 56f66137..3c23e8fc 100644
--- a/.github/workflows/data/expat_config_h_in__expected.txt
+++ b/.github/workflows/data/expat_config_h_in__expected.txt
@@ -29,7 +29,6 @@ PACKAGE_STRING
PACKAGE_TARNAME
PACKAGE_URL
PACKAGE_VERSION
-SIZEOF_VOID_P
size_t
STDC_HEADERS
VERSION
diff --git a/expat/Changes b/expat/Changes
index 6d926eb5..db4a396e 100644
--- a/expat/Changes
+++ b/expat/Changes
@@ -2,6 +2,14 @@ NOTE: We are looking for help with a few things:
https://github.com/libexpat/libexpat/labels/help%20wanted
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
Security fixes:
#34 #466 #484 CVE-2013-0340/CWE-776 -- Protect against billion laughs attacks
diff --git a/expat/buildconf.sh b/expat/buildconf.sh
index 174b6c07..5edbc565 100755
--- a/expat/buildconf.sh
+++ b/expat/buildconf.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /usr/bin/env bash
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
@@ -6,8 +6,8 @@
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
-# Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
-# Copyright (c) 2018 Marco Maggi <marco.maggi-ipsu@poste.it>
+# Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
+# Copyright (c) 2018 Marco Maggi <marco.maggi-ipsu@poste.it>
# Licensed under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -29,4 +29,27 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# 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