ecm.eclass: Set correct KFMIN default for kde-frameworks/*
[gentoo.git] / eclass / bsdmk.eclass
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @DEAD
5 # All consumers are gone.  Removal in 14 days
6
7 # @ECLASS: bsdmk.eclass
8 # @MAINTAINER:
9 # maintainer-needed@gentoo.org
10 # @BLURB: Some functions for BSDmake
11
12 inherit toolchain-funcs portability flag-o-matic
13
14 EXPORT_FUNCTIONS src_compile src_install
15
16 RDEPEND=""
17 # this should actually be BDEPEND, but this works.
18 DEPEND="virtual/pmake"
19
20 ESED="/usr/bin/sed"
21
22 # @ECLASS-VARIABLE: mymakeopts
23 # @DESCRIPTION:
24 # Options for bsd-make
25
26 # @FUNCTION: append-opt
27 # @USAGE: < options >
28 # @DESCRIPTION:
29 # append options to enable or disable features
30 append-opt() {
31         mymakeopts="${mymakeopts} $@"
32 }
33
34 # @FUNCTION: mkmake
35 # @USAGE: [ options ]
36 # @DESCRIPTION:
37 # calls bsd-make command with the given options, passing ${mymakeopts} to
38 # enable ports to useflags bridge.
39 mkmake() {
40         [[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)"
41
42         tc-export CC CXX LD RANLIB
43
44         set -- ${BMAKE} ${MAKEOPTS} ${EXTRA_EMAKE} ${mymakeopts} NO_WERROR= STRIP= "$@"
45         echo "${@}"
46         "${@}"
47 }
48
49 # @FUNCTION: mkinstall
50 # @USAGE: [ options ]
51 # @DESCRIPTION:
52 # Calls "bsd-make install" with the given options, passing ${mamakeopts} to
53 # enable ports to useflags bridge
54 mkinstall() {
55         [[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)"
56
57         # STRIP= will replace the default value of -s, leaving to portage the
58         # task of stripping executables.
59         set -- ${BMAKE} ${mymakeopts} NO_WERROR= STRIP= MANSUBDIR= DESTDIR="${D}" "$@" install
60         echo "${@}"
61         "${@}"
62 }
63
64 # @FUNCTION: dummy_mk
65 # @USAGE: < dirnames >
66 # @DESCRIPTION:
67 # removes the specified subdirectories and creates a dummy makefile in them
68 # useful to remove the need for "minimal" patches
69 dummy_mk() {
70         for dir in $@; do
71                 [ -d ${dir} ] || ewarn "dummy_mk called on a non-existing directory: $dir"
72                 [ -f ${dir}/Makefile ] || ewarn "dummy_mk called on a directory without Makefile: $dir"
73                 echo ".include <bsd.lib.mk>" > ${dir}/Makefile
74         done
75 }
76
77 # @FUNCTION: bsdmk_src_compile
78 # @DESCRIPTION:
79 # The bsdmk src_compile function, which is exported
80 bsdmk_src_compile() {
81         mkmake "$@" || die "make failed"
82 }
83
84 # @FUNCTION: bsdmk_src_install
85 # @DESCRIPTION:
86 # The bsdmk src_install function, which is exported
87 bsdmk_src_install() {
88         mkinstall "$@" || die "install failed"
89 }