| 1 |
# Copyright 1999-2004 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/bsdmk.eclass,v 1.5 2006/04/25 16:35:47 flameeyes Exp $ |
| 4 |
# |
| 5 |
# Otavio R. Piske "AngusYoung" <angusyoung@gentoo.org> |
| 6 |
# Diego Pettenò <flameeyes@gentoo.org> |
| 7 |
# Benigno B. Junior <bbj@gentoo.org> |
| 8 |
|
| 9 |
inherit toolchain-funcs portability flag-o-matic |
| 10 |
|
| 11 |
EXPORT_FUNCTIONS src_compile src_install |
| 12 |
|
| 13 |
RDEPEND="" |
| 14 |
# this should actually be BDEPEND, but this works. |
| 15 |
DEPEND="virtual/pmake" |
| 16 |
|
| 17 |
ESED="/usr/bin/sed" |
| 18 |
|
| 19 |
#### append-opt <options> |
| 20 |
# append options to enable or disable features |
| 21 |
# |
| 22 |
########################################################################### |
| 23 |
append-opt() { |
| 24 |
mymakeopts="${mymakeopts} $@" |
| 25 |
} |
| 26 |
|
| 27 |
#### mkmake <options> |
| 28 |
# calls bsd-make command with the given options, passing ${mymakeopts} to |
| 29 |
# enable ports to useflags bridge. |
| 30 |
# |
| 31 |
########################################################################### |
| 32 |
mkmake() { |
| 33 |
[[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)" |
| 34 |
|
| 35 |
tc-export CC CXX LD RANLIB |
| 36 |
|
| 37 |
${BMAKE} ${MAKEOPTS} ${EXTRA_EMAKE} ${mymakeopts} NO_WERROR= STRIP= "$@" |
| 38 |
} |
| 39 |
|
| 40 |
mkinstall() { |
| 41 |
[[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)" |
| 42 |
|
| 43 |
# STRIP= will replace the default value of -s, leaving to portage the |
| 44 |
# task of stripping executables. |
| 45 |
${BMAKE} ${mymakeopts} NO_WERROR= STRIP= DESTDIR="${D}" "$@" install |
| 46 |
} |
| 47 |
|
| 48 |
#### dummy_mk <dirnames> |
| 49 |
# removes the specified subdirectories and creates a dummy makefile in them |
| 50 |
# useful to remove the need for "minimal" patches |
| 51 |
# |
| 52 |
############################################################################ |
| 53 |
dummy_mk() { |
| 54 |
for dir in $@; do |
| 55 |
echo ".include <bsd.lib.mk>" > ${dir}/Makefile |
| 56 |
done |
| 57 |
} |
| 58 |
|
| 59 |
#### fix_lazy_bindings <dirnames> |
| 60 |
# set LDFLAGS in order to fix lazy binding warnings in binaries |
| 61 |
# |
| 62 |
############################################################################ |
| 63 |
fix_lazy_bindings() { |
| 64 |
for dir in $@; do |
| 65 |
echo "LDFLAGS+= $(bindnow-flags)" >> ${dir}/Makefile |
| 66 |
done |
| 67 |
} |
| 68 |
|
| 69 |
bsdmk_src_compile() { |
| 70 |
mkmake || die "make failed" |
| 71 |
} |
| 72 |
|
| 73 |
bsdmk_src_install() { |
| 74 |
mkinstall || die "install failed" |
| 75 |
} |