Gentoo Archives: gentoo-commits

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