1
+ RELEASE_DIR=../_internal/MacRelease
2
+ CONTENT_DIR=$RELEASE_DIR /DeskewGui.app/Contents
3
+
4
+ mkdir -p $RELEASE_DIR
5
+ rm -rf $RELEASE_DIR /*
6
+
7
+ # build executable
8
+ lazbuild --build-mode=Release-macOS --no-write-project ../Gui/deskewgui.lpi
9
+
10
+ # build app bundle
11
+ mkdir -p $CONTENT_DIR /MacOS
12
+ mkdir $CONTENT_DIR /Resources
13
+
14
+ cp ../Gui/deskewgui $CONTENT_DIR /MacOS/
15
+ chmod 755 $CONTENT_DIR /MacOS/deskewgui
16
+
17
+ cp ../Gui/deskewgui.icns $CONTENT_DIR /Resources/
18
+ chmod 644 $CONTENT_DIR /Resources/deskewgui.icns
19
+
20
+ echo " APPL????" > $CONTENT_DIR /PkgInfo
21
+
22
+ cat << EOT >> $CONTENT_DIR /Info.plist
23
+ <?xml version="1.0" encoding="UTF-8"?>
24
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
25
+ <plist version="1.0">
26
+ <dict>
27
+ <key>CFBundleDevelopmentRegion</key>
28
+ <string>English</string>
29
+ <key>CFBundleExecutable</key>
30
+ <string>deskewgui</string>
31
+ <key>CFBundleDisplayName</key>
32
+ <string>Deskew GUI</string>
33
+ <key>CFBundleName</key>
34
+ <string>Deskew GUI</string>
35
+ <key>CFBundleIdentifier</key>
36
+ <string>net.galfarslair.deskewgui</string>
37
+ <key>CFBundleIconFile</key>
38
+ <string>deskewgui</string>
39
+ <key>CFBundleInfoDictionaryVersion</key>
40
+ <string>6.0</string>
41
+ <key>CFBundlePackageType</key>
42
+ <string>APPL</string>
43
+ <key>CFBundleSignature</key>
44
+ <string>desk</string>
45
+ <key>CSResourcesFileMapped</key>
46
+ <true/>
47
+ <key>NSHumanReadableCopyright</key>
48
+ <string>©2018, Marek Mauder</string>
49
+ <key>NSHighResolutionCapable</key>
50
+ <true/>
51
+ </dict>
52
+ </plist>
53
+ EOT
54
+
55
+ # update version from Lazarus project file
56
+ MAJOR_VER=$( grep ' MajorVersionNr' ../Gui/deskewgui.lpi | grep -oE ' [0-9]+' )
57
+ MAJOR_VER=${MAJOR_VER:- 0} # if major=0 it's not included in project file
58
+ MINOR_VER=$( grep ' MinorVersionNr' ../Gui/deskewgui.lpi | grep -oE ' [0-9]+' )
59
+
60
+ plutil -insert CFBundleShortVersionString -string $MAJOR_VER .$MINOR_VER $CONTENT_DIR /Info.plist
61
+ plutil -insert CFBundleVersion -string $MAJOR_VER .$MINOR_VER $CONTENT_DIR /Info.plist
62
+
63
+ # create DMG from folder
64
+ DMG_NAME=DeskewGui-$MAJOR_VER .$MINOR_VER .dmg
65
+
66
+ hdiutil create -srcfolder $RELEASE_DIR -volname DeskewGui -format UDZO -ov $RELEASE_DIR /$DMG_NAME
0 commit comments