浏览代码

macOS: modernize app bundle info (#941)

- updated Info.plist
- renamed app icon
- added gxw document icon
nilason 4 年之前
父节点
当前提交
d0c0a43d99
共有 6 个文件被更改,包括 458 次插入26 次删除
  1. 3 2
      macosx/Makefile
  2. 0 0
      macosx/app/AppIcon.icns
  3. 二进制
      macosx/app/GRASSDocument_gxw.icns
  4. 400 0
      macosx/app/GRASSDocument_gxw.svg
  5. 18 22
      macosx/app/Info.plist.in
  6. 37 2
      macosx/app/Makefile

+ 3 - 2
macosx/Makefile

@@ -86,7 +86,8 @@ install-macosxapp:
 	$(INSTALL) app/build_html_user_index.sh ${INST_DIR_TARGET}/etc
 	$(INSTALL) app/build_gui_user_menu.sh ${INST_DIR_TARGET}/etc
 	$(INSTALL) app/python_wrapper ${INST_DIR_TARGET}/bin/python 
-	$(INSTALL_DATA) app/app.icns ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources
+	$(INSTALL_DATA) app/AppIcon.icns ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources
+	$(INSTALL_DATA) app/GRASSDocument_gxw.icns ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources
 	$(INSTALL_DATA) app/${OBJDIR}/Info.plist ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents
 	$(INSTALL_DATA) app/PkgInfo ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents
 	$(INSTALL) app/${OBJDIR}/GRASS.scpt ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources/Scripts/
@@ -111,7 +112,7 @@ install-basic-macosx:
 	     -e 's#'@LD_LIBRARY_PATH_VAR@'#'$(LD_LIBRARY_PATH_VAR)'#g' \
 	     -e 's#'@CONFIG_PROJSHARE@'#'$(PROJSHARE)'#g' \
 	     $(ARCH_DISTDIR)/$(GRASS_NAME).tmp > $(INST_DIR_TARGET)/$(GRASS_NAME)
-	-chmod a+x $(UNIX_BIN)/$(GRASS_NAME)
+	-chmod a+x $(INST_DIR_TARGET)/$(GRASS_NAME)
 	-rm -f $(INST_DIR_TARGET)/$(GRASS_NAME).tmp
 	-chmod -R a+rX ${PREFIX_TARGET}/${MACOSX_APP_NAME} 2>/dev/null
 	-touch ${PREFIX_TARGET}/${MACOSX_APP_NAME}

macosx/app/app.icns → macosx/app/AppIcon.icns


二进制
macosx/app/GRASSDocument_gxw.icns


文件差异内容过多而无法显示
+ 400 - 0
macosx/app/GRASSDocument_gxw.svg


+ 18 - 22
macosx/app/Info.plist.in

@@ -3,45 +3,41 @@
 <plist version="1.0">
 <dict>
 	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
+	<string>en</string>
 	<key>CFBundleExecutable</key>
 	<string>GRASS</string>
-	<key>CFBundleGetInfoString</key>
-	<string>GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@-@GRASS_VERSION_BUILD@</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>Copyright © 1999–@GRASS_VERSION_DATE@ GRASS Development Team</string>
 	<key>CFBundleIconFile</key>
-	<string>app.icns</string>
+	<string>AppIcon</string>
+	<key>CFBundleName</key>
+	<string>GRASS-@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@</string>
+	<key>CFBundleDisplayName</key>
+	<string>GRASS-@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@</string>
 	<key>CFBundleIdentifier</key>
-	<string>org.osgeo.grass@GRASS_VERSION_MAJOR@_@GRASS_VERSION_MINOR@</string>
+	<string>org.osgeo.grass</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
+	<string>@BUNDLE_VERSION@</string>
 	<key>CFBundleVersion</key>
-	<string>@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@-@GRASS_VERSION_BUILD@</string>
-	<key>NSMainNibFile</key>
-	<string>MainMenu.nib</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
+	<string>@BUNDLE_VERSION@</string>
 	<key>CFBundleDocumentTypes</key>
 	<array>
 		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
-				<string>****</string>
-			</array>
 			<key>CFBundleTypeName</key>
-			<string>FolderType</string>
-			<key>CFBundleTypeOSTypes</key>
+			<string>GRASS Workspace File</string>
+			<key>CFBundleTypeExtensions</key>
 			<array>
-				<string>fold</string>
+				<string>gxw</string>
 			</array>
-			<key>CFBundleTypeRole</key>
-			<string>Editor</string>
+			<key>CFBundleTypeIconFile</key>
+			<string>GRASSDocument_gxw</string>
 		</dict>
 	</array>
+	<key>LSMinimumSystemVersion</key>
+	<string>@DEPLOYMENT_TARGET@</string>
 </dict>
 </plist>

+ 37 - 2
macosx/app/Makefile

@@ -15,6 +15,40 @@ APPDIR = $(ARCH_DISTDIR)/${MACOSX_APP_NAME}/Contents
 MAKE_DIR_CMD = mkdir -p -m 755
 GRASS_VERSION_BUILD = `/bin/date "+%y%m%d"`
 
+BUNDLE_VERSION := ${GRASS_VERSION_NUMBER}
+# add git commit hash to bundle version if it is a development release
+ifneq (,$(findstring dev,$(GRASS_VERSION_RELEASE)))
+BUNDLE_VERSION := ${GRASS_VERSION_NUMBER} (${GRASS_VERSION_GIT})
+endif
+
+# Figure out version for MACOSX_DEPLOYMENT_TARGET, with following order:
+# - if MACOSX_SDK is set then it will be used
+# - the result of `xcrun --show-sdk-path`
+# - check if Command Line Tools' SDKs is present, and use the default version
+# - use the MacOS version of building machine
+SDK_CMD = ""
+ifeq ($(strip $(MACOSX_SDK)),)
+SDK_CMD = xcrun --show-sdk-path
+else
+SDK_CMD = echo "${MACOSX_SDK}" | cut -d \  -f 2
+endif
+SDK := $(shell $(SDK_CMD))
+
+ifeq ($(SDK),)
+ifneq ($(wildcard /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/.*),)
+SDK = /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
+endif
+endif
+
+ifneq ($(SDK),)
+DEPLOYMENT_TARGET_CMD = plutil -extract DefaultProperties.MACOSX_DEPLOYMENT_TARGET \
+	xml1 -o - $(SDK)/SDKSettings.plist | awk -F '[<>]' '/string/{print $$3}'
+else
+DEPLOYMENT_TARGET_CMD = sw_vers -productVersion | cut -d . -f 1,2
+endif
+
+DEPLOYMENT_TARGET := $(shell $(DEPLOYMENT_TARGET_CMD))
+
 # ugly hack - assume gdal prefix starts with -L flag
 ifndef GDAL_BIN
 GDAL_BIN = `echo "${GDALLIBS}" | sed -e "s,-L,," -e "s,/lib.*$$,/bin:,"`
@@ -51,8 +85,9 @@ $(OBJDIR)/Info.plist: Info.plist.in
 	$(MAKE_DIR_CMD) $(OBJDIR)
 	sed -e "s,@GRASS_VERSION_MAJOR@,$(GRASS_VERSION_MAJOR),g" \
 		-e "s,@GRASS_VERSION_MINOR@,$(GRASS_VERSION_MINOR),g" \
-		-e "s,@GRASS_VERSION_RELEASE@,$(GRASS_VERSION_RELEASE),g" \
-		-e "s,@GRASS_VERSION_BUILD@,$(GRASS_VERSION_BUILD),g" \
+		-e "s,@GRASS_VERSION_DATE@,$(GRASS_VERSION_DATE),g" \
+		-e "s,@BUNDLE_VERSION@,$(BUNDLE_VERSION),g" \
+		-e "s,@DEPLOYMENT_TARGET@,$(DEPLOYMENT_TARGET),g" \
 		$< > $@
 
 $(OBJDIR)/GRASS.scpt: GRASS.applescript