git: ab52d5af3b6f - main - dns/doh-proxy: fix build on powerpc

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Sun, 04 Aug 2024 12:01:10 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ab52d5af3b6fa295d2b9fb45d89e1cd23b15330f

commit ab52d5af3b6fa295d2b9fb45d89e1cd23b15330f
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2024-07-30 14:35:38 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2024-08-04 12:00:25 +0000

    dns/doh-proxy: fix build on powerpc
    
      = note: ld: error: undefined symbol: __atomic_load_8
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_arena_schedule_purge) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_arenas_try_purge) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_stat_update) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced 2 more times
    
              ld: error: undefined symbol: __atomic_fetch_add_8
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_arena_schedule_purge) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_manage_os_memory_ex2) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_manage_os_memory_ex2) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced 88 more times
    
              ld: error: undefined symbol: __atomic_store_8
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_arena_schedule_purge) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
    
              ld: error: undefined symbol: __atomic_compare_exchange_8
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_arenas_try_purge) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_arenas_try_purge) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_stat_update) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
    
              ld: error: undefined symbol: __atomic_store
              >>> referenced by static.c
              >>>               98cfcaec7182b1d8-static.o:(mi_manage_os_memory_ex2) in archive /wrkdirs/usr/ports/dns/doh-proxy/work/rustc4xSzx7/liblibmimalloc_sys-4a9c093f9f8149a2.rlib
              cc: error: linker command failed with exit code 1 (use -v to see invocation)
---
 dns/doh-proxy/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dns/doh-proxy/Makefile b/dns/doh-proxy/Makefile
index 066a0369c609..b315af4861ef 100644
--- a/dns/doh-proxy/Makefile
+++ b/dns/doh-proxy/Makefile
@@ -17,6 +17,13 @@ PLIST_FILES=	bin/doh-proxy
 
 # make cargo-crates > Makefile.crates
 
+.include <bsd.port.options.mk>
+
+.if ${ARCH} == powerpc
+LIB_DEPENDS+=	libatomic.so:lang/gcc${GCC_DEFAULT}
+LDFLAGS+=	-L/usr/local/lib/gcc${GCC_DEFAULT} -latomic
+.endif
+
 post-install:
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/doh-proxy