jdk/makefiles/SignJars.gmk
author erikj
Fri, 05 Apr 2013 09:39:10 +0200
changeset 16636 1cc691bcfe50
parent 15128 296bb1620e00
child 20547 453837141fac
permissions -rw-r--r--
8008373: JFR JTReg tests fail with CompilationError on MacOSX; missing '._sunec.jar' Reviewed-by: tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15128
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     1
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     2
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     4
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    10
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    15
# accompanied this code).
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    16
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    20
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    23
# questions.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    24
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    25
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    26
include $(SPEC)
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    27
include MakeBase.gmk
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    28
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    29
# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Oracle JDK 
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    30
# builds respectively.)
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    31
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    32
# JCE builds are very different between OpenJDK and JDK.  The OpenJDK JCE
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    33
# jar files do not require signing, but those for JDK do.  If an unsigned
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    34
# jar file is installed into JDK, things will break when the crypto
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    35
# routines are called.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    36
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    37
# All jars are created in CreateJars.gmk. This Makefile does the signing
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    38
# of the jars for JDK.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    39
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    40
# For JDK, the binaries use pre-built/pre-signed binary files stored in
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    41
# the closed workspace that are not shipped in the OpenJDK workspaces.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    42
# We still build the JDK files to verify the files compile, and in
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    43
# preparation for possible signing.  Developers working on JCE in JDK
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    44
# must sign the JCE files before testing.  The JCE signing key is kept
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    45
# separate from the JDK workspace to prevent its disclosure.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    46
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    47
# SPECIAL NOTE TO JCE/JDK developers:  The source files must eventually
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    48
# be built, signed, and then the resulting jar files MUST BE CHECKED
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    49
# INTO THE CLOSED PART OF THE WORKSPACE*.  This separate step *MUST NOT
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    50
# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    51
# reflected in the shipped binaries.  The "sign-jars" target in the top
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    52
# level Makefile should be used to generate the required files.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    53
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    54
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    55
# Default target
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    56
all:
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    57
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    58
ifndef OPENJDK
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    59
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    60
README-MAKEFILE_WARNING := \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    61
    "\nPlease read makefiles/SignJars.gmk for further build instructions.\n"
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    62
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    63
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    64
# Location for JCE codesigning key.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    65
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    66
SIGNING_KEY_DIR    := /security/ws/JCE-signing/src
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    67
SIGNING_KEYSTORE   := $(SIGNING_KEY_DIR)/KeyStore.jks
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    68
SIGNING_PASSPHRASE := $(SIGNING_KEY_DIR)/passphrase.txt
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    69
SIGNING_ALIAS      := oracle_jce_rsa
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    70
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    71
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    72
# Defines for signing the various jar files.
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    73
#
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    74
check-keystore:
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    75
	@if [ ! -f $(SIGNING_KEYSTORE) -o ! -f $(SIGNING_PASSPHRASE) ]; then \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    76
	    $(PRINTF) "\n$(SIGNING_KEYSTORE): Signing mechanism *NOT* available..."; \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    77
	    $(PRINTF) $(README-MAKEFILE_WARNING); \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    78
	    exit 2; \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    79
	fi
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    80
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    81
$(JCE_OUTPUTDIR)/%: $(IMAGES_OUTPUTDIR)/unsigned/%
16636
1cc691bcfe50 8008373: JFR JTReg tests fail with CompilationError on MacOSX; missing '._sunec.jar'
erikj
parents: 15128
diff changeset
    82
	$(call install-file)
15128
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    83
	$(JARSIGNER) -keystore $(SIGNING_KEYSTORE) \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    84
	    $@ $(SIGNING_ALIAS) < $(SIGNING_PASSPHRASE)
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    85
	@$(PRINTF) "\nJar codesigning finished.\n"
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    86
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    87
JAR_LIST := jce.jar \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    88
            local_policy.jar \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    89
            sunec.jar \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    90
            sunjce_provider.jar \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    91
            sunpkcs11.jar \
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    92
            US_export_policy.jar
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    93
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    94
SIGNED_JARS := $(addprefix $(JCE_OUTPUTDIR)/,$(JAR_LIST))
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    95
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    96
$(SIGNED_JARS): check-keystore
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    97
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    98
all: $(SIGNED_JARS)
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
    99
	@$(PRINTF) "\n***The jar files built by the 'jar-sign' target must***"
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
   100
	@$(PRINTF) "\n***still be checked into the closed workspace!     ***"
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
   101
	@$(PRINTF)  $(README-MAKEFILE_WARNING)
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
   102
296bb1620e00 8005355: build-infra: Java security signing (need a top-level make target).
erikj
parents:
diff changeset
   103
endif  # !OPENJDK