diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 461a9d16..96db355f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,6 +110,12 @@ jobs: run: | echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-universal" >> "$GITHUB_ENV" + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install dmgbuild + run: pip install dmgbuild - uses: actions/checkout@v3 - name: Download artifacts uses: actions/download-artifact@v3 @@ -117,8 +123,6 @@ jobs: with: name: macOS DMG Images path: dmgs-original - - name: Install appdmg - run: cd ~; npm i appdmg; cd - - name: Make universal bundles run: | bash --version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index edf66372..5d9a388c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -185,8 +185,8 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.9 - - name: Install appdmg - run: cd ~; npm i appdmg; cd - + - name: Install dmgbuild + run: pip install dmgbuild - name: Prepare DMG Images run: | mkdir -p dmgs-addons dmgs-normal diff --git a/.gitignore b/.gitignore index 9b248455..7b420ff6 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ LiteXL* !resources/windows/*.diff !resources/windows/*.exe.manifest.in +!resources/macos/*.py diff --git a/build-packages.sh b/build-packages.sh index 96a7d11d..a95d3460 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -38,7 +38,7 @@ show_help() { echo "-v --version VERSION Sets the version on the package name." echo "-A --appimage Create an AppImage (Linux only)." echo "-D --dmg Create a DMG disk image (macOS only)." - echo " Requires NPM and AppDMG." + echo " Requires dmgbuild." echo "-I --innosetup Create an InnoSetup installer (Windows only)." echo "-r --release Compile in release mode." echo "-S --source Create a source code package," diff --git a/resources/README.md b/resources/README.md index 4cd85256..d6d80eec 100644 --- a/resources/README.md +++ b/resources/README.md @@ -11,8 +11,9 @@ This folder contains resources that is used for building or packaging the projec - `icons/icon.{icns,ico,inl,rc,svg}`: lite-xl icon in various formats. - `linux/com.lite_xl.LiteXL.appdata.xml`: AppStream metadata. - `linux/com.lite_xl.LiteXL.desktop`: Desktop file for Linux desktops. -- `macos/appdmg.png`: Background image for packaging MacOS DMGs. -- `macos/Info.plist.in`: Template for generating `info.plist` on MacOS. See `macos/macos-retina-display.md` for details. +- `macos/dmg-cover.png`: Background image for packaging macOS DMGs. +- `macos/Info.plist.in`: Template for generating `info.plist` on macOS. See `macos/macos-retina-display.md` for details. +- `macos/lite-xl-dmg.py`: Configuration options for dmgbuild for packaging macOS DMGs. - `windows/001-lua-unicode.diff`: Patch for allowing Lua to load files with UTF-8 filenames on Windows. ### Development diff --git a/resources/macos/appdmg.png b/resources/macos/dmg-cover.png similarity index 100% rename from resources/macos/appdmg.png rename to resources/macos/dmg-cover.png diff --git a/resources/macos/lite-xl-dmg.py b/resources/macos/lite-xl-dmg.py new file mode 100644 index 00000000..27b24417 --- /dev/null +++ b/resources/macos/lite-xl-dmg.py @@ -0,0 +1,28 @@ +# configuration for dmgbuild + +import os.path + +app_path = "Lite XL.app" +app_name = os.path.basename(app_path) + +# Image options +format = defines.get("format", "UDZO") + +# Content options +files = [(app_path, app_name)] +symlinks = { "Applications": "/Applications" } +icon = "resources/icons/icon.icns" +icon_locations = { + app_name: (144, 248), + "Applications": (336, 248) +} + +# Window options +background = "resources/macos/dmg-cover.png" +window_rect = ((360, 360), (480, 380)) +default_view = "coverflow" +include_icon_view_settings = True + +# Icon view options +icon_size = 80 +text_size = 11.0 diff --git a/scripts/README.md b/scripts/README.md index 478e461f..5910931c 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -10,7 +10,7 @@ Various scripts and configurations used to configure, build, and package Lite XL ### Package -- **appdmg.sh**: Create a macOS DMG image using [AppDMG][1]. +- **appdmg.sh**: Create a macOS DMG image using [dmgbuild][1]. - **appimage.sh**: [AppImage][2] builder. - **innosetup.sh**: Creates a 32/64 bit [InnoSetup][3] installer package. - **package.sh**: Creates all binary / DMG image / installer / source packages. @@ -25,6 +25,6 @@ Various scripts and configurations used to configure, build, and package Lite XL - **generate_header.sh**: Generates a header file for native plugin API - **keymap-generator**: Generates a JSON file containing the keymap -[1]: https://github.com/LinusU/node-appdmg +[1]: https://github.com/dmgbuild/dmgbuild [2]: https://docs.appimage.org/ [3]: https://jrsoftware.org/isinfo.php diff --git a/scripts/appdmg.sh b/scripts/appdmg.sh index 840f518b..5ce4fe71 100644 --- a/scripts/appdmg.sh +++ b/scripts/appdmg.sh @@ -6,25 +6,4 @@ if [ ! -e "src/api/api.h" ]; then exit 1 fi -cat > lite-xl-dmg.json << EOF -{ - "title": "Lite XL", - "icon": "$(pwd)/resources/icons/icon.icns", - "background": "$(pwd)/resources/macos/appdmg.png", - "window": { - "position": { - "x": 360, - "y": 360 - }, - "size": { - "width": 480, - "height": 360 - } - }, - "contents": [ - { "x": 144, "y": 248, "type": "file", "path": "$(pwd)/Lite XL.app" }, - { "x": 336, "y": 248, "type": "link", "path": "/Applications" } - ] -} -EOF -~/node_modules/appdmg/bin/appdmg.js lite-xl-dmg.json "$(pwd)/$1.dmg" +dmgbuild -s resources/macos/lite-xl-dmg.py "Lite XL" "$1.dmg" diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 1290cfcc..00606944 100644 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -57,9 +57,7 @@ main() { else brew install bash ninja sdl2 fi - pip3 install meson - cd ~; npm install appdmg; cd - - ~/node_modules/appdmg/bin/appdmg.js --version + pip3 install meson dmgbuild elif [[ "$OSTYPE" == "msys" ]]; then if [[ $lhelper == true ]]; then pacman --noconfirm -S \ diff --git a/scripts/package.sh b/scripts/package.sh index 1faba509..d9a9c14c 100644 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -25,7 +25,7 @@ show_help() { echo "-A --appimage Create an AppImage (Linux only)." echo "-B --binary Create a normal / portable package or macOS bundle," echo " depending on how the build was configured. (Default.)" - echo "-D --dmg Create a DMG disk image with AppDMG (macOS only)." + echo "-D --dmg Create a DMG disk image with dmgbuild (macOS only)." echo "-I --innosetup Create a InnoSetup package (Windows only)." echo "-r --release Strip debugging symbols." echo "-S --source Create a source code package,"