1 #
   2 # Copyright (c) 2014, 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, jdk, copy/Copy-java.base.gmk))
  29 
  30 ################################################################################
  31 #
  32 # Copy exported header files to outputdir.
  33 #
  34 TARGETS += \
  35     $(INCLUDE_DST_DIR)/jni.h \
  36     $(INCLUDE_DST_DIR)/jvmti.h \
  37     $(INCLUDE_DST_DIR)/jvmticmlr.h \
  38     $(INCLUDE_DST_DIR)/classfile_constants.h \
  39     $(INCLUDE_DST_OS_DIR)/jni_md.h \
  40     #
  41 
  42 $(INCLUDE_DST_DIR)/%.h: $(JDK_TOPDIR)/src/java.base/share/native/include/%.h
  43         $(call install-file)
  44 
  45 $(INCLUDE_DST_OS_DIR)/%.h: \
  46     $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include/%.h
  47         $(call install-file)
  48 
  49 ################################################################################
  50 
  51 ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
  52 
  53   TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
  54 
  55   $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
  56         $(call install-file)
  57 
  58   TARGETS += $(LIB_DST_DIR)/tzmappings
  59 
  60 endif
  61 
  62 ################################################################################
  63 # Copy the microsoft runtime libraries on windows
  64 ifeq ($(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)
  85 endif
  86 
  87 ################################################################################
  88 #
  89 # How to install jvm.cfg.
  90 #
  91 ifeq ($(JVM_VARIANT_ZERO), true)
  92   JVMCFG_ARCH := zero
  93 else
  94   JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
  95 endif
  96 
  97 ifeq ($(OPENJDK_TARGET_OS), macosx)
  98   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
  99 else
 100   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
 101 endif
 102 JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
 103 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
 104 
 105 # To do: should this also support -zeroshark?
 106 
 107 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 108   COPY_JVM_CFG_FILE := true
 109 else
 110   # On 32-bit machines we have three potential VMs: client, server and minimal.
 111   # Historically we usually have both client and server and so that is what the
 112   # committed jvm.cfg expects (including platform specific ergonomics switches
 113   # to decide whether to use client or server by default). So when we have anything
 114   # other than client and server we need to define a new jvm.cfg file.
 115   # The main problem is deciding whether to use aliases for the VMs that are not
 116   # present and the current position is that we add aliases for client and server, but
 117   # not for minimal.
 118   CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
 119   ifeq ($(CLIENT_AND_SERVER), true)
 120     COPY_JVM_CFG_FILE := true
 121   else
 122     # For zero, the default jvm.cfg file is sufficient
 123     ifeq ($(JVM_VARIANT_ZERO), true)
 124       COPY_JVM_CFG_FILE := true
 125     endif
 126   endif
 127 endif
 128 
 129 ifeq ($(COPY_JVM_CFG_FILE), true)
 130   $(JVMCFG): $(JVMCFG_SRC)
 131         $(call install-file)
 132 else
 133   $(JVMCFG):
 134         $(MKDIR) -p $(@D)
 135         $(RM) $(@)
 136         # Now check for other permutations
 137         ifeq ($(JVM_VARIANT_SERVER), true)
 138           $(PRINTF) "-server KNOWN\n">>$(@)
 139           $(PRINTF) "-client ALIASED_TO -server\n">>$(@)
 140           ifeq ($(JVM_VARIANT_MINIMAL1), true)
 141             $(PRINTF) "-minimal KNOWN\n">>$(@)
 142           endif
 143         else
 144           ifeq ($(JVM_VARIANT_CLIENT), true)
 145             $(PRINTF) "-client KNOWN\n">>$(@)
 146             $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
 147             ifeq ($(JVM_VARIANT_MINIMAL1), true)
 148               $(PRINTF) "-minimal KNOWN\n">>$(@)
 149             endif
 150           else
 151             ifeq ($(JVM_VARIANT_MINIMAL1), true)
 152               $(PRINTF) "-minimal KNOWN\n">>$(@)
 153               $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
 154               $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
 155             endif
 156           endif
 157         endif
 158 endif
 159 
 160 TARGETS += $(JVMCFG)
 161 
 162 ################################################################################
 163 
 164 POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
 165 POLICY_DST := $(CONF_DST_DIR)/security/java.policy
 166 
 167 POLICY_SRC_LIST :=
 168 
 169 ifeq ($(OPENJDK_TARGET_OS), windows)
 170   POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
 171   ifndef OPENJDK
 172     POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
 173   endif
 174 endif
 175 
 176 POLICY_SRC_LIST += $(POLICY_SRC)
 177 
 178 $(POLICY_DST): $(POLICY_SRC_LIST)
 179         $(MKDIR) -p $(@D)
 180         $(RM) $@ $@.tmp
 181         $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
 182         $(MV) $@.tmp $@
 183 
 184 TARGETS += $(POLICY_DST)
 185 
 186 ################################################################################
 187 
 188 ifeq ($(CACERTS_FILE), )
 189   CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
 190 endif
 191 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
 192 
 193 $(CACERTS_DST): $(CACERTS_FILE)
 194         $(call install-file)
 195 
 196 TARGETS += $(CACERTS_DST)
 197 
 198 ################################################################################
 199 
 200 $(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
 201         $(ECHO) $(LOG_INFO) Copying $(@F)
 202         $(call install-file)
 203 
 204 TARGETS += $(CONF_DST_DIR)/net.properties
 205 
 206 ifeq ($(OPENJDK_TARGET_OS), solaris)
 207   $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template
 208         $(ECHO) $(LOG_INFO) Copying $(@F)
 209         $(call install-file)
 210 
 211   TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
 212 endif
 213 
 214 ################################################################################