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 28 $(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk)) 29 30 ################################################################################ 31 32 ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),) 33 34 TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf 35 36 $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings 37 $(call install-file) 38 39 TARGETS += $(LIB_DST_DIR)/tzmappings 40 41 endif 42 43 ################################################################################ 44 # Copy the microsoft runtime libraries on windows 45 ifeq ($(OPENJDK_TARGET_OS), windows) 46 47 # Chmod to avoid permission issues if bundles are unpacked on unix platforms. 48 define copy-and-chmod 49 $(install-file) 50 $(CHMOD) a+rx $@ 51 endef 52 53 # Use separate macro calls in case the source files are not in the same 54 # directory. 55 $(eval $(call SetupCopyFiles,COPY_MSVCR, \ 56 DEST := $(LIB_DST_DIR), \ 57 FILES := $(MSVCR_DLL), \ 58 MACRO := copy-and-chmod)) 59 60 $(eval $(call SetupCopyFiles,COPY_MSVCP, \ 61 DEST := $(LIB_DST_DIR), \ 62 FILES := $(MSVCP_DLL), \ 63 MACRO := copy-and-chmod)) 64 65 TARGETS += $(COPY_MSVCR) $(COPY_MSVCP) 66 endif 67 68 ################################################################################ 69 # 70 # How to install jvm.cfg. 71 # 72 ifeq ($(call check-jvm-variant, zero), true) 73 JVMCFG_ARCH := zero 74 else 75 JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY) 76 endif 77 78 ifeq ($(OPENJDK_TARGET_OS), macosx) 79 JVMCFG_SRC := $(TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg 80 else 81 JVMCFG_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg 82 # Allow override by ALT_JVMCFG_SRC if it exists 83 JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC)) 84 endif 85 JVMCFG := $(LIB_DST_DIR)/jvm.cfg 86 87 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64) 88 COPY_JVM_CFG_FILE := true 89 else 90 # On 32-bit machines we have three potential VMs: client, server and minimal. 91 # Historically we usually have both client and server and so that is what the 92 # committed jvm.cfg expects (including platform specific ergonomics switches 93 # to decide whether to use client or server by default). So when we have anything 94 # other than client and server we need to define a new jvm.cfg file. 95 # The main problem is deciding whether to use aliases for the VMs that are not 96 # present and the current position is that we add aliases for client and server, but 97 # not for minimal. 98 CLIENT_AND_SERVER := $(call check-jvm-variant, client)+$(call check-jvm-variant, server) 99 ifeq ($(CLIENT_AND_SERVER), true+true) 100 COPY_JVM_CFG_FILE := true 101 else 102 # For zero, the default jvm.cfg file is sufficient 103 ifeq ($(call check-jvm-variant, zero), true) 104 COPY_JVM_CFG_FILE := true 105 endif 106 endif 107 endif 108 109 ifeq ($(COPY_JVM_CFG_FILE), true) 110 $(JVMCFG): $(JVMCFG_SRC) 111 $(call install-file) 112 else 113 $(JVMCFG): 114 $(MKDIR) -p $(@D) 115 $(RM) $(@) 116 # Now check for other permutations 117 ifeq ($(call check-jvm-variant, server), true) 118 $(PRINTF) "-server KNOWN\n">>$(@) 119 $(PRINTF) "-client ALIASED_TO -server\n">>$(@) 120 ifeq ($(call check-jvm-variant, minimal), true) 121 $(PRINTF) "-minimal KNOWN\n">>$(@) 122 endif 123 else 124 ifeq ($(call check-jvm-variant, client), true) 125 $(PRINTF) "-client KNOWN\n">>$(@) 126 $(PRINTF) "-server ALIASED_TO -client\n">>$(@) 127 ifeq ($(call check-jvm-variant, minimal), true) 128 $(PRINTF) "-minimal KNOWN\n">>$(@) 129 endif 130 else 131 ifeq ($(call check-jvm-variant, minimal), true) 132 $(PRINTF) "-minimal KNOWN\n">>$(@) 133 $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@) 134 $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@) 135 endif 136 endif 137 endif 138 endif 139 140 TARGETS += $(JVMCFG) 141 142 ################################################################################ 143 144 POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy 145 POLICY_DST := $(CONF_DST_DIR)/security/java.policy 146 147 POLICY_SRC_LIST := $(POLICY_SRC) 148 149 $(POLICY_DST): $(POLICY_SRC_LIST) 150 $(MKDIR) -p $(@D) 151 $(RM) $@ $@.tmp 152 $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) 153 $(MV) $@.tmp $@ 154 155 TARGETS += $(POLICY_DST) 156 157 ################################################################################ 158 159 DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy 160 DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy 161 162 DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC) 163 DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST) 164 165 ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), ) 166 DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy 167 endif 168 169 # Allow imported modules to modify the java.policy 170 ifneq ($(IMPORT_MODULES_CONF), ) 171 DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra) 172 endif 173 174 $(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST) 175 $(MKDIR) -p $(@D) 176 $(RM) $@ $@.tmp 177 $(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) 178 $(MV) $@.tmp $@ 179 180 TARGETS += $(DEF_POLICY_DST) 181 182 ################################################################################ 183 184 ifeq ($(CACERTS_FILE), ) 185 CACERTS_FILE := $(TOPDIR)/src/java.base/share/lib/security/cacerts 186 endif 187 188 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts 189 190 $(CACERTS_DST): $(CACERTS_FILE) 191 $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@)) 192 $(call install-file) 193 194 TARGETS += $(CACERTS_DST) 195 196 ################################################################################ 197 198 $(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \ 199 FILES := $(TOPDIR)/src/java.base/share/conf/net.properties, \ 200 DEST := $(CONF_DST_DIR), \ 201 )) 202 203 TARGETS += $(COPY_NET_PROPERTIES) 204 205 ifeq ($(OPENJDK_TARGET_OS), solaris) 206 $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \ 207 FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \ 208 DEST := $(CONF_DST_DIR)/sdp, \ 209 )) 210 211 TARGETS += $(COPY_SDP_CONF) 212 endif 213 214 ################################################################################ 215 216 # JDK license and assembly exception files to be packaged in JMOD 217 218 # The license files may not be present if the source has been obtained using a 219 # different license. 220 JDK_LICENSE ?= $(wildcard $(TOPDIR)/LICENSE) 221 JDK_NOTICE ?= $(wildcard $(TOPDIR)/ASSEMBLY_EXCEPTION) 222 223 $(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \ 224 FILES := $(JDK_LICENSE) $(JDK_NOTICE), \ 225 DEST := $(LEGAL_DST_DIR), \ 226 FLATTEN := true, \ 227 )) 228 229 TARGETS += $(COPY_JDK_NOTICES) 230 231 ################################################################################ 232 # Optionally copy libffi.so.? into the the image 233 234 ifeq ($(ENABLE_LIBFFI_BUNDLING), true) 235 $(eval $(call SetupCopyFiles, COPY_LIBFFI, \ 236 FILES := $(LIBFFI_LIB_FILE), \ 237 DEST := $(call FindLibDirForModule, $(MODULE)), \ 238 FLATTEN := true, \ 239 MACRO := install-file-nolink, \ 240 )) 241 242 TARGETS += $(COPY_LIBFFI) 243 endif 244 245 ################################################################################