refactor(build): use dmgbuild to create dmgs (#1664)

* refactor(appdmg): make dmgs with dmgbuild

* fix(appdmg.sh): typo

* refactor(appdmg.sh): don't generate config on the fly

* fix(dmgbuild): icon file

* fix(gitignore): dmgbuild settings

* chore(resources): update readme with new files

* chore(resources/macos): add missing newline
This commit is contained in:
Takase 2023-11-10 09:44:58 +08:00 committed by takase1121
parent 63d99d4431
commit 34d163aa25
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
11 changed files with 48 additions and 37 deletions

View File

@ -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

View File

@ -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

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ LiteXL*
!resources/windows/*.diff
!resources/windows/*.exe.manifest.in
!resources/macos/*.py

View File

@ -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,"

View File

@ -9,10 +9,11 @@ This folder contains resources that is used for building or packaging the projec
### Packaging
- `icons/icon.{icns,ico,inl,rc,svg}`: lite-xl icon in various formats.
- `linux/org.lite_xl.lite_xl.appdata.xml`: AppStream metadata.
- `linux/org.lite_xl.lite_xl.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.
- `linux/com.lite_xl.LiteXL.appdata.xml`: AppStream metadata.
- `linux/com.lite_xl.LiteXL.desktop`: Desktop file for Linux desktops.
- `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

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 \

View File

@ -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,"