1 # |
|
2 # Copyright (c) 1997, 2008, 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 $(SPEC) |
|
27 |
|
28 # JDK jars where component classes come from as second choice |
|
29 JDK_RT_JAR = $(JDK_IMPORT_PATH)/jre/lib/rt.jar |
|
30 JDK_TOOLS_JAR = $(JDK_IMPORT_PATH)/lib/tools.jar |
|
31 JDK_RESOURCES_JAR = $(JDK_IMPORT_PATH)/jre/lib/resources.jar |
|
32 |
|
33 # The specific packages that come from or go to rt.jar and tools.jar |
|
34 # IF the component deliverables are not available. |
|
35 IMPORT_TOOLS_PACKAGES = |
|
36 IMPORT_RT_PACKAGES = |
|
37 |
|
38 # The following will add to IMPORT_TOOLS_PACKAGES and/or IMPORT_RT_PACKAGES |
|
39 ifndef LANGTOOLS_DIST |
|
40 include $(BUILDDIR)/common/internal/Defs-langtools.gmk |
|
41 endif |
|
42 ifndef CORBA_DIST |
|
43 include $(BUILDDIR)/common/internal/Defs-corba.gmk |
|
44 endif |
|
45 ifndef JAXP_DIST |
|
46 include $(BUILDDIR)/common/internal/Defs-jaxp.gmk |
|
47 endif |
|
48 ifndef JAXWS_DIST |
|
49 include $(BUILDDIR)/common/internal/Defs-jaxws.gmk |
|
50 endif |
|
51 |
|
52 # Clean up these lists so empty lists are empty |
|
53 IMPORT_TOOLS_PACKAGES := $(strip $(IMPORT_TOOLS_PACKAGES)) |
|
54 IMPORT_RT_PACKAGES := $(strip $(IMPORT_RT_PACKAGES)) |
|
55 |
|
56 # Relative paths to import component deliverables |
|
57 CLASSES_JAR_FILE=lib/classes.jar |
|
58 SRC_ZIP_FILE=lib/src.zip |
|
59 BIN_ZIP_FILE=lib/bin.zip |
|
60 DOC_ZIP_FILE=lib/doc.zip |
|
61 |
|
62 ################################################################# |
|
63 # Macros: |
|
64 |
|
65 # Importing component class files |
|
66 define import-one-classes |
|
67 if [ "$($1)" != "" ] ; then \ |
|
68 $(ECHO) "Importing classes from component $1"; \ |
|
69 $(call Unjar,$2,$($1)/$(CLASSES_JAR_FILE),); \ |
|
70 fi |
|
71 endef |
|
72 |
|
73 # Importing optional component doc files (for man pages?) |
|
74 define import-one-docs |
|
75 if [ "$($1)" != "" -a -f $($1)/$(DOC_ZIP_FILE) ] ; then \ |
|
76 $(ECHO) "Importing docs from component $1"; \ |
|
77 $(call Unzipper,$2,$($1)/$(DOC_ZIP_FILE)); \ |
|
78 fi |
|
79 endef |
|
80 |
|
81 # Importing optional component src files (for jdk src.zip and javadoc) |
|
82 define import-one-sources |
|
83 if [ "$($1)" != "" ] ; then \ |
|
84 $(ECHO) "Importing sources from component $1"; \ |
|
85 $(call Unzipper,$2,$($1)/$(SRC_ZIP_FILE)); \ |
|
86 fi |
|
87 endef |
|
88 |
|
89 # Importing optional component bin files (for install image) |
|
90 define import-one-binaries |
|
91 if [ "$($1)" != "" -a -f $($1)/$(BIN_ZIP_FILE) ] ; then \ |
|
92 $(ECHO) "Importing binaries from component $1"; \ |
|
93 $(call Unzipper,$2,$($1)/$(BIN_ZIP_FILE)); \ |
|
94 fi |
|
95 endef |
|
96 |
|
97 # Unzip zip file $2 into directory $1 (if $2 exists) |
|
98 # Warning: $2 must be absolute path not relative |
|
99 define Unzipper |
|
100 ( \ |
|
101 $(MKDIR) -p $1; \ |
|
102 ( $(CD) $1 && $(UNZIP) -o $2 > /dev/null ) \ |
|
103 ) |
|
104 endef |
|
105 |
|
106 # Unjar directories $3 from jar file $2 into directory $1 (if $2 exists) |
|
107 # Warning: $2 must be absolute path not relative |
|
108 define Unjar |
|
109 ( \ |
|
110 $(MKDIR) -p $1; \ |
|
111 ( $(CD) $1 && $(BOOT_JAR_CMD) xf $2 $3 $(BOOT_JAR_JFLAGS) ) && \ |
|
112 ( $(CD) $1 && $(java-vm-cleanup) ) \ |
|
113 ) |
|
114 endef |
|
115 |
|
116 # Import all component sources into directory $1 |
|
117 define import-component-sources |
|
118 $(call import-one-sources,LANGTOOLS_DIST,$1) |
|
119 $(call import-one-sources,CORBA_DIST,$1) |
|
120 $(call import-one-sources,JAXP_DIST,$1) |
|
121 $(call import-one-sources,JAXWS_DIST,$1) |
|
122 endef |
|
123 |
|
124 # Import all component docs into directory $1 (optional) |
|
125 define import-component-docs |
|
126 $(call import-one-docs,LANGTOOLS_DIST,$1) |
|
127 $(call import-one-docs,CORBA_DIST,$1) |
|
128 $(call import-one-docs,JAXP_DIST,$1) |
|
129 $(call import-one-docs,JAXWS_DIST,$1) |
|
130 endef |
|
131 |
|
132 # Import all component bins into directory $1 (optional) |
|
133 define import-component-binaries |
|
134 $(call import-one-binaries,LANGTOOLS_DIST,$1) |
|
135 $(call import-one-binaries,CORBA_DIST,$1) |
|
136 $(call import-one-binaries,JAXP_DIST,$1) |
|
137 $(call import-one-binaries,JAXWS_DIST,$1) |
|
138 if [ "$(CORBA_DIST)" = "" ] ; then \ |
|
139 $(MKDIR) -p $(OUTPUTDIR)/lib ; \ |
|
140 ( $(CD) $(JDK_IMPORT_PATH) && $(CP) $(IMPORT_CORBA_BINARIES) $(ABS_OUTPUTDIR)/lib ) ; \ |
|
141 fi |
|
142 endef |
|
143 |
|
144 # Import all component classes into directory $1 |
|
145 # Here we special case classes coming from JDK when component not supplied |
|
146 define import-component-classes |
|
147 $(ECHO) "Import classes from $(JDK_IMPORT_PATH)" |
|
148 if [ "$(IMPORT_TOOLS_PACKAGES)" != "" ] ; then \ |
|
149 $(call Unjar,$1,$(JDK_RESOURCES_JAR),$(IMPORT_TOOLS_PACKAGES)); \ |
|
150 $(call Unjar,$1,$(JDK_TOOLS_JAR),$(IMPORT_TOOLS_PACKAGES)); \ |
|
151 fi |
|
152 if [ "$(IMPORT_RT_PACKAGES)" != "" ] ; then \ |
|
153 $(call Unjar,$1,$(JDK_RESOURCES_JAR),$(IMPORT_RT_PACKAGES)); \ |
|
154 $(call Unjar,$1,$(JDK_RT_JAR),$(IMPORT_RT_PACKAGES)); \ |
|
155 fi |
|
156 $(call import-one-classes,LANGTOOLS_DIST,$1) |
|
157 $(call import-one-classes,CORBA_DIST,$1) |
|
158 $(call import-one-classes,JAXP_DIST,$1) |
|
159 $(call import-one-classes,JAXWS_DIST,$1) |
|
160 endef |
|
161 |
|
162 # Clean up import files |
|
163 define import-component-sources-clean |
|
164 $(RM) -r $1 |
|
165 endef |
|
166 define import-component-docs-clean |
|
167 $(RM) -r $1 |
|
168 endef |
|
169 define import-component-classes-clean |
|
170 $(RM) -r $(IMPORT_TOOLS_PACKAGES:%=$1/%) |
|
171 $(RM) -r $(IMPORT_RT_PACKAGES:%=$1/%) |
|
172 endef |
|
173 |
|