This script is designed to build (if needed) and package the Neovide application packaging it into a macOS .app
bundle, and then creating a .dmg
disk image for distribution.
Before running the script, ensure you have the following dependencies installed:
Run the Script:
GENERATE_BUNDLE_APP=true GENERATE_DMG=true ./macos-builder/run aarch64-apple-darwin
Set Up Release Directory:
The script sets the RELEASE_DIR
based on the TARGET_ARCHITECTURE
environment variable. If TARGET_ARCHITECTURE
is not set, it defaults to target/release
.
RELEASE_DIR=${TARGET_ARCHITECTURE:+target/${TARGET_ARCHITECTURE}/release}
RELEASE_DIR=${RELEASE_DIR:-target/release}
Build the Project:
If the release directory does not exist, the script runs the cargo build --release
command to build the project.
This is for local development purposes since you would typically build the project beforehand.
if [ ! -d "${RELEASE_DIR}" ]; then
cargo build --release ${TARGET_ARCHITECTURE:+--target "${TARGET_ARCHITECTURE}"}
fi
Prepare the Application Bundle:
- Sets up directories for the
.app
bundle. - Copies the built binary and other necessary resources into the bundle.
- Signs the application using
codesign
.
mkdir -p "${APP_BINARY_DIR}"
mkdir -p "${APP_EXTRAS_DIR}"
cp -fRp "${APP_TEMPLATE}" "${APP_DIR}"
cp -fp "${APP_BINARY}" "${APP_BINARY_DIR}"
touch -r "${APP_BINARY}" "${APP_DIR}/${APP_NAME}"
codesign --remove-signature "${APP_DIR}/${APP_NAME}"
codesign --force --deep --sign - "${APP_DIR}/${APP_NAME}"
Create the Disk Image:
Uses create-dmg
to create a .dmg
file for the application.
create-dmg \
--filesystem "${DMG_FILESYSTEM}" \
--format "${DMG_FORMAT}" \
--volname "${DMG_VOLNAME}" \
--volicon "${DMG_ICNS}" \
--background "${DMG_BACKGROUND}" \
--window-size 650 470 \
--icon-size 80 \
--icon Neovide.app 240 320 \
--app-drop-link 410 320 \
"${APP_DIR}/${DMG_NAME}" \
"${APP_DIR}/${APP_NAME}"
- Ensure all paths and filenames are correct and that the necessary files (like
Neovide.icns
andneovide-dmg-background.tiff
) are present in their respective directories. - The script assumes a macOS environment with the necessary tools installed.