Andreas Wacknitz
2024-04-05 2196154aaaa4f9e57ba4e7c886275d1cd18d7490
commit | author | age
18b823 1 #
AP 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 #
dab0d0 21 .NOTPARALLEL:
1e5ead 22
AP 23 #
24 # Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
18b823 25 #
AP 26 GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem
27
28 VENDOR_GEM_DIR=/usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/gems/$(RUBY_LIB_VERSION)
29
30 # Name of the gem spec to use.  This will typically be
31 # <component_name>.gemspec
32 GEMSPEC=$(COMPONENT_NAME).gemspec
33
34
35 # Some gems projects have to be built using rake
36 # Allow GEM build/install commands to be overwritten
37 # to account for possible differences
1e5ead 38 GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEM_BUILD_ARGS) $(GEMSPEC))
18b823 39
1e5ead 40 # Build install args in a more readable fashion
AP 41 ifeq ($(firstword $(subst .,$(space),$(RUBY_VERSION))),2)
42 # gem install 2.x does docs differently. Continue to generate both types
43 GEM_INSTALL_ARGS += --document rdoc,ri
44 endif
45
46 GEM_INSTALL_ARGS += -V --local --force
47 GEM_INSTALL_ARGS += --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR)
48 GEM_INSTALL_ARGS += --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin
49
50 # cd into build directory
51 # gem 2.2.3 uses .gem from the cwd ignoring command line .gem file
52 # gem 1.8.23.2 uses command line .gem file OR .gem from cwd
53 GEM_INSTALL_ACTION= (cd $(@D); $(GEM) install $(GEM_INSTALL_ARGS) $(COMPONENT_NAME))
54
18b823 55
AP 56 $(BUILD_DIR)/%/.built:  $(SOURCE_DIR)/.prep
57     $(RM) -r $(@D) ; $(MKDIR) $(@D)
1e5ead 58     $(GTAR) -C $(SOURCE_DIR) -cpf - . | $(GTAR) -C $(@D) -xpf -
18b823 59     $(COMPONENT_PRE_BUILD_ACTION)
AP 60     # Build the gem and cause the generation of a new gem spec
61     # file in $(COMPONENT_SRC)
62     $(GEM_BUILD_ACTION)
63     $(COMPONENT_POST_BUILD_ACTION)
64     $(TOUCH) $@
65
66 $(BUILD_DIR)/%/.installed:      $(BUILD_DIR)/%/.built
67     $(COMPONENT_PRE_INSTALL_ACTION)
68     $(MKDIR) $(PROTO_DIR)/$(GEM_DIR)
69     # Install the new recreated gem
70     $(GEM_INSTALL_ACTION)
71     $(COMPONENT_POST_INSTALL_ACTION)
72     $(TOUCH) $@
73
1e5ead 74 COMPONENT_TEST_TARGETS =
AP 75
76 # Test the built source.  If the output file shows up in the environment or
77 # arguments, don't redirect stdout/stderr to it.
b6799e 78 $(BUILD_DIR)/%/.tested-and-compared:    $(COMPONENT_TEST_DEP)
1e5ead 79     $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
AP 80     $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
81     $(COMPONENT_PRE_TEST_ACTION)
82     -(cd $(COMPONENT_TEST_DIR) ; \
83         $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
84         $(COMPONENT_TEST_CMD) \
85         $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
86         $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
87     $(COMPONENT_POST_TEST_ACTION)
88     $(COMPONENT_TEST_CREATE_TRANSFORMS)
89     $(COMPONENT_TEST_PERFORM_TRANSFORM)
90     $(COMPONENT_TEST_COMPARE)
91     $(COMPONENT_TEST_CLEANUP)
92     $(TOUCH) $@
93
94
89aae0 95 $(BUILD_DIR)/%/.tested:    SHELLOPTS=pipefail
1e5ead 96 $(BUILD_DIR)/%/.tested:    $(COMPONENT_TEST_DEP)
89aae0 97     $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
MT 98     $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
1e5ead 99     $(COMPONENT_PRE_TEST_ACTION)
AP 100     (cd $(COMPONENT_TEST_DIR) ; \
101         $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
102         $(COMPONENT_TEST_CMD) \
89aae0 103         $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
MT 104         $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,|& $(TEE) $(COMPONENT_TEST_OUTPUT))
1e5ead 105     $(COMPONENT_POST_TEST_ACTION)
89aae0 106     $(COMPONENT_TEST_CREATE_TRANSFORMS)
MT 107     $(COMPONENT_TEST_PERFORM_TRANSFORM)
1e5ead 108     $(COMPONENT_TEST_CLEANUP)
AP 109     $(TOUCH) $@
110
18b823 111 clean::
AP 112     $(RM) -r $(SOURCE_DIR) $(BUILD_DIR)
1e5ead 113
1349f8 114 USERLAND_REQUIRED_PACKAGES += runtime/ruby