mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
dmg: version, and set icon
- Add the version number into the .dmg filename - Set the lokinet icon on the .dmg. This is done via a swift program because all the Apple CLI tools to do this are deprecated.
This commit is contained in:
parent
4605b49cfc
commit
500530a336
5 changed files with 34 additions and 6 deletions
|
@ -32,7 +32,7 @@ project(lokinet
|
|||
if(APPLE)
|
||||
# Apple build number: must be incremented to submit a new build for the same lokinet version,
|
||||
# should be reset to 0 when the lokinet version increments.
|
||||
set(LOKINET_APPLE_BUILD 3)
|
||||
set(LOKINET_APPLE_BUILD 4)
|
||||
endif()
|
||||
|
||||
set(RELEASE_MOTTO "Our Lord And Savior" CACHE STRING "Release motto")
|
||||
|
|
|
@ -73,7 +73,7 @@ message(STATUS "Using ${CODESIGN_EXT_PROFILE} extension provisioning profile")
|
|||
|
||||
|
||||
|
||||
set(lokinet_installer "${PROJECT_BINARY_DIR}/Lokinet Installer")
|
||||
set(lokinet_installer "${PROJECT_BINARY_DIR}/Lokinet ${PROJECT_VERSION}")
|
||||
set(lokinet_app "${lokinet_installer}/Lokinet.app")
|
||||
|
||||
|
||||
|
@ -128,10 +128,11 @@ add_custom_command(OUTPUT "${mac_icon}"
|
|||
add_custom_target(icon DEPENDS "${mac_icon}")
|
||||
|
||||
if(BUILD_PACKAGE)
|
||||
add_executable(seticon "${PROJECT_SOURCE_DIR}/contrib/macos/seticon.swift")
|
||||
add_custom_command(OUTPUT "${lokinet_installer}.dmg"
|
||||
DEPENDS notarize
|
||||
DEPENDS notarize seticon
|
||||
COMMAND create-dmg
|
||||
--volname "Lokinet Installer"
|
||||
--volname "Lokinet ${PROJECT_VERSION}"
|
||||
--volicon lokinet.icns
|
||||
#--background ... FIXME
|
||||
--text-size 16
|
||||
|
@ -144,6 +145,7 @@ if(BUILD_PACKAGE)
|
|||
--no-internet-enable
|
||||
"${lokinet_installer}.dmg"
|
||||
"${lokinet_installer}"
|
||||
COMMAND ./seticon lokinet.icns "${lokinet_installer}.dmg"
|
||||
)
|
||||
add_custom_target(package DEPENDS "${lokinet_installer}.dmg")
|
||||
endif()
|
||||
|
|
|
@ -35,5 +35,5 @@ ninja -j1 package
|
|||
cd ..
|
||||
|
||||
echo -e "Build complete, your app is here:\n"
|
||||
ls -lad $(pwd)/build-mac/Lokinet\ Installer*
|
||||
ls -lad $(pwd)/build-mac/Lokinet\ *
|
||||
echo ""
|
||||
|
|
26
contrib/macos/seticon.swift
Normal file
26
contrib/macos/seticon.swift
Normal file
|
@ -0,0 +1,26 @@
|
|||
import Foundation
|
||||
import AppKit
|
||||
|
||||
// Apple deprecated their command line tools to set images on things and replaced them with a
|
||||
// barely-documented swift function. Yay!
|
||||
|
||||
// Usage: ./seticon /path/to/my.icns /path/to/some.dmg
|
||||
|
||||
let args = CommandLine.arguments
|
||||
|
||||
if args.count != 3 {
|
||||
print("Error: usage: ./seticon /path/to/my.icns /path/to/some.dmg")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
var icns = args[1]
|
||||
var dmg = args[2]
|
||||
|
||||
var img = NSImage(byReferencingFile: icns)!
|
||||
|
||||
if NSWorkspace.shared.setIcon(img, forFile: dmg) {
|
||||
print("Set \(dmg) icon to \(icns) [\(img.size)]")
|
||||
} else {
|
||||
print("Setting icon failed, don't know why")
|
||||
exit(2)
|
||||
}
|
|
@ -26,7 +26,7 @@ gui_entitlements="@PROJECT_SOURCE_DIR@/gui/node_modules/app-builder-lib/template
|
|||
ext_entitlements="@PROJECT_SOURCE_DIR@/contrib/macos/lokinet-extension.@LOKINET_ENTITLEMENTS_TYPE@.entitlements.plist"
|
||||
app_entitlements="@PROJECT_SOURCE_DIR@/contrib/macos/lokinet.@LOKINET_ENTITLEMENTS_TYPE@.entitlements.plist"
|
||||
|
||||
SIGN_TARGET="@PROJECT_BINARY_DIR@/Lokinet Installer/Lokinet.app"
|
||||
SIGN_TARGET="@PROJECT_BINARY_DIR@/Lokinet @PROJECT_VERSION@/Lokinet.app"
|
||||
|
||||
for ext in systemextension appex; do
|
||||
netext="$SIGN_TARGET/@lokinet_ext_dir@/org.lokinet.network-extension.$ext"
|
||||
|
|
Loading…
Reference in a new issue