Use the release build of NWJS for Apple Silicon

This commit is contained in:
Dave Page 2023-06-09 14:58:35 +01:00
parent a1608900ed
commit 6bf2733628

View File

@ -30,42 +30,36 @@ _build_runtime() {
# NOTE: The nw download servers seem to be very unreliable, so at the moment we're using wget
# in a retry loop as Yarn/Npm don't seem to like that.
# Temporarily handle arm64 builds (Apple Silicon) differently, until NWjs produces an actual release
# uname -m returns "x86_64" on Intel, but we need "x64"
NW_ARCH="x64"
if [ "$(uname -m)" == "arm64" ]; then
pushd "${BUILD_ROOT}" > /dev/null || exit
wget https://dl.nwjs.io/live-build/nw76/20230516-150708/a88c13a6c/v0.76.1/nwjs-sdk-v0.76.1-osx-arm64.zip
unzip "nwjs-sdk-v0.76.1-osx-arm64.zip"
popd > /dev/null || exit
xattr -r -d com.apple.quarantine "${BUILD_ROOT}/nwjs-sdk-v0.76.1-osx-arm64"/nwjs.app
cp -R "${BUILD_ROOT}/nwjs-sdk-v0.76.1-osx-arm64"/nwjs.app "${BUILD_ROOT}/"
else
# YARN:
# yarn add --cwd "${BUILDROOT}" nw
# YARN END
# WGET:
NW_VERSION=$(yarn info nw | grep latest | awk -F "'" '{ print $2}')
pushd "${BUILD_ROOT}" > /dev/null || exit
while true;do
wget "https://dl.nwjs.io/v${NW_VERSION}/nwjs-v${NW_VERSION}-osx-x64.zip" && break
rm "nwjs-v${NW_VERSION}-osx-x64.zip"
done
unzip "nwjs-v${NW_VERSION}-osx-x64.zip"
popd > /dev/null || exit
# WGET END
# YARN:
# cp -R "${BUILD_ROOT}/node_modules/nw/nwjs/nwjs.app" "${BUILD_ROOT}/"
# YARN END
# WGET:
cp -R "${BUILD_ROOT}/nwjs-v${NW_VERSION}-osx-x64"/nwjs.app "${BUILD_ROOT}/"
# WGET END
NW_ARCH="arm64"
fi
# YARN:
# yarn add --cwd "${BUILDROOT}" nw
# YARN END
# WGET:
NW_VERSION=$(yarn info nw | grep latest | awk -F "'" '{ print $2}')
pushd "${BUILD_ROOT}" > /dev/null || exit
while true;do
wget "https://dl.nwjs.io/v${NW_VERSION}/nwjs-v${NW_VERSION}-osx-${NW_ARCH}.zip" && break
rm "nwjs-v${NW_VERSION}-osx-${NW_ARCH}.zip"
done
unzip "nwjs-v${NW_VERSION}-osx-${NW_ARCH}.zip"
popd > /dev/null || exit
# WGET END
# YARN:
# cp -R "${BUILD_ROOT}/node_modules/nw/nwjs/nwjs.app" "${BUILD_ROOT}/"
# YARN END
# WGET:
cp -R "${BUILD_ROOT}/nwjs-v${NW_VERSION}-osx-${NW_ARCH}"/nwjs.app "${BUILD_ROOT}/"
# WGET END
mv "${BUILD_ROOT}/nwjs.app" "${BUNDLE_DIR}"
# Copy in the runtime code