git: bfbfda09669c - main - www/onlyoffice-documentserver: Fix build on aarch64

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Sat, 10 Feb 2024 10:50:47 UTC
The branch main has been updated by mikael:

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

commit bfbfda09669c6bfd3309ca3d508c4eeccd55fcc8
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-02-10 10:50:33 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2024-02-10 10:50:33 +0000

    www/onlyoffice-documentserver: Fix build on aarch64
---
 www/onlyoffice-documentserver/Makefile                      | 13 ++++++++++++-
 .../files/extra-patch-pkg-fetch_lib-es5_build.js            |  9 +++++++--
 .../files/patch-document-server-package_Makefile            |  2 +-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/www/onlyoffice-documentserver/Makefile b/www/onlyoffice-documentserver/Makefile
index 9a7379657084..1cf9c135bd32 100644
--- a/www/onlyoffice-documentserver/Makefile
+++ b/www/onlyoffice-documentserver/Makefile
@@ -110,6 +110,17 @@ DOS2UNIX_FILES=	document-server-package/common/documentserver/nginx/includes/htt
 
 CONFLICTS_BUILD=devel/googletest
 
+.include <bsd.port.pre.mk>
+.if ${ARCH} == aarch64
+BUILD_DEPENDS+=	clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT}
+BINARY_ALIAS+=	cpp=${LOCALBASE}/bin/clang-cpp${LLVM_DEFAULT} \
+		cc=${LOCALBASE}/bin/clang${LLVM_DEFAULT} \
+		c++=${LOCALBASE}/bin/clang++${LLVM_DEFAULT} \
+		ar=${LOCALBASE}/bin/llvm-ar${LLVM_DEFAULT} \
+		nm=${LOCALBASE}/bin/llvm-nm${LLVM_DEFAULT} \
+		ld=${LOCALBASE}/bin/ld.lld${LLVM_DEFAULT}
+.endif
+
 post-extract:
 	@${MV} ${WRKDIR}/v8 ${WRKSRC}/core/Common/3dParty/v8_89
 
@@ -238,4 +249,4 @@ create-caches-tarball:
 	cd ${WRKDIR} && \
 		${TAR} czf ${PORTNAME}-${DISTVERSION}-npm-cache.tar.gz .npm .pkg-cache
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/www/onlyoffice-documentserver/files/extra-patch-pkg-fetch_lib-es5_build.js b/www/onlyoffice-documentserver/files/extra-patch-pkg-fetch_lib-es5_build.js
index b45253b02607..e8cc8e840655 100644
--- a/www/onlyoffice-documentserver/files/extra-patch-pkg-fetch_lib-es5_build.js
+++ b/www/onlyoffice-documentserver/files/extra-patch-pkg-fetch_lib-es5_build.js
@@ -13,7 +13,7 @@
      // production binaries do NOT take NODE_OPTIONS from end-users
      args.push('--without-node-options');
      // The dtrace and etw support was removed in https://github.com/nodejs/node/commit/aa3a572e6bee116cde69508dc29478b40f40551a
-@@ -115,7 +109,9 @@ function getConfigureArgs(major, targetPlatform) {
+@@ -115,7 +109,14 @@ function getConfigureArgs(major, targetPlatform) {
      // bundled npm package manager
      args.push('--without-npm');
      // Small ICU
@@ -21,10 +21,15 @@
 +    args.push('--with-intl=system-icu');
 +    args.push('--shared-openssl');
 +    args.push('--openssl-use-def-ca-store');
++    args.push('--shared-brotli');
++    args.push('--shared-cares');
++    args.push('--shared-libuv');
++    args.push('--shared-nghttp2');
++    args.push('--shared-zlib');
      // Workaround for nodejs/node#39313
      // All supported macOS versions have zlib as a system library
      if (targetPlatform === 'macos') {
-@@ -433,4 +429,4 @@ exports.default = build;
+@@ -433,4 +434,4 @@ exports.default = build;
      });
  }
  exports.default = build;
diff --git a/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile b/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile
index 091c7e43df5c..c760d9de5b5b 100644
--- a/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile
+++ b/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile
@@ -26,7 +26,7 @@
 +		DS_FILES := /var/db/$(DS_PREFIX)
 +		DS_EXAMLE := /usr/local/www/$(DS_PREFIX)-example
 +		DEV_NULL := /dev/null
-+		PKG_TARGET := node18-freebsd-x64
++		PKG_TARGET := node18
 +	endif
  	ifeq ($(UNAME_S),Darwin)
  		PLATFORM := mac