jdk/makefiles/Bundles.gmk
changeset 14231 a0c23c1c010f
child 15129 38c7422a92ff
equal deleted inserted replaced
14104:8d9d430b4244 14231:a0c23c1c010f
       
     1 #
       
     2 # Copyright (c) 2011, 2012, 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 
       
    37 JDK_BUNDLE_DIR := $(IMAGES_OUTPUTDIR)/j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
       
    38 JRE_BUNDLE_DIR := $(IMAGES_OUTPUTDIR)/j2re-bundle/jre$(JDK_VERSION).jre/Contents
       
    39 
       
    40 MACOSX_SRC := $(JDK_TOPDIR)/src/macosx
       
    41 
       
    42 # All these OPENJDK checks are needed since there is no coherency between
       
    43 # these values in open and closed. Should probably be fixed.
       
    44 ifndef OPENJDK
       
    45     BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
       
    46 else
       
    47     BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
       
    48 endif
       
    49 BUNDLE_ID_JRE := $(BUNDLE_ID).jre
       
    50 BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
       
    51 
       
    52 BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
       
    53 BUNDLE_NAME_JRE := $(BUNDLE_NAME)
       
    54 BUNDLE_NAME_JDK := $(BUNDLE_NAME)
       
    55 
       
    56 ifndef OPENJDK
       
    57     BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
       
    58 else
       
    59     BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
       
    60 endif
       
    61 BUNDLE_INFO_JRE := $(BUNDLE_INFO)
       
    62 BUNDLE_INFO_JDK := $(BUNDLE_INFO)
       
    63 
       
    64 BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
       
    65 BUNDLE_VERSION := $(JDK_VERSION)
       
    66 ifeq ($(COMPANY_NAME),N/A)
       
    67     BUNDLE_VENDOR := UNDEFINED
       
    68 else
       
    69     BUNDLE_VENDOR := $(COMPANY_NAME)
       
    70 endif
       
    71 
       
    72 
       
    73 JDK_FILE_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/j2sdk-image ! -type d)
       
    74 JRE_FILE_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/j2re-image ! -type d)
       
    75 
       
    76 JDK_TARGET_LIST := $(subst $(IMAGES_OUTPUTDIR)/j2sdk-image,$(JDK_BUNDLE_DIR)/Home,$(JDK_FILE_LIST))
       
    77 JRE_TARGET_LIST := $(subst $(IMAGES_OUTPUTDIR)/j2re-image,$(JRE_BUNDLE_DIR)/Home,$(JRE_FILE_LIST))
       
    78 
       
    79 # The old builds implementation of this did not preserve symlinks so
       
    80 # make sure they are followed and the contents copied instead.
       
    81 # To fix this, just replace copy with install-file macro.
       
    82 $(JDK_BUNDLE_DIR)/Home/%: $(IMAGES_OUTPUTDIR)/j2sdk-image/%
       
    83 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
       
    84 	$(MKDIR) -p $(@D)
       
    85 	$(CP) -f -R -L '$<' '$@'
       
    86 
       
    87 $(JRE_BUNDLE_DIR)/Home/%: $(IMAGES_OUTPUTDIR)/j2re-image/%
       
    88 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
       
    89 	$(MKDIR) -p $(@D)
       
    90 	$(CP) -f -R -L '$<' '$@'
       
    91 
       
    92 $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
       
    93 	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
       
    94 	$(MKDIR) -p $(@D)
       
    95 	$(RM) $@
       
    96 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
       
    97 
       
    98 $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
       
    99 	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
       
   100 	$(MKDIR) -p $(@D)
       
   101 	$(RM) $@
       
   102 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
       
   103 
       
   104 $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
       
   105 	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
       
   106 	$(MKDIR) -p $(@D)
       
   107 	$(SED)  -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
       
   108 		-e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
       
   109 		-e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
       
   110 		-e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
       
   111 		-e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
       
   112 		-e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
       
   113 		< $(MACOSX_SRC)/bundle/JDK-Info.plist > $@
       
   114 
       
   115 $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
       
   116 	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
       
   117 	$(MKDIR) -p $(@D)
       
   118 	$(SED)  -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
       
   119 		-e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
       
   120 		-e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
       
   121 		-e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
       
   122 		-e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
       
   123 		-e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
       
   124 		< $(MACOSX_SRC)/bundle/JRE-Info.plist > $@
       
   125 
       
   126 jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
       
   127 		$(JDK_BUNDLE_DIR)/Info.plist
       
   128 	$(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
       
   129 
       
   130 jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
       
   131 		$(JRE_BUNDLE_DIR)/Info.plist
       
   132 	$(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
       
   133 
       
   134 else # Not macosx
       
   135 
       
   136 bundles:
       
   137 	$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
       
   138 
       
   139 endif # macosx
       
   140 
       
   141 .PHONY: jdk-bundle jre-bundle bundles