jdk/make/common/internal/ImportComponents.gmk
author alanb
Sun, 05 Feb 2012 12:29:31 +0000
changeset 11825 267ac03556be
parent 5506 202f599c92aa
permissions -rw-r--r--
7140918: Remove dependency on apt and com.sun.mirror API Reviewed-by: darcy Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     2
# Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
# JDK jars where component classes come from as second choice
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
JDK_RT_JAR    = $(JDK_IMPORT_PATH)/jre/lib/rt.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
JDK_TOOLS_JAR = $(JDK_IMPORT_PATH)/lib/tools.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
JDK_RESOURCES_JAR = $(JDK_IMPORT_PATH)/jre/lib/resources.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
# The specific packages that come from or go to rt.jar and tools.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#   IF the component deliverables are not available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
IMPORT_TOOLS_PACKAGES =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
IMPORT_RT_PACKAGES =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
# The following will add to IMPORT_TOOLS_PACKAGES and/or IMPORT_RT_PACKAGES
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
ifndef LANGTOOLS_DIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  include $(BUILDDIR)/common/internal/Defs-langtools.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
ifndef CORBA_DIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  include $(BUILDDIR)/common/internal/Defs-corba.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
ifndef JAXP_DIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  include $(BUILDDIR)/common/internal/Defs-jaxp.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
ifndef JAXWS_DIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  include $(BUILDDIR)/common/internal/Defs-jaxws.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
# Clean up these lists so empty lists are empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
IMPORT_TOOLS_PACKAGES := $(strip $(IMPORT_TOOLS_PACKAGES))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
IMPORT_RT_PACKAGES    := $(strip $(IMPORT_RT_PACKAGES))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
# Relative paths to import component deliverables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
CLASSES_JAR_FILE=lib/classes.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
SRC_ZIP_FILE=lib/src.zip
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
BIN_ZIP_FILE=lib/bin.zip
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
DOC_ZIP_FILE=lib/doc.zip
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#################################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
# Macros:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
# Importing component class files
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
define import-one-classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
@if [ "$($1)" != "" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  $(ECHO) "Importing classes from component $1"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  $(call Unjar,$2,$($1)/$(CLASSES_JAR_FILE),); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
# Importing optional component doc files (for man pages?)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
define import-one-docs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
@if [ "$($1)" != "" -a -f $($1)/$(DOC_ZIP_FILE) ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  $(ECHO) "Importing docs from component $1"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  $(call Unzipper,$2,$($1)/$(DOC_ZIP_FILE)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
# Importing optional component src files (for jdk src.zip and javadoc)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
define import-one-sources
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
@if [ "$($1)" != "" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  $(ECHO) "Importing sources from component $1"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
  $(call Unzipper,$2,$($1)/$(SRC_ZIP_FILE)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
# Importing optional component bin files (for install image)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
define import-one-binaries
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
@if [ "$($1)" != "" -a -f $($1)/$(BIN_ZIP_FILE) ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
  $(ECHO) "Importing binaries from component $1"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  $(call Unzipper,$2,$($1)/$(BIN_ZIP_FILE)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
# Unzip zip file $2 into directory $1 (if $2 exists)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#   Warning: $2 must be absolute path not relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
define Unzipper
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
( \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  $(MKDIR) -p $1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  $(ECHO) "( $(CD) $1 && $(UNZIP) -o $2 )"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  ( $(CD) $1 && $(UNZIP) -o $2 ) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
# Unjar directories $3 from jar file $2 into directory $1 (if $2 exists)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
#   Warning: $2 must be absolute path not relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
define Unjar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
( \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  $(MKDIR) -p $1; \
916
867515b155b5 6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents: 2
diff changeset
   110
  $(ECHO) "( $(CD) $1 && $(BOOT_JAR_CMD) xfv $2 $3 $(BOOT_JAR_JFLAGS) )" ; \
867515b155b5 6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents: 2
diff changeset
   111
  ( $(CD) $1 && $(BOOT_JAR_CMD) xfv $2 $3 $(BOOT_JAR_JFLAGS) ) && \
867515b155b5 6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents: 2
diff changeset
   112
  ( $(CD) $1 && $(java-vm-cleanup) ) \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
# Import all component sources into directory $1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
define import-component-sources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
$(call import-one-sources,LANGTOOLS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
$(call import-one-sources,CORBA_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
$(call import-one-sources,JAXP_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
$(call import-one-sources,JAXWS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
# Import all component docs into directory $1 (optional)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
define import-component-docs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
$(call import-one-docs,LANGTOOLS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
$(call import-one-docs,CORBA_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
$(call import-one-docs,JAXP_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
$(call import-one-docs,JAXWS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
# Import all component bins into directory $1 (optional)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
define import-component-binaries
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
$(call import-one-binaries,LANGTOOLS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
$(call import-one-binaries,CORBA_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
$(call import-one-binaries,JAXP_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
$(call import-one-binaries,JAXWS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
if [ "$(CORBA_DIST)" = "" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  $(MKDIR) -p $(OUTPUTDIR)/lib ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
  ( $(CD) $(JDK_IMPORT_PATH) && $(CP) $(IMPORT_CORBA_BINARIES) $(ABS_OUTPUTDIR)/lib ) ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
fi 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
# Import all component classes into directory $1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
#   Here we special case classes coming from JDK when component not supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
define import-component-classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
$(ECHO) "Import classes from $(JDK_IMPORT_PATH)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
if [ "$(IMPORT_TOOLS_PACKAGES)" != "" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  $(call Unjar,$1,$(JDK_RESOURCES_JAR),$(IMPORT_TOOLS_PACKAGES)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
  $(call Unjar,$1,$(JDK_TOOLS_JAR),$(IMPORT_TOOLS_PACKAGES)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
if [ "$(IMPORT_RT_PACKAGES)" != "" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
  $(call Unjar,$1,$(JDK_RESOURCES_JAR),$(IMPORT_RT_PACKAGES)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  $(call Unjar,$1,$(JDK_RT_JAR),$(IMPORT_RT_PACKAGES)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
$(call import-one-classes,LANGTOOLS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
$(call import-one-classes,CORBA_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
$(call import-one-classes,JAXP_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
$(call import-one-classes,JAXWS_DIST,$1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
# Clean up import files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
define import-component-sources-clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
$(RM) -r $1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
define import-component-docs-clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
$(RM) -r $1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
define import-component-classes-clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
$(RM) -r $(IMPORT_TOOLS_PACKAGES:%=$1/%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
$(RM) -r $(IMPORT_RT_PACKAGES:%=$1/%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173