app.mk 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Create an application directory for Darwin.
  2. APP_SUPPORT_DIR:=build/package-darwin
  3. APP_DIR:=openMSX.app
  4. APP_EXE_DIR:=$(APP_DIR)/Contents/MacOS
  5. APP_PLIST:=$(APP_DIR)/Contents/Info.plist
  6. APP_RES:=$(APP_DIR)/Contents/Resources
  7. APP_ICON:=$(APP_RES)/openmsx-logo.icns
  8. # Override install locations.
  9. DESTDIR:=$(BINDIST_DIR)
  10. INSTALL_BINARY_DIR:=$(APP_EXE_DIR)
  11. INSTALL_SHARE_DIR:=$(APP_DIR)/share
  12. INSTALL_DOC_DIR:=Documentation
  13. PACKAGE_FULL:=$(shell PYTHONPATH=build $(PYTHON) -c \
  14. "import version; print(version.getVersionedPackageName())" \
  15. )
  16. BINDIST_PACKAGE:=$(BUILD_PATH)/$(PACKAGE_FULL)-mac-$(OPENMSX_TARGET_CPU)-bin.dmg
  17. BINDIST_README:=README.html
  18. BINDIST_LICENSE:=$(INSTALL_DOC_DIR)/GPL.txt
  19. # TODO: What is needed for an app folder?
  20. app: install $(DESTDIR)/$(APP_PLIST) $(DESTDIR)/$(APP_ICON)
  21. bindist: app $(DESTDIR)/$(BINDIST_README) $(DESTDIR)/$(BINDIST_LICENSE)
  22. @echo "Creating disk image:"
  23. @hdiutil create -srcfolder $(BINDIST_DIR) \
  24. -volname openMSX \
  25. -imagekey zlib-level=9 \
  26. -ov $(BINDIST_PACKAGE)
  27. $(DESTDIR)/$(APP_PLIST): $(DESTDIR)/$(APP_DIR)/Contents/%: $(APP_SUPPORT_DIR)/% bindistclean
  28. @echo " Writing meta-info..."
  29. @mkdir -p $(@D)
  30. @sed -e 's/%ICON%/$(notdir $(APP_ICON))/' \
  31. -e 's/%VERSION%/$(shell $(PYTHON) build/version.py)/' < $< > $@
  32. @echo "APPLoMSX" > $(@D)/PkgInfo
  33. $(DESTDIR)/$(APP_ICON): $(DESTDIR)/$(APP_RES)/%: $(APP_SUPPORT_DIR)/% bindistclean
  34. @echo " Copying resources..."
  35. @mkdir -p $(@D)
  36. @cp $< $@
  37. $(DESTDIR)/$(BINDIST_README): $(APP_SUPPORT_DIR)/README.html
  38. @echo " Copying README..."
  39. @mkdir -p $(@D)
  40. @cp $< $@
  41. $(DESTDIR)/$(BINDIST_LICENSE): doc/GPL.txt app
  42. @echo " Copying license..."
  43. @mkdir -p $(@D)
  44. # Remove form feeds from the GPL document, so Safari will treat it as text.
  45. @awk '!/\f/ ; /\f/ { print "" }' $< > $@