make-rules/prep-unpack.mk
changeset 4196 d697072a92f5
child 4251 2bf7e2c1ca74
equal deleted inserted replaced
4195:d88c5d15a4af 4196:d697072a92f5
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
       
    22 #
       
    23 
       
    24 UNPACK =		$(WS_TOOLS)/userland-unpack
       
    25 
       
    26 #
       
    27 # Anything that we downloaded and want to unpack must have a
       
    28 # COMPONENT_ARCHIVE{_[0-9]+} macro.
       
    29 #
       
    30 TMP_SUFFIXES = $(subst COMPONENT_ARCHIVE_,, \
       
    31                 $(filter COMPONENT_ARCHIVE_%, $(.VARIABLES)))
       
    32 
       
    33 # Template for unpacking rules.
       
    34 define unpack-rules
       
    35 ifdef COMPONENT_ARCHIVE$(1)
       
    36 ifdef COMPONENT_SRC$(1)
       
    37 
       
    38 CLEAN_PATHS += $$(COMPONENT_SRC$(1))
       
    39 SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
       
    40 
       
    41 UNPACK_STAMP$(1) =	$$(SOURCE_DIR$(1))/.unpacked
       
    42 
       
    43 $$(UNPACK_STAMP$(1)):	$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) download
       
    44 	$$(RM) -r $$(SOURCE_DIR$(1))
       
    45 	$$(UNPACK) $$(UNPACK_ARGS$(1)) $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
       
    46 	$$(COMPONENT_POST_UNPACK_ACTION$(1))
       
    47 	$$(TOUCH) $$@
       
    48 
       
    49 unpack::	$$(UNPACK_STAMP$(1))
       
    50 
       
    51 REQUIRED_PACKAGES += archiver/gnu-tar
       
    52 REQUIRED_PACKAGES += compress/bzip2
       
    53 REQUIRED_PACKAGES += compress/gzip
       
    54 REQUIRED_PACKAGES += compress/p7zip
       
    55 REQUIRED_PACKAGES += compress/unzip
       
    56 REQUIRED_PACKAGES += compress/xz
       
    57 REQUIRED_PACKAGES += developer/java/jdk
       
    58 REQUIRED_PACKAGES += runtime/ruby
       
    59 
       
    60 endif
       
    61 endif
       
    62 endef
       
    63 
       
    64 #
       
    65 # Define the rules required to download any source archives and augment any
       
    66 # cleanup macros.
       
    67 #
       
    68 $(eval $(call unpack-rules,))
       
    69 $(foreach suffix, $(TMP_SUFFIXES), $(eval $(call unpack-rules,_$(suffix))))