[PATCH] Make contrib/download_prerequisites work on AIX and OpenBSD

Ilya Leoshkevich iii@linux.ibm.com
Tue Jun 23 20:36:13 GMT 2020


Hello,

I needed to test [1] on AIX and OpenBSD and noticed
download_prerequisites doesn't work there. The attached patch fixes
it.

OK for master?

Best regards,
Ilya

[1] https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548182.html

---

contrib/ChangeLog:

2020-06-11  Ilya Leoshkevich  <iii@linux.ibm.com>

	* download_prerequisites: Support AIX and OpenBSD unames.
	Pipe `{gzip,bzip2} -d` to `tar -xf -`.
---
 contrib/download_prerequisites | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
index aa0356e6266..da19913f9ab 100755
--- a/contrib/download_prerequisites
+++ b/contrib/download_prerequisites
@@ -47,9 +47,12 @@ force=0
 OS=$(uname)
 
 case $OS in
-  "Darwin"|"FreeBSD"|"DragonFly")
+  "Darwin"|"FreeBSD"|"DragonFly"|"AIX")
     chksum='shasum -a 512 --check'
   ;;
+  "OpenBSD")
+    chksum='sha512 -c'
+  ;;
   *)
     chksum='sha512sum -c'
   ;;
@@ -242,8 +245,19 @@ for ar in $(echo_archives)
 do
     package="${ar%.tar*}"
     if [ ${force} -gt 0 ]; then rm -rf "${directory}/${package}"; fi
+    case $ar in
+    *.gz)
+	uncompress='gzip -d'
+	;;
+    *.bz2)
+	uncompress='bzip2 -d'
+	;;
+    *)
+	uncompress='cat'
+	;;
+    esac
     [ -e "${directory}/${package}" ]                                          \
-        || ( cd "${directory}" && tar -xf "${ar}" )                           \
+        || ( cd "${directory}" && $uncompress <"${ar}" | tar -xf - )          \
         || die "Cannot extract package from ${ar}"
     unset package
 done
-- 
2.25.4



More information about the Gcc-patches mailing list