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 server, client or minimal is represented as server in 90 # the cfg file. 91 VALID_CFG_VARIANTS := server client minimal 92 CFG_VARIANTS := $(filter $(VALID_CFG_VARIANTS), $(JVM_VARIANTS)) \ 93 $(if $(filter-out $(VALID_CFG_VARIANTS), $(JVM_VARIANTS)), server) 94 95 # Change the order to put the default variant first if present. 96 ORDERED_CFG_VARIANTS := \ 97 $(if $(filter $(DEFAULT_CFG_VARIANT), $(CFG_VARIANTS)), $(DEFAULT_CFG_VARIANT)) \ 98 $(filter-out $(DEFAULT_CFG_VARIANT), $(CFG_VARIANTS)) 99 100 JVMCFG := $(LIB_DST_DIR)/jvm.cfg 101 102 define print-cfg-line 103 $(call LogInfo, Adding -$1 $2 to jvm.cfg) 104 $(PRINTF) -- "-$1 $2\n" >> $@ $(NEWLINE) 105 endef 106 107 $(JVMCFG): $(call DependOnVariable, ORDERED_CFG_VARIANTS) 108 $(call MakeTargetDir) 109 $(RM) $@ 110 $(foreach v, $(ORDERED_CFG_VARIANTS), \ 111 $(call print-cfg-line,$v,KNOWN) \ 112 ) 113 # If either of server or client aren't present, add IGNORE lines for 114 # them. 115 $(foreach v, server client, \ 116 $(if $(filter $v, $(ORDERED_CFG_VARIANTS)), , \ 117 $(call print-cfg-line,$v,IGNORE) \ 118 ) \ 119 ) 120 121 TARGETS += $(JVMCFG) 122 123 ################################################################################ 124 125 POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy 126 POLICY_DST := $(CONF_DST_DIR)/security/java.policy 127 128 POLICY_SRC_LIST := $(POLICY_SRC) 129 130 $(POLICY_DST): $(POLICY_SRC_LIST) 131 $(MKDIR) -p $(@D) 132 $(RM) $@ $@.tmp 133 $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) 134 $(MV) $@.tmp $@ 135 136 TARGETS += $(POLICY_DST) 137 138 ################################################################################ 139 140 DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy 141 DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy 142 143 DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC) 144 DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST) 145 146 ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), ) 147 DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy 148 endif 149 150 # Allow imported modules to modify the java.policy 151 ifneq ($(IMPORT_MODULES_CONF), ) 152 DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra) 153 endif 154 155 $(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST) 156 $(MKDIR) -p $(@D) 157 $(RM) $@ $@.tmp 158 $(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) 159 $(MV) $@.tmp $@ 160 161 TARGETS += $(DEF_POLICY_DST) 162 163 ################################################################################ 164 165 ifeq ($(CACERTS_FILE), ) 166 CACERTS_FILE := $(TOPDIR)/src/java.base/share/lib/security/cacerts 167 endif 168 169 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts 170 171 $(CACERTS_DST): $(CACERTS_FILE) 172 $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@)) 173 $(call install-file) 174 175 TARGETS += $(CACERTS_DST) 176 177 ################################################################################ 178 179 $(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \ 180 FILES := $(TOPDIR)/src/java.base/share/conf/net.properties, \ 181 DEST := $(CONF_DST_DIR), \ 182 )) 183 184 TARGETS += $(COPY_NET_PROPERTIES) 185 186 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux), ) 187 $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \ 188 FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \ 189 DEST := $(CONF_DST_DIR)/sdp, \ 190 )) 191 192 TARGETS += $(COPY_SDP_CONF) 193 endif 194 195 ################################################################################ 196 197 # JDK license and assembly exception files to be packaged in JMOD 198 199 # The license files may not be present if the source has been obtained using a 200 # different license. 201 JDK_LICENSE ?= $(wildcard $(TOPDIR)/LICENSE) 202 JDK_NOTICE ?= $(wildcard $(TOPDIR)/ASSEMBLY_EXCEPTION) 203 JDK_ADDITIONAL_LICENSE_INFO ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO) 204 205 $(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \ 206 FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \ 207 DEST := $(COMMON_LEGAL_DST_DIR), \ 208 FLATTEN := true, \ 209 )) 210 211 TARGETS += $(COPY_JDK_NOTICES) 212 213 ################################################################################ 214 # 215 # Copy and filter the legal files depending on what 3rd party components are 216 # bundled or linked from the OS. 217 # 218 ifeq ($(USE_EXTERNAL_LIBZ), true) 219 LEGAL_EXCLUDES += zlib.md 220 endif 221 222 $(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \ 223 EXCLUDES := $(LEGAL_EXCLUDES), \ 224 )) 225 226 TARGETS += $(COPY_LEGAL) 227 228 ################################################################################ 229 # Optionally copy libffi.so.? into the the image 230 231 ifeq ($(ENABLE_LIBFFI_BUNDLING), true) 232 $(eval $(call SetupCopyFiles, COPY_LIBFFI, \ 233 FILES := $(LIBFFI_LIB_FILE), \ 234 DEST := $(call FindLibDirForModule, $(MODULE)), \ 235 FLATTEN := true, \ 236 MACRO := install-file-nolink, \ 237 )) 238 239 TARGETS += $(COPY_LIBFFI) 240 endif 241 242 ################################################################################ 243 # Generate classfile_constants.h 244 245 $(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \ 246 SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \ 247 OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \ 248 REPLACEMENTS := \ 249 @@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \ 250 @@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \ 251 )) 252 253 TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H) 254 255 ################################################################################