author | ihse |
Thu, 05 Nov 2015 10:54:05 +0100 | |
changeset 33523 | eb067bcd9414 |
parent 33406 | 4680f7495292 |
child 33666 | 7908508d9e1c |
child 34013 | 79c21cd6fcfc |
permissions | -rw-r--r-- |
25859 | 1 |
# |
29925
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
2 |
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
25859 | 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 NativeCompilation.gmk |
|
27 |
||
28 |
# Prepare the find cache. |
|
29 |
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher)) |
|
30 |
||
31 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
32 |
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN) |
|
33 |
else |
|
33523 | 34 |
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) |
25859 | 35 |
|
33523 | 36 |
# Applications expect to be able to link against libjawt without invoking |
37 |
# System.loadLibrary("jawt") first. This was the behaviour described in the |
|
38 |
# devloper documentation of JAWT and what worked with OpenJDK6. |
|
39 |
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) |
|
40 |
ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)) |
|
41 |
endif |
|
25859 | 42 |
endif |
43 |
||
44 |
LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher |
|
45 |
LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \ |
|
46 |
-I$(JDK_TOPDIR)/src/java.base/share/native/libjli \ |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
47 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ |
25859 | 48 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ |
49 |
# |
|
50 |
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc |
|
51 |
JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc |
|
52 |
MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher |
|
53 |
JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest |
|
54 |
||
33523 | 55 |
################################################################################ |
56 |
# Build standard launcher. |
|
25859 | 57 |
|
33523 | 58 |
# Setup make rules for building a standard launcher. |
59 |
# |
|
60 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
61 |
# and the targets generated are listed in a variable by that name. It is also |
|
62 |
# used as the name of the executable. |
|
63 |
# |
|
64 |
# Remaining parameters are named arguments. These include: |
|
65 |
# MAIN_CLASS The Java main class to launch |
|
66 |
# JAVA_ARGS Processed into a -DJAVA_ARGS C flag |
|
67 |
# APP_CLASSPATH Processed into a -DAPP_CLASSPATH C flag |
|
68 |
# CFLAGS Additional CFLAGS |
|
69 |
# CFLAGS_windows Additional CFLAGS_windows |
|
70 |
# LIBS_unix Additional LIBS_unix |
|
71 |
# LIBS_windows Additional LIBS_windows |
|
72 |
# LDFLAGS_solaris Additional LDFLAGS_solaris |
|
73 |
# RC_FLAGS Additional RC_FLAGS |
|
74 |
# MACOSX_SIGNED On macosx, sign this binary |
|
75 |
# WINDOWS_STATIC_LINK On windows, link statically with C runtime and libjli. |
|
76 |
# OPTIMIZATION Override default optimization level (LOW) |
|
77 |
# OUTPUT_DIR Override default output directory |
|
78 |
# VERSION_INFO_RESOURCE Override default Windows resource file |
|
79 |
# NO_JAVA_MS Do not add -ms8m to JAVA_ARGS. |
|
80 |
SetupBuildLauncher = $(NamedParamsMacroTemplate) |
|
81 |
define SetupBuildLauncherBody |
|
82 |
# Setup default values (unless overridden) |
|
83 |
ifeq ($$($1_VERSION_INFO_RESOURCE), ) |
|
84 |
$1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE) |
|
25859 | 85 |
endif |
86 |
||
33523 | 87 |
ifeq ($$($1_OUTPUT_DIR), ) |
88 |
$1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) |
|
89 |
endif |
|
90 |
||
91 |
ifeq ($$($1_OPTIMIZATION), ) |
|
92 |
$1_OPTIMIZATION := LOW |
|
93 |
endif |
|
94 |
||
95 |
ifneq ($$($1_NO_JAVA_MS), true) |
|
96 |
# The norm is to append -ms8m, unless otherwise instructed. |
|
97 |
$1_JAVA_ARGS += -ms8m |
|
98 |
endif |
|
99 |
||
100 |
ifneq ($$($1_JAVA_ARGS), ) |
|
101 |
$1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ |
|
102 |
$$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_MAIN_CLASS), "$$a"$(COMMA) )) }' |
|
103 |
$1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR) |
|
104 |
endif |
|
105 |
||
106 |
ifneq ($$($1_APP_CLASSPATH), ) |
|
107 |
$1_APP_CLASSPATH_STR := '{ $$(strip $$(foreach a, \ |
|
108 |
$$($1_APP_CLASSPATH), "$$a"$(COMMA) )) }' |
|
109 |
# Remove the trailing comma |
|
110 |
$1_APP_CLASSPATH_STR := $$(strip $$(subst $$(COMMA) }', }', \ |
|
111 |
$$($1_APP_CLASSPATH_STR))) |
|
112 |
$1_CFLAGS += -DAPP_CLASSPATH=$$($1_APP_CLASSPATH_STR) |
|
113 |
endif |
|
114 |
||
33406 | 115 |
$1_LIBS := |
25859 | 116 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
33523 | 117 |
ifeq ($$($1_MACOSX_SIGNED), true) |
118 |
$1_PLIST_FILE := Info-privileged.plist |
|
25859 | 119 |
$1_CODESIGN := true |
33523 | 120 |
else |
121 |
$1_PLIST_FILE := Info-cmdline.plist |
|
25859 | 122 |
endif |
123 |
||
33523 | 124 |
$1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"' |
27565 | 125 |
$1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \ |
25859 | 126 |
-sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE) |
33406 | 127 |
$1_LIBS += -framework Cocoa -framework Security \ |
128 |
-framework ApplicationServices |
|
25859 | 129 |
endif |
130 |
||
131 |
ifeq ($(OPENJDK_TARGET_OS), aix) |
|
33406 | 132 |
$1_LDFLAGS += -L$(SUPPORT_OUTPUTDIR)/native/java.base |
133 |
$1_LIBS += -ljli_static |
|
25859 | 134 |
endif |
135 |
||
136 |
ifeq ($(USE_EXTERNAL_LIBZ), true) |
|
33406 | 137 |
$1_LIBS += -lz |
25859 | 138 |
endif |
139 |
||
33523 | 140 |
ifeq ($$($1_WINDOWS_STATIC_LINK), true) |
141 |
$1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE)) |
|
142 |
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib |
|
25859 | 143 |
else |
33523 | 144 |
$1_CFLAGS += $(CFLAGS_JDKEXE) |
145 |
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib |
|
25859 | 146 |
endif |
147 |
||
148 |
# The linker on older SuSE distros (e.g. on SLES 10) complains with: |
|
149 |
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable." |
|
150 |
# if feeded with a version script which contains named tags. |
|
151 |
ifeq ($(USING_BROKEN_SUSE_LD),yes) |
|
152 |
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), ) |
|
153 |
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous |
|
154 |
else |
|
155 |
$1_MAPFILE := |
|
156 |
endif |
|
157 |
else |
|
158 |
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), ) |
|
159 |
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU) |
|
160 |
else |
|
161 |
$1_MAPFILE := |
|
162 |
endif |
|
163 |
endif |
|
164 |
||
33523 | 165 |
$$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \ |
25859 | 166 |
SRC := $(LAUNCHER_SRC), \ |
167 |
INCLUDE_FILES := main.c, \ |
|
33523 | 168 |
OPTIMIZATION := $$($1_OPTIMIZATION), \ |
25859 | 169 |
CFLAGS := $$($1_CFLAGS) \ |
170 |
$(LAUNCHER_CFLAGS) \ |
|
171 |
-DFULL_VERSION='"$(FULL_VERSION)"' \ |
|
172 |
-DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \ |
|
173 |
-DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \ |
|
174 |
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \ |
|
33523 | 175 |
-DPROGNAME='"$1"' \ |
176 |
$$($1_CFLAGS), \ |
|
25859 | 177 |
CFLAGS_linux := -fPIC, \ |
178 |
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \ |
|
33523 | 179 |
CFLAGS_windows := $$($1_CFLAGS_windows), \ |
25859 | 180 |
LDFLAGS := $(LDFLAGS_JDKEXE) \ |
33523 | 181 |
$$(ORIGIN_ARG) \ |
25859 | 182 |
$$($1_LDFLAGS), \ |
33406 | 183 |
LDFLAGS_linux := \ |
184 |
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \ |
|
185 |
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \ |
|
25859 | 186 |
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_NAME,$1), \ |
187 |
LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \ |
|
33406 | 188 |
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \ |
189 |
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \ |
|
25859 | 190 |
MAPFILE := $$($1_MAPFILE), \ |
33406 | 191 |
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \ |
33523 | 192 |
LIBS_unix := $$($1_LIBS_unix), \ |
33406 | 193 |
LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \ |
194 |
LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \ |
|
195 |
LIBS_windows := $$($1_WINDOWS_JLI_LIB) \ |
|
33523 | 196 |
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \ |
197 |
$$($1_LIBS_windows), \ |
|
198 |
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \ |
|
199 |
OUTPUT_DIR := $$($1_OUTPUT_DIR), \ |
|
25859 | 200 |
PROGRAM := $1, \ |
201 |
DEBUG_SYMBOLS := true, \ |
|
202 |
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ |
|
33523 | 203 |
RC_FLAGS := $$(RC_FLAGS) \ |
25859 | 204 |
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \ |
205 |
-D "JDK_INTERNAL_NAME=$1" \ |
|
206 |
-D "JDK_FTYPE=0x1L" \ |
|
33523 | 207 |
$$($1_RC_FLAGS), \ |
25859 | 208 |
MANIFEST := $(JAVA_MANIFEST), \ |
29925
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
209 |
MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \ |
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
210 |
CODESIGN := $$($1_CODESIGN), \ |
33523 | 211 |
)) |
25859 | 212 |
|
33523 | 213 |
$1 += $$(BUILD_LAUNCHER_$1) |
214 |
TARGETS += $$($1) |
|
25859 | 215 |
|
216 |
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix)) |
|
27565 | 217 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a |
25859 | 218 |
endif |
219 |
||
220 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
27565 | 221 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ |
25859 | 222 |
$$($1_WINDOWS_JLI_LIB) |
223 |
endif |
|
224 |
endef |