git: b990f5d66341 - main - net-im/signal-desktop: Fix build on aarch64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 02 Jul 2022 14:29:27 UTC
The branch main has been updated by mikael: URL: https://cgit.FreeBSD.org/ports/commit/?id=b990f5d66341986260d02727a86102f01d81fec4 commit b990f5d66341986260d02727a86102f01d81fec4 Author: Mikael Urankar <mikael@FreeBSD.org> AuthorDate: 2022-07-02 12:52:00 +0000 Commit: Mikael Urankar <mikael@FreeBSD.org> CommitDate: 2022-07-02 14:17:59 +0000 net-im/signal-desktop: Fix build on aarch64 - patch-package can't patch sqlite3 on aarch64, patch the yarn cache instead - Delete ${WRKDIR}/electron${ELECTRON_VER_MAJOR}, as it may already contains electron19 (in case of a build failure) - Update electron-builder patch file --- net-im/signal-desktop/Makefile | 18 ++++++++++++++---- .../files/patch-patches_better-sqlite3+7.5.0.patch | 20 -------------------- ...h => patch-patches_electron-builder+23.0.8.patch} | 4 ++-- net-im/signal-desktop/files/sqlite3.gyp.diff | 17 +++++++++++++++++ net-im/signal-desktop/pkg-plist | 6 +++--- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/net-im/signal-desktop/Makefile b/net-im/signal-desktop/Makefile index 7d2d242e277a..c535cdbc833f 100644 --- a/net-im/signal-desktop/Makefile +++ b/net-im/signal-desktop/Makefile @@ -90,6 +90,12 @@ NPM_PLAYWRITE_DIR= npm-playwright-core-1.17.1-a16e0f89284a0ed8ae6d77e1c905c84b8a NPM_ESBUILD_VERS= 0.14.28 NPM_ESBUILD_DIR= npm-esbuild-${NPM_ESBUILD_VERS}-7738635d2ea19e446bd319d83a1802545e6aebb8-integrity +NODE_ARCH= ${ARCH:S/aarch64/arm64/:S/amd64/x64/} +APP_OUT_DIR= linux-${ARCH:S/aarch64/arm64-/:S/amd64//}unpacked + +PLIST_SUB= NODE_ARCH=${NODE_ARCH} \ + SHARP_ARCH=${ARCH:S/aarch64/arm64v8/:S/amd64/x64/} + post-patch: ${REINPLACE_CMD} "s#%%EPOCH%%#${_BUILD_DATE}#" \ ${WRKSRC}/ts/scripts/get-expire-time.ts @@ -101,16 +107,17 @@ do-build: # copy ${LOCALBASE}/share/electron19 in WRKDIR # it's needed for the do-install phase, it's here because of this issue # https://github.com/MikaelUrankar/signal-desktop/issues/6 (I don't know why it fails though) + @${RM} -r ${WRKDIR}/electron${ELECTRON_VER_MAJOR} @${CP} -pR ${LOCALBASE}/share/electron${ELECTRON_VER_MAJOR} ${WRKDIR}/electron${ELECTRON_VER_MAJOR} ${CHMOD} -R a+w ${WRKDIR}/electron${ELECTRON_VER_MAJOR} # Install libsignal_node.so and libringrtc.so binaries in the yarn cache - ${MKDIR} ${WRKDIR}/.cache/yarn/v6/${NPM_SIGNAL_DIR}/node_modules/@signalapp/libsignal-client/prebuilds/freebsd-x64 \ + ${MKDIR} ${WRKDIR}/.cache/yarn/v6/${NPM_SIGNAL_DIR}/node_modules/@signalapp/libsignal-client/prebuilds/freebsd-${NODE_ARCH} \ ${WRKDIR}/.cache/yarn/v6/${NPM_RINGRTC_DIR}/node_modules/ringrtc/build/freebsd ${CP} ${LOCALBASE}/lib/libsignal_node.so \ - ${WRKDIR}/.cache/yarn/v6/${NPM_SIGNAL_DIR}/node_modules/@signalapp/libsignal-client/prebuilds/freebsd-x64/node.napi.node + ${WRKDIR}/.cache/yarn/v6/${NPM_SIGNAL_DIR}/node_modules/@signalapp/libsignal-client/prebuilds/freebsd-${NODE_ARCH}/node.napi.node ${CP} ${LOCALBASE}/lib/libringrtc.so \ - ${WRKDIR}/.cache/yarn/v6/${NPM_RINGRTC_DIR}/node_modules/ringrtc/build/freebsd/libringrtc-x64.node + ${WRKDIR}/.cache/yarn/v6/${NPM_RINGRTC_DIR}/node_modules/ringrtc/build/freebsd/libringrtc-${NODE_ARCH}.node # sqlcipher.tar.gz requires git-lfs to fetch, just copy a previously downloaded one (I've had to use ubuntu for that, # as I didn't manage to do it with FreeBSD, see https://github.com/signalapp/Signal-Desktop/blob/development/CONTRIBUTING.md for instructions) @@ -122,6 +129,9 @@ do-build: ${CP} ${FILESDIR}/playwrigth-registry.js \ ${WRKDIR}/.cache/yarn/v6/${NPM_PLAYWRITE_DIR}/node_modules/playwright-core/lib/utils/registry.js + # patch-package can't patch sqlite3 on aarch64, patch the yarn cache instead + cd ${WRKDIR}/.cache/yarn/v6 && ${PATCH} -s -N -i ${FILESDIR}/sqlite3.gyp.diff + ${MKDIR} ${WRKDIR}/esbuild-freebsd-64-${NPM_ESBUILD_VERS} ${TAR} -xf ${WRKDIR}/yarn-cache/esbuild-freebsd-64-${NPM_ESBUILD_VERS}.tgz -C ${WRKDIR}/esbuild-freebsd-64-${NPM_ESBUILD_VERS} ${CP} ${WRKDIR}/esbuild-freebsd-64-${NPM_ESBUILD_VERS}/package/bin/esbuild \ @@ -155,7 +165,7 @@ do-install: --config.electronDist=${WRKDIR}/electron${ELECTRON_VER_MAJOR} ${MKDIR} ${STAGEDIR}${DATADIR} - cd ${BUILD_WRKSRC}/dist/linux-unpacked && \ + cd ${BUILD_WRKSRC}/dist/${APP_OUT_DIR} && \ ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR} ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps diff --git a/net-im/signal-desktop/files/patch-patches_better-sqlite3+7.5.0.patch b/net-im/signal-desktop/files/patch-patches_better-sqlite3+7.5.0.patch deleted file mode 100644 index 3b02e7399c4b..000000000000 --- a/net-im/signal-desktop/files/patch-patches_better-sqlite3+7.5.0.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- patches/better-sqlite3+7.5.0.patch.orig 2021-05-16 17:14:17 UTC -+++ patches/better-sqlite3+7.5.0.patch -@@ -0,0 +1,17 @@ -+--- a/node_modules/better-sqlite3/deps/sqlite3.gyp.orig -++++ b/node_modules/better-sqlite3/deps/sqlite3.gyp -+@@ -95,6 +95,14 @@ -+ ] -+ } -+ }, -++ 'OS == "freebsd"', { -++ 'link_settings': { -++ 'libraries': [ -++ # This statically links libcrypto, whereas -lcrypto would dynamically link it -++ '/usr/local/lib/libcrypto.a' -++ ] -++ } -++ }, -+ { # Linux -+ 'link_settings': { -+ 'libraries': [ diff --git a/net-im/signal-desktop/files/patch-patches_electron-builder+23.0.1.patch b/net-im/signal-desktop/files/patch-patches_electron-builder+23.0.8.patch similarity index 86% rename from net-im/signal-desktop/files/patch-patches_electron-builder+23.0.1.patch rename to net-im/signal-desktop/files/patch-patches_electron-builder+23.0.8.patch index d0de11b7c8c7..1dbd00a2200f 100644 --- a/net-im/signal-desktop/files/patch-patches_electron-builder+23.0.1.patch +++ b/net-im/signal-desktop/files/patch-patches_electron-builder+23.0.8.patch @@ -1,5 +1,5 @@ ---- patches/electron-builder+23.0.1.patch.orig 2022-02-24 13:03:47 UTC -+++ patches/electron-builder+23.0.1.patch +--- patches/electron-builder+23.0.8.patch.orig 2022-02-24 13:03:47 UTC ++++ patches/electron-builder+23.0.8.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/electron-builder/out/cli/install-app-deps.js b/node_modules/electron-builder/out/cli/install-app-deps.js +index 0c58564..2b6f9a5 100644 diff --git a/net-im/signal-desktop/files/sqlite3.gyp.diff b/net-im/signal-desktop/files/sqlite3.gyp.diff new file mode 100644 index 000000000000..81f31a90fa68 --- /dev/null +++ b/net-im/signal-desktop/files/sqlite3.gyp.diff @@ -0,0 +1,17 @@ +--- npm-better-sqlite3-7.5.0-3c4a7eebba3d5f5d8cb88fe83be1c01b8c0dea7d/node_modules/better-sqlite3/deps/sqlite3.gyp.orig 2022-07-02 14:34:04 UTC ++++ npm-better-sqlite3-7.5.0-3c4a7eebba3d5f5d8cb88fe83be1c01b8c0dea7d/node_modules/better-sqlite3/deps/sqlite3.gyp +@@ -95,6 +95,14 @@ + ] + } + }, ++ 'OS == "freebsd"', { ++ 'link_settings': { ++ 'libraries': [ ++ # This statically links libcrypto, whereas -lcrypto would dynamically link it ++ '/usr/local/lib/libcrypto.a' ++ ] ++ } ++ }, + { # Linux + 'link_settings': { + 'libraries': [ diff --git a/net-im/signal-desktop/pkg-plist b/net-im/signal-desktop/pkg-plist index be1863b8bd50..48b8204f269d 100644 --- a/net-im/signal-desktop/pkg-plist +++ b/net-im/signal-desktop/pkg-plist @@ -84,10 +84,10 @@ share/pixmaps/signal-desktop.png %%DATADIR%%/locales/zh-TW.pak %%DATADIR%%/resources.pak %%DATADIR%%/resources/app.asar -%%DATADIR%%/resources/app.asar.unpacked/node_modules/@signalapp/libsignal-client/prebuilds/freebsd-x64/node.napi.node +%%DATADIR%%/resources/app.asar.unpacked/node_modules/@signalapp/libsignal-client/prebuilds/freebsd-%%NODE_ARCH%%/node.napi.node %%DATADIR%%/resources/app.asar.unpacked/node_modules/better-sqlite3/build/Release/better_sqlite3.node -%%DATADIR%%/resources/app.asar.unpacked/node_modules/ringrtc/build/freebsd/libringrtc-x64.node -%%DATADIR%%/resources/app.asar.unpacked/node_modules/sharp/build/Release/sharp-freebsd-x64.node +%%DATADIR%%/resources/app.asar.unpacked/node_modules/ringrtc/build/freebsd/libringrtc-%%NODE_ARCH%%.node +%%DATADIR%%/resources/app.asar.unpacked/node_modules/sharp/build/Release/sharp-freebsd-%%SHARP_ARCH%%.node @(,,755) %%DATADIR%%/signal-desktop %%DATADIR%%/snapshot_blob.bin %%DATADIR%%/v8_context_snapshot.bin