changeset 1196:e0ed05bed368

Building mac bundles
author erikj
date Mon, 22 Sep 2014 17:32:06 +0200
parents f06bc8eb2756
children 3d7b88817c42
files common/autoconf/spec.gmk.in make/MacBundles.gmk make/Main.gmk
diffstat 3 files changed, 149 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/spec.gmk.in	Mon Sep 22 16:04:34 2014 +0200
+++ b/common/autoconf/spec.gmk.in	Mon Sep 22 17:32:06 2014 +0200
@@ -696,8 +696,8 @@
 JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
 
 # Macosx bundles directory definitions
-JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
-JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
+JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
 JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
 JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/MacBundles.gmk	Mon Sep 22 17:32:06 2014 +0200
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2011, 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.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+default: bundles
+
+# Only macosx has bundles defined.
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+  bundles: jre-bundle jdk-bundle
+
+  # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
+
+  MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
+
+  # All these OPENJDK checks are needed since there is no coherency between
+  # these values in open and closed. Should probably be fixed.
+  ifndef OPENJDK
+    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
+  else
+    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
+  endif
+  BUNDLE_ID_JRE := $(BUNDLE_ID).jre
+  BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
+
+  BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
+  BUNDLE_NAME_JRE := $(BUNDLE_NAME)
+  BUNDLE_NAME_JDK := $(BUNDLE_NAME)
+
+  ifndef OPENJDK
+    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
+  else
+    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
+  endif
+  BUNDLE_INFO_JRE := $(BUNDLE_INFO)
+  BUNDLE_INFO_JDK := $(BUNDLE_INFO)
+
+  BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
+  BUNDLE_VERSION := $(JDK_VERSION)
+  ifeq ($(COMPANY_NAME), N/A)
+    BUNDLE_VENDOR := UNDEFINED
+  else
+    BUNDLE_VENDOR := $(COMPANY_NAME)
+  endif
+
+
+  JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
+  JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
+
+  JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
+  JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
+
+  # Copy empty directories (jre/lib/applet).
+  $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+  $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+  $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
+	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+  $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
+	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+  $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
+	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
+	    -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
+	    -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
+	    -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+	    -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+	    -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+	    < $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
+
+  $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
+	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
+	    -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
+	    -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
+	    -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+	    -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+	    -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+	    < $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
+
+  jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
+      $(JDK_BUNDLE_DIR)/Info.plist
+	$(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
+
+  jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
+      $(JRE_BUNDLE_DIR)/Info.plist
+	$(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
+
+else # Not macosx
+
+  bundles:
+	$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
+
+endif # macosx
+
+.PHONY: jdk-bundle jre-bundle bundles
--- a/make/Main.gmk	Mon Sep 22 16:04:34 2014 +0200
+++ b/make/Main.gmk	Mon Sep 22 17:32:06 2014 +0200
@@ -268,9 +268,12 @@
 jimages:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk)
 
+mac-bundles:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
+
 ALL_TARGETS += source-tips security-jars nashorn-jar main-jars legacy-images \
     $(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
-    bootcycle-images zip-src strip-binaries jimages
+    bootcycle-images zip-src strip-binaries jimages mac-bundles
 
 ################################################################################
 # Docs targets
@@ -416,6 +419,8 @@
 
   jimages: exploded-image zip-src strip-binaries source-tips demos samples
 
+  mac-bundles: jimages
+
   bootcycle-images: legacy-images
 
   # Need to depend on jars as otherwise there will a race between all the
@@ -491,6 +496,10 @@
 
 images: jimages demos samples
 
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+  images: mac-bundles
+endif
+
 # Make each profile name a target that depends on it's images target.
 $(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))