make-rules/gem.mk
author Peter Schow <peter.schow@oracle.com>
Tue, 10 Mar 2015 09:04:36 -0700
branchs11-update
changeset 3954 7e6addf418e2
parent 3378 8c7eb3630145
child 3817 30b42c38bbc4
permissions -rw-r--r--
19622198 Update tmux to 1.9 20647910 tmux should ship its source manual page instead of a preformatted one
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3378
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     1
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     2
# CDDL HEADER START
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     3
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     4
# The contents of this file are subject to the terms of the
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     5
# Common Development and Distribution License (the "License").
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     6
# You may not use this file except in compliance with the License.
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     7
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     8
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     9
# or http://www.opensolaris.org/os/licensing.
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    10
# See the License for the specific language governing permissions
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    11
# and limitations under the License.
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    12
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    13
# When distributing Covered Code, include this CDDL HEADER in each
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    14
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    15
# If applicable, add the following below this CDDL HEADER, with the
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    16
# fields enclosed by brackets "[]" replaced with your own identifying
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    17
# information: Portions Copyright [yyyy] [name of copyright owner]
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    18
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    19
# CDDL HEADER END
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    20
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    21
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    22
#
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    23
GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    24
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    25
VENDOR_GEM_DIR=/usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/gems/$(RUBY_LIB_VERSION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    26
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    27
# Name of the gem spec to use.  This will typically be
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    28
# <component_name>.gemspec
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    29
GEMSPEC=$(COMPONENT_NAME).gemspec
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    30
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    31
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    32
# Some gems projects have to be built using rake
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    33
# Allow GEM build/install commands to be overwritten
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    34
# to account for possible differences
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    35
GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEMSPEC))
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    36
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    37
GEM_INSTALL_ACTION=\
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    38
	$(GEM) install -V --local --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR) \
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    39
	     --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin --force \
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    40
	     $(@D)/$(COMPONENT_ARCHIVE)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    41
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    42
$(BUILD_DIR)/%/.built:  $(SOURCE_DIR)/.prep
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    43
	$(RM) -r $(@D) ; $(MKDIR) $(@D)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    44
	$(CLONEY) $(SOURCE_DIR) $(@D)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    45
	$(COMPONENT_PRE_BUILD_ACTION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    46
	# Build the gem and cause the generation of a new gem spec
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    47
	# file in $(COMPONENT_SRC)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    48
	$(GEM_BUILD_ACTION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    49
	$(COMPONENT_POST_BUILD_ACTION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    50
	$(TOUCH) $@
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    51
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    52
$(BUILD_DIR)/%/.installed:      $(BUILD_DIR)/%/.built
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    53
	$(COMPONENT_PRE_INSTALL_ACTION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    54
	$(MKDIR) $(PROTO_DIR)/$(GEM_DIR)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    55
	# Install the new recreated gem
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    56
	$(GEM_INSTALL_ACTION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    57
	$(COMPONENT_POST_INSTALL_ACTION)
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    58
	$(TOUCH) $@
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    59
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    60
clean::
8c7eb3630145 PSARC/2014/275 Hiera 1.3.4
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    61
	$(RM) -r $(SOURCE_DIR) $(BUILD_DIR)