Wed Dec 27 14:41:31 2023 UTC (152d)
openssl: on NetBSD arches without atomic 64-bit ops, use builtin fallbacks.

Fixes these errors on NetBSD/macppc (and presumably the other listed platforms):

ld: ./libcrypto.so: undefined reference to `__atomic_load_8'
ld: ./libcrypto.so: undefined reference to `__atomic_fetch_or_8'
ld: ./libcrypto.so: undefined reference to `__atomic_is_lock_free'

(suggested by riastradh@)


(schmonz)
diff -r1.294 -r1.295 pkgsrc/security/openssl/Makefile

cvs diff -r1.294 -r1.295 pkgsrc/security/openssl/Makefile (expand / switch to unified diff)

--- pkgsrc/security/openssl/Makefile 2023/11/05 19:37:19 1.294
+++ pkgsrc/security/openssl/Makefile 2023/12/27 14:41:31 1.295
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.294 2023/11/05 19:37:19 nia Exp $ 1# $NetBSD: Makefile,v 1.295 2023/12/27 14:41:31 schmonz Exp $
2 2
3# Remember to upload-distfiles when updating OpenSSL -- otherwise it 3# Remember to upload-distfiles when updating OpenSSL -- otherwise it
4# is not possible for users who have bootstrapped without OpenSSL 4# is not possible for users who have bootstrapped without OpenSSL
5# to install it and enable HTTPS fetching. 5# to install it and enable HTTPS fetching.
6DISTNAME= openssl-3.1.4 6DISTNAME= openssl-3.1.4
7CATEGORIES= security 7CATEGORIES= security
8MASTER_SITES= https://www.openssl.org/source/ 8MASTER_SITES= https://www.openssl.org/source/
9 9
10MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
11HOMEPAGE= https://www.openssl.org/ 11HOMEPAGE= https://www.openssl.org/
12COMMENT= Secure Socket Layer and cryptographic library 12COMMENT= Secure Socket Layer and cryptographic library
13LICENSE= openssl 13LICENSE= openssl
14 14
@@ -20,26 +20,42 @@ BUILD_TARGET= depend all @@ -20,26 +20,42 @@ BUILD_TARGET= depend all
20TEST_TARGET= test 20TEST_TARGET= test
21 21
22HAS_CONFIGURE= yes 22HAS_CONFIGURE= yes
23CONFIGURE_SCRIPT= ./config 23CONFIGURE_SCRIPT= ./config
24CONFIGURE_ARGS+= --prefix=${PREFIX} 24CONFIGURE_ARGS+= --prefix=${PREFIX}
25CONFIGURE_ARGS+= --libdir=${PREFIX}/lib 25CONFIGURE_ARGS+= --libdir=${PREFIX}/lib
26CONFIGURE_ARGS+= --openssldir=${PKG_SYSCONFDIR} 26CONFIGURE_ARGS+= --openssldir=${PKG_SYSCONFDIR}
27CONFIGURE_ARGS+= shared 27CONFIGURE_ARGS+= shared
28MAKE_FLAGS+= MANSUFFIX= 28MAKE_FLAGS+= MANSUFFIX=
29MAKE_FLAGS+= MANDIR=${PREFIX}/${PKGMANDIR} 29MAKE_FLAGS+= MANDIR=${PREFIX}/${PKGMANDIR}
30 30
31.include "../../mk/bsd.prefs.mk" 31.include "../../mk/bsd.prefs.mk"
32 32
 33.if ${OPSYS} == "NetBSD" && \
 34 ((${MACHINE_ARCH} == "arm") || \
 35 (${MACHINE_ARCH} == "hppa") || \
 36 (${MACHINE_ARCH} == "i386") || \
 37 (${MACHINE_ARCH} == "m68k") || \
 38 (${MACHINE_ARCH} == "mips") || \
 39 (${MACHINE_ARCH} == "powerpc") || \
 40 (${MACHINE_ARCH} == "riscv32") || \
 41 (${MACHINE_ARCH} == "sh3") || \
 42 (${MACHINE_ARCH} == "sparc") || \
 43 (${MACHINE_ARCH} == "vax"))
 44# Use OpenSSL's built-in fallbacks (not actually clang-specific)
 45# see src/crypto/external/bsd/openssl/lib/libcrypto/arch/*/crypto.inc
 46CFLAGS+= -DBROKEN_CLANG_ATOMICS # no atomic 64 bit ops
 47.endif
 48
33.if ${MACHINE_PLATFORM:MDarwin-[0-8].*-powerpc} 49.if ${MACHINE_PLATFORM:MDarwin-[0-8].*-powerpc}
34# No {get,make,set}context support before Darwin 9 50# No {get,make,set}context support before Darwin 9
35CONFIGURE_ARGS+= no-async 51CONFIGURE_ARGS+= no-async
36.endif 52.endif
37 53
38.if ${OPSYS} == "Darwin" && ${OPSYS_VERSION} < 101200 54.if ${OPSYS} == "Darwin" && ${OPSYS_VERSION} < 101200
39# While it does check for this, it does so using a header that is only 55# While it does check for this, it does so using a header that is only
40# available in OS X versions starting with Leopard. 56# available in OS X versions starting with Leopard.
41CFLAGS+= -DOPENSSL_NO_APPLE_CRYPTO_RANDOM=1 57CFLAGS+= -DOPENSSL_NO_APPLE_CRYPTO_RANDOM=1
42.endif 58.endif
43 59
44PLIST_VARS+= devcrypto afalg 60PLIST_VARS+= devcrypto afalg
45# the AF_ALG engine is supported only on Linux, where it 61# the AF_ALG engine is supported only on Linux, where it