1 # 2 # Copyright (c) 2014, 2017, 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 26 include CopyCommon.gmk 27 include Modules.gmk 28 include TextFileProcessing.gmk 29 30 $(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk)) 31 32 ################################################################################ 33 34 ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),) 35 36 TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf 37 38 $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings 39 $(call install-file) 40 41 TARGETS += $(LIB_DST_DIR)/tzmappings 42 43 endif 44 45 ################################################################################ 46 # Copy the microsoft runtime libraries on windows 47 ifeq ($(OPENJDK_TARGET_OS), windows) 48 49 # Chmod to avoid permission issues if bundles are unpacked on unix platforms. 50 define copy-and-chmod 51 $(install-file) 52 $(CHMOD) a+rx $@ 53 endef 54 55 # Use separate macro calls in case the source files are not in the same 56 # directory. 57 $(eval $(call SetupCopyFiles,COPY_MSVCR, \ 58 DEST := $(LIB_DST_DIR), \ 59 FILES := $(MSVCR_DLL), \ 60 MACRO := copy-and-chmod)) 61 62 $(eval $(call SetupCopyFiles,COPY_MSVCP, \ 63 DEST := $(LIB_DST_DIR), \ 64 FILES := $(MSVCP_DLL), \ 65 MACRO := copy-and-chmod)) 66 67 TARGETS += $(COPY_MSVCR) $(COPY_MSVCP) 68 69 ifneq ($(UCRT_DLL_DIR), ) 70 $(eval $(call SetupCopyFiles, COPY_UCRT_DLLS, \ 71 DEST := $(LIB_DST_DIR), \ 72 SRC := $(UCRT_DLL_DIR), \ 73 FILES := $(wildcard $(UCRT_DLL_DIR)/*.dll), \ 74 MACRO := copy-and-chmod, \ 75 )) 76 77 TARGETS += $(COPY_UCRT_DLLS) 78 endif 79 endif 80 81 ################################################################################ 82 # In jvm.cfg, the first listed KNOWN variant is the default. On most build 83 # configurations, that is the server variant. 84 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), windows-x86) 85 DEFAULT_CFG_VARIANT ?= client 86 endif 87 DEFAULT_CFG_VARIANT ?= server 88 89 # Any variant other than the valid multiple jvm variants is represented as 90 # server in the cfg file. 91 CFG_VARIANTS := $(filter $(VALID_MULTIPLE_JVM_VARIANTS), $(JVM_VARIANTS)) \ 92 $(if $(filter-out $(VALID_MULTIPLE_JVM_VARIANTS), $(JVM_VARIANTS)), server) 93 94 # Change the order to put the default variant first if present. 95 ORDERED_CFG_VARIANTS := \ 96 $(if $(filter $(DEFAULT_CFG_VARIANT), $(CFG_VARIANTS)), $(DEFAULT_CFG_VARIANT)) \ 97 $(filter-out $(DEFAULT_CFG_VARIANT), $(CFG_VARIANTS)) 98 99 JVMCFG := $(LIB_DST_DIR)/jvm.cfg 100 101 define print-cfg-line 102 $(call LogInfo, Adding -$1 $2 to jvm.cfg) 103 $(PRINTF) -- "-$1 $2\n" >> $@ $(NEWLINE) 104 endef 105 106 $(JVMCFG): $(call DependOnVariable, ORDERED_CFG_VARIANTS) 107 $(call MakeTargetDir) 108 $(RM) $@ 109 $(foreach v, $(ORDERED_CFG_VARIANTS), \ 110 $(call print-cfg-line,$v,KNOWN) \ 111 ) 112 # If either of server or client aren't present, add IGNORE lines for 113 # them. 114 $(foreach v, server client, \ 115 $(if $(filter $v, $(ORDERED_CFG_VARIANTS)), , \ 116 $(call print-cfg-line,$v,IGNORE) \ 117 ) \ 118 ) 119 120 TARGETS += $(JVMCFG) 121 122 ################################################################################ 123 124 POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy 125 POLICY_DST := $(CONF_DST_DIR)/security/java.policy 126 127 POLICY_SRC_LIST := $(POLICY_SRC) 128 129 $(POLICY_DST): $(POLICY_SRC_LIST) 130 $(MKDIR) -p $(@D) 131 $(RM) $@ $@.tmp 132 $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) 133 $(MV) $@.tmp $@ 134 135 TARGETS += $(POLICY_DST) 136 137 ################################################################################ 138 139 DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy 140 DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy 141 142 DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC) 143 DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST) 144 145 ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), ) 146 DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy 147 endif 148 149 # Allow imported modules to modify the java.policy 150 ifneq ($(IMPORT_MODULES_CONF), ) 151 DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra) 152 endif 153 154 $(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST) 155 $(MKDIR) -p $(@D) 156 $(RM) $@ $@.tmp 157 $(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) 158 $(MV) $@.tmp $@ 159 160 TARGETS += $(DEF_POLICY_DST) 161 162 ################################################################################ 163 164 ifeq ($(CACERTS_FILE), ) 165 CACERTS_FILE := $(TOPDIR)/src/java.base/share/lib/security/cacerts 166 endif 167 168 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts 169 170 $(CACERTS_DST): $(CACERTS_FILE) 171 $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@)) 172 $(call install-file) 173 174 TARGETS += $(CACERTS_DST) 175 176 ################################################################################ 177 178 $(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \ 179 FILES := $(TOPDIR)/src/java.base/share/conf/net.properties, \ 180 DEST := $(CONF_DST_DIR), \ 181 )) 182 183 TARGETS += $(COPY_NET_PROPERTIES) 184 185 ifeq ($(OPENJDK_TARGET_OS), solaris) 186 $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \ 187 FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \ 188 DEST := $(CONF_DST_DIR)/sdp, \ 189 )) 190 191 TARGETS += $(COPY_SDP_CONF) 192 endif 193 194 ################################################################################ 195 196 # JDK license and assembly exception files to be packaged in JMOD 197 198 # The license files may not be present if the source has been obtained using a 199 # different license. 200 JDK_LICENSE ?= $(wildcard $(TOPDIR)/LICENSE) 201 JDK_NOTICE ?= $(wildcard $(TOPDIR)/ASSEMBLY_EXCEPTION) 202 JDK_ADDITIONAL_LICENSE_INFO ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO) 203 204 $(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \ 205 FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \ 206 DEST := $(COMMON_LEGAL_DST_DIR), \ 207 FLATTEN := true, \ 208 )) 209 210 TARGETS += $(COPY_JDK_NOTICES) 211 212 ################################################################################ 213 # 214 # Copy and filter the legal files depending on what 3rd party components are 215 # bundled or linked from the OS. 216 # 217 ifeq ($(USE_EXTERNAL_LIBZ), true) 218 LEGAL_EXCLUDES += zlib.md 219 endif 220 221 $(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \ 222 EXCLUDES := $(LEGAL_EXCLUDES), \ 223 )) 224 225 TARGETS += $(COPY_LEGAL) 226 227 ################################################################################ 228 # Optionally copy libffi.so.? into the the image 229 230 ifeq ($(ENABLE_LIBFFI_BUNDLING), true) 231 $(eval $(call SetupCopyFiles, COPY_LIBFFI, \ 232 FILES := $(LIBFFI_LIB_FILE), \ 233 DEST := $(call FindLibDirForModule, $(MODULE)), \ 234 FLATTEN := true, \ 235 MACRO := install-file-nolink, \ 236 )) 237 238 TARGETS += $(COPY_LIBFFI) 239 endif 240 241 ################################################################################ 242 # Generate classfile_constants.h 243 244 $(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \ 245 SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \ 246 OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \ 247 REPLACEMENTS := \ 248 @@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \ 249 @@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \ 250 )) 251 252 TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H) 253 254 ################################################################################