MacBundles.gmk revision 1551:908ccef3834c
1#
2# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.  Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26include $(SPEC)
27include MakeBase.gmk
28include TextFileProcessing.gmk
29
30default: bundles
31
32# Only macosx has bundles defined.
33ifeq ($(OPENJDK_TARGET_OS), macosx)
34
35  bundles: jre-bundle jdk-bundle
36
37  # JDK_MACOSX_BUNDLE_DIR and JRE_MACOSX_BUNDLE_DIR are defined in SPEC.
38
39  MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
40
41    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
42  BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
43    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
44  BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
45  BUNDLE_VERSION := $(JDK_VERSION)
46  ifeq ($(COMPANY_NAME), N/A)
47    BUNDLE_VENDOR := UNDEFINED
48  else
49    BUNDLE_VENDOR := $(COMPANY_NAME)
50  endif
51
52  JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
53  JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
54
55  JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_MACOSX_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
56  JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_MACOSX_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
57
58  # Copy empty directories (jre/lib/applet).
59  $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
60	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
61	$(MKDIR) -p $(@D)
62	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
63
64  $(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
65	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
66	$(MKDIR) -p $(@D)
67	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
68
69  $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
70	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
71	$(MKDIR) -p $(@D)
72	$(RM) $@
73	$(LN) -s ../Home/lib/jli/libjli.dylib $@
74
75  $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
76	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
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_BUNDLE_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_BUNDLE_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_BUNDLE_DIR)/MacOS/libjli.dylib \
106      $(BUILD_JDK_PLIST)
107	$(SETFILE) -a B $(dir $(JDK_MACOSX_BUNDLE_DIR))
108
109  jre-bundle: $(JRE_TARGET_LIST) $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib \
110      $(BUILD_JRE_PLIST)
111	$(SETFILE) -a B $(dir $(JRE_MACOSX_BUNDLE_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