| 1 |
aballier |
1.9 |
# Copyright 1999-2008 Gentoo Foundation |
| 2 |
flameeyes |
1.1 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
aballier |
1.10 |
# $Header: /var/cvsroot/gentoo-x86/eclass/bsdmk.eclass,v 1.9 2008/08/08 21:16:24 aballier Exp $ |
| 4 |
aballier |
1.9 |
|
| 5 |
|
|
# @ECLASS: bsdmk.eclass |
| 6 |
|
|
# @MAINTAINER: |
| 7 |
flameeyes |
1.1 |
# Otavio R. Piske "AngusYoung" <angusyoung@gentoo.org> |
| 8 |
|
|
# Diego Pettenò <flameeyes@gentoo.org> |
| 9 |
|
|
# Benigno B. Junior <bbj@gentoo.org> |
| 10 |
aballier |
1.9 |
# @BLURB: Some functions for BSDmake |
| 11 |
flameeyes |
1.1 |
|
| 12 |
flameeyes |
1.2 |
inherit toolchain-funcs portability flag-o-matic |
| 13 |
flameeyes |
1.1 |
|
| 14 |
|
|
EXPORT_FUNCTIONS src_compile src_install |
| 15 |
|
|
|
| 16 |
flameeyes |
1.2 |
RDEPEND="" |
| 17 |
flameeyes |
1.1 |
# this should actually be BDEPEND, but this works. |
| 18 |
flameeyes |
1.5 |
DEPEND="virtual/pmake" |
| 19 |
flameeyes |
1.1 |
|
| 20 |
flameeyes |
1.4 |
ESED="/usr/bin/sed" |
| 21 |
|
|
|
| 22 |
aballier |
1.9 |
# @ECLASS-VARIABLE: mymakeopts |
| 23 |
|
|
# @DESCRIPTION: |
| 24 |
|
|
# Options for bsd-make |
| 25 |
|
|
|
| 26 |
|
|
# @FUNCTION: append-opt |
| 27 |
|
|
# @USAGE: < options > |
| 28 |
|
|
# @DESCRIPTION: |
| 29 |
flameeyes |
1.1 |
# append options to enable or disable features |
| 30 |
|
|
append-opt() { |
| 31 |
|
|
mymakeopts="${mymakeopts} $@" |
| 32 |
|
|
} |
| 33 |
|
|
|
| 34 |
aballier |
1.9 |
# @FUNCTION: mkmake |
| 35 |
|
|
# @USAGE: [ options ] |
| 36 |
|
|
# @DESCRIPTION: |
| 37 |
flameeyes |
1.1 |
# 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 |
flameeyes |
1.6 |
${BMAKE} ${MAKEOPTS} ${EXTRA_EMAKE} ${mymakeopts} NO_WERROR= STRIP= "$@" |
| 45 |
flameeyes |
1.1 |
} |
| 46 |
|
|
|
| 47 |
aballier |
1.9 |
# @FUNCTION: mkinstall |
| 48 |
|
|
# @USAGE: [ options ] |
| 49 |
|
|
# @DESCRIPTION: |
| 50 |
|
|
# Calls "bsd-make install" with the given options, passing ${mamakeopts} to |
| 51 |
|
|
# enable ports to useflags bridge |
| 52 |
flameeyes |
1.1 |
mkinstall() { |
| 53 |
|
|
[[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)" |
| 54 |
|
|
|
| 55 |
flameeyes |
1.6 |
# STRIP= will replace the default value of -s, leaving to portage the |
| 56 |
|
|
# task of stripping executables. |
| 57 |
flameeyes |
1.7 |
${BMAKE} ${mymakeopts} NO_WERROR= STRIP= MANSUBDIR= DESTDIR="${D}" "$@" install |
| 58 |
flameeyes |
1.1 |
} |
| 59 |
|
|
|
| 60 |
aballier |
1.9 |
# @FUNCTION: dummy_mk |
| 61 |
|
|
# @USAGE: < dirnames > |
| 62 |
|
|
# @DESCRIPTION: |
| 63 |
flameeyes |
1.1 |
# removes the specified subdirectories and creates a dummy makefile in them |
| 64 |
|
|
# useful to remove the need for "minimal" patches |
| 65 |
|
|
dummy_mk() { |
| 66 |
|
|
for dir in $@; do |
| 67 |
aballier |
1.10 |
[ -d ${dir} ] || ewarn "dummy_mk called on a non-existing directory: $dir" |
| 68 |
|
|
[ -f ${dir}/Makefile ] || ewarn "dummy_mk called on a directory without Makefile: $dir" |
| 69 |
flameeyes |
1.1 |
echo ".include <bsd.lib.mk>" > ${dir}/Makefile |
| 70 |
|
|
done |
| 71 |
|
|
} |
| 72 |
|
|
|
| 73 |
aballier |
1.9 |
# @FUNCTION: bsdmk_src_compile |
| 74 |
|
|
# @DESCRIPTION: |
| 75 |
|
|
# The bsdmk src_compile function, which is exported |
| 76 |
flameeyes |
1.1 |
bsdmk_src_compile() { |
| 77 |
|
|
mkmake || die "make failed" |
| 78 |
|
|
} |
| 79 |
|
|
|
| 80 |
aballier |
1.9 |
# @FUNCTION: bsdmk_src_install |
| 81 |
|
|
# @DESCRIPTION: |
| 82 |
|
|
# The bsdmk src_install function, which is exported |
| 83 |
flameeyes |
1.1 |
bsdmk_src_install() { |
| 84 |
|
|
mkinstall || die "install failed" |
| 85 |
|
|
} |