prep-unpack.mk revision 6909
4194N/A#
4194N/A# CDDL HEADER START
4194N/A#
4194N/A# The contents of this file are subject to the terms of the
4194N/A# Common Development and Distribution License (the "License").
4194N/A# You may not use this file except in compliance with the License.
4194N/A#
4194N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4194N/A# or http://www.opensolaris.org/os/licensing.
4194N/A# See the License for the specific language governing permissions
4194N/A# and limitations under the License.
4194N/A#
4194N/A# When distributing Covered Code, include this CDDL HEADER in each
4194N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4194N/A# If applicable, add the following below this CDDL HEADER, with the
4194N/A# fields enclosed by brackets "[]" replaced with your own identifying
4194N/A# information: Portions Copyright [yyyy] [name of copyright owner]
4194N/A#
4194N/A# CDDL HEADER END
4194N/A#
5680N/A
5680N/A#
5475N/A# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
4194N/A#
4194N/A
4194N/AUNPACK = $(WS_TOOLS)/userland-unpack
4194N/A
4194N/A#
4194N/A# Anything that we downloaded and want to unpack must have a
6909N/A# COMPONENT_ARCHIVE{_[0-9]+} macro. Filter out a handful of
6909N/A# well-known macros that don't correspond to extra archives.
6909N/A#
6909N/APCK_SUFFIXES = $(filter-out HASH OVERRIDE SRC URL, $(subst COMPONENT_ARCHIVE_,, \
6909N/A $(filter COMPONENT_ARCHIVE_%, $(.VARIABLES))))
6909N/A
6909N/A# Templates for unpacking variables and rules. We separate the variable
6909N/A# assignments from the rules so that all the variable assignments are given a
6909N/A# chance to complete before those variables are used in targets or
6909N/A# prerequisites, where they'll be expanded immediately.
4194N/A#
6909N/A# Some components don't have an archive that we download, but host their source
6909N/A# directly in the repo, and a separate unpacking step will fail. So we don't do
6909N/A# any unpacking if COMPONENT_ARCHIVE_SRC is "none", and rely on such components
6909N/A# to set that variable specifically.
6909N/A#
6909N/A# The reason we don't condition on an empty COMPONENT_ARCHIVE is that any
6909N/A# components that rely on that being set by default by prep.mk won't have it set
6909N/A# for this conditional. It's easier to make the very few archive-less
6909N/A# components declare themselves rather than force everyone else to use
6909N/A# boilerplate code to name their archives.
6909N/Adefine unpack-variables
6909N/Aifneq ($(strip $(COMPONENT_ARCHIVE_SRC$(1))),none)
6909N/ACLEAN_PATHS += $$(COMPONENT_SRC$(1))
6909N/ASOURCE_DIR$(1) = $$(COMPONENT_SRC$(1):%=$$(COMPONENT_DIR)/%)
4194N/A
6909N/AUNPACK_STAMP$(1) = $$(SOURCE_DIR$(1):%=%/.unpacked)
6909N/Aendif
6909N/Aendef
6909N/A
4194N/Adefine unpack-rules
6909N/Aifneq ($(strip $(COMPONENT_ARCHIVE_SRC$(1))),none)
6909N/A# RUBY_VERSION is passed on to ensure userland-unpack uses the
5475N/A# correct gem command for the ruby version specified
4194N/A$$(UNPACK_STAMP$(1)): $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) download
4194N/A $$(RM) -r $$(SOURCE_DIR$(1))
5475N/A $(ENV) RUBY_VERSION=$(RUBY_VERSION) \
4194N/A $$(UNPACK) $$(UNPACK_ARGS$(1)) $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
4194N/A $$(COMPONENT_POST_UNPACK_ACTION$(1))
4194N/A $$(TOUCH) $$@
4194N/A
4194N/Aunpack:: $$(UNPACK_STAMP$(1))
4194N/A
4194N/AREQUIRED_PACKAGES += archiver/gnu-tar
4194N/AREQUIRED_PACKAGES += compress/bzip2
4194N/AREQUIRED_PACKAGES += compress/gzip
4194N/AREQUIRED_PACKAGES += compress/p7zip
4194N/AREQUIRED_PACKAGES += compress/unzip
4194N/AREQUIRED_PACKAGES += compress/xz
4951N/AREQUIRED_PACKAGES += compress/zip
5676N/AREQUIRED_PACKAGES += developer/java/jdk-8
4194N/AREQUIRED_PACKAGES += runtime/ruby
4194N/Aendif
4194N/Aendef
4194N/A
6909N/A# Evaluate the variable assignments immediately.
6909N/A$(eval $(call unpack-variables,))
6909N/A$(foreach suffix, $(PCK_SUFFIXES), $(eval $(call unpack-variables,_$(suffix))))
6909N/A
6909N/A# Put the rule evaluations in a variable for deferred evaluation.
6909N/Adefine eval-unpack-rules
4194N/A$(eval $(call unpack-rules,))
4249N/A$(foreach suffix, $(PCK_SUFFIXES), $(eval $(call unpack-rules,_$(suffix))))
6909N/Aendef