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 msvcrXX.dll on windows
  64 
  65 ifeq ($(OPENJDK_TARGET_OS), windows)
  66   MSVCR_TARGET := $(LIB_DST_DIR)/$(notdir $(MSVCR_DLL))
  67   # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
  68   $(MSVCR_TARGET): $(MSVCR_DLL)
  69         $(call install-file)
  70         $(CHMOD) a+rx $@
  71 
  72   TARGETS += $(MSVCR_TARGET)
  73 endif
  74 
  75 ################################################################################
  76 #
  77 # How to install jvm.cfg.
  78 #
  79 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
  80   JVMCFG_ARCH := zero
  81 else
  82   JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
  83 endif
  84 
  85 ifeq ($(OPENJDK_TARGET_OS), macosx)
  86   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
  87 else
  88   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
  89 endif
  90 JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
  91 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
  92 
  93 # To do: should this also support -zeroshark?
  94 
  95 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
  96   COPY_JVM_CFG_FILE := true
  97 else
  98   # On 32-bit machines we have three potential VMs: client, server and minimal.
  99   # Historically we usually have both client and server and so that is what the
 100   # committed jvm.cfg expects (including platform specific ergonomics switches
 101   # to decide whether to use client or server by default). So when we have anything
 102   # other than client and server we need to define a new jvm.cfg file.
 103   # The main problem is deciding whether to use aliases for the VMs that are not
 104   # present and the current position is that we add aliases for client and server, but
 105   # not for minimal.
 106   CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
 107   ifeq ($(CLIENT_AND_SERVER), true)
 108     COPY_JVM_CFG_FILE := true
 109   else
 110     # For zero, the default jvm.cfg file is sufficient
 111     ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
 112       COPY_JVM_CFG_FILE := true
 113     endif
 114   endif
 115 endif
 116 
 117 ifeq ($(COPY_JVM_CFG_FILE), true)
 118   $(JVMCFG): $(JVMCFG_SRC)
 119         $(call install-file)
 120 else
 121   $(JVMCFG):
 122         $(MKDIR) -p $(@D)
 123         $(RM) $(@)
 124         # Now check for other permutations
 125         ifeq ($(JVM_VARIANT_SERVER), true)
 126           $(PRINTF) "-server KNOWN\n">>$(@)
 127           $(PRINTF) "-client ALIASED_TO -server\n">>$(@)
 128           ifeq ($(JVM_VARIANT_MINIMAL1), true)
 129             $(PRINTF) "-minimal KNOWN\n">>$(@)
 130           endif
 131         else
 132           ifeq ($(JVM_VARIANT_CLIENT), true)
 133             $(PRINTF) "-client KNOWN\n">>$(@)
 134             $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
 135             ifeq ($(JVM_VARIANT_MINIMAL1), true)
 136               $(PRINTF) "-minimal KNOWN\n">>$(@)
 137             endif
 138           else
 139             ifeq ($(JVM_VARIANT_MINIMAL1), true)
 140               $(PRINTF) "-minimal KNOWN\n">>$(@)
 141               $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
 142               $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
 143             endif
 144           endif
 145         endif
 146 endif
 147 
 148 TARGETS += $(JVMCFG)
 149 
 150 ################################################################################
 151 
 152 POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
 153 POLICY_DST := $(CONF_DST_DIR)/security/java.policy
 154 
 155 POLICY_SRC_LIST :=
 156 
 157 ifeq ($(OPENJDK_TARGET_OS), windows)
 158   POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
 159   ifndef OPENJDK
 160     POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
 161   endif
 162 endif
 163 
 164 POLICY_SRC_LIST += $(POLICY_SRC)
 165 
 166 $(POLICY_DST): $(POLICY_SRC_LIST)
 167         $(MKDIR) -p $(@D)
 168         $(RM) $@ $@.tmp
 169         $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
 170         $(MV) $@.tmp $@
 171 
 172 TARGETS += $(POLICY_DST)
 173 
 174 ################################################################################
 175 
 176 ifeq ($(CACERTS_FILE), )
 177   CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
 178 endif
 179 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
 180 
 181 $(CACERTS_DST): $(CACERTS_FILE)
 182         $(call install-file)
 183 
 184 TARGETS += $(CACERTS_DST)
 185 
 186 ################################################################################
 187 
 188 $(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
 189         $(ECHO) $(LOG_INFO) Copying $(@F)
 190         $(call install-file)
 191 
 192 TARGETS += $(CONF_DST_DIR)/net.properties
 193 
 194 ifeq ($(OPENJDK_TARGET_OS), solaris)
 195   $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template
 196         $(ECHO) $(LOG_INFO) Copying $(@F)
 197         $(call install-file)
 198 
 199   TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
 200 endif
 201 
 202 ################################################################################