Add pymongo 3.4.0
[unleashed-userland.git] / make-rules / gem.mk
blob67107c27a097bb9b5c4c9333ef262c83961bad8d
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
23 # Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
25 GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem
27 VENDOR_GEM_DIR=/usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/gems/$(RUBY_LIB_VERSION)
29 # Name of the gem spec to use. This will typically be
30 # <component_name>.gemspec
31 GEMSPEC=$(COMPONENT_NAME).gemspec
34 # Some gems projects have to be built using rake
35 # Allow GEM build/install commands to be overwritten
36 # to account for possible differences
37 GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEM_BUILD_ARGS) $(GEMSPEC))
39 # Build install args in a more readable fashion
40 ifeq ($(firstword $(subst .,$(space),$(RUBY_VERSION))),2)
41 # gem install 2.x does docs differently. Continue to generate both types
42 GEM_INSTALL_ARGS += --document rdoc,ri
43 endif
45 GEM_INSTALL_ARGS += -V --local --force
46 GEM_INSTALL_ARGS += --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR)
47 GEM_INSTALL_ARGS += --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin
49 # cd into build directory
50 # gem 2.2.3 uses .gem from the cwd ignoring command line .gem file
51 # gem 1.8.23.2 uses command line .gem file OR .gem from cwd
52 GEM_INSTALL_ACTION= (cd $(@D); $(GEM) install $(GEM_INSTALL_ARGS) $(COMPONENT_NAME))
55 $(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep
56 $(RM) -r $(@D) ; $(MKDIR) $(@D)
57 $(GTAR) -C $(SOURCE_DIR) -cpf - . | $(GTAR) -C $(@D) -xpf -
58 $(COMPONENT_PRE_BUILD_ACTION)
59 # Build the gem and cause the generation of a new gem spec
60 # file in $(COMPONENT_SRC)
61 $(GEM_BUILD_ACTION)
62 $(COMPONENT_POST_BUILD_ACTION)
63 $(TOUCH) $@
65 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
66 $(COMPONENT_PRE_INSTALL_ACTION)
67 $(MKDIR) $(PROTO_DIR)/$(GEM_DIR)
68 # Install the new recreated gem
69 $(GEM_INSTALL_ACTION)
70 $(COMPONENT_POST_INSTALL_ACTION)
71 $(TOUCH) $@
73 COMPONENT_TEST_TARGETS =
75 # Test the built source. If the output file shows up in the environment or
76 # arguments, don't redirect stdout/stderr to it.
77 $(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
78 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
79 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
80 $(COMPONENT_PRE_TEST_ACTION)
81 -(cd $(COMPONENT_TEST_DIR) ; \
82 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
83 $(COMPONENT_TEST_CMD) \
84 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
85 $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
86 $(COMPONENT_POST_TEST_ACTION)
87 $(COMPONENT_TEST_CREATE_TRANSFORMS)
88 $(COMPONENT_TEST_PERFORM_TRANSFORM)
89 $(COMPONENT_TEST_COMPARE)
90 $(COMPONENT_TEST_CLEANUP)
91 $(TOUCH) $@
94 $(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
95 $(COMPONENT_PRE_TEST_ACTION)
96 (cd $(COMPONENT_TEST_DIR) ; \
97 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
98 $(COMPONENT_TEST_CMD) \
99 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
100 $(COMPONENT_POST_TEST_ACTION)
101 $(COMPONENT_TEST_CLEANUP)
102 $(TOUCH) $@
104 clean::
105 $(RM) -r $(SOURCE_DIR) $(BUILD_DIR)
107 REQUIRED_PACKAGES += runtime/ruby