--- a/ApplicationDefinition.st Tue Oct 11 17:01:57 2016 +0100
+++ b/ApplicationDefinition.st Tue Oct 11 17:03:52 2016 +0100
@@ -111,7 +111,7 @@
!
startupClass
- "the class, but onlz of loaded"
+ "the class, but only if loaded"
|cls|
@@ -741,9 +741,14 @@
at:self rcFilename put:#'generate_packageName_dot_rc';
at:self nsiFilename put:#'generate_packageName_dot_nsi';
at:self apspecFilename put:#'generate_autopackage_default_dot_apspec'; "/ for linux
+ at:'osx/Info.plist' put:#'generate_osx_info_dot_plist';
+ at:'osx/PkgInfo' put:#'generate_osx_pkginfo';
at:'builder/baseline.rbspec' put:#'generate_builder_baseline_dot_rbspec';
at:'builder/package.deps.rake' put: #'generate_package_dot_deps_dot_rake'.
+"/ self isGUIApplication ifFalse:[
+"/ dict at:'osx/Distribution' put:#'generate_osx_distributionScript'.
+"/ ].
^ dict.
"Modified: / 21-12-2010 / 11:01:27 / cg"
@@ -794,6 +799,10 @@
"Modified: / 11-08-2006 / 14:01:56 / cg"
!
+generate_osx_pkginfo
+ ^ 'APPL',self applicationName
+!
+
generate_packageName_dot_nsi
^self
@@ -1012,52 +1021,6 @@
RMDir /r "$INSTDIR"'
!
-dmgImageSetupLines
- "generate (unix) copy commands to generate a directory holding the dmg prototype image directory.
- This is used to generate a macOS deployable package"
-
- |genLine product productFile dmgVolume dmgDir appDir contentsDir macOSDir resourcesDir dirsMade|
-
- product := self productName.
- productFile := self productFilename.
-
- dmgVolume := productFile,'.dmg'.
- dmgDir := productFile,'_dmg'.
- appDir := dmgDir,'/',productFile,'.app'.
- contentsDir := appDir,'/Contents'.
- macOSDir := contentsDir,'/MacOS'.
- resourcesDir := contentsDir,'/Resources'.
- dirsMade := Set new.
-
- genLine :=
- [:s :d :srcAndDest |
- |sourcePattern relPath destination|
-
- sourcePattern := srcAndDest first.
- relPath := srcAndDest second.
- (relPath startsWith:'bin') ifTrue:[
- relPath := '.',(relPath copyFrom:4)
- ].
- destination := contentsDir,'/',d,'/',relPath.
- (dirsMade includes:destination) ifFalse:[
- s tab; nextPutLine:('@-mkdir "%1"' bindWith:destination).
- dirsMade add:destination.
- ].
- s tab; nextPutLine:('-cp -r %1 "%2"' bindWith:sourcePattern with:destination).
- ].
-
- ^ String streamContents:[:s |
- s tab; nextPutLine:('@-rm -rf "%1"' bindWith:dmgDir).
- s tab; nextPutLine:('@-mkdir "%1"' bindWith:dmgDir). dirsMade add:dmgDir.
- s tab; nextPutLine:('@-mkdir "%1"' bindWith:appDir). dirsMade add:appDir.
- s tab; nextPutLine:('@-mkdir "%1"' bindWith:contentsDir). dirsMade add:contentsDir.
- s tab; nextPutLine:('@-mkdir "%1"' bindWith:macOSDir). dirsMade add:macOSDir.
- s tab; nextPutLine:('cp "',self applicationName,'" "',macOSDir,'/',productFile,'"').
- self commonFilesToInstall_unix do:[:eachPair | genLine value:s value:'MacOS' value:eachPair].
- self additionalFilesToInstall_unix do:[:eachPair | genLine value:s value:'MacOS' value:eachPair].
- ].
-!
-
fileExtensionDefinitionLines_dot_nsi:bindings
^ String streamContents:[:s |
self documentExtensions do:[:ext |
@@ -1105,7 +1068,9 @@
at: 'PRODUCT_PUBLISHER' put: (self productPublisher);
at: 'PRODUCT_WEBSITE' put: (self productWebSite);
at: 'PRODUCT_INSTALLDIR' put: (self productInstallDir);
- at: 'DMG_IMAGE_SETUP' put: (self dmgImageSetupLines);
+ at: 'OSX_DMG_SETUP' put: (self osxDmgImageSetupLines);
+ at: 'OSX_PKG_SETUP' put: (self osxPkgImageSetupLines);
+ at: 'PRODUCT_ID' put: (self package copyReplaceAny:':/' with:$.);
at: 'BUILD_TARGET' put: (self buildTarget ).
self offerSmalltalkSourceCode ifTrue:[
@@ -2394,6 +2359,32 @@
"Created: / 01-03-2007 / 20:00:20 / cg"
!
+linuxSetupRules
+ "this is sliced into the generated Make.proto file"
+
+ ^ '
+#
+# for linux, this uses autopackage
+# (SETUP_RULE is set to setup_linux)
+setup_linux:
+ @if test -d autopackage; then \
+ makepackage; \
+ else \
+ echo "Error: missing autopackage directory"; \
+ exit 1; \
+ fi
+
+# backward compatible fallback
+setup::
+ @if test -d autopackage; then \
+ makepackage; \
+ else \
+ echo "Error: make setup not yet available in this unix"; \
+ exit 1; \
+ fi
+'
+!
+
make_dot_proto
^
@@ -2497,37 +2488,8 @@
#
# a self installable delivery
#
-# backward compatible fallback
-setup::
- @if test -d autopackage; then \
- makepackage; \
- else \
- echo "Error: make setup not yet available in this unix"; \
- exit 1; \
- fi
-
-#
-# for linux, this uses autopackage
-#
-setup_linux:
- @if test -d autopackage; then \
- makepackage; \
- else \
- echo "Error: missing autopackage directory"; \
- exit 1; \
- fi
-
-#
-# for mac, a dmg is generated
-#
-setup_macosx: "%(PRODUCT_FILENAME)_dmg"
- -rm "%(PRODUCT_FILENAME).dmg"
- hdiutil create -fs HFSX -layout SPUD "%(PRODUCT_FILENAME).dmg" -srcfolder "%(PRODUCT_FILENAME)_dmg" -format UDZO -volname "%(PRODUCT_NAME)" -quiet
-
-app: "%(PRODUCT_FILENAME)_dmg"
-
-"%(PRODUCT_FILENAME)_dmg": $(SUBPROJECT_LIBS) $(REQUIRED_SUPPORT_DIRS)
-%(DMG_IMAGE_SETUP)
+',self linuxSetupRules,'
+',self osxSetupRules,'
SOURCEFILES: %(APPLICATION)_SOURCES \
stx_SOURCES
@@ -2787,6 +2749,182 @@
"Modified: / 09-11-2010 / 11:57:39 / cg"
!
+osxDmgImageSetupLines
+ "generate (OSX unix) copy commands to generate a directory holding the dmg prototype image directory.
+ This is used to generate a macOS deployable dmg containing an app"
+
+ |genLine product productFile dmgVolume dmgDir appDir contentsDir macOSDir resourcesDir dirsMade|
+
+ product := self productName.
+ productFile := self productFilename.
+
+ dmgVolume := productFile,'.dmg'.
+ dmgDir := productFile,'_dmg'.
+ appDir := dmgDir,'/',productFile,'.app'.
+ contentsDir := appDir,'/Contents'.
+ macOSDir := contentsDir,'/MacOS'.
+ resourcesDir := contentsDir,'/Resources'.
+ dirsMade := Set new.
+
+ genLine :=
+ [:s :d :srcAndDest |
+ |sourcePattern relPath destination|
+
+ sourcePattern := srcAndDest first.
+ relPath := srcAndDest second.
+ (relPath startsWith:'bin') ifTrue:[
+ relPath := '.',(relPath copyFrom:4)
+ ].
+ destination := contentsDir,'/',d,'/',relPath.
+ (dirsMade includes:destination) ifFalse:[
+ s tab; nextPutLine:('@-mkdir "%1"' bindWith:destination).
+ dirsMade add:destination.
+ ].
+ s tab; nextPutLine:('-cp -r %1 "%2"' bindWith:sourcePattern with:destination).
+ ].
+
+ ^ String streamContents:[:s |
+ s tab; nextPutLine:('@-rm -rf "%1"' bindWith:dmgDir).
+ s tab; nextPutLine:('@-mkdir "%1"' bindWith:dmgDir). dirsMade add:dmgDir.
+ s tab; nextPutLine:('@-mkdir "%1"' bindWith:appDir). dirsMade add:appDir.
+ s tab; nextPutLine:('@-mkdir "%1"' bindWith:contentsDir). dirsMade add:contentsDir.
+ s tab; nextPutLine:('@-mkdir "%1"' bindWith:macOSDir). dirsMade add:macOSDir.
+ s tab; nextPutLine:('cp "',self applicationName,'" "',macOSDir,'/"').
+ s tab; nextPutLine:('@-cp osx/Info.plist "',contentsDir,'/"').
+ s tab; nextPutLine:('@-cp osx/PkgInfo "',contentsDir,'/"').
+ self commonFilesToInstall_unix do:[:eachPair | genLine value:s value:'MacOS' value:eachPair].
+ s tab; nextPutLine:('@-rm "%1/"*WINrc.rc' bindWith:macOSDir).
+ self additionalFilesToInstall_unix do:[:eachPair | genLine value:s value:'MacOS' value:eachPair].
+ ].
+!
+
+osxPkgDistributionScript
+ "unfinished.
+ generate (OSX unix) copy commands to generate a directory holding the pkg prototype image directory.
+ This is used to generate a macOS deployable pkg containing libraries or non-GUI programs"
+
+ |packageID product|
+
+ product := self productName.
+ packageID := self package copyReplaceAny:':/' with:$..
+
+ ^ '
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<installer-gui-script minSpecVersion="1">
+ <title>',product,'</title>
+ <options customize="never"/>
+ <allowed-os-versions>
+ <os-version min="10.5"/>
+ </allowed-os-versions>
+ <installation-check script="InstallationCheck();"/>
+ <script><!![CDATA[
+function InstallationCheck () {
+ if (system.compareVersions(system.version.ProductVersion, "10.5") < 0) {
+ my.result.message = "This package is meant to be installed on Mac OS X 10.5 or newer.";
+ my.result.type = ''Fatal'';
+ return false;
+ }
+ if (system.files.fileExistsAtPath(''/opt/local/bin/',product,''')) {
+ my.result.message = "',product,' is already installed.";
+ my.result.type = ''Warn'';
+ return false;
+ }
+ return true;
+}
+ ]]></script>
+ <readme mime-type="text/html" file="ReadMe.html"/>
+ <welcome mime-type="text/html" file="Welcome.html"/>
+ <choices-outline>
+ <line choice="default">
+ <line choice="',packageID,'"/>
+ </line>
+ </choices-outline>
+ <choice id="default"/>
+ <choice id="',packageID,'" visible="false">
+ <pkg-ref id="',packageID,'"/>
+ </choice>
+ <pkg-ref id="',packageID,'" version="0.2.3.3.0.0.0.0.0" installKBytes="14236">#MacPorts-2.3.3-component.pkg</pkg-ref>
+ <pkg-ref id="',packageID,'">
+ <bundle-version/>
+ </pkg-ref>
+ <product id="',packageID,'"/>
+</installer-gui-script>
+'.
+!
+
+osxPkgImageSetupLines
+ "generate (OSX unix) copy commands to generate a directory holding the pkg prototype image directory.
+ This is used to generate a macOS deployable pkg containing libraries or non-GUI programs"
+
+ |product productFile pkgVolume pkgDir
+ optDir optLocalDir optLocalBinDir|
+
+ product := self productName.
+ productFile := self productFilename.
+
+ pkgVolume := productFile,'.pkg'.
+ pkgDir := productFile,'_pkg'.
+ optDir := pkgDir,'/opt'.
+ optLocalDir := optDir,'/local'.
+ optLocalBinDir := optLocalDir,'/bin'.
+
+ ^ String streamContents:[:s |
+ s tab; nextPutLine:('-rm -rf "%1"' bindWith:pkgDir).
+ s tab; nextPutLine:('-mkdir "%1"' bindWith:pkgDir).
+ s tab; nextPutLine:('-mkdir "%1"' bindWith:optDir).
+ s tab; nextPutLine:('-mkdir "%1"' bindWith:optLocalDir).
+ s tab; nextPutLine:('-mkdir "%1"' bindWith:optLocalBinDir).
+ s tab; nextPutLine:('cp "',self applicationName,'" "',optLocalBinDir,'/"').
+ ].
+!
+
+osxSetupRules
+ "this is sliced into the generated Make.proto file"
+
+ self isGUIApplication ifTrue:[
+ ^ self osxSetupRules_forDMG
+ ].
+ ^ self osxSetupRules_forPKG
+!
+
+osxSetupRules_forDMG
+ "this is sliced into the generated Make.proto file"
+
+ ^ '
+#
+# for mac, a dmg is generated
+# (SETUP_RULE is set to setup_macosx)
+#
+setup_macosx: "%(PRODUCT_FILENAME)_dmg"
+ -rm "%(PRODUCT_FILENAME).dmg"
+ hdiutil create -fs HFSX -layout SPUD "%(PRODUCT_FILENAME).dmg" -srcfolder "%(PRODUCT_FILENAME)_dmg" -format UDZO -volname "%(PRODUCT_NAME)" -quiet
+
+app: "%(PRODUCT_FILENAME)_dmg"
+
+"%(PRODUCT_FILENAME)_dmg": $(SUBPROJECT_LIBS) $(REQUIRED_SUPPORT_DIRS)
+%(OSX_DMG_SETUP)
+'
+!
+
+osxSetupRules_forPKG
+ "this is sliced into the generated Make.proto file"
+
+ ^ '
+#
+# for mac, a pkg is generated
+# (SETUP_RULE is set to setup_macosx)
+#
+setup_macosx: "%(PRODUCT_FILENAME)_pkg"
+ -rm "%(PRODUCT_FILENAME).pkg"
+ pkgbuild --identifier "%(PRODUCT_ID)" --version "%(PRODUCT_VERSION)" --root %(PRODUCT_FILENAME)_pkg "%(PRODUCT_FILENAME).pkg"
+
+app: "%(PRODUCT_FILENAME)_pkg"
+
+"%(PRODUCT_FILENAME)_pkg": $(SUBPROJECT_LIBS) $(REQUIRED_SUPPORT_DIRS)
+%(OSX_PKG_SETUP)
+'
+!
+
packageName_dot_nsi
"the template code for the <appname>.nsi file"
--- a/ProjectDefinition.st Tue Oct 11 17:01:57 2016 +0100
+++ b/ProjectDefinition.st Tue Oct 11 17:03:52 2016 +0100
@@ -1362,8 +1362,8 @@
applicationIconFileNameLinux_code
^ String streamContents:[:s |
s nextPutLine:'applicationIconFileNameLinux'.
- s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'
- s nextputLine:' This is currently unused (will be for desktop definitions)"'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'.
+ s nextPutLine:' This is currently unused (will be for desktop definitions)"'.
s cr;
nextPutLine:' ^ nil';
nextPutLine:' " ^ self applicationName "'.
@@ -1380,8 +1380,8 @@
applicationIconFileNameOSX_code
^ String streamContents:[:s |
s nextPutLine:'applicationIconFileNameOSX'.
- s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'
- s nextputLine:' This is used to create the info.plist file"'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'.
+ s nextPutLine:' This is used to create the info.plist file"'.
s cr;
nextPutLine:' ^ nil';
nextPutLine:' " ^ self applicationName "'.
@@ -1398,8 +1398,8 @@
applicationIconFileNameWindows_code
^ String streamContents:[:s |
s nextPutLine:'applicationIconFileNameWindows'.
- s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'
- s nextputLine:' This will be included in the rc-resource file for Windowsdeployment"'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'.
+ s nextPutLine:' This will be included in the rc-resource file for Windowsdeployment"'.
s cr;
nextPutLine:' ^ nil';
nextPutLine:' " ^ self applicationName "'.
@@ -1418,7 +1418,8 @@
^ String streamContents:[:s |
s nextPutLine:'applicationIconFileName'.
- s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon); will be included in the rc-resource file"'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon);'.
+ s nextPutLine:' "will be included in the rc-resource file"'.
s cr;
nextPutLine:' ^ nil';
nextPutLine:' " ^ self applicationName "'.
@@ -4898,24 +4899,9 @@
!
headerFileOutputArg
-"/ "all stx stuff goes to the common include directory.
-"/ Everything else is left locally"
-"/
-"/ (
-"/ #(
-"/ 'stx:libbasic' 'stx:libview' 'stx:libtool'
-"/ 'stx:libbasic2' 'stx:libview2' 'stx:libtool2'
-"/ 'stx:libbasic3' 'stx:libwidg' 'stx:libhtml'
-"/ 'stx:libcomp' 'stx:libwidg2' 'stx:libui'
-"/ 'stx:libboss' 'stx:libdb'
-"/ )
-"/ includes:self package) ifTrue:[
-"/ ^ '-H$(INCLUDE)'
-"/ ].
+ "Every header file is left locally in its lib-dir"
+
^ '-headerDir=.'
-
- "Created: / 18-08-2006 / 13:01:52 / cg"
- "Modified: / 23-12-2011 / 15:07:27 / cg"
!
objectLine_make_dot_spec_mappings: aClassName
@@ -5170,60 +5156,16 @@
"Modified: / 08-08-2006 / 15:46:05 / fm"
!
-info_dot_plist
+generate_osx_info_dot_plist
"template for the info.plist file, which is included in an OS X deployment"
|plist|
- (plist := self info_dot_plist_dictionary) isNil ifTrue:[^ nil].
- ^ MacPlistXMLCoder encode:plist
-
- "
- exept_expecco_application info_dot_plist
- "
-!
-
-info_dot_plist_dictionary
- "template for the info.plist file, which is included in an OS X deployment"
-
- |plist pkg icnFilename docTypeDescriptions|
-
- plist := Dictionary new.
- plist at:'CFBundleInfoDictionaryVersion' put:'6.0'.
- pkg := self package copyReplaceAny:':/' with:$..
- (pkg endsWith:'.application') ifTrue:[
- pkg := pkg copyButLast:'.application' size.
+ (plist := self osx_info_dot_plist_dictionary) isNil ifTrue:[^ nil].
+ MacPlistXMLCoder isNil ifTrue:[
+ Smalltalk loadPackage:'stx:goodies/xml/stx'
].
- plist at:'CFBundleIdentifier' put:pkg.
- plist at:'CFBundleShortVersionString' put:(self fileVersion asString).
- plist at:'CFBundleVersion' put:(self fileVersion asString).
- plist at:'LSMinimumSystemVersion' put:'10.6'.
- "/ plist at:'CFBundleDevelopmentRegion' put:'English'.
- "/ plist at:'CFBundleExecutable' put:(self executableName).
-
- self isLibraryDefinition ifTrue:[
- plist at:'CFBundleName' put:(self package copyReplaceAny:':/' with:$.).
- ] ifFalse:[
- plist at:'CFBundleName' put:(self applicationName).
- plist at:'CFBundlePackageType' put:'APPL'.
- ].
- (icnFilename := self applicationIconFileNameOSX) notNil ifTrue:[
- plist at:'CFBundleIconFile' put:icnFilename.
- ].
- (docTypeDescriptions := self applicationDocumentTypeDescriptions) notNil ifTrue:[
- plist at:'CFBundleDocumentTypes' put:
- (docTypeDescriptions collect:[:each |
- |d|
- d := Dictionary new.
- d at:'CFBundleTypeExtensions' put:{ each extension }.
- d at:'CFBundleTypeIconFile' put:{ each iconFileOSX }.
- d at:'CFBundleTypeMimeTypes' put:{ each mimeType }.
- d at:'CFBundleTypeName' put:(each documentTypeName).
- d at:'CFBundleTypeRole' put:'Editor'.
- d
- ]).
- ].
- ^ plist
+ ^ MacPlistXMLCoder encode:plist
"
exept_expecco_application info_dot_plist
@@ -5388,6 +5330,53 @@
"Modified: / 23-08-2006 / 11:11:38 / cg"
!
+osx_info_dot_plist_dictionary
+ "template for the info.plist file, which is included in an OS X deployment"
+
+ |plist pkg icnFilename docTypeDescriptions|
+
+ plist := Dictionary new.
+ plist at:'CFBundleInfoDictionaryVersion' put:'6.0'.
+ pkg := self package copyReplaceAny:':/' with:$..
+ (pkg endsWith:'.application') ifTrue:[
+ pkg := pkg copyButLast:'.application' size.
+ ].
+ plist at:'CFBundleIdentifier' put:pkg.
+ plist at:'CFBundleShortVersionString' put:(self fileVersion asString).
+ plist at:'CFBundleVersion' put:(self fileVersion asString).
+ plist at:'LSMinimumSystemVersion' put:'10.6'.
+ "/ plist at:'CFBundleDevelopmentRegion' put:'English'.
+ "/ plist at:'CFBundleExecutable' put:(self executableName).
+
+ self isLibraryDefinition ifTrue:[
+ plist at:'CFBundleName' put:(self package copyReplaceAny:':/' with:$.).
+ ] ifFalse:[
+ plist at:'CFBundleName' put:(self applicationName).
+ plist at:'CFBundlePackageType' put:'APPL'.
+ ].
+ (icnFilename := self applicationIconFileNameOSX) notNil ifTrue:[
+ plist at:'CFBundleIconFile' put:icnFilename.
+ ].
+ (docTypeDescriptions := self applicationDocumentTypeDescriptions) notNil ifTrue:[
+ plist at:'CFBundleDocumentTypes' put:
+ (docTypeDescriptions collect:[:each |
+ |d|
+ d := Dictionary new.
+ d at:'CFBundleTypeExtensions' put:{ each extension }.
+ d at:'CFBundleTypeIconFile' put:{ each iconFileOSX }.
+ d at:'CFBundleTypeMimeTypes' put:{ each mimeType }.
+ d at:'CFBundleTypeName' put:(each documentTypeName).
+ d at:'CFBundleTypeRole' put:'Editor'.
+ d
+ ]).
+ ].
+ ^ plist
+
+ "
+ exept_expecco_application info_dot_plist
+ "
+!
+
packageName_dot_rc
"the template code for the <libName>.rc file.
Only used for WIN"