make-rules/gem.mk
branchs11u2-sru
changeset 3385 cb76431f36d7
child 3817 30b42c38bbc4
equal deleted inserted replaced
3384:1c6fb0717458 3385:cb76431f36d7
       
     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) 2014, Oracle and/or its affiliates. All rights reserved.
       
    22 #
       
    23 GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem
       
    24 
       
    25 VENDOR_GEM_DIR=/usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/gems/$(RUBY_LIB_VERSION)
       
    26 
       
    27 # Name of the gem spec to use.  This will typically be
       
    28 # <component_name>.gemspec
       
    29 GEMSPEC=$(COMPONENT_NAME).gemspec
       
    30 
       
    31 
       
    32 # Some gems projects have to be built using rake
       
    33 # Allow GEM build/install commands to be overwritten
       
    34 # to account for possible differences
       
    35 GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEMSPEC))
       
    36 
       
    37 GEM_INSTALL_ACTION=\
       
    38 	$(GEM) install -V --local --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR) \
       
    39 	     --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin --force \
       
    40 	     $(@D)/$(COMPONENT_ARCHIVE)
       
    41 
       
    42 $(BUILD_DIR)/%/.built:  $(SOURCE_DIR)/.prep
       
    43 	$(RM) -r $(@D) ; $(MKDIR) $(@D)
       
    44 	$(CLONEY) $(SOURCE_DIR) $(@D)
       
    45 	$(COMPONENT_PRE_BUILD_ACTION)
       
    46 	# Build the gem and cause the generation of a new gem spec
       
    47 	# file in $(COMPONENT_SRC)
       
    48 	$(GEM_BUILD_ACTION)
       
    49 	$(COMPONENT_POST_BUILD_ACTION)
       
    50 	$(TOUCH) [email protected]
       
    51 
       
    52 $(BUILD_DIR)/%/.installed:      $(BUILD_DIR)/%/.built
       
    53 	$(COMPONENT_PRE_INSTALL_ACTION)
       
    54 	$(MKDIR) $(PROTO_DIR)/$(GEM_DIR)
       
    55 	# Install the new recreated gem
       
    56 	$(GEM_INSTALL_ACTION)
       
    57 	$(COMPONENT_POST_INSTALL_ACTION)
       
    58 	$(TOUCH) [email protected]
       
    59 
       
    60 clean::
       
    61 	$(RM) -r $(SOURCE_DIR) $(BUILD_DIR)