app.mk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. -fs HFS+J \
  25. -volname openMSX \
  26. -imagekey zlib-level=9 \
  27. -ov $(BINDIST_PACKAGE)
  28. $(DESTDIR)/$(APP_PLIST): $(DESTDIR)/$(APP_DIR)/Contents/%: $(APP_SUPPORT_DIR)/% bindistclean
  29. @echo " Writing meta-info..."
  30. @mkdir -p $(@D)
  31. @sed -e 's/%ICON%/$(notdir $(APP_ICON))/' \
  32. -e 's/%VERSION%/$(shell $(PYTHON) build/version.py triple)/' < $< > $@
  33. @echo "APPLoMSX" > $(@D)/PkgInfo
  34. $(DESTDIR)/$(APP_ICON): $(DESTDIR)/$(APP_RES)/%: $(APP_SUPPORT_DIR)/% bindistclean
  35. @echo " Copying resources..."
  36. @mkdir -p $(@D)
  37. @cp $< $@
  38. $(DESTDIR)/$(BINDIST_README): $(APP_SUPPORT_DIR)/README.html
  39. @echo " Copying README..."
  40. @mkdir -p $(@D)
  41. @cp $< $@
  42. $(DESTDIR)/$(BINDIST_LICENSE): doc/GPL.txt app
  43. @echo " Copying license..."
  44. @mkdir -p $(@D)
  45. # Remove form feeds from the GPL document, so Safari will treat it as text.
  46. @awk '!/\f/ ; /\f/ { print "" }' $< > $@