I just want to share my experience in creating pkg setup packages on MacOS X.
We are using a makefile to compile the software. In order to also create a setup, we are using the MacOS PackageMaker which is part of the development tools of MacOS. If you can not find it, please search for "Auxiliary tools for Xcode".
Let us assume that the executable, created by PureBasic is myApp.app. It is generated including some initial content by the purebasic IDE and we are using it as a initial default. You also might need to add some additional directories like /Resources/. In order to make it work correctly, we need to insert some additional files like program and document icons and some adapted Info.plist.
Here is the important part of our Makefile (it is stripped to the setup parts only):
Code: Select all
CP=cp -f
macpackage:
# The path to our myApp.app including the underlying /Contents/ folder:
MACAPP=~/src/mac/myApp.app/Contents/
# The path to the PackageMaker executable:
PACKAGEMAKER=/Volumes/Auxiliary\ Tools/PackageMaker.app/Contents/MacOS/PackageMaker
@echo --- Copy executable to .app file… ---
$(CP) ~/src/mac/myApp $(MACAPP)MacOS/myApp
@echo --- Copy Info.plist to .app file… ---
$(CP) ~/src/mac/Info.plist $(MACAPP)Info.plist
@echo --- Copy icon ressource to .app file… ---
$(CP) ~/src/mac/images/myApp_128x128.icns $(MACAPP)Resources/myApp_128x128.icns
$(CP) ~/src/mac/images/myApp_doc.icns $(MACAPP)Resources/myApp_doc.icns
@echo --- Run PackageMaker to create .pkg file… ---
$(PACKAGEMAKER) \
--title "myApp installer" \
--version 1.0 \
--filter "\.DS_Store" \
--root-volume-only \
--domain system \
--verbose \
--no-relocate \
--target 10.5 \
--id com.myCompany.myApp_installer.pkg \
--root ~/src/mac/myApp.app \
--out ~/src/mac/myApp_installer.pkg
@echo --- Finished ---
In order to assign the icons and embed the app to the MacOS system, we are using this Info.plist
(which is definitely not complete):
Code: Select all
<?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>myApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleDisplayName</key>
<string>myApp</string>
<key>CFBundleSignature</key>
<string>PURE</string>
<key>CFBundleVersion</key>
<string>0.1</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>CFBundleIconFile</key>
<string>myApp_128x128.icns</string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.myAppFileType</string>
</array>
<key>CFBundleTypeName</key>
<string>myApp file</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>myApp_doc.icns</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>extension1</string>
<string>extension2</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>myApp_doc.icns</string>
</array>
</dict>
</array>
</dict>
</plist>
I hope this helps someone.
By the way, if you like to sign the app you can also add these lines to the Makefile:
Code: Select all
@echo "--- Signing package (Keys must be imported to Mac Keychain Manager) ---"
#$(PACKAGEMAKER) \
--sign $(base)mac/myApp_installer.pkg \
--certificate "MyCertificateName"
Kukulkan