Tue, 29 Jan 2013 14:25:39 -0400
8007094: Apply version to nashorn.jar manifest
Reviewed-by: sundar
Contributed-by: james.laskey@oracle.com
jlaskey@54 | 1 | # |
jlaskey@54 | 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
jlaskey@54 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jlaskey@54 | 4 | # |
jlaskey@54 | 5 | # This code is free software; you can redistribute it and/or modify it |
jlaskey@54 | 6 | # under the terms of the GNU General Public License version 2 only, as |
jlaskey@54 | 7 | # published by the Free Software Foundation. Oracle designates this |
jlaskey@54 | 8 | # particular file as subject to the "Classpath" exception as provided |
jlaskey@54 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
jlaskey@54 | 10 | # |
jlaskey@54 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
jlaskey@54 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jlaskey@54 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jlaskey@54 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
jlaskey@54 | 15 | # accompanied this code). |
jlaskey@54 | 16 | # |
jlaskey@54 | 17 | # You should have received a copy of the GNU General Public License version |
jlaskey@54 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
jlaskey@54 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jlaskey@54 | 20 | # |
jlaskey@54 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jlaskey@54 | 22 | # or visit www.oracle.com if you need additional information or have any |
jlaskey@54 | 23 | # questions. |
jlaskey@54 | 24 | # |
jlaskey@54 | 25 | |
jlaskey@54 | 26 | # This must be the first rule |
jlaskey@54 | 27 | default: all |
jlaskey@54 | 28 | |
jlaskey@54 | 29 | -include $(SPEC) |
jlaskey@54 | 30 | include MakeBase.gmk |
jlaskey@54 | 31 | include JavaCompilation.gmk |
jlaskey@54 | 32 | |
jlaskey@54 | 33 | # TODO: build-infra, move this to SPEC |
jlaskey@54 | 34 | JAVAC_JARS ?= "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ |
jlaskey@54 | 35 | -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar |
jlaskey@54 | 36 | |
jlaskey@54 | 37 | JDK_CLASSES := $(JDK_OUTPUTDIR)/classes |
jlaskey@54 | 38 | # TODO: Remove dependency? |
jlaskey@54 | 39 | DYNALINK_JAR := $(NASHORN_TOPDIR)/build/dynalink/dynalink.jar |
jlaskey@54 | 40 | |
jlaskey@54 | 41 | NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar |
jlaskey@56 | 42 | NASHORN_VERSION := $(JDK_VERSION) |
jlaskey@56 | 43 | NASHORN_FULL_VERSION := $(FULL_VERSION) |
jlaskey@56 | 44 | |
jlaskey@56 | 45 | ifdef MILESTONE |
jlaskey@56 | 46 | ifeq ($(MILESTONE),internal) |
jlaskey@56 | 47 | NASHORN_VERSION = $(FULL_VERSION) |
jlaskey@56 | 48 | endif |
jlaskey@56 | 49 | endif |
jlaskey@54 | 50 | |
jlaskey@54 | 51 | # Need to use source and target 7 for nasgen to work. |
jlaskey@54 | 52 | $(eval $(call SetupJavaCompiler,COMPILER_SETUP,\ |
jlaskey@54 | 53 | JVM:=$(JAVA),\ |
jlaskey@54 | 54 | JAVAC:=$(JAVAC_JARS),\ |
jlaskey@54 | 55 | FLAGS:=-g -source 7 -target 7 -bootclasspath $(JDK_CLASSES),\ |
jlaskey@54 | 56 | SERVER_DIR:=$(SJAVAC_SERVER_DIR),\ |
jlaskey@54 | 57 | SERVER_JVM:=$(SJAVAC_SERVER_JAVA))) |
jlaskey@54 | 58 | |
jlaskey@54 | 59 | # Build nashorn into intermediate directory |
jlaskey@54 | 60 | $(eval $(call SetupJavaCompilation,BUILD_NASHORN,\ |
jlaskey@54 | 61 | SETUP:=COMPILER_SETUP,\ |
jlaskey@54 | 62 | SRC:=$(NASHORN_TOPDIR)/src,\ |
jlaskey@54 | 63 | COPY:=.properties .js,\ |
jlaskey@54 | 64 | BIN:=$(NASHORN_OUTPUTDIR)/nashorn_classes,\ |
jlaskey@54 | 65 | ADD_JAVAC_FLAGS:=-cp $(DYNALINK_JAR))) |
jlaskey@54 | 66 | |
jlaskey@54 | 67 | # Build nasgen |
jlaskey@54 | 68 | $(eval $(call SetupJavaCompilation,BUILD_NASGEN,\ |
jlaskey@54 | 69 | SETUP:=COMPILER_SETUP,\ |
jlaskey@54 | 70 | SRC:=$(NASHORN_TOPDIR)/buildtools/nasgen/src,\ |
jlaskey@54 | 71 | BIN:=$(NASHORN_OUTPUTDIR)/nasgen_classes,\ |
jlaskey@54 | 72 | ADD_JAVAC_FLAGS:=-cp $(NASHORN_OUTPUTDIR)/nashorn_classes)) |
jlaskey@54 | 73 | |
jlaskey@54 | 74 | # Nasgen needs nashorn classes |
jlaskey@54 | 75 | $(BUILD_NASGEN): $(BUILD_NASHORN) |
jlaskey@54 | 76 | |
jlaskey@54 | 77 | # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package |
jlaskey@54 | 78 | # Finally rename classes in jdk.nashorn.internal.objects package |
jlaskey@54 | 79 | $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run: $(BUILD_NASGEN) |
jlaskey@54 | 80 | $(ECHO) Running nasgen |
jlaskey@54 | 81 | $(MKDIR) -p $(@D) |
jlaskey@54 | 82 | $(RM) -rf $(@D)/jdk $(@D)/netscape |
jlaskey@54 | 83 | $(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/ |
jlaskey@54 | 84 | $(JDK_OUTPUTDIR)/bin/java \ |
jlaskey@54 | 85 | -cp $(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes \ |
jlaskey@54 | 86 | jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D) |
jlaskey@54 | 87 | for f in `$(FIND) $(@D)/jdk/nashorn/internal/objects/ -name "*.class"`; do \ |
jlaskey@54 | 88 | mv "$$f" `$(ECHO) "$$f" | $(SED) "s/\.class$$/\.clazz/"`; \ |
jlaskey@54 | 89 | done |
jlaskey@54 | 90 | $(TOUCH) $@ |
jlaskey@54 | 91 | |
jlaskey@54 | 92 | # Unpack dynalink.jar for inclusion in nashorn.jar |
jlaskey@54 | 93 | $(NASHORN_OUTPUTDIR)/classes/_the.dynalink.unpacked: $(DYNALINK_JAR) |
jlaskey@54 | 94 | $(ECHO) Unpacking dynalink.jar |
jlaskey@54 | 95 | $(MKDIR) -p $(@D) |
jlaskey@54 | 96 | $(RM) -rf $(@D)/org |
jlaskey@54 | 97 | $(UNZIP) -q $(DYNALINK_JAR) -x "META-INF*" -d $(@D) |
jlaskey@54 | 98 | $(TOUCH) $@ |
jlaskey@54 | 99 | |
jlaskey@54 | 100 | # Version file needs to be processed with version numbers |
jlaskey@54 | 101 | VERSION_FILE := $(NASHORN_OUTPUTDIR)/classes/jdk/nashorn/internal/runtime/resources/version.properties |
jlaskey@54 | 102 | # Needs to happen after nasgen run since nasgen run deletes it |
jlaskey@54 | 103 | $(VERSION_FILE): $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run |
jlaskey@54 | 104 | $(VERSION_FILE): $(NASHORN_TOPDIR)/src/jdk/nashorn/internal/runtime/resources/version.properties-template |
jlaskey@54 | 105 | $(ECHO) Creating version.properties |
jlaskey@54 | 106 | $(MKDIR) -p $(@D) |
jlaskey@56 | 107 | $(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \ |
jlaskey@54 | 108 | -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \ |
jlaskey@54 | 109 | -e '/^#.*$$/d' -e '/^$$/d' > $@ |
jlaskey@54 | 110 | |
jlaskey@54 | 111 | |
jlaskey@56 | 112 | MANIFEST_ATTRIBUTES:=Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION) |
jlaskey@54 | 113 | |
jlaskey@54 | 114 | # Create nashorn.jar from the final classes dir |
jlaskey@54 | 115 | $(eval $(call SetupArchive,BUILD_NASHORN_JAR,\ |
jlaskey@54 | 116 | $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run \ |
jlaskey@54 | 117 | $(NASHORN_OUTPUTDIR)/classes/_the.dynalink.unpacked \ |
jlaskey@54 | 118 | $(VERSION_FILE),\ |
jlaskey@54 | 119 | SRCS:=$(NASHORN_OUTPUTDIR)/classes,\ |
jlaskey@54 | 120 | SUFFIXES:=.class .clazz .js .properties Factory,\ |
jlaskey@54 | 121 | MANIFEST:=$(NASHORN_TOPDIR)/src/META-INF/MANIFEST.MF,\ |
jlaskey@54 | 122 | EXTRA_MANIFEST_ATTR:=$(MANIFEST_ATTRIBUTES),\ |
jlaskey@54 | 123 | SKIP_METAINF:=true,\ |
jlaskey@54 | 124 | JAR:=$(NASHORN_JAR))) |
jlaskey@54 | 125 | |
jlaskey@54 | 126 | all: $(NASHORN_JAR) |
jlaskey@56 | 127 | |
jlaskey@54 | 128 | .PHONY: all |