1 #
   2 # Copyright (c) 2011, 2019, 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 ($(call isTargetOs, macosx), true)
  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_FEATURE).$(VERSION_INTERIM)
  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   $(eval $(call SetupCopyFiles, COPY_JDK_IMAGE, \
  53       SRC := $(JDK_IMAGE_DIR), \
  54       DEST := $(JDK_MACOSX_CONTENTS_DIR)/Home, \
  55       FILES := $(call FindFiles, $(JDK_IMAGE_DIR)), \
  56   ))
  57 
  58   $(eval $(call SetupCopyFiles, COPY_JRE_IMAGE, \
  59       SRC := $(JRE_IMAGE_DIR), \
  60       DEST := $(JRE_MACOSX_CONTENTS_DIR)/Home, \
  61       FILES := $(call FindFiles, $(JRE_IMAGE_DIR)), \
  62   ))
  63 
  64   $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
  65         $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
  66         $(call MakeTargetDir)
  67         $(RM) $@
  68         $(LN) -s ../Home/lib/libjli.dylib $@
  69 
  70   $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
  71         $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
  72         $(call MakeTargetDir)
  73         $(RM) $@
  74         $(LN) -s ../Home/lib/libjli.dylib $@
  75 
  76   $(eval $(call SetupTextFileProcessing, BUILD_JDK_PLIST, \
  77       SOURCE_FILES := $(MACOSX_PLIST_SRC)/JDK-Info.plist, \
  78       OUTPUT_FILE := $(JDK_MACOSX_CONTENTS_DIR)/Info.plist, \
  79       REPLACEMENTS := \
  80           @@ID@@ => $(BUNDLE_ID).jdk ; \
  81           @@NAME@@ => $(BUNDLE_NAME) ; \
  82           @@INFO@@ => $(BUNDLE_INFO) ; \
  83           @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
  84           @@VERSION@@ => $(BUNDLE_VERSION) ; \
  85           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
  86   ))
  87 
  88   $(eval $(call SetupTextFileProcessing, BUILD_JRE_PLIST, \
  89       SOURCE_FILES := $(MACOSX_PLIST_SRC)/JRE-Info.plist, \
  90       OUTPUT_FILE := $(JRE_MACOSX_CONTENTS_DIR)/Info.plist, \
  91       REPLACEMENTS := \
  92           @@ID@@ => $(BUNDLE_ID).jre ; \
  93           @@NAME@@ => $(BUNDLE_NAME) ; \
  94           @@INFO@@ => $(BUNDLE_INFO) ; \
  95           @@PLATFORM_VERSION@@ => $(BUNDLE_PLATFORM_VERSION) ; \
  96           @@VERSION@@ => $(BUNDLE_VERSION) ; \
  97           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
  98   ))
  99 
 100   jdk-bundle: $(COPY_JDK_IMAGE) $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
 101       $(BUILD_JDK_PLIST)
 102         $(SETFILE) -a B $(dir $(JDK_MACOSX_CONTENTS_DIR))
 103 
 104   jre-bundle: $(COPY_JRE_IMAGE) $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
 105       $(BUILD_JRE_PLIST)
 106         $(SETFILE) -a B $(dir $(JRE_MACOSX_CONTENTS_DIR))
 107 
 108 else # Not macosx
 109 
 110   bundles:
 111         $(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
 112 
 113 endif # macosx
 114 
 115 .PHONY: jdk-bundle jre-bundle bundles