summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorSam bobroff <sam.bobroff@au1.ibm.com>2016-11-28 16:11:39 +1100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-12-05 22:51:17 +0100
commit41444d7f892b44c87d3b08e7ba1824b9cb9ee9a8 (patch)
tree49e20d888f52436848ed1e7d27c7dfaeafb023b8 /support
parent00810e0ea3976c5b26a7fd264870f15e17a2eaa2 (diff)
pkg-autotools: generic configure fix for powerpc64
Many (100+) packages supported by buildroot contain old configure scripts (or build them from old versions of autotools) that are unable to determine how to link shared libraries on powerpc64 and powerpc64le. This causes that test to erroneously fail on toolchains that are not "bi-endian" (which is the case for toolchains built by buildroot), which causes configure to build static libraries instead of dynamic ones. Although these builds succeed, they tend to cause linker failures in binaries later linked against them. Because affected configure files can be discovered automatically, this patch introduces a hook (enabled only when building for powerpc64 and powerpc64le) that uses a script to scan and fix each package. Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
-rwxr-xr-xsupport/scripts/fix-configure-powerpc64.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/support/scripts/fix-configure-powerpc64.sh b/support/scripts/fix-configure-powerpc64.sh
new file mode 100755
index 000000000..ad710422a
--- /dev/null
+++ b/support/scripts/fix-configure-powerpc64.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# This is a script to find, and correct, a problem with old versions of
+# configure that affect powerpc64 and powerpc64le.
+
+# The issue causes configure to incorrectly determine that shared library
+# support is not present in the linker. This causes the package to build a
+# static library rather than a dynamic one and although the build will succeed,
+# it may cause packages that link with the static library it to fail due to
+# undefined symbols.
+
+# This script searches for files named 'configure' that appear to have this
+# issue (by searching for a known bad pattern) and patching them.
+
+set -e
+
+if [ $# -ne 1 ]; then
+ echo "Usage: $0 <package build directory>"
+ exit 2
+fi
+
+srcdir="$1"
+files=$(cd "$srcdir" && find . -name configure \
+-exec grep -qF 'Generated by GNU Autoconf' {} \; \
+-exec grep -qF 'ppc*-*linux*|powerpc*-*linux*)' {} \; -print)
+
+# --ignore-whitespace is needed because some packages have included
+# copies of configure scripts where tabs have been replaced with spaces.
+for c in $files; do
+ patch --ignore-whitespace "$srcdir"/"$c" <<'EOF'
+--- a/configure 2016-11-16 15:31:46.097447271 +1100
++++ b/configure 2008-07-21 12:17:23.000000000 +1000
+@@ -4433,7 +4433,10 @@
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+- ppc*-*linux*|powerpc*-*linux*)
++ powerpcle-*linux*)
++ LD="${LD-ld} -m elf64lppc"
++ ;;
++ powerpc-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+EOF
+done
+