From nobody Mon Nov 06 11:03:25 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SP7kP6vKsz50KFk; Mon, 6 Nov 2023 11:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SP7kP6PvDz4YXN; Mon, 6 Nov 2023 11:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699268605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xf68eEgg3+hVmdo2mGt9A/wQKk7YeonfFCk/vx2FePg=; b=PDv3Fp6IVGk9YhCIcbfWfT0jSTwYU5Fgkh0F4j2lIJCnOT8dfH7mQH27HV7eSHoedNQCHJ 0IcwDS3D5RHUeQorcDstkD2IqRYnVtmqDwc06xnH3LglGZAWqcEEElH5KlLrHHMfc8K7zB O8NmeVslyh4+wnrbvRX+qKINOQXlLiMfA3K0KdgUjcgRZHHLSEgOlFrk6PNqqnTHmHidVt x/gkctdceKNTb+ZKVcArvxTFK6BTrWcZ+pBqJ21fv/HcseE3WY1O093ykM4/0nmqjY6i1f /1AVHq/PI4CCofKomzLcWsXAER6NHKcPj3O44WrG8/dGqtFztdToTZfjADf/mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699268605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xf68eEgg3+hVmdo2mGt9A/wQKk7YeonfFCk/vx2FePg=; b=B2TRhOIuCFvm3wwBzjiRxzC0G4AIKHEj3maRw9Dvb+kDDSHLwYG/rf0UVdnEGH+5VM/69P Bk18C65wB2HpMOltTekpBOpg7gW+ul4TveqtL8+fMR86+xSm6kXnghZqKgmyn5U4zKTh8m SRh8nQLx0QYGPQnEm/QL0rvyWhwN+BuwaiwNp8sHB3lRpPPDpyDnWWsq7juLHx7IxTha3u eFTnCWlO9PlRlYnjipR00pjux5lkmI4/q4ByeJiH4/vq+8nMfYHgfIPHgKCehi2CcjRGrT XYjBUuJTqYPEpKBDlE1jbPMrBq1ziEhY9xkKW1G7j6/K4iIPUCQlUwhHy05x3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699268605; a=rsa-sha256; cv=none; b=Clm/PcGoFVFFcNKUrBbluayiacBA654BHcDedYWPXUu76OMJqmhNR+fL23N2DvYq1+kQvE 5VowE+rkbF51NX0zorZA0NcrD9FrHnYRsifMoL1FvjMvFseZ8Po1GGedkgENGOTK60Pe8l gsmY7uZdw/VSEZXMK7i3u31rEbFoYMQ7AvJynIybjt5fC4GpjyW7Odu8cVVI3/OpKLiMWY dsNjzWY8FsQi9Ba05jwbaNOdb8iHR4eiynaEDCdyIYopnab4rkuQGgG0Kk65jZvV1R5w5I HEsZcHAATfJNQP5NwEXuOYngwOrV9+Y/cVh24L4m07aZLaboPU6P1+/H0la7FA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SP7kP5S3zz14Yv; Mon, 6 Nov 2023 11:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A6B3PJT089779; Mon, 6 Nov 2023 11:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A6B3PqB089776; Mon, 6 Nov 2023 11:03:25 GMT (envelope-from git) Date: Mon, 6 Nov 2023 11:03:25 GMT Message-Id: <202311061103.3A6B3PqB089776@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Gleb Popov Subject: git: 76f1820a7ee2 - main - Uses/electronfix.mk: Framework for quick porting of Electron apps. List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76f1820a7ee2ad20f481d45c43c6dea886da07b1 Auto-Submitted: auto-generated The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=76f1820a7ee2ad20f481d45c43c6dea886da07b1 commit 76f1820a7ee2ad20f481d45c43c6dea886da07b1 Author: Gleb Popov AuthorDate: 2023-09-22 18:30:11 +0000 Commit: Gleb Popov CommitDate: 2023-11-06 11:02:22 +0000 Uses/electronfix.mk: Framework for quick porting of Electron apps. The idea behind this USES is to take a binary distribution of some Electron app and replace Linux binaries with the native ones. Not only this allows for quick porting, but it is also a way to get closed-source Electron apps (Obsidian, XMind) working on FreeBSD. Sponsored by: Serenity Cybersecurity, LLC --- Mk/Uses/electronfix.mk | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Mk/Uses/electronfix.mk b/Mk/Uses/electronfix.mk new file mode 100644 index 000000000000..f2655c634bf5 --- /dev/null +++ b/Mk/Uses/electronfix.mk @@ -0,0 +1,61 @@ +# Provide support for easy porting of Electron applications that are distributed +# in binary form. +# +# Feature: electronfix +# Usage: USES=electronfix:version +# +# An example usage might be: +# USES= electronfix:24 +# +# Variables, which can be set by the port: +# +# ELECTRONFIX_SYMLINK_FILES List of files to be symlinked from Electron distribution. +# +# ELECTRONFIX_MAIN_EXECUTABLE File name of the main executable to be replaced +# with the original Electron binary. + +.if !defined(_INCLUDE_USES_ELECTRONFIX_MK) +_INCLUDE_USES_ELECTRONFIX_MK= yes + +_ELECTRONFIX_MK_VALID_VERSIONS= 22 23 24 25 + +# === parse version arguments === +_ELECTRONFIX_MK_VERSION= # empty +. for _ver in ${_ELECTRONFIX_MK_VALID_VERSIONS} +. if ${electronfix_ARGS:M${_ver}} +. if !empty(_ELECTRONFIX_MK_VERSION) +BROKEN= USES=electronfix:${electronfix_ARGS} contains multiple version definitions +. else +_ELECTRONFIX_MK_VERSION= ${_ver} +. endif +. endif +. endfor + +BUILD_DEPENDS+= electron${_ELECTRONFIX_MK_VERSION}:devel/electron${_ELECTRONFIX_MK_VERSION} +RUN_DEPENDS+= electron${_ELECTRONFIX_MK_VERSION}:devel/electron${_ELECTRONFIX_MK_VERSION} + +ELECTRONFIX_SYMLINK_FILES?= \ + chromedriver \ + libEGL.so \ + libGLESv2.so \ + libffmpeg.so \ + libvk_swiftshader.so \ + libvulkan.so \ + resources.pak \ + snapshot_blob.bin \ + v8_context_snapshot.bin + +_USES_install= 701:electronfix-post-install + +electronfix-post-install: + ${RM} ${STAGEDIR}${DATADIR}/chrome-sandbox + ${RM} ${STAGEDIR}${DATADIR}/libvulkan.so.1 +. for f in ${ELECTRONFIX_SYMLINK_FILES} + ${RM} ${STAGEDIR}${DATADIR}/${f} + ${LN} -s ${LOCALBASE}/share/electron${_ELECTRONFIX_MK_VERSION}/${f} ${STAGEDIR}${DATADIR}/${f} +. endfor +. ifdef ELECTRONFIX_MAIN_EXECUTABLE +# We have to copy the electron binary instead of symlinking + ${CP} ${LOCALBASE}/share/electron${_ELECTRONFIX_MK_VERSION}/electron ${STAGEDIR}${DATADIR}/${ELECTRONFIX_MAIN_EXECUTABLE} +. endif +.endif