Skip to content

Commit

Permalink
Deskew GUI: added macOS release build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Mauder committed Dec 3, 2018
1 parent 0290997 commit c33750b
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 9 deletions.
Binary file added Gui/deskewgui.icns
Binary file not shown.
59 changes: 50 additions & 9 deletions Gui/deskewgui.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<VersionInfo>
<UseVersionInfo Value="True"/>
<MinorVersionNr Value="90"/>
<StringTable CompanyName="Galfar's Lair" FileDescription="Deskew GUI" ProductName="Deskew GUI" ProductVersion=""/>
<StringTable CompanyName="Galfar's Lair" FileDescription="Deskew GUI" ProductName="Deskew GUI"/>
</VersionInfo>
<BuildModes Count="2">
<BuildModes Count="3">
<Item1 Name="Debug" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
Expand Down Expand Up @@ -56,11 +56,56 @@
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dDONT_LINK_FILE_FORMATS"/>
</Other>
</CompilerOptions>
</Item2>
<Item3 Name="Release-macOS">
<MacroValues Count="1">
<Macro1 Name="LCLWidgetType" Value="cocoa"/>
</MacroValues>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="deskewgui"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\Imaging"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="darwin"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
<SharedMatrixOptions Count="5">
<Item1 ID="734952752827" Modes="Release-macOS" Type="IDEMacro" MacroName="LCLWidgetType" Value="cocoa"/>
<Item2 ID="088075076274" Modes="Release-macOS"/>
<Item3 ID="382385632331" Modes="Release-macOS" Value="-WM10.9"/>
<Item4 ID="590039250505" Modes="Debug" Value="-dDEBUG"/>
<Item5 ID="453512566522" Modes="Debug,Release,Release-macOS" Value="-dDONT_LINK_FILE_FORMATS"/>
</SharedMatrixOptions>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
Expand Down Expand Up @@ -175,10 +220,6 @@
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dDONT_LINK_FILE_FORMATS
-dDEBUG"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
Expand Down
66 changes: 66 additions & 0 deletions Scripts/build_gui_release_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
RELEASE_DIR=../_internal/MacRelease
CONTENT_DIR=$RELEASE_DIR/DeskewGui.app/Contents

mkdir -p $RELEASE_DIR
rm -rf $RELEASE_DIR/*

# build executable
lazbuild --build-mode=Release-macOS --no-write-project ../Gui/deskewgui.lpi

# build app bundle
mkdir -p $CONTENT_DIR/MacOS
mkdir $CONTENT_DIR/Resources

cp ../Gui/deskewgui $CONTENT_DIR/MacOS/
chmod 755 $CONTENT_DIR/MacOS/deskewgui

cp ../Gui/deskewgui.icns $CONTENT_DIR/Resources/
chmod 644 $CONTENT_DIR/Resources/deskewgui.icns

echo "APPL????" > $CONTENT_DIR/PkgInfo

cat <<EOT >> $CONTENT_DIR/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>deskewgui</string>
<key>CFBundleDisplayName</key>
<string>Deskew GUI</string>
<key>CFBundleName</key>
<string>Deskew GUI</string>
<key>CFBundleIdentifier</key>
<string>net.galfarslair.deskewgui</string>
<key>CFBundleIconFile</key>
<string>deskewgui</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>desk</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>©2018, Marek Mauder</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
EOT

# update version from Lazarus project file
MAJOR_VER=$(grep 'MajorVersionNr' ../Gui/deskewgui.lpi | grep -oE '[0-9]+')
MAJOR_VER=${MAJOR_VER:-0} # if major=0 it's not included in project file
MINOR_VER=$(grep 'MinorVersionNr' ../Gui/deskewgui.lpi | grep -oE '[0-9]+')

plutil -insert CFBundleShortVersionString -string $MAJOR_VER.$MINOR_VER $CONTENT_DIR/Info.plist
plutil -insert CFBundleVersion -string $MAJOR_VER.$MINOR_VER $CONTENT_DIR/Info.plist

# create DMG from folder
DMG_NAME=DeskewGui-$MAJOR_VER.$MINOR_VER.dmg

hdiutil create -srcfolder $RELEASE_DIR -volname DeskewGui -format UDZO -ov $RELEASE_DIR/$DMG_NAME

0 comments on commit c33750b

Please sign in to comment.