fastfetch: update to 2.30.1
[oi-userland.git] / make-rules / modulebuild.mk
blob9c8ea1b261503a393df1063ba4a1501f4f62de08
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 2022 Niklas Poslovski
26 include $(WS_MAKE_RULES)/makemaker.mk
28 COMPONENT_CONFIGURE_ARGS = --installdirs=vendor
29 $(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep
30 ($(RM) -r $(@D) ; $(MKDIR) $(@D))
31 $(ENV) $(CLONEY_ARGS) $(CLONEY) $(SOURCE_DIR) $(@D)
32 $(COMPONENT_PRE_CONFIGURE_ACTION)
33 (cd $(@D) ; $(COMPONENT_CONFIGURE_ENV) $(PERL) $(PERL_FLAGS) \
34 Build.PL $(COMPONENT_CONFIGURE_ARGS) $(CONFIGURE_OPTIONS))
35 $(COMPONENT_POST_CONFIGURE_ACTION)
36 $(TOUCH) $@
38 $(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured
39 $(COMPONENT_PRE_BUILD_ACTION)
40 (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
41 ./Build \
42 $(COMPONENT_BUILD_TARGETS))
43 $(COMPONENT_POST_BUILD_ACTION)
44 $(TOUCH) $@
46 COMPONENT_INSTALL_ARGS = --destdir="$(PROTO_DIR)"
47 COMPONENT_INSTALL_TARGETS = install
48 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
49 $(COMPONENT_PRE_INSTALL_ACTION)
50 (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) ./Build \
51 $(COMPONENT_INSTALL_TARGETS) $(COMPONENT_INSTALL_ARGS))
52 $(COMPONENT_POST_INSTALL_ACTION)
53 $(TOUCH) $@
55 # test the built source
56 $(BUILD_DIR)/%/.tested-and-compared: $(COMPONENT_TEST_DEP)
57 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
58 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
59 $(COMPONENT_PRE_TEST_ACTION)
60 -(cd $(COMPONENT_TEST_DIR) ; \
61 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
62 ./Build \
63 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
64 &> $(COMPONENT_TEST_OUTPUT)
65 $(COMPONENT_POST_TEST_ACTION)
66 $(COMPONENT_TEST_CREATE_TRANSFORMS)
67 $(COMPONENT_TEST_PERFORM_TRANSFORM)
68 $(COMPONENT_TEST_COMPARE)
69 $(COMPONENT_TEST_CLEANUP)
70 $(TOUCH) $@
72 $(BUILD_DIR)/%/.tested: SHELLOPTS=pipefail
73 $(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
74 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
75 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
76 $(COMPONENT_PRE_TEST_ACTION)
77 (cd $(COMPONENT_TEST_DIR) ; \
78 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
79 ./Build \
80 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
81 |& $(TEE) $(COMPONENT_TEST_OUTPUT)
82 $(COMPONENT_POST_TEST_ACTION)
83 $(COMPONENT_TEST_CREATE_TRANSFORMS)
84 $(COMPONENT_TEST_PERFORM_TRANSFORM)
85 $(COMPONENT_TEST_CLEANUP)
86 $(TOUCH) $@
88 # Workaround for https://github.com/Perl-Toolchain-Gang/Module-Build/issues/91.
89 # Without the workaround we would need to add library/perl-5/module-build as a
90 # required package manually to all Perl components with the modulebuild build
91 # style. We do not need the library/perl-5/module-build package to bootstrap
92 # the Module::Build module itself.
93 ifneq ($(strip $(COMPONENT_PERL_MODULE)),Module::Build)
94 USERLAND_REQUIRED_PACKAGES.perl += library/perl-5/module-build
95 endif