Copy-java.base.gmk revision 13901:b2a69d66dc65
12428Spgovereau#
22933Sakulyakh# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
32428Spgovereau# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42428Spgovereau#
52428Spgovereau# This code is free software; you can redistribute it and/or modify it
62428Spgovereau# under the terms of the GNU General Public License version 2 only, as
72428Spgovereau# published by the Free Software Foundation.  Oracle designates this
82428Spgovereau# particular file as subject to the "Classpath" exception as provided
92428Spgovereau# by Oracle in the LICENSE file that accompanied this code.
102428Spgovereau#
112428Spgovereau# This code is distributed in the hope that it will be useful, but WITHOUT
122428Spgovereau# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
132428Spgovereau# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
142428Spgovereau# version 2 for more details (a copy is included in the LICENSE file that
152428Spgovereau# accompanied this code).
162428Spgovereau#
172428Spgovereau# You should have received a copy of the GNU General Public License version
182428Spgovereau# 2 along with this work; if not, write to the Free Software Foundation,
192428Spgovereau# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
202428Spgovereau#
212428Spgovereau# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
222428Spgovereau# or visit www.oracle.com if you need additional information or have any
232428Spgovereau# questions.
242428Spgovereau#
252428Spgovereau
262428Spgovereauinclude CopyCommon.gmk
272428Spgovereau
282942Smchung$(eval $(call IncludeCustomExtension, jdk, copy/Copy-java.base.gmk))
292428Spgovereau
302428Spgovereau################################################################################
312428Spgovereau#
322428Spgovereau# Copy exported header files to outputdir.
332428Spgovereau#
342428SpgovereauTARGETS += \
352428Spgovereau    $(INCLUDE_DST_DIR)/jni.h \
362428Spgovereau    $(INCLUDE_DST_DIR)/jvmti.h \
372428Spgovereau    $(INCLUDE_DST_DIR)/jvmticmlr.h \
382428Spgovereau    $(INCLUDE_DST_DIR)/classfile_constants.h \
392428Spgovereau    $(INCLUDE_DST_OS_DIR)/jni_md.h \
402428Spgovereau    #
412428Spgovereau
422428Spgovereau$(INCLUDE_DST_DIR)/%.h: $(JDK_TOPDIR)/src/java.base/share/native/include/%.h
432428Spgovereau	$(call install-file)
442428Spgovereau
452428Spgovereau$(INCLUDE_DST_OS_DIR)/%.h: \
462428Spgovereau    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include/%.h
472428Spgovereau	$(call install-file)
482428Spgovereau
492428Spgovereau################################################################################
502428Spgovereau
512428Spgovereauifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
522428Spgovereau
532428Spgovereau  TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
542428Spgovereau
552428Spgovereau  $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
562428Spgovereau	$(call install-file)
572428Spgovereau
582428Spgovereau  TARGETS += $(LIB_DST_DIR)/tzmappings
592428Spgovereau
602428Spgovereauendif
612428Spgovereau
622428Spgovereau################################################################################
632428Spgovereau# Copy the microsoft runtime libraries on windows
642428Spgovereauifeq ($(OPENJDK_TARGET_OS), windows)
65
66  # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
67  define copy-and-chmod
68	$(install-file)
69	$(CHMOD) a+rx $@
70  endef
71
72  # Use separate macro calls in case the source files are not in the same
73  # directory.
74  $(eval $(call SetupCopyFiles,COPY_MSVCR, \
75      DEST := $(LIB_DST_DIR), \
76      FILES := $(MSVCR_DLL), \
77      MACRO := copy-and-chmod))
78
79  $(eval $(call SetupCopyFiles,COPY_MSVCP, \
80      DEST := $(LIB_DST_DIR), \
81      FILES := $(MSVCP_DLL), \
82      MACRO := copy-and-chmod))
83
84  TARGETS += $(COPY_MSVCR) $(COPY_MSVCP)
85endif
86
87################################################################################
88#
89# How to install jvm.cfg.
90#
91ifeq ($(JVM_VARIANT_ZERO), true)
92  JVMCFG_ARCH := zero
93else
94  JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
95endif
96
97ifeq ($(OPENJDK_TARGET_OS), macosx)
98  JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
99else
100  JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
101  # Allow override by ALT_JVMCFG_SRC if it exists
102  JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC)) 
103endif
104JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
105JVMCFG := $(JVMCFG_DIR)/jvm.cfg
106
107# To do: should this also support -zeroshark?
108
109ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
110  COPY_JVM_CFG_FILE := true
111else
112  # On 32-bit machines we have three potential VMs: client, server and minimal.
113  # Historically we usually have both client and server and so that is what the
114  # committed jvm.cfg expects (including platform specific ergonomics switches
115  # to decide whether to use client or server by default). So when we have anything
116  # other than client and server we need to define a new jvm.cfg file.
117  # The main problem is deciding whether to use aliases for the VMs that are not
118  # present and the current position is that we add aliases for client and server, but
119  # not for minimal.
120  CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
121  ifeq ($(CLIENT_AND_SERVER), true)
122    COPY_JVM_CFG_FILE := true
123  else
124    # For zero, the default jvm.cfg file is sufficient
125    ifeq ($(JVM_VARIANT_ZERO), true)
126      COPY_JVM_CFG_FILE := true
127    endif
128  endif
129endif
130
131ifeq ($(COPY_JVM_CFG_FILE), true)
132  $(JVMCFG): $(JVMCFG_SRC)
133	$(call install-file)
134else
135  $(JVMCFG):
136	$(MKDIR) -p $(@D)
137	$(RM) $(@)
138        # Now check for other permutations
139        ifeq ($(JVM_VARIANT_SERVER), true)
140	  $(PRINTF) "-server KNOWN\n">>$(@)
141	  $(PRINTF) "-client ALIASED_TO -server\n">>$(@)
142          ifeq ($(JVM_VARIANT_MINIMAL1), true)
143	    $(PRINTF) "-minimal KNOWN\n">>$(@)
144          endif
145        else
146          ifeq ($(JVM_VARIANT_CLIENT), true)
147	    $(PRINTF) "-client KNOWN\n">>$(@)
148	    $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
149            ifeq ($(JVM_VARIANT_MINIMAL1), true)
150	      $(PRINTF) "-minimal KNOWN\n">>$(@)
151            endif
152          else
153            ifeq ($(JVM_VARIANT_MINIMAL1), true)
154	      $(PRINTF) "-minimal KNOWN\n">>$(@)
155	      $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
156	      $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
157            endif
158          endif
159        endif
160endif
161
162TARGETS += $(JVMCFG)
163
164################################################################################
165
166POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
167POLICY_DST := $(CONF_DST_DIR)/security/java.policy
168
169POLICY_SRC_LIST :=
170
171ifeq ($(OPENJDK_TARGET_OS), windows)
172  POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
173endif
174
175# Allow imported modules to modify the java.policy
176ifneq ($(IMPORT_MODULES_CONF), )
177  POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
178endif
179
180POLICY_SRC_LIST += $(POLICY_SRC)
181
182$(POLICY_DST): $(POLICY_SRC_LIST)
183	$(MKDIR) -p $(@D)
184	$(RM) $@ $@.tmp
185	$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
186	$(MV) $@.tmp $@
187
188TARGETS += $(POLICY_DST)
189
190################################################################################
191
192ifeq ($(CACERTS_FILE), )
193  CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
194endif
195
196CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
197
198$(CACERTS_DST): $(CACERTS_FILE)
199	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
200	$(call install-file)
201
202TARGETS += $(CACERTS_DST)
203
204################################################################################
205
206$(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \
207    FILES := $(JDK_TOPDIR)/src/java.base/share/conf/net.properties, \
208    DEST := $(CONF_DST_DIR), \
209))
210
211TARGETS += $(COPY_NET_PROPERTIES)
212
213ifeq ($(OPENJDK_TARGET_OS), solaris)
214  $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
215      FILES := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
216      DEST := $(CONF_DST_DIR)/sdp, \
217  ))
218
219  TARGETS += $(COPY_SDP_CONF)
220endif
221
222################################################################################
223