jdk

Форк
0
291 строка · 9.5 Кб
1
#
2
# Copyright (c) 2014, 2022, 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
# Hook to include the corresponding custom file, if present.
31
$(eval $(call IncludeCustomExtension, modules/java.base/Copy.gmk))
32

33
################################################################################
34

35
ifeq ($(call isTargetOs, aix), true)
36

37
  TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
38

39
  $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
40
	$(call install-file)
41

42
  TARGETS += $(LIB_DST_DIR)/tzmappings
43

44
endif
45

46
################################################################################
47
# Copy the microsoft runtime libraries on windows, but only if we are not
48
# creating a buildjdk. If we are, the provided runtime librareis are made for
49
# the target platform, not the build platform (and we should not need to bundle
50
# anything with the minimalistic, locally-only buildjdk.)
51
ifeq ($(call isTargetOs, windows)+$(CREATING_BUILDJDK), true+false)
52

53
  # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
54
  define copy-and-chmod
55
	$(install-file)
56
	$(CHMOD) a+rx $@
57
  endef
58

59
  # Use separate macro calls in case the source files are not in the same
60
  # directory.
61
  $(eval $(call SetupCopyFiles,COPY_MSVCR, \
62
      DEST := $(LIB_DST_DIR), \
63
      FILES := $(MSVCR_DLL), \
64
      MACRO := copy-and-chmod))
65

66
  $(eval $(call SetupCopyFiles,COPY_VCRUNTIME_1, \
67
      DEST := $(LIB_DST_DIR), \
68
      FILES := $(VCRUNTIME_1_DLL), \
69
      MACRO := copy-and-chmod))
70

71
  $(eval $(call SetupCopyFiles,COPY_MSVCP, \
72
      DEST := $(LIB_DST_DIR), \
73
      FILES := $(MSVCP_DLL), \
74
      MACRO := copy-and-chmod))
75

76
  TARGETS += $(COPY_MSVCR) $(COPY_VCRUNTIME_1) $(COPY_MSVCP)
77

78
  ifneq ($(UCRT_DLL_DIR), )
79
    $(eval $(call SetupCopyFiles, COPY_UCRT_DLLS, \
80
        DEST := $(LIB_DST_DIR), \
81
        SRC := $(UCRT_DLL_DIR), \
82
        FILES := $(wildcard $(UCRT_DLL_DIR)/*.dll), \
83
        MACRO := copy-and-chmod, \
84
    ))
85

86
    TARGETS += $(COPY_UCRT_DLLS)
87
  endif
88
endif
89

90
################################################################################
91
# In jvm.cfg, the first listed KNOWN variant is the default. On most build
92
# configurations, that is the server variant.
93
ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86)), true)
94
  DEFAULT_CFG_VARIANT ?= client
95
endif
96
DEFAULT_CFG_VARIANT ?= server
97

98
# Change the order to put the default variant first if present.
99
ORDERED_CFG_VARIANTS := \
100
    $(if $(filter $(DEFAULT_CFG_VARIANT), $(JVM_VARIANTS)), $(DEFAULT_CFG_VARIANT)) \
101
    $(filter-out $(DEFAULT_CFG_VARIANT), $(JVM_VARIANTS))
102

103
JVMCFG := $(LIB_DST_DIR)/jvm.cfg
104

105
define print-cfg-line
106
	$(call LogInfo, Adding -$1 $2 to jvm.cfg)
107
	$(PRINTF) -- "-$1 $2\n" >> $@ $(NEWLINE)
108
endef
109

110
$(JVMCFG): $(call DependOnVariable, ORDERED_CFG_VARIANTS)
111
	$(call MakeTargetDir)
112
	$(RM) $@
113
	$(foreach v, $(ORDERED_CFG_VARIANTS), \
114
	  $(call print-cfg-line,$v,KNOWN) \
115
	)
116
        # If either of server or client aren't present, add IGNORE lines for
117
        # them.
118
	$(foreach v, server client, \
119
	  $(if $(filter $v, $(ORDERED_CFG_VARIANTS)), , \
120
	    $(call print-cfg-line,$v,IGNORE) \
121
	  ) \
122
	)
123

124
TARGETS += $(JVMCFG)
125

126
################################################################################
127

128
POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy
129
POLICY_DST := $(CONF_DST_DIR)/security/java.policy
130

131
POLICY_SRC_LIST := $(POLICY_SRC)
132

133
$(POLICY_DST): $(POLICY_SRC_LIST)
134
	$(call MakeTargetDir)
135
	$(RM) $@ $@.tmp
136
	$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
137
	$(MV) $@.tmp $@
138

139
TARGETS += $(POLICY_DST)
140

141
################################################################################
142

143
DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy
144
DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy
145

146
DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
147
DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST)
148

149
ifeq ($(call isTargetOs, windows), true)
150
  DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
151
endif
152

153
# Allow imported modules to modify the java.policy
154
ifneq ($(IMPORT_MODULES_CONF), )
155
  DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
156
endif
157

158
$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
159
	$(call MakeTargetDir)
160
	$(RM) $@ $@.tmp
161
	$(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
162
	$(MV) $@.tmp $@
163

164
TARGETS += $(DEF_POLICY_DST)
165

166
################################################################################
167

168
# CACERTS_FILE is optionally set in configure to override the default cacerts
169
# which is otherwise generated in Gendata-java.base.gmk
170
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
171

172
$(CACERTS_DST): $(CACERTS_FILE)
173
	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@))
174
	$(call install-file)
175

176
ifneq ($(CACERTS_FILE), )
177
  TARGETS += $(CACERTS_DST)
178
endif
179

180
################################################################################
181

182
NET_PROPERTIES_SRCS := $(TOPDIR)/src/java.base/share/conf/net.properties \
183
	$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/net.properties
184

185
NET_PROPERTIES_DST  := $(CONF_DST_DIR)/net.properties
186

187
$(NET_PROPERTIES_DST): $(NET_PROPERTIES_SRCS)
188
	$(call MakeTargetDir)
189
	$(CAT) $(NET_PROPERTIES_SRCS) > $@
190

191
TARGETS += $(NET_PROPERTIES_DST)
192

193
ifeq ($(call isTargetOs, linux), true)
194
  $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
195
      FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
196
      DEST := $(CONF_DST_DIR)/sdp, \
197
  ))
198

199
  TARGETS += $(COPY_SDP_CONF)
200
endif
201

202
################################################################################
203

204
# JDK license and assembly exception files to be packaged in JMOD
205

206
# The license files may not be present if the source has been obtained using a
207
# different license.
208
JDK_LICENSE ?= $(wildcard $(TOPDIR)/LICENSE)
209
JDK_NOTICE  ?= $(wildcard $(TOPDIR)/ASSEMBLY_EXCEPTION)
210
JDK_ADDITIONAL_LICENSE_INFO  ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO)
211

212
$(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \
213
    FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \
214
    DEST := $(COMMON_LEGAL_DST_DIR), \
215
    FLATTEN := true, \
216
))
217

218
TARGETS += $(COPY_JDK_NOTICES)
219

220
################################################################################
221
#
222
# Copy and filter the legal files depending on what 3rd party components are
223
# bundled or linked from the OS.
224
#
225
ifeq ($(USE_EXTERNAL_LIBZ), true)
226
  LEGAL_EXCLUDES += zlib.md
227
endif
228

229
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
230
    EXCLUDES := $(LEGAL_EXCLUDES), \
231
))
232

233
TARGETS += $(COPY_LEGAL)
234

235
################################################################################
236
# Optionally copy libffi.so.? into the image
237

238
ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
239
  $(eval $(call SetupCopyFiles, COPY_LIBFFI, \
240
      FILES := $(LIBFFI_LIB_FILE), \
241
      DEST := $(call FindLibDirForModule, $(MODULE)), \
242
      FLATTEN := true, \
243
      MACRO := install-file-nolink, \
244
  ))
245

246
  TARGETS += $(COPY_LIBFFI)
247
endif
248

249
################################################################################
250
# Copy tzmappings file for Windows
251

252
ifeq ($(call isTargetOs, windows), true)
253
  $(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \
254
      FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \
255
      DEST := $(call FindLibDirForModule, $(MODULE)), \
256
  ))
257

258
  TARGETS += $(COPY_TZMAPPINGS)
259
endif
260

261
################################################################################
262
# Optionally copy hsdis into the image
263

264
ifeq ($(ENABLE_HSDIS_BUNDLING), true)
265
  HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX)
266
  HSDIS_PATH := $(SUPPORT_OUTPUTDIR)/hsdis/$(HSDIS_NAME)
267

268
  $(eval $(call SetupCopyFiles, COPY_HSDIS, \
269
      FILES := $(HSDIS_PATH), \
270
      DEST := $(call FindLibDirForModule, $(MODULE)), \
271
      FLATTEN := true, \
272
      MACRO := install-file-nolink, \
273
  ))
274

275
  TARGETS += $(COPY_HSDIS)
276
endif
277

278
################################################################################
279
# Generate classfile_constants.h
280

281
$(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \
282
    SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \
283
    OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \
284
    REPLACEMENTS := \
285
        @@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \
286
        @@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \
287
))
288

289
TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H)
290

291
################################################################################
292

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.