Bundles.gmk revision 2084:7de7decfd096
1135446Strhodes# 2135446Strhodes# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3135446Strhodes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4135446Strhodes# 5135446Strhodes# This code is free software; you can redistribute it and/or modify it 6135446Strhodes# under the terms of the GNU General Public License version 2 only, as 7135446Strhodes# published by the Free Software Foundation. Oracle designates this 8135446Strhodes# particular file as subject to the "Classpath" exception as provided 9135446Strhodes# by Oracle in the LICENSE file that accompanied this code. 10135446Strhodes# 11135446Strhodes# This code is distributed in the hope that it will be useful, but WITHOUT 12135446Strhodes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13135446Strhodes# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14135446Strhodes# version 2 for more details (a copy is included in the LICENSE file that 15135446Strhodes# accompanied this code). 16135446Strhodes# 17135446Strhodes# You should have received a copy of the GNU General Public License version 18135446Strhodes# 2 along with this work; if not, write to the Free Software Foundation, 19135446Strhodes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20135446Strhodes# 21135446Strhodes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22135446Strhodes# or visit www.oracle.com if you need additional information or have any 23135446Strhodes# questions. 24135446Strhodes# 25135446Strhodes 26135446Strhodesdefault: all 27135446Strhodes 28135446Strhodesinclude $(SPEC) 29135446Strhodesinclude MakeBase.gmk 30135446Strhodes 31135446StrhodesPRODUCT_TARGETS := 32135446StrhodesTEST_TARGETS := 33135446StrhodesDOCS_TARGETS := 34135446Strhodes 35135446Strhodes# On Windows tar frequently complains that "file changed as we read it" for 36135446Strhodes# some random source files. This seems to be cause by anti virus scanners and 37135446Strhodes# is most likely safe to ignore. When it happens, tar returns '1'. 38135446Strhodesifeq ($(OPENJDK_BUILD_OS), windows) 39135446Strhodes TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1" 40135446Strhodesendif 41135446Strhodes 42135446Strhodes# Hook to include the corresponding custom file, if present. 43135446Strhodes$(eval $(call IncludeCustomExtension, , Bundles-pre.gmk)) 44135446Strhodes################################################################################ 45135446Strhodes# BUNDLE : Name of bundle to create 46135446Strhodes# FILES : Files in BASE_DIR to add to bundle 47135446Strhodes# SPECIAL_INCLUDES : List of directories inside BASE_DIR to look for additional 48135446Strhodes# files in. These files will not get proper dependency handling. Use when 49135446Strhodes# files or directories may contain spaces. 50135446Strhodes# BASE_DIR : Base directory for the root dir in the bundle. 51135446Strhodes# SUBDIR : Optional name of root dir in bundle. 52135446StrhodesSetupBundleFile = $(NamedParamsMacroTemplate) 53135446Strhodesdefine SetupBundleFileBody 54135446Strhodes 55135446Strhodes $1_RELATIVE_FILES := $$(patsubst $$($1_BASE_DIR)/%, ./%, $$($1_FILES)) 56135446Strhodes 57135446Strhodes ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), ) 58135446Strhodes $1_TYPE := tar.gz 59135446Strhodes else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), ) 60135446Strhodes $1_TYPE := zip 61135446Strhodes else 62135446Strhodes $$(error Unknown bundle type $$($1_BUNDLE_NAME)) 63135446Strhodes endif 64135446Strhodes 65135446Strhodes $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false) 66135446Strhodes 67135446Strhodes $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES) 68135446Strhodes $$(eval $$(call ListPathsSafely, \ 69135446Strhodes $1_RELATIVE_FILES, \ 70135446Strhodes $(SUPPORT_OUTPUTDIR)/bundles/_$1_files)) 71135446Strhodes $$(call MakeDir, $$(@D)) 72135446Strhodes ifneq ($$($1_SPECIAL_INCLUDES), ) 73135446Strhodes $$(foreach i, $$($1_SPECIAL_INCLUDES), \ 74135446Strhodes ($(CD) $$($1_BASE_DIR) && $(FIND) ./$$i \ 75135446Strhodes >> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; ) 76135446Strhodes endif 77135446Strhodes ifneq ($$($1_SUBDIR), ) 78135446Strhodes ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO), tar.gz-true-false) 79135446Strhodes $(CD) $$($1_BASE_DIR) \ 80135446Strhodes && ( $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \ 81135446Strhodes --transform 's|^|$$($1_SUBDIR)/|' $(TAR_IGNORE_EXIT_VALUE) ) \ 82135446Strhodes | $(GZIP) > $$@ 83135446Strhodes else 84135446Strhodes # If a subdir has been specified, copy all files into a temporary 85135446Strhodes # location with this subdir before creating the tar file 86135446Strhodes $(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) 87135446Strhodes $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) 88135446Strhodes ( $(CD) $$($1_BASE_DIR) \ 89135446Strhodes && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \ 90135446Strhodes $(TAR_IGNORE_EXIT_VALUE) ) \ 91135446Strhodes | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - ) 92135446Strhodes # Unzip any zipped debuginfo files 93135446Strhodes ifeq ($$($1_UNZIP_DEBUGINFO), true) 94135446Strhodes for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \ 95135446Strhodes $(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \ 96135446Strhodes done 97135446Strhodes endif 98135446Strhodes ifeq ($$($1_TYPE), tar.gz) 99135446Strhodes $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \ 100135446Strhodes ( $(TAR) cf - $$($1_SUBDIR) $(TAR_IGNORE_EXIT_VALUE) ) | $(GZIP) > $$@ 101135446Strhodes else ifeq ($$($1_TYPE), zip) 102135446Strhodes $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIP) -qr $$@ . 103135446Strhodes endif 104135446Strhodes endif 105135446Strhodes else 106135446Strhodes ifeq ($$($1_TYPE), tar.gz) 107135446Strhodes $(CD) $$($1_BASE_DIR) \ 108135446Strhodes && ( $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \ 109135446Strhodes $(TAR_IGNORE_EXIT_VALUE) ) \ 110135446Strhodes | $(GZIP) > $$@ 111135446Strhodes else ifeq ($$($1_TYPE), zip) 112135446Strhodes $(CD) $$($1_BASE_DIR) \ 113135446Strhodes && $(ZIP) -qr $$@ . -i@$(SUPPORT_OUTPUTDIR)/bundles/_$1_files 114135446Strhodes endif 115135446Strhodes endif 116135446Strhodes 117135446Strhodes $1 += $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME) 118135446Strhodes 119135446Strhodesendef 120135446Strhodes 121135446Strhodes################################################################################ 122135446Strhodes 123135446Strhodes# On Macosx, we bundle up the macosx specific images which already have the 124135446Strhodes# correct base directories. 125135446Strhodesifeq ($(OPENJDK_TARGET_OS), macosx) 126135446Strhodes JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR) 127135446Strhodes JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR) 128135446Strhodes JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home 129135446Strhodes JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home 130135446Strhodes JDK_BUNDLE_SUBDIR := 131135446Strhodes JRE_BUNDLE_SUBDIR := 132135446Strhodeselse 133135446Strhodes JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR) 134135446Strhodes JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR) 135135446Strhodes JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER) 136135446Strhodes JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER) 137135446Strhodes ifneq ($(DEBUG_LEVEL), release) 138135446Strhodes JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL) 139135446Strhodes JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL) 140135446Strhodes endif 141135446Strhodesendif 142135446Strhodes 143135446Strhodes################################################################################ 144135446Strhodes 145135446Strhodesifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) 146135446Strhodes $(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR))) 147135446Strhodes 148135446Strhodes SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map 149135446Strhodes 150135446Strhodes ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR)) 151135446Strhodes 152135446Strhodes # Create special filter rules when dealing with unzipped .dSYM directories on 153135446Strhodes # macosx 154135446Strhodes ifeq ($(OPENJDK_TARGET_OS), macosx) 155135446Strhodes ifeq ($(ZIP_DEBUGINFO_FILES), false) 156135446Strhodes JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ 157135446Strhodes $(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, $(ALL_JDK_FILES)))) 158135446Strhodes endif 159135446Strhodes endif 160135446Strhodes 161135446Strhodes JDK_BUNDLE_FILES := \ 162135446Strhodes $(filter-out \ 163135446Strhodes $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ 164135446Strhodes $(JDK_EXTRA_EXCLUDES) \ 165135446Strhodes $(SYMBOLS_EXCLUDE_PATTERN) \ 166135446Strhodes $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \ 167135446Strhodes , \ 168135446Strhodes $(ALL_JDK_FILES) \ 169135446Strhodes ) 170135446Strhodes DEMOS_BUNDLE_FILES := \ 171135446Strhodes $(filter-out \ 172135446Strhodes $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ 173135446Strhodes $(SYMBOLS_EXCLUDE_PATTERN) \ 174135446Strhodes , \ 175135446Strhodes $(filter \ 176135446Strhodes $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \ 177135446Strhodes $(JDK_IMAGE_HOMEDIR)/release \ 178135446Strhodes , \ 179135446Strhodes $(ALL_JDK_FILES) \ 180135446Strhodes ) \ 181135446Strhodes ) 182135446Strhodes JDK_SYMBOLS_BUNDLE_FILES := \ 183135446Strhodes $(filter \ 184135446Strhodes $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ 185135446Strhodes $(SYMBOLS_EXCLUDE_PATTERN) \ 186135446Strhodes , \ 187135446Strhodes $(ALL_JDK_FILES) \ 188135446Strhodes ) \ 189135446Strhodes $(call CacheFind, $(SYMBOLS_IMAGE_DIR)) 190135446Strhodes 191135446Strhodes ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR)) 192135446Strhodes 193135446Strhodes # Create special filter rules when dealing with unzipped .dSYM directories on 194135446Strhodes # macosx 195135446Strhodes ifeq ($(OPENJDK_TARGET_OS), macosx) 196135446Strhodes ifeq ($(ZIP_DEBUGINFO_FILES), false) 197135446Strhodes JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ 198135446Strhodes $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES)))) 199135446Strhodes endif 200135446Strhodes endif 201135446Strhodes 202135446Strhodes JRE_BUNDLE_FILES := $(filter-out \ 203135446Strhodes $(JRE_SYMBOLS_EXCLUDE_PATTERN) \ 204135446Strhodes $(SYMBOLS_EXCLUDE_PATTERN), \ 205135446Strhodes $(ALL_JRE_FILES)) 206135446Strhodes JRE_SYMBOLS_BUNDLE_FILES := $(filter \ 207135446Strhodes $(JRE_SYMBOLS_EXCLUDE_PATTERN) \ 208135446Strhodes $(SYMBOLS_EXCLUDE_PATTERN), \ 209135446Strhodes $(ALL_JRE_FILES)) 210135446Strhodes 211135446Strhodes $(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \ 212135446Strhodes BUNDLE_NAME := $(JDK_BUNDLE_NAME), \ 213135446Strhodes FILES := $(JDK_BUNDLE_FILES), \ 214135446Strhodes SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \ 215135446Strhodes BASE_DIR := $(JDK_IMAGE_DIR), \ 216135446Strhodes SUBDIR := $(JDK_BUNDLE_SUBDIR), \ 217135446Strhodes )) 218135446Strhodes 219135446Strhodes PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE) 220135446Strhodes 221135446Strhodes $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \ 222135446Strhodes BUNDLE_NAME := $(JRE_BUNDLE_NAME), \ 223135446Strhodes FILES := $(JRE_BUNDLE_FILES), \ 224135446Strhodes BASE_DIR := $(JRE_IMAGE_DIR), \ 225135446Strhodes SUBDIR := $(JRE_BUNDLE_SUBDIR), \ 226135446Strhodes )) 227135446Strhodes 228135446Strhodes PRODUCT_TARGETS += $(BUILD_JRE_BUNDLE) 229135446Strhodes 230135446Strhodes $(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \ 231135446Strhodes BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \ 232135446Strhodes FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \ 233135446Strhodes BASE_DIR := $(JDK_IMAGE_DIR), \ 234135446Strhodes SUBDIR := $(JDK_BUNDLE_SUBDIR), \ 235135446Strhodes UNZIP_DEBUGINFO := true, \ 236135446Strhodes )) 237135446Strhodes 238135446Strhodes PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE) 239135446Strhodes 240135446Strhodes $(eval $(call SetupBundleFile, BUILD_JRE_SYMBOLS_BUNDLE, \ 241135446Strhodes BUNDLE_NAME := $(JRE_SYMBOLS_BUNDLE_NAME), \ 242135446Strhodes FILES := $(JRE_SYMBOLS_BUNDLE_FILES), \ 243135446Strhodes BASE_DIR := $(JRE_IMAGE_DIR), \ 244135446Strhodes SUBDIR := $(JRE_BUNDLE_SUBDIR), \ 245135446Strhodes UNZIP_DEBUGINFO := true, \ 246135446Strhodes )) 247135446Strhodes 248135446Strhodes PRODUCT_TARGETS += $(BUILD_JRE_SYMBOLS_BUNDLE) 249135446Strhodes 250135446Strhodes $(eval $(call SetupBundleFile, BUILD_DEMOS_BUNDLE, \ 251135446Strhodes BUNDLE_NAME := $(DEMOS_BUNDLE_NAME), \ 252135446Strhodes FILES := $(call DoubleDollar, $(DEMOS_BUNDLE_FILES)), \ 253135446Strhodes BASE_DIR := $(JDK_IMAGE_DIR), \ 254135446Strhodes SUBDIR := $(JDK_BUNDLE_SUBDIR), \ 255135446Strhodes )) 256135446Strhodes 257135446Strhodes PRODUCT_TARGETS += $(BUILD_DEMOS_BUNDLE) 258135446Strhodesendif 259135446Strhodes 260135446Strhodes################################################################################ 261135446Strhodes 262135446Strhodesifneq ($(filter test-bundles, $(MAKECMDGOALS)), ) 263135446Strhodes TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR)) 264135446Strhodes 265135446Strhodes $(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \ 266135446Strhodes BUNDLE_NAME := $(TEST_BUNDLE_NAME), \ 267135446Strhodes FILES := $(call DoubleDollar, $(TEST_BUNDLE_FILES)), \ 268135446Strhodes BASE_DIR := $(TEST_IMAGE_DIR), \ 269135446Strhodes )) 270135446Strhodes 271135446Strhodes TEST_TARGETS += $(BUILD_TEST_BUNDLE) 272135446Strhodesendif 273135446Strhodes 274135446Strhodes################################################################################ 275135446Strhodes 276135446Strhodesifneq ($(filter docs-bundles, $(MAKECMDGOALS)), ) 277135446Strhodes DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR)) 278135446Strhodes 279135446Strhodes $(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \ 280135446Strhodes BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \ 281135446Strhodes FILES := $(DOCS_BUNDLE_FILES), \ 282135446Strhodes BASE_DIR := $(DOCS_IMAGE_DIR), \ 283135446Strhodes SUBDIR := docs, \ 284135446Strhodes )) 285135446Strhodes 286135446Strhodes DOCS_TARGETS += $(BUILD_DOCS_BUNDLE) 287135446Strhodesendif 288135446Strhodes 289135446Strhodes################################################################################ 290135446Strhodes 291135446Strhodes# Hook to include the corresponding custom file, if present. 292135446Strhodes$(eval $(call IncludeCustomExtension, , Bundles.gmk)) 293135446Strhodes 294135446Strhodes################################################################################ 295135446Strhodes 296135446Strhodesproduct-bundles: $(PRODUCT_TARGETS) 297135446Strhodestest-bundles: $(TEST_TARGETS) 298135446Strhodesdocs-bundles: $(DOCS_TARGETS) 299135446Strhodes 300135446Strhodes.PHONY: all default product-bundles test-bundles docs-bundles 301135446Strhodes