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
This commit is contained in:
parent
06df180a9e
commit
76f1820a7e
61
Mk/Uses/electronfix.mk
Normal file
61
Mk/Uses/electronfix.mk
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user