1 #
   2 # Copyright (c) 2011, 2015, 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 include $(SPEC)
  27 include MakeBase.gmk
  28 
  29 default: bundles
  30 
  31 # Only macosx has bundles defined.
  32 ifeq ($(OPENJDK_TARGET_OS), macosx)
  33 
  34   bundles: jre-bundle jdk-bundle
  35 
  36   # JDK_MACOSX_BUNDLE_DIR and JRE_MACOSX_BUNDLE_DIR are defined in SPEC.
  37 
  38   MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
  39 
  40   BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(VERSION_SHORT)
  41   BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_SHORT)
  42   BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_STRING)
  43   BUNDLE_PLATFORM_VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
  44   BUNDLE_VERSION := $(VERSION_NUMBER)
  45   ifeq ($(COMPANY_NAME), N/A)
  46     BUNDLE_VENDOR := UNDEFINED
  47   else
  48     BUNDLE_VENDOR := $(COMPANY_NAME)
  49   endif
  50 
  51   JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
  52   JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
  53 
  54   JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_MACOSX_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
  55   JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_MACOSX_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
  56 
  57   # Copy empty directories (jre/lib/applet).
  58   $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
  59         $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
  60         $(MKDIR) -p $(@D)
  61         if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
  62 
  63   $(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
  64         $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
  65         $(MKDIR) -p $(@D)
  66         if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
  67 
  68   $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
  69         $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
  70         $(MKDIR) -p $(@D)
  71         $(RM) $@
  72         $(LN) -s ../Home/lib/jli/libjli.dylib $@
  73 
  74   $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
  75         $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
  76         $(MKDIR) -p $(@D)
  77         $(RM) $@
  78         $(LN) -s ../Home/lib/jli/libjli.dylib $@
  79 
  80   $(eval $(call SetupTextFileProcessing, BUILD_JDK_PLIST, \
  81       SOURCE_FILES := $(MACOSX_PLIST_SRC)/JDK-Info.plist, \
  82       OUTPUT_FILE := $(JDK_MACOSX_BUNDLE_DIR)/Info.plist, \
  83       REPLACEMENTS := \
  84           @@ID@@ => $(BUNDLE_ID).jdk ; \
  85           @@NAME@@ => $(BUNDLE_NAME) ; \
  86           @@INFO@@ => $(BUNDLE_INFO) ; \
  87           @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
  88           @@VERSION@@ => $(BUNDLE_VERSION) ; \
  89           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
  90   ))
  91 
  92   $(eval $(call SetupTextFileProcessing, BUILD_JRE_PLIST, \
  93       SOURCE_FILES := $(MACOSX_PLIST_SRC)/JRE-Info.plist, \
  94       OUTPUT_FILE := $(JRE_MACOSX_BUNDLE_DIR)/Info.plist, \
  95       REPLACEMENTS := \
  96           @@ID@@ => $(BUNDLE_ID).jre ; \
  97           @@NAME@@ => $(BUNDLE_NAME) ; \
  98           @@INFO@@ => $(BUNDLE_INFO) ; \
  99           @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
 100           @@VERSION@@ => $(BUNDLE_VERSION) ; \
 101           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
 102   ))
 103 
 104   jdk-bundle: $(JDK_TARGET_LIST) $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib \
 105       $(BUILD_JDK_PLIST)
 106         $(SETFILE) -a B $(dir $(JDK_MACOSX_BUNDLE_DIR))
 107 
 108   jre-bundle: $(JRE_TARGET_LIST) $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib \
 109       $(BUILD_JRE_PLIST)
 110         $(SETFILE) -a B $(dir $(JRE_MACOSX_BUNDLE_DIR))
 111 
 112 else # Not macosx
 113 
 114   bundles:
 115         $(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
 116 
 117 endif # macosx
 118 
 119 .PHONY: jdk-bundle jre-bundle bundles
--- EOF ---