contrib: distribute on macOS using a zip, not a dmg

The DMG needs more custom and complicated tooling. Switching to a zip is
also more compatible with our upcoming codesigning tooling. No need for
a DS_Store anymore. The UX is also neat for the user: once downloaded
they can just click on the app. They can still drag it to the
application folder.
This commit is contained in:
Antoine Poinsot 2023-05-09 11:30:27 +02:00
parent eade76e3f1
commit 471ecd296e
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
6 changed files with 6 additions and 65 deletions

View File

@ -1,51 +0,0 @@
"""
Script to generate a .DS_Store within the dmg folder to have a neat fancy window
when installing the software on macOS.
This was taken and adapted from the Bitcoin Core 'macdeployqtplus' script.
https://github.com/bitcoin/bitcoin/blob/cb32328d1b80d0ccd6eb9532bd8fe4e0a4de385e/contrib/macdeploy/macdeployqtplus
"""
from ds_store import DSStore
from mac_alias import Alias
output_file = ".DS_Store"
ds = DSStore.open(output_file, "w+")
ds["."]["bwsp"] = {
"WindowBounds": "{{300, 280}, {500, 343}}",
"PreviewPaneVisibility": False,
}
icvp = {
"gridOffsetX": 0.0,
"textSize": 12.0,
"viewOptionsVersion": 1,
"backgroundImageAlias": b"\x00\x00\x00\x00\x02\x1e\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x94\\\xb0H+\x00\x05\x00\x00\x00\x98\x0fbackground.tiff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\xd19\xb0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\r\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b.background\x00\x00\x10\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x11\x00\x08\x00\x00\xd19\xb0\xf8\x00\x00\x00\x01\x00\x04\x00\x00\x00\x98\x00\x0e\x00 \x00\x0f\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00.\x00t\x00i\x00f\x00f\x00\x0f\x00\x02\x00\x00\x00\x12\x00\x1c/.background/background.tiff\x00\x14\x01\x06\x00\x00\x00\x00\x01\x06\x00\x02\x00\x00\x0cMacintosh HD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x97\xab\xc3H+\x00\x00\x01\x88[\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02u\xab\x8d\xd1\x94\\\xb0devrddsk\xff\xff\xff\xff\x00\x00\t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07bitcoin\x00\x00\x10\x00\x08\x00\x00\xce\x97\xab\xc3\x00\x00\x00\x11\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x01\x00\x14\x01\x88[\x88\x00\x16\xa9\t\x00\x08\xfaR\x00\x08\xfaQ\x00\x02d\x8e\x00\x0e\x00\x02\x00\x00\x00\x0f\x00\x1a\x00\x0c\x00M\x00a\x00c\x00i\x00n\x00t\x00o\x00s\x00h\x00 \x00H\x00D\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\x14\xff\xff\x00\x00\xff\xff\x00\x00",
"backgroundColorBlue": 1.0,
"iconSize": 96.0,
"backgroundColorGreen": 1.0,
"arrangeBy": "none",
"showIconPreview": True,
"gridSpacing": 100.0,
"gridOffsetY": 0.0,
"showItemInfo": False,
"labelOnBottom": True,
"backgroundType": 2,
"backgroundColorRed": 1.0,
}
alias = Alias().from_bytes(icvp["backgroundImageAlias"])
alias.volume.name = "Liana"
alias.volume.posix_path = "/Volumes/Liana"
icvp["backgroundImageAlias"] = alias.to_bytes()
ds["."]["icvp"] = icvp
ds["."]["vSrn"] = ("long", 1)
ds["Applications"]["Iloc"] = (370, 156)
ds["Liana.app"]["Iloc"] = (128, 156)
ds.flush()
ds.close()

View File

@ -48,7 +48,7 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe"
)
# Create the MacOS archive and the DMG
# Create the MacOS archive and a zipped application bundle of liana-gui.
(
cd "$BUILD_DIR"
create_dir "$MAC_DIR_NAME"
@ -56,19 +56,11 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
tar -czf "$MAC_ARCHIVE" "$MAC_DIR_NAME"
cp "$MAC_ARCHIVE" "$RELEASE_DIR"
DMG_DIR="liana-$VERSION"
cp -r ../contrib/release/macos/dmg_template "$DMG_DIR"
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" "$DMG_DIR/Liana.app/Contents/Info.plist"
ln -s /Applications "$DMG_DIR/Applications"
python3 -m venv venv
. venv/bin/activate
pip install ds_store mac_alias
python3 ../contrib/release/macos/gen_dstore.py
mv .DS_Store "$DMG_DIR/"
cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" "$DMG_DIR/Liana.app/Contents/MacOS/Liana"
DMG_FILE="liana-$VERSION.dmg"
xorrisofs -D -l -V Liana -no-pad -r -dir-mode 0755 -o "$DMG_FILE" "$DMG_DIR"
cp "$DMG_FILE" "$RELEASE_DIR/"
cp -r ../contrib/release/macos/Liana.app ./
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./Liana.app/Contents/Info.plist
cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana
zip -ry Liana.zip Liana.app
cp ./Liana.zip "$RELEASE_DIR/"
)
# Finally, sign all the assets