jdk/makefiles/CreateSecurityJars.gmk
changeset 21416 7d9198dd107c
parent 21399 3ed2559e161d
parent 21128 2a7460bba7a5
equal deleted inserted replaced
21415:c19a1fd5d61a 21416:7d9198dd107c
       
     1 #
       
     2 # Copyright (c) 2013, 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 default: all
       
    27 
       
    28 include $(SPEC)
       
    29 include MakeBase.gmk
       
    30 include JavaCompilation.gmk
       
    31 include Setup.gmk
       
    32 
       
    33 # The jars created in this file are required for the exploded jdk image to function and
       
    34 # cannot wait to be built in the images target.
       
    35 
       
    36 ##########################################################################################
       
    37 # Create manifest for security jars
       
    38 #
       
    39 # Include these extra attributes for now, should probably take out.
       
    40 #
       
    41 MAINMANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf
       
    42 JCE_MANIFEST := $(JDK_OUTPUTDIR)/lib/_the.security.manifest.mf
       
    43 
       
    44 $(JCE_MANIFEST): $(MAINMANIFEST)
       
    45 	$(MKDIR) -p $(@D)
       
    46 	$(RM) $@ $@.tmp
       
    47 	$(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
       
    48 	    -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
       
    49 	    $(MAINMANIFEST) >> $@.tmp
       
    50 	$(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
       
    51 	$(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
       
    52 	$(MV) $@.tmp $@
       
    53 
       
    54 ##########################################################################################
       
    55 # For security and crypto jars, always build the jar, but for closed, install the prebuilt
       
    56 # signed version instead of the newly built jar. Unsigned jars are treated as intermediate
       
    57 # targets and explicitly added to the JARS list. For open, signing is not needed. See
       
    58 # SignJars.gmk for more information.
       
    59 #
       
    60 # The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO
       
    61 # variable is set to no if these jars can't be built to skip that step of the build.
       
    62 # Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
       
    63 # other way to get the jars than to build them.
       
    64 
       
    65 SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
       
    66 SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunpkcs11.jar
       
    67 
       
    68 $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
       
    69     SRCS := $(JDK_OUTPUTDIR)/classes_security, \
       
    70     SUFFIXES := .class, \
       
    71     INCLUDES := sun/security/pkcs11, \
       
    72     JAR := $(SUNPKCS11_JAR_UNSIGNED), \
       
    73     MANIFEST := $(JCE_MANIFEST), \
       
    74     SKIP_METAINF := true))
       
    75 
       
    76 $(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
       
    77 
       
    78 ifndef OPENJDK
       
    79   SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
       
    80   $(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_SRC)
       
    81 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
       
    82 	$(install-file)
       
    83 else
       
    84   $(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
       
    85 	$(install-file)
       
    86 endif
       
    87 
       
    88 JARS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
       
    89 
       
    90 ##########################################################################################
       
    91 
       
    92 SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
       
    93 SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunec.jar
       
    94 
       
    95 $(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
       
    96     SRCS := $(JDK_OUTPUTDIR)/classes_security, \
       
    97     SUFFIXES := .class, \
       
    98     INCLUDES := sun/security/ec, \
       
    99     JAR := $(SUNEC_JAR_UNSIGNED), \
       
   100     MANIFEST := $(JCE_MANIFEST), \
       
   101     SKIP_METAINF := true))
       
   102 
       
   103 $(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
       
   104 
       
   105 ifndef OPENJDK
       
   106   SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
       
   107   $(SUNEC_JAR_DST): $(SUNEC_JAR_SRC)
       
   108 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
       
   109 	$(install-file)
       
   110 else
       
   111   $(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
       
   112 	$(install-file)
       
   113 endif
       
   114 
       
   115 JARS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
       
   116 
       
   117 ##########################################################################################
       
   118 
       
   119 SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
       
   120 SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunjce_provider.jar
       
   121 
       
   122 ifneq ($(BUILD_CRYPTO), no)
       
   123   $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
       
   124       SRCS := $(JDK_OUTPUTDIR)/classes_security, \
       
   125       SUFFIXES := .class, \
       
   126       INCLUDES := com/sun/crypto/provider, \
       
   127       JAR := $(SUNJCE_PROVIDER_JAR_UNSIGNED), \
       
   128       MANIFEST := $(JCE_MANIFEST), \
       
   129       SKIP_METAINF := true))
       
   130 
       
   131   $(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
       
   132 
       
   133   JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
       
   134 endif
       
   135 
       
   136 ifndef OPENJDK
       
   137   SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
       
   138   $(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_SRC)
       
   139 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
       
   140 	$(install-file)
       
   141 else
       
   142   $(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
       
   143 	$(install-file)
       
   144 endif
       
   145 
       
   146 JARS += $(SUNJCE_PROVIDER_JAR_DST)
       
   147 
       
   148 ##########################################################################################
       
   149 
       
   150 JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
       
   151 JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/jce.jar
       
   152 
       
   153 ifneq ($(BUILD_CRYPTO), no)
       
   154   $(eval $(call SetupArchive,BUILD_JCE_JAR, , \
       
   155       SRCS := $(JDK_OUTPUTDIR)/classes_security, \
       
   156       SUFFIXES := .class, \
       
   157       INCLUDES := javax/crypto sun/security/internal, \
       
   158       JAR := $(JCE_JAR_UNSIGNED), \
       
   159       MANIFEST := $(JCE_MANIFEST), \
       
   160       SKIP_METAINF := true))
       
   161 
       
   162   $(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
       
   163 
       
   164   JARS += $(JCE_JAR_UNSIGNED)
       
   165 endif
       
   166 
       
   167 ifndef OPENJDK
       
   168   JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
       
   169   $(JCE_JAR_DST): $(JCE_JAR_SRC)
       
   170 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
       
   171 	$(install-file)
       
   172 else
       
   173   $(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
       
   174 	$(install-file)
       
   175 endif
       
   176 
       
   177 JARS += $(JCE_JAR_DST)
       
   178 
       
   179 ##########################################################################################
       
   180 
       
   181 US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
       
   182 US_EXPORT_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/US_export_policy.jar
       
   183 
       
   184 ifneq ($(BUILD_CRYPTO), no)
       
   185   #
       
   186   # TODO fix so that SetupArchive does not write files into SRCS
       
   187   # then we don't need this extra copying
       
   188   #
       
   189   # NOTE: We currently do not place restrictions on our limited export
       
   190   # policy. This was not a typo.
       
   191   #
       
   192   US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
       
   193   US_EXPORT_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/US_export_policy_jar.tmp
       
   194 
       
   195   $(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
       
   196 	$(install-file)
       
   197 
       
   198   US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
       
   199 
       
   200   $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, $(US_EXPORT_POLICY_JAR_DEPS), \
       
   201       SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
       
   202       SUFFIXES := .policy, \
       
   203       JAR := $(US_EXPORT_POLICY_JAR_UNSIGNED), \
       
   204       EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
       
   205       SKIP_METAINF := true))
       
   206 
       
   207   JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
       
   208 endif
       
   209 
       
   210 ifndef OPENJDK
       
   211   $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
       
   212 	$(ECHO) $(LOG_INFO) Copying $(@F)
       
   213 	$(install-file)
       
   214 else
       
   215   $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
       
   216 	$(install-file)
       
   217 endif
       
   218 
       
   219 JARS += $(US_EXPORT_POLICY_JAR_DST)
       
   220 
       
   221 ##########################################################################################
       
   222 
       
   223 LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
       
   224 LOCAL_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/local_policy.jar
       
   225 
       
   226 ifneq ($(BUILD_CRYPTO), no)
       
   227   #
       
   228   # TODO fix so that SetupArchive does not write files into SRCS
       
   229   # then we don't need this extra copying
       
   230   #
       
   231   LOCAL_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/local_policy_jar.tmp
       
   232 
       
   233   ifeq ($(UNLIMITED_CRYPTO), true)
       
   234     LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
       
   235     LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
       
   236     LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
       
   237   else
       
   238     LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
       
   239     LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
       
   240         $(LOCAL_POLICY_JAR_TMP)/default_local.policy
       
   241     LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
       
   242   endif
       
   243 
       
   244   $(LOCAL_POLICY_JAR_TMP)/%: $(LOCAL_POLICY_JAR_SRC_DIR)/%
       
   245 	$(install-file)
       
   246 
       
   247   $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR, $(LOCAL_POLICY_JAR_DEPS), \
       
   248       SRCS := $(LOCAL_POLICY_JAR_TMP), \
       
   249       SUFFIXES := .policy, \
       
   250       JAR := $(LOCAL_POLICY_JAR_UNSIGNED), \
       
   251       EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
       
   252       SKIP_METAINF := true))
       
   253 
       
   254   JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
       
   255 endif
       
   256 
       
   257 ifndef OPENJDK
       
   258   $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
       
   259 	$(ECHO) $(LOG_INFO) Copying $(@F)
       
   260 	$(install-file)
       
   261 else
       
   262   $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
       
   263 	$(install-file)
       
   264 endif
       
   265 
       
   266 JARS += $(LOCAL_POLICY_JAR_DST)
       
   267 
       
   268 ##########################################################################################
       
   269 
       
   270 ifeq ($(OPENJDK_TARGET_OS), windows)
       
   271 
       
   272   SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
       
   273   SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunmscapi.jar
       
   274 
       
   275   $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
       
   276       SRCS := $(JDK_OUTPUTDIR)/classes_security, \
       
   277       SUFFIXES := .class, \
       
   278       INCLUDES := sun/security/mscapi, \
       
   279       JAR := $(SUNMSCAPI_JAR_UNSIGNED), \
       
   280       MANIFEST := $(JCE_MANIFEST), \
       
   281       SKIP_METAINF := true))
       
   282 
       
   283   $(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
       
   284 
       
   285   ifndef OPENJDK
       
   286     SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
       
   287     $(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_SRC)
       
   288 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
       
   289 	$(install-file)
       
   290   else
       
   291     $(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
       
   292 	$(install-file)
       
   293   endif
       
   294 
       
   295   JARS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
       
   296 
       
   297 endif
       
   298 
       
   299 ##########################################################################################
       
   300 
       
   301 ifeq ($(OPENJDK_TARGET_OS), solaris)
       
   302   ifndef OPENJDK
       
   303 
       
   304     UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
       
   305     UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/ucrypto.jar
       
   306     UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
       
   307 
       
   308     $(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
       
   309         SRCS := $(JDK_OUTPUTDIR)/classes_security, \
       
   310         SUFFIXES := .class, \
       
   311         INCLUDES := com/oracle/security/ucrypto, \
       
   312         JAR := $(UCRYPTO_JAR_UNSIGNED), \
       
   313         MANIFEST := $(JCE_MANIFEST), \
       
   314         SKIP_METAINF := true))
       
   315 
       
   316     $(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
       
   317 
       
   318     $(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_SRC)
       
   319 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
       
   320 	$(install-file)
       
   321 
       
   322     JARS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
       
   323 
       
   324   endif
       
   325 endif
       
   326 
       
   327 all: $(JARS)
       
   328 
       
   329 .PHONY: default all