From 5323db1a1c004755650f912df4e868f043a9c9df Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Fri, 6 Apr 2018 22:53:21 +0200 Subject: [PATCH 1/9] have libarchive compile with recent libressl defining HMAC_CTX_new and HMAC_CTX_FREE as a workaround makes builds fail with LibreSSL 2.7+. Fixing this is necessary to bootstrap pkgsrc with clang on OpenBSD 6.3 --- .../libarchive/files/libarchive/archive_openssl_hmac_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h b/archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h index 59f95b80af83..4e793f772a24 100644 --- a/archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h +++ b/archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h @@ -28,7 +28,7 @@ #include #include -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) #include /* malloc, free */ #include /* memset */ static inline HMAC_CTX *HMAC_CTX_new(void) From 71c7aac09f67674a1227e1dfae2b578bc8c8fdec Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Fri, 6 Apr 2018 23:24:34 +0200 Subject: [PATCH 2/9] use clang on OpenBSD 6.2 work around the circular dependency on gcc3-c when building cwrappers by letting pkgsrc know that the default compiler has changed to clang since OpenBSD 6.2 --- bootstrap/bootstrap | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 8def6e72fc6b..8b0151693b7b 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: bootstrap,v 1.248 2018/03/07 07:34:07 rillig Exp $ +# $NetBSD: bootstrap,v 1.248 2018/04/06 23:30:00 rillig Exp $ # # Copyright (c) 2001-2011 Alistair Crooks # All rights reserved. @@ -776,6 +776,7 @@ OpenBSD) need_awk=no need_sed=no set_opsys=no + check_openbsd_clang=yes machine_arch=`arch -s` ;; OSF1) @@ -983,6 +984,11 @@ if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then esac fi fi +if [ x"$check_openbsd_clang" = x"yes" ]; then + if [ $(echo "$(uname -r) > 6.2" | bc -l) ]; then + compiler="clang" + fi +fi mkdir_p_early ${wrkdir}/bin From 5077e2f317862fc34a9d98220ee449a12544fff6 Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Sat, 7 Apr 2018 17:28:58 +0200 Subject: [PATCH 3/9] fix bootstrapping on openbsd 6.2+ with clang fix bootstrapping on openbsd 6.2+ with clang by fixing the get_compiler function to use 'cc' as testcc instead of gcc. --- bootstrap/bootstrap | 56 +++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 8b0151693b7b..f3cfcd17e551 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -134,37 +134,33 @@ get_compiler() # normally, we'd just use 'cc', but certain configure tools look # for gcc specifically, so we have to see if that comes first if [ -z "${testcc}" ]; then - save_IFS="${IFS}" - IFS=':' - for dir in ${PATH}; do - test -z "$dir" && dir=. - if [ -x "$dir/gcc" ]; then - testcc="$dir/gcc" - break - fi - done - IFS="${save_IFS}" - fi +# save_IFS="${IFS}" +# IFS=':' +# for dir in ${PATH}; do +# test -z "$dir" && dir=. +# if [ -x "$dir/gcc" ]; then +# testcc="$dir/gcc" +# break +# fi +# done +# IFS="${save_IFS}" +# fi # Clang compiler pretends to be GCC, so we have to check that - cat >${wrkdir}/$$.c </dev/null | grep -c indeed` - rm -f ${wrkdir}/$$.c - - cat >${wrkdir}/$$.c <${wrkdir}/$$.c </dev/null | grep -c indeed` - rm -f ${wrkdir}/$$.c - + compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c gcc` + compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c clang` + rm -f ${wrkdir}/$$.c + fi + } get_abi() { @@ -776,7 +772,7 @@ OpenBSD) need_awk=no need_sed=no set_opsys=no - check_openbsd_clang=yes + check_compiler=yes machine_arch=`arch -s` ;; OSF1) @@ -984,12 +980,6 @@ if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then esac fi fi -if [ x"$check_openbsd_clang" = x"yes" ]; then - if [ $(echo "$(uname -r) > 6.2" | bc -l) ]; then - compiler="clang" - fi -fi - mkdir_p_early ${wrkdir}/bin # build install-sh From c2fd02de9338a80a7b2728274713c822fbd90ec3 Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Sun, 8 Apr 2018 18:29:39 +0200 Subject: [PATCH 4/9] don't retain code that searches for gcc as comment --- bootstrap/bootstrap | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index f3cfcd17e551..845abd765efd 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -134,18 +134,6 @@ get_compiler() # normally, we'd just use 'cc', but certain configure tools look # for gcc specifically, so we have to see if that comes first if [ -z "${testcc}" ]; then -# save_IFS="${IFS}" -# IFS=':' -# for dir in ${PATH}; do -# test -z "$dir" && dir=. -# if [ -x "$dir/gcc" ]; then -# testcc="$dir/gcc" -# break -# fi -# done -# IFS="${save_IFS}" -# fi - # Clang compiler pretends to be GCC, so we have to check that cat >${wrkdir}/$$.c < Date: Sun, 8 Apr 2018 18:30:13 +0200 Subject: [PATCH 5/9] don't update date --- bootstrap/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 845abd765efd..fd219e5cbafb 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: bootstrap,v 1.248 2018/04/06 23:30:00 rillig Exp $ +# $NetBSD: bootstrap,v 1.248 2018/03/07 07:34:07 rillig Exp $ # # Copyright (c) 2001-2011 Alistair Crooks # All rights reserved. From e33024c4eef321534e6360b949f1cbffe01ade15 Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Sun, 8 Apr 2018 18:33:04 +0200 Subject: [PATCH 6/9] restore newline after compiler check --- bootstrap/bootstrap | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index fd219e5cbafb..f61a88bc43a1 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -968,6 +968,7 @@ if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then esac fi fi + mkdir_p_early ${wrkdir}/bin # build install-sh From 88fdaf126175afee3b5037adae0ba0550c56b9fc Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Mon, 9 Apr 2018 11:05:22 +0200 Subject: [PATCH 7/9] delete stray indeed --- bootstrap/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index f61a88bc43a1..d5d5e054e632 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -136,7 +136,7 @@ get_compiler() if [ -z "${testcc}" ]; then # Clang compiler pretends to be GCC, so we have to check that cat >${wrkdir}/$$.c < Date: Sat, 5 May 2018 16:09:51 +0200 Subject: [PATCH 8/9] get_compiler: remove now unused condition if -z testcc had the preprocessor test run only if cc was not already set, which broke things on osx. --- bootstrap/bootstrap | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index d5d5e054e632..3e25a991724f 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -131,9 +131,6 @@ echo_msg() get_compiler() { testcc="${CC}" - # normally, we'd just use 'cc', but certain configure tools look - # for gcc specifically, so we have to see if that comes first - if [ -z "${testcc}" ]; then # Clang compiler pretends to be GCC, so we have to check that cat >${wrkdir}/$$.c </dev/null | grep -c gcc` compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c clang` rm -f ${wrkdir}/$$.c - fi } get_abi() From 82813f1115afee4e016f2a0f5c7c9c00cd0a986a Mon Sep 17 00:00:00 2001 From: kmotavalli Date: Sat, 5 May 2018 16:12:13 +0200 Subject: [PATCH 9/9] adjust identation in get_compiler --- bootstrap/bootstrap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 3e25a991724f..720fc7c8da35 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -132,7 +132,7 @@ get_compiler() { testcc="${CC}" # Clang compiler pretends to be GCC, so we have to check that - cat >${wrkdir}/$$.c <${wrkdir}/$$.c </dev/null | grep -c gcc` - compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c clang` - rm -f ${wrkdir}/$$.c + compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c gcc` + compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c clang` + rm -f ${wrkdir}/$$.c } get_abi()