MacBundles.gmk revision 2281:4353c659dfde
11573Srgrimes#
21573Srgrimes# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
31573Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41573Srgrimes#
51573Srgrimes# This code is free software; you can redistribute it and/or modify it
61573Srgrimes# under the terms of the GNU General Public License version 2 only, as
71573Srgrimes# published by the Free Software Foundation.  Oracle designates this
81573Srgrimes# particular file as subject to the "Classpath" exception as provided
91573Srgrimes# by Oracle in the LICENSE file that accompanied this code.
101573Srgrimes#
111573Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT
121573Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131573Srgrimes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141573Srgrimes# version 2 for more details (a copy is included in the LICENSE file that
151573Srgrimes# accompanied this code).
16249808Semaste#
171573Srgrimes# You should have received a copy of the GNU General Public License version
181573Srgrimes# 2 along with this work; if not, write to the Free Software Foundation,
191573Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
201573Srgrimes#
211573Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
221573Srgrimes# or visit www.oracle.com if you need additional information or have any
231573Srgrimes# questions.
241573Srgrimes#
251573Srgrimes
261573Srgrimesinclude $(SPEC)
271573Srgrimesinclude MakeBase.gmk
281573Srgrimesinclude TextFileProcessing.gmk
291573Srgrimes
301573Srgrimesdefault: bundles
311573Srgrimes
321573Srgrimes# Only macosx has bundles defined.
331573Srgrimesifeq ($(OPENJDK_TARGET_OS), macosx)
341573Srgrimes
351573Srgrimes  bundles: jre-bundle jdk-bundle
3692986Sobrien
3792986Sobrien  # JDK_MACOSX_CONTENTS_DIR and JRE_MACOSX_CONTENTS_DIR are defined in SPEC.
381573Srgrimes
39109155Stjr  MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
401573Srgrimes
41109155Stjr  BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(VERSION_SHORT)
42109155Stjr  BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_SHORT)
431573Srgrimes  BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_STRING)
44178778Sjhb  BUNDLE_PLATFORM_VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
45178778Sjhb  BUNDLE_VERSION := $(VERSION_NUMBER)
46127100Stjr  ifeq ($(COMPANY_NAME), N/A)
4716586Sjraynard    BUNDLE_VENDOR := UNDEFINED
4872373Sdeischen  else
491573Srgrimes    BUNDLE_VENDOR := $(COMPANY_NAME)
50109155Stjr  endif
51109155Stjr
52109155Stjr  JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
53109155Stjr  JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
54109155Stjr
55109155Stjr  JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_MACOSX_CONTENTS_DIR)/Home/,$(JDK_FILE_LIST))
56109155Stjr  JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_MACOSX_CONTENTS_DIR)/Home/,$(JRE_FILE_LIST))
571573Srgrimes
58178721Sjhb  # Copy empty directories (jre/lib/applet).
59178721Sjhb  $(JDK_MACOSX_CONTENTS_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
60178721Sjhb	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
61178721Sjhb	$(MKDIR) -p $(@D)
62178721Sjhb	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
63178721Sjhb
64178721Sjhb  $(JRE_MACOSX_CONTENTS_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
65	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
66	$(MKDIR) -p $(@D)
67	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
68
69  $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
70	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
71	$(MKDIR) -p $(@D)
72	$(RM) $@
73	$(LN) -s ../Home/lib/jli/libjli.dylib $@
74
75  $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
76	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
77	$(MKDIR) -p $(@D)
78	$(RM) $@
79	$(LN) -s ../Home/lib/jli/libjli.dylib $@
80
81  $(eval $(call SetupTextFileProcessing, BUILD_JDK_PLIST, \
82      SOURCE_FILES := $(MACOSX_PLIST_SRC)/JDK-Info.plist, \
83      OUTPUT_FILE := $(JDK_MACOSX_CONTENTS_DIR)/Info.plist, \
84      REPLACEMENTS := \
85          @@ID@@ => $(BUNDLE_ID).jdk ; \
86          @@NAME@@ => $(BUNDLE_NAME) ; \
87          @@INFO@@ => $(BUNDLE_INFO) ; \
88          @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
89          @@VERSION@@ => $(BUNDLE_VERSION) ; \
90          @@VENDOR@@ => $(BUNDLE_VENDOR) , \
91  ))
92
93  $(eval $(call SetupTextFileProcessing, BUILD_JRE_PLIST, \
94      SOURCE_FILES := $(MACOSX_PLIST_SRC)/JRE-Info.plist, \
95      OUTPUT_FILE := $(JRE_MACOSX_CONTENTS_DIR)/Info.plist, \
96      REPLACEMENTS := \
97          @@ID@@ => $(BUNDLE_ID).jre ; \
98          @@NAME@@ => $(BUNDLE_NAME) ; \
99          @@INFO@@ => $(BUNDLE_INFO) ; \
100          @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
101          @@VERSION@@ => $(BUNDLE_VERSION) ; \
102          @@VENDOR@@ => $(BUNDLE_VENDOR) , \
103  ))
104
105  jdk-bundle: $(JDK_TARGET_LIST) $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
106      $(BUILD_JDK_PLIST)
107	$(SETFILE) -a B $(dir $(JDK_MACOSX_CONTENTS_DIR))
108
109  jre-bundle: $(JRE_TARGET_LIST) $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
110      $(BUILD_JRE_PLIST)
111	$(SETFILE) -a B $(dir $(JRE_MACOSX_CONTENTS_DIR))
112
113else # Not macosx
114
115  bundles:
116	$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
117
118endif # macosx
119
120.PHONY: jdk-bundle jre-bundle bundles
121