summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorYuta SATOH <nigoro@gentoo.gr.jp>2012-12-31 16:04:09 +0900
committerYuta SATOH <nigoro@gentoo.gr.jp>2012-12-31 16:04:09 +0900
commitc5e72ef28177f81ea25648b3c7e50fc5285a1b74 (patch)
tree112b778a80b7a1e152c396b33ae6ba820ef97726 /eclass
parentfreebsd-{share,usbin}: removed isdn flag, bug 448502 (diff)
downloadgentoo-bsd-c5e72ef28177f81ea25648b3c7e50fc5285a1b74.tar.gz
gentoo-bsd-c5e72ef28177f81ea25648b3c7e50fc5285a1b74.tar.bz2
gentoo-bsd-c5e72ef28177f81ea25648b3c7e50fc5285a1b74.zip
freebsd.eclass: import from latest tree
Diffstat (limited to 'eclass')
-rw-r--r--eclass/freebsd.eclass131
1 files changed, 131 insertions, 0 deletions
diff --git a/eclass/freebsd.eclass b/eclass/freebsd.eclass
new file mode 100644
index 0000000..53a0b8a
--- /dev/null
+++ b/eclass/freebsd.eclass
@@ -0,0 +1,131 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+#
+# Diego Pettenò <flameeyes@gentoo.org>
+
+inherit versionator eutils flag-o-matic bsdmk
+
+LICENSE="BSD"
+HOMEPAGE="http://www.freebsd.org/"
+
+# Define global package names
+LIB="freebsd-lib-${PV}"
+BIN="freebsd-bin-${PV}"
+CONTRIB="freebsd-contrib-${PV}"
+SHARE="freebsd-share-${PV}"
+UBIN="freebsd-ubin-${PV}"
+USBIN="freebsd-usbin-${PV}"
+CRYPTO="freebsd-crypto-${PV}"
+LIBEXEC="freebsd-libexec-${PV}"
+SBIN="freebsd-sbin-${PV}"
+GNU="freebsd-gnu-${PV}"
+ETC="freebsd-etc-${PV}"
+SYS="freebsd-sys-${PV}"
+INCLUDE="freebsd-include-${PV}"
+RESCUE="freebsd-rescue-${PV}"
+CDDL="freebsd-cddl-${PV}"
+
+# Release version (5.3, 5.4, 6.0, etc)
+RV="$(get_version_component_range 1-2)"
+
+if [[ ${PN} != "freebsd-share" ]] && [[ ${PN} != freebsd-sources ]]; then
+ IUSE="profile"
+fi
+
+#unalias -a
+alias install-info='/usr/bin/bsdinstall-info'
+
+EXPORT_FUNCTIONS src_compile src_install src_unpack
+
+# doperiodic <kind> <file> ...
+doperiodic() {
+ local kind=$1
+ shift
+
+ ( # dont want to pollute calling env
+ insinto /etc/periodic/${kind}
+ insopts -m 0755
+ doins "$@"
+ )
+}
+
+freebsd_get_bmake() {
+ local bmake
+ bmake=$(get_bmake)
+ [[ ${CBUILD} == *-freebsd* ]] || bmake="${bmake} -m /usr/share/mk/freebsd"
+
+ echo "${bmake}"
+}
+
+freebsd_do_patches() {
+ if [[ ${#PATCHES[@]} -gt 1 ]] ; then
+ for x in "${PATCHES[@]}"; do
+ epatch "${x}"
+ done
+ else
+ for x in ${PATCHES} ; do
+ epatch "${x}"
+ done
+ fi
+ epatch_user
+}
+
+freebsd_rename_libraries() {
+ ebegin "Renaming libraries"
+ # We don't use libtermcap, we use libncurses
+ find "${S}" -name Makefile -print0 | xargs -0 \
+ sed -i -e 's:-ltermcap:-lncurses:g; s:{LIBTERMCAP}:{LIBNCURSES}:g'
+ # flex provides libfl, not libl
+ find "${S}" -name Makefile -print0 | xargs -0 \
+ sed -i -e 's:-ll$:-lfl:g; s:-ll :-lfl :g; s:{LIBL}:{LIBFL}:g'
+ # ncurses provides libncursesw not libcursesw
+ find "${S}" -name Makefile -print0 | xargs -0 \
+ sed -i -e 's:-lcursesw:-lncursesw:g'
+ # we use expat instead of bsdxml
+ find "${S}" -name Makefile -print0 | xargs -0 \
+ sed -i -e 's:-lbsdxml:-lexpat:g'
+
+ eend $?
+}
+
+freebsd_src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ dummy_mk ${REMOVE_SUBDIRS}
+
+ freebsd_do_patches
+ freebsd_rename_libraries
+}
+
+freebsd_src_compile() {
+ use profile && filter-flags "-fomit-frame-pointer"
+ use profile || mymakeopts="${mymakeopts} NO_PROFILE= "
+
+ mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS= NO_FSCHG="
+
+ # Many things breaks when using ricer flags here
+ [[ -z "${NOFLAGSTRIP}" ]] && strip-flags
+
+ # Make sure to use FreeBSD definitions while crosscompiling
+ [[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)"
+
+ # Create objdir if MAKEOBJDIRPREFIX is defined, so that we can make out of
+ # tree builds easily.
+ if [[ -n "${MAKEOBJDIRPREFIX}" ]] ; then
+ mkmake obj || die
+ fi
+
+ bsdmk_src_compile
+}
+
+freebsd_src_install() {
+ use profile || mymakeopts="${mymakeopts} NO_PROFILE= "
+
+ mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS= NO_FSCHG="
+
+ [[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)"
+
+ bsdmk_src_install
+}