1 #
   2 # Copyright (c) 2011, 2016, 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 include TextFileProcessing.gmk
  29 
  30 default: bundles
  31 
  32 # Only macosx has bundles defined.
  33 ifeq ($(OPENJDK_TARGET_OS), macosx)
  34 
  35   bundles: jre-bundle jdk-bundle
  36 
  37   # JDK_MACOSX_CONTENTS_DIR and JRE_MACOSX_CONTENTS_DIR are defined in SPEC.
  38 
  39   MACOSX_PLIST_SRC := $(TOPDIR)/make/data/bundle
  40 
  41   BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(VERSION_SHORT)
  42   BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_SHORT)
  43   BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_STRING)
  44   BUNDLE_PLATFORM_VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
  45   BUNDLE_VERSION := $(VERSION_NUMBER)
  46   ifeq ($(COMPANY_NAME), N/A)
  47     BUNDLE_VENDOR := UNDEFINED
  48   else
  49     BUNDLE_VENDOR := $(COMPANY_NAME)
  50   endif
  51 
  52   # Ideally the prerequisites of these two rules should be all files in the src
  53   # dir, but running find over all of them takes unnecessary time, and more
  54   # importantly, there may be files with spaces in the names which are very
  55   # tricky to handle in make.
  56   $(JDK_MACOSX_CONTENTS_DIR)/Home/bin/java: $(JDK_IMAGE_DIR)/bin/java
  57         $(call LogInfo, Copying $(JDK_MACOSX_CONTENTS_DIR)/Home)
  58         $(call MakeDir, $(JDK_MACOSX_CONTENTS_DIR)/Home)
  59         $(CP) -f -R -P $(JDK_IMAGE_DIR)/. $(JDK_MACOSX_CONTENTS_DIR)/Home/
  60 
  61   $(JRE_MACOSX_CONTENTS_DIR)/Home/bin/java: $(JRE_IMAGE_DIR)/bin/java
  62         $(call LogInfo, Copying $(JRE_MACOSX_CONTENTS_DIR)/Home)
  63         $(call MakeDir, $(JRE_MACOSX_CONTENTS_DIR)/Home)
  64         $(CP) -f -R -P $(JRE_IMAGE_DIR)/. $(JRE_MACOSX_CONTENTS_DIR)/Home/
  65 
  66   $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
  67         $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
  68         $(MKDIR) -p $(@D)
  69         $(RM) $@
  70         $(LN) -s ../Home/lib/jli/libjli.dylib $@
  71 
  72   $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
  73         $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
  74         $(MKDIR) -p $(@D)
  75         $(RM) $@
  76         $(LN) -s ../Home/lib/jli/libjli.dylib $@
  77 
  78   $(eval $(call SetupTextFileProcessing, BUILD_JDK_PLIST, \
  79       SOURCE_FILES := $(MACOSX_PLIST_SRC)/JDK-Info.plist, \
  80       OUTPUT_FILE := $(JDK_MACOSX_CONTENTS_DIR)/Info.plist, \
  81       REPLACEMENTS := \
  82           @@ID@@ => $(BUNDLE_ID).jdk ; \
  83           @@NAME@@ => $(BUNDLE_NAME) ; \
  84           @@INFO@@ => $(BUNDLE_INFO) ; \
  85           @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
  86           @@VERSION@@ => $(BUNDLE_VERSION) ; \
  87           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
  88   ))
  89 
  90   $(eval $(call SetupTextFileProcessing, BUILD_JRE_PLIST, \
  91       SOURCE_FILES := $(MACOSX_PLIST_SRC)/JRE-Info.plist, \
  92       OUTPUT_FILE := $(JRE_MACOSX_CONTENTS_DIR)/Info.plist, \
  93       REPLACEMENTS := \
  94           @@ID@@ => $(BUNDLE_ID).jre ; \
  95           @@NAME@@ => $(BUNDLE_NAME) ; \
  96           @@INFO@@ => $(BUNDLE_INFO) ; \
  97           @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
  98           @@VERSION@@ => $(BUNDLE_VERSION) ; \
  99           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
 100   ))
 101 
 102   jdk-bundle: $(JDK_MACOSX_CONTENTS_DIR)/Home/bin/java \
 103       $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
 104       $(BUILD_JDK_PLIST)
 105         $(SETFILE) -a B $(dir $(JDK_MACOSX_CONTENTS_DIR))
 106 
 107   jre-bundle: $(JRE_MACOSX_CONTENTS_DIR)/Home/bin/java \
 108       $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
 109       $(BUILD_JRE_PLIST)
 110         $(SETFILE) -a B $(dir $(JRE_MACOSX_CONTENTS_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