blob: 15538f0a11a783380ee865a8af23f899f389fa43 [file] [log] [blame]
ohairb71409c2012-10-26 14:23:29 -07001#
lanaf3d11f62013-12-26 12:04:16 -08002# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
ohairb71409c2012-10-26 14:23:29 -07003# 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
28
29default: bundles
30
31# Only macosx has bundles defined.
32ifeq ($(OPENJDK_TARGET_OS), macosx)
33
ihsea29e6222013-10-10 15:06:21 +020034 bundles: jre-bundle jdk-bundle
ohairb71409c2012-10-26 14:23:29 -070035
ihsea29e6222013-10-10 15:06:21 +020036 # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
ohairb71409c2012-10-26 14:23:29 -070037
ihsea29e6222013-10-10 15:06:21 +020038 MACOSX_SRC := $(JDK_TOPDIR)/src/macosx
ohairb71409c2012-10-26 14:23:29 -070039
ihsea29e6222013-10-10 15:06:21 +020040 # All these OPENJDK checks are needed since there is no coherency between
41 # these values in open and closed. Should probably be fixed.
42 ifndef OPENJDK
ohairb71409c2012-10-26 14:23:29 -070043 BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
ihsea29e6222013-10-10 15:06:21 +020044 else
ohairb71409c2012-10-26 14:23:29 -070045 BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
ihsea29e6222013-10-10 15:06:21 +020046 endif
47 BUNDLE_ID_JRE := $(BUNDLE_ID).jre
48 BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
ohairb71409c2012-10-26 14:23:29 -070049
ihsea29e6222013-10-10 15:06:21 +020050 BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
51 BUNDLE_NAME_JRE := $(BUNDLE_NAME)
52 BUNDLE_NAME_JDK := $(BUNDLE_NAME)
ohairb71409c2012-10-26 14:23:29 -070053
ihsea29e6222013-10-10 15:06:21 +020054 ifndef OPENJDK
ohairb71409c2012-10-26 14:23:29 -070055 BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
ihsea29e6222013-10-10 15:06:21 +020056 else
ohairb71409c2012-10-26 14:23:29 -070057 BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
ihsea29e6222013-10-10 15:06:21 +020058 endif
59 BUNDLE_INFO_JRE := $(BUNDLE_INFO)
60 BUNDLE_INFO_JDK := $(BUNDLE_INFO)
ohairb71409c2012-10-26 14:23:29 -070061
ihsea29e6222013-10-10 15:06:21 +020062 BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
63 BUNDLE_VERSION := $(JDK_VERSION)
64 ifeq ($(COMPANY_NAME), N/A)
ohairb71409c2012-10-26 14:23:29 -070065 BUNDLE_VENDOR := UNDEFINED
ihsea29e6222013-10-10 15:06:21 +020066 else
ohairb71409c2012-10-26 14:23:29 -070067 BUNDLE_VENDOR := $(COMPANY_NAME)
ihsea29e6222013-10-10 15:06:21 +020068 endif
ohairb71409c2012-10-26 14:23:29 -070069
70
ihsea29e6222013-10-10 15:06:21 +020071 JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
72 JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
ohairb71409c2012-10-26 14:23:29 -070073
ihsea29e6222013-10-10 15:06:21 +020074 JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
75 JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
ohairb71409c2012-10-26 14:23:29 -070076
ihsea29e6222013-10-10 15:06:21 +020077 # The old builds implementation of this did not preserve symlinks so
78 # make sure they are followed and the contents copied instead.
79 # To fix this, remove -L
80 # Copy empty directories (jre/lib/applet).
81 $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
ohairb71409c2012-10-26 14:23:29 -070082 $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
83 $(MKDIR) -p $(@D)
erikj23011b72013-01-18 16:44:07 +010084 if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -L '$<' '$@'; fi
ohairb71409c2012-10-26 14:23:29 -070085
ihsea29e6222013-10-10 15:06:21 +020086 $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
ohairb71409c2012-10-26 14:23:29 -070087 $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
88 $(MKDIR) -p $(@D)
erikj23011b72013-01-18 16:44:07 +010089 if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -L '$<' '$@'; fi
ohairb71409c2012-10-26 14:23:29 -070090
ihsea29e6222013-10-10 15:06:21 +020091 $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
ohairb71409c2012-10-26 14:23:29 -070092 $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
93 $(MKDIR) -p $(@D)
94 $(RM) $@
erikjf945a2b2013-01-09 16:13:29 +010095 $(LN) -s ../Home/jre/lib/jli/libjli.dylib $@
ohairb71409c2012-10-26 14:23:29 -070096
ihsea29e6222013-10-10 15:06:21 +020097 $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
ohairb71409c2012-10-26 14:23:29 -070098 $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
99 $(MKDIR) -p $(@D)
100 $(RM) $@
101 $(LN) -s ../Home/lib/jli/libjli.dylib $@
102
ihsea29e6222013-10-10 15:06:21 +0200103 $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
ohairb71409c2012-10-26 14:23:29 -0700104 $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
105 $(MKDIR) -p $(@D)
ihsea29e6222013-10-10 15:06:21 +0200106 $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
107 -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
108 -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
109 -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
110 -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
111 -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
112 < $(MACOSX_SRC)/bundle/JDK-Info.plist > $@
ohairb71409c2012-10-26 14:23:29 -0700113
ihsea29e6222013-10-10 15:06:21 +0200114 $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
ohairb71409c2012-10-26 14:23:29 -0700115 $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
116 $(MKDIR) -p $(@D)
ihsea29e6222013-10-10 15:06:21 +0200117 $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
118 -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
119 -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
120 -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
121 -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
122 -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
123 < $(MACOSX_SRC)/bundle/JRE-Info.plist > $@
ohairb71409c2012-10-26 14:23:29 -0700124
ihsea29e6222013-10-10 15:06:21 +0200125 jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
126 $(JDK_BUNDLE_DIR)/Info.plist
ohairb71409c2012-10-26 14:23:29 -0700127 $(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
128
ihsea29e6222013-10-10 15:06:21 +0200129 jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
130 $(JRE_BUNDLE_DIR)/Info.plist
ohairb71409c2012-10-26 14:23:29 -0700131 $(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
132
133else # Not macosx
134
ihsea29e6222013-10-10 15:06:21 +0200135 bundles:
ohairb71409c2012-10-26 14:23:29 -0700136 $(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
137
138endif # macosx
139
140.PHONY: jdk-bundle jre-bundle bundles