jdk/make/CreatePolicyJars.gmk
author jmasa
Fri, 29 Aug 2014 08:14:19 -0700
changeset 26331 8f17e084029b
parent 25859 3317bb8137f4
child 26861 47dde7f5cf36
permissions -rw-r--r--
Merge

#
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

default: all

include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk


################################################################################

US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar

ifneq ($(BUILD_CRYPTO), no)

  US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/US_export_policy.jar
  US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy.jar

  #
  # TODO fix so that SetupArchive does not write files into SRCS
  # then we don't need this extra copying
  #
  # NOTE: We currently do not place restrictions on our limited export
  # policy. This was not a typo. This means we are shipping the same file
  # for both limimted and unlimited US_export_policy.jar.
  #
  US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
  US_EXPORT_POLICY_JAR_TMP := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy_jar.tmp

  $(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
	$(install-file)

  US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy

  $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, $(US_EXPORT_POLICY_JAR_DEPS), \
      SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
      SUFFIXES := .policy, \
      JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED), \
      EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
      SKIP_METAINF := true))

  $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
	$(ECHO) $(LOG_INFO) Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(install-file)

  TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED) \
      $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
endif

ifndef OPENJDK
  ifeq ($(UNLIMITED_CRYPTO), true)
    $(error No prebuilt unlimited crypto jars available)
  endif
  $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
	$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
	$(install-file)
else
  ifeq ($(UNLIMITED_CRYPTO), true)
    $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
	$(install-file)
  else
    $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
	$(install-file)
  endif
endif

POLICY_JARS += $(US_EXPORT_POLICY_JAR_DST)

################################################################################

LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar

ifneq ($(BUILD_CRYPTO), no)

  LOCAL_POLICY_JAR_LIMITED_UNSIGNED := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy.jar
  LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy.jar

  #
  # TODO fix so that SetupArchive does not write files into SRCS
  # then we don't need this extra copying
  #
  LOCAL_POLICY_JAR_LIMITED_TMP := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy_jar.tmp
  LOCAL_POLICY_JAR_UNLIMITED_TMP := \
      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy_jar.tmp

  $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
	$(install-file)

  $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/%
	$(install-file)

  $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
      $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
      $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
      SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
      SUFFIXES := .policy, \
      JAR := $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED), \
      EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
      SKIP_METAINF := true))

  $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
      $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
      SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
      SUFFIXES := .policy, \
      JAR := $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED), \
      EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
      SKIP_METAINF := true))

  TARGETS += $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED) $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)

  ifndef OPENJDK
    $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt: \
        $(JDK_TOPDIR)/make/closed/javax/crypto/doc/README.txt
		$(install-file)

    TARGETS += $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt
  endif
endif

ifndef OPENJDK
  $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
	$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
	$(install-file)
else
  ifeq ($(UNLIMITED_CRYPTO), true)
    $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
	$(install-file)
  else
    $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
	$(install-file)
  endif
endif

POLICY_JARS += $(LOCAL_POLICY_JAR_DST)
TARGETS += $(POLICY_JARS)

################################################################################

all: $(TARGETS)