| 1 |
# Copyright 1999-2011 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/freebsd.eclass,v 1.22 2012/05/24 11:18:46 aballier Exp $ |
| 4 |
# |
| 5 |
# Diego Pettenò <flameeyes@gentoo.org> |
| 6 |
|
| 7 |
inherit versionator eutils flag-o-matic bsdmk |
| 8 |
|
| 9 |
LICENSE="BSD" |
| 10 |
HOMEPAGE="http://www.freebsd.org/" |
| 11 |
|
| 12 |
# Define global package names |
| 13 |
LIB="freebsd-lib-${PV}" |
| 14 |
BIN="freebsd-bin-${PV}" |
| 15 |
CONTRIB="freebsd-contrib-${PV}" |
| 16 |
SHARE="freebsd-share-${PV}" |
| 17 |
UBIN="freebsd-ubin-${PV}" |
| 18 |
USBIN="freebsd-usbin-${PV}" |
| 19 |
CRYPTO="freebsd-crypto-${PV}" |
| 20 |
LIBEXEC="freebsd-libexec-${PV}" |
| 21 |
SBIN="freebsd-sbin-${PV}" |
| 22 |
GNU="freebsd-gnu-${PV}" |
| 23 |
ETC="freebsd-etc-${PV}" |
| 24 |
SYS="freebsd-sys-${PV}" |
| 25 |
INCLUDE="freebsd-include-${PV}" |
| 26 |
RESCUE="freebsd-rescue-${PV}" |
| 27 |
CDDL="freebsd-cddl-${PV}" |
| 28 |
|
| 29 |
# Release version (5.3, 5.4, 6.0, etc) |
| 30 |
RV="$(get_version_component_range 1-2)" |
| 31 |
|
| 32 |
if [[ ${PN} != "freebsd-share" ]] && [[ ${PN} != freebsd-sources ]]; then |
| 33 |
IUSE="profile" |
| 34 |
fi |
| 35 |
|
| 36 |
#unalias -a |
| 37 |
alias install-info='/usr/bin/bsdinstall-info' |
| 38 |
|
| 39 |
EXPORT_FUNCTIONS src_compile src_install src_unpack |
| 40 |
|
| 41 |
# doperiodic <kind> <file> ... |
| 42 |
doperiodic() { |
| 43 |
local kind=$1 |
| 44 |
shift |
| 45 |
|
| 46 |
( # dont want to pollute calling env |
| 47 |
insinto /etc/periodic/${kind} |
| 48 |
insopts -m 0755 |
| 49 |
doins "$@" |
| 50 |
) |
| 51 |
} |
| 52 |
|
| 53 |
freebsd_get_bmake() { |
| 54 |
local bmake |
| 55 |
bmake=$(get_bmake) |
| 56 |
[[ ${CBUILD} == *-freebsd* ]] || bmake="${bmake} -m /usr/share/mk/freebsd" |
| 57 |
|
| 58 |
echo "${bmake}" |
| 59 |
} |
| 60 |
|
| 61 |
freebsd_do_patches() { |
| 62 |
if [[ ${#PATCHES[@]} -gt 1 ]] ; then |
| 63 |
for x in "${PATCHES[@]}"; do |
| 64 |
epatch "${x}" |
| 65 |
done |
| 66 |
else |
| 67 |
for x in ${PATCHES} ; do |
| 68 |
epatch "${x}" |
| 69 |
done |
| 70 |
fi |
| 71 |
} |
| 72 |
|
| 73 |
freebsd_rename_libraries() { |
| 74 |
ebegin "Renaming libraries" |
| 75 |
# We don't use libtermcap, we use libncurses |
| 76 |
find "${S}" -name Makefile -print0 | xargs -0 \ |
| 77 |
sed -i -e 's:-ltermcap:-lncurses:g; s:{LIBTERMCAP}:{LIBNCURSES}:g' |
| 78 |
# flex provides libfl, not libl |
| 79 |
find "${S}" -name Makefile -print0 | xargs -0 \ |
| 80 |
sed -i -e 's:-ll$:-lfl:g; s:-ll :-lfl :g; s:{LIBL}:{LIBFL}:g' |
| 81 |
# ncurses provides libncursesw not libcursesw |
| 82 |
find "${S}" -name Makefile -print0 | xargs -0 \ |
| 83 |
sed -i -e 's:-lcursesw:-lncursesw:g' |
| 84 |
# we use expat instead of bsdxml |
| 85 |
find "${S}" -name Makefile -print0 | xargs -0 \ |
| 86 |
sed -i -e 's:-lbsdxml:-lexpat:g' |
| 87 |
|
| 88 |
eend $? |
| 89 |
} |
| 90 |
|
| 91 |
freebsd_src_unpack() { |
| 92 |
unpack ${A} |
| 93 |
cd "${S}" |
| 94 |
|
| 95 |
dummy_mk ${REMOVE_SUBDIRS} |
| 96 |
|
| 97 |
freebsd_do_patches |
| 98 |
freebsd_rename_libraries |
| 99 |
} |
| 100 |
|
| 101 |
freebsd_src_compile() { |
| 102 |
use profile && filter-flags "-fomit-frame-pointer" |
| 103 |
use profile || mymakeopts="${mymakeopts} NO_PROFILE= " |
| 104 |
|
| 105 |
mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS= NO_FSCHG=" |
| 106 |
|
| 107 |
# Many things breaks when using ricer flags here |
| 108 |
[[ -z "${NOFLAGSTRIP}" ]] && strip-flags |
| 109 |
|
| 110 |
# Make sure to use FreeBSD definitions while crosscompiling |
| 111 |
[[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)" |
| 112 |
|
| 113 |
# Create objdir if MAKEOBJDIRPREFIX is defined, so that we can make out of |
| 114 |
# tree builds easily. |
| 115 |
if [[ -n "${MAKEOBJDIRPREFIX}" ]] ; then |
| 116 |
mkmake obj || die |
| 117 |
fi |
| 118 |
|
| 119 |
bsdmk_src_compile |
| 120 |
} |
| 121 |
|
| 122 |
freebsd_src_install() { |
| 123 |
use profile || mymakeopts="${mymakeopts} NO_PROFILE= " |
| 124 |
|
| 125 |
mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS= NO_FSCHG=" |
| 126 |
|
| 127 |
[[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)" |
| 128 |
|
| 129 |
bsdmk_src_install |
| 130 |
} |