author | iris |
Mon, 09 Nov 2015 10:57:01 -0800 | |
changeset 34012 | b8b34f35e2ee |
parent 33406 | 4680f7495292 |
parent 34005 | bb40b397f7c6 |
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 |
# When building a legacy overlay image (on solaris 64 bit), the launchers |
|
32 |
# need to be built with a different rpath and a different output dir. |
|
33 |
ifeq ($(OVERLAY_IMAGES), true) |
|
34 |
ORIGIN_ROOT := /../.. |
|
35 |
OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR) |
|
36 |
else |
|
37 |
ORIGIN_ROOT := /.. |
|
38 |
endif |
|
39 |
||
40 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
41 |
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN) |
|
42 |
else |
|
43 |
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) |
|
44 |
endif |
|
45 |
||
46 |
# |
|
47 |
# Applications expect to be able to link against libjawt without invoking |
|
48 |
# System.loadLibrary("jawt") first. This was the behaviour described in the |
|
49 |
# devloper documentation of JAWT and what worked with OpenJDK6. |
|
50 |
# |
|
51 |
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) |
|
52 |
ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) |
|
53 |
endif |
|
54 |
||
55 |
LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher |
|
56 |
LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \ |
|
57 |
-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
|
58 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ |
25859 | 59 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ |
60 |
# |
|
61 |
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc |
|
62 |
JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc |
|
63 |
MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher |
|
64 |
# Until the shuffle is permanent, we can't add this in configure |
|
65 |
CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE)) |
|
66 |
CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
67 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include |
25859 | 68 |
CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE)) |
69 |
CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
70 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include |
25859 | 71 |
JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest |
72 |
||
73 |
define SetupLauncher |
|
74 |
# TODO: Fix mapfile on solaris. Won't work with ld as linker. |
|
75 |
# Parameter 1 is the name of the launcher (java, javac, jar...) |
|
76 |
# Parameter 2 is extra CFLAGS |
|
77 |
# Parameter 3 is extra LDFLAGS |
|
33406 | 78 |
# Parameter 4 is extra LIBS_unix |
79 |
# Parameter 5 is extra LIBS_windows |
|
25859 | 80 |
# Parameter 6 is optional Windows JLI library (full path) |
81 |
# Parameter 7 is optional Windows resource (RC) flags |
|
82 |
# Parameter 8 is optional Windows version resource file (.rc) |
|
83 |
# Parameter 9 is different output dir |
|
84 |
# Parameter 10 if set, link statically with c runtime on windows. |
|
85 |
# Parameter 11 if set, override plist file on macosx. |
|
86 |
$(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11)) |
|
87 |
$(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk)) |
|
88 |
||
27565 | 89 |
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib |
25859 | 90 |
ifneq ($6, ) |
91 |
$1_WINDOWS_JLI_LIB := $6 |
|
92 |
endif |
|
93 |
$1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE) |
|
94 |
ifneq ($8, ) |
|
95 |
$1_VERSION_INFO_RESOURCE := $8 |
|
96 |
endif |
|
97 |
||
98 |
$1_LDFLAGS := $3 |
|
33406 | 99 |
$1_LIBS := |
25859 | 100 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
101 |
$1_PLIST_FILE := Info-cmdline.plist |
|
102 |
ifneq ($(11), ) |
|
103 |
$1_PLIST_FILE := $(11) |
|
104 |
ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), ) |
|
105 |
$1_CODESIGN := true |
|
106 |
endif |
|
107 |
endif |
|
108 |
||
27565 | 109 |
$1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \ |
25859 | 110 |
-sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE) |
33406 | 111 |
$1_LIBS += -framework Cocoa -framework Security \ |
112 |
-framework ApplicationServices |
|
25859 | 113 |
endif |
114 |
||
115 |
ifeq ($(OPENJDK_TARGET_OS), aix) |
|
33406 | 116 |
$1_LDFLAGS += -L$(SUPPORT_OUTPUTDIR)/native/java.base |
117 |
$1_LIBS += -ljli_static |
|
25859 | 118 |
endif |
119 |
||
120 |
ifeq ($(USE_EXTERNAL_LIBZ), true) |
|
33406 | 121 |
$1_LIBS += -lz |
25859 | 122 |
endif |
123 |
||
124 |
$1_OUTPUT_DIR_ARG := $9 |
|
125 |
ifeq (, $$($1_OUTPUT_DIR_ARG)) |
|
27565 | 126 |
$1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) |
25859 | 127 |
endif |
128 |
||
129 |
# TODO: maybe it's better to move this if-statement out of this function |
|
130 |
ifeq ($1, java) |
|
131 |
$1_OPTIMIZATION_ARG := HIGH |
|
132 |
$1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR) |
|
133 |
else |
|
33406 | 134 |
$1_OPTIMIZATION_ARG := LOW |
25859 | 135 |
endif |
136 |
||
137 |
$1_CFLAGS := $(CFLAGS_JDKEXE) |
|
138 |
ifeq ($(10), true) |
|
139 |
$1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE)) |
|
140 |
endif |
|
141 |
||
142 |
# The linker on older SuSE distros (e.g. on SLES 10) complains with: |
|
143 |
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable." |
|
144 |
# if feeded with a version script which contains named tags. |
|
145 |
ifeq ($(USING_BROKEN_SUSE_LD),yes) |
|
146 |
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), ) |
|
147 |
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous |
|
148 |
else |
|
149 |
$1_MAPFILE := |
|
150 |
endif |
|
151 |
else |
|
152 |
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), ) |
|
153 |
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU) |
|
154 |
else |
|
155 |
$1_MAPFILE := |
|
156 |
endif |
|
157 |
endif |
|
158 |
||
159 |
$(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \ |
|
160 |
SRC := $(LAUNCHER_SRC), \ |
|
161 |
INCLUDE_FILES := main.c, \ |
|
162 |
OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \ |
|
163 |
CFLAGS := $$($1_CFLAGS) \ |
|
164 |
$(LAUNCHER_CFLAGS) \ |
|
33984
2333676816eb
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
29931
diff
changeset
|
165 |
$(VERSION_CFLAGS) \ |
25859 | 166 |
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \ |
167 |
-DPROGNAME='"$1"' $(DPACKAGEPATH) \ |
|
168 |
$2, \ |
|
169 |
CFLAGS_linux := -fPIC, \ |
|
170 |
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \ |
|
171 |
LDFLAGS := $(LDFLAGS_JDKEXE) \ |
|
172 |
$(ORIGIN_ARG) \ |
|
173 |
$$($1_LDFLAGS), \ |
|
33406 | 174 |
LDFLAGS_linux := \ |
175 |
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \ |
|
176 |
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \ |
|
25859 | 177 |
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_NAME,$1), \ |
178 |
LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \ |
|
33406 | 179 |
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \ |
180 |
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \ |
|
25859 | 181 |
MAPFILE := $$($1_MAPFILE), \ |
33406 | 182 |
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \ |
183 |
LIBS_unix := $4, \ |
|
184 |
LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \ |
|
185 |
LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \ |
|
186 |
LIBS_windows := $$($1_WINDOWS_JLI_LIB) \ |
|
27565 | 187 |
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \ |
188 |
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \ |
|
25859 | 189 |
OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \ |
190 |
PROGRAM := $1, \ |
|
191 |
DEBUG_SYMBOLS := true, \ |
|
192 |
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ |
|
193 |
RC_FLAGS := $(RC_FLAGS) \ |
|
194 |
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \ |
|
195 |
-D "JDK_INTERNAL_NAME=$1" \ |
|
196 |
-D "JDK_FTYPE=0x1L" \ |
|
197 |
$7, \ |
|
198 |
MANIFEST := $(JAVA_MANIFEST), \ |
|
33984
2333676816eb
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
29931
diff
changeset
|
199 |
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \ |
29925
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
200 |
CODESIGN := $$($1_CODESIGN), \ |
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
201 |
) |
25859 | 202 |
|
27565 | 203 |
TARGETS += $$(BUILD_LAUNCHER_$1) |
25859 | 204 |
|
205 |
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix)) |
|
27565 | 206 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a |
25859 | 207 |
endif |
208 |
||
209 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
27565 | 210 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ |
25859 | 211 |
$$($1_WINDOWS_JLI_LIB) |
212 |
endif |
|
213 |
endef |
|
214 |
||
215 |
########################################################################################## |
|
216 |
||
217 |
XLIBS := $(X_LIBS) -lX11 |
|
218 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
219 |
DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"' |
|
220 |
XLIBS := |
|
221 |
endif |
|
222 |
||
223 |
JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common |
|
224 |
ifdef OPENJDK |
|
225 |
JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons" |
|
226 |
else |
|
227 |
JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" |
|
228 |
endif |