Gentoo Archives: gentoo-commits

From: "Tim Harder (radhermit)" <radhermit@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-libs/klibc: ChangeLog klibc-1.5.25.ebuild
Date: Tue, 30 Aug 2011 01:37:15
Message-Id: 20110830013701.1DCED2004C@flycatcher.gentoo.org
1 radhermit 11/08/30 01:37:01
2
3 Modified: ChangeLog
4 Added: klibc-1.5.25.ebuild
5 Log:
6 Version bump.
7
8 (Portage version: 2.2.0_alpha51/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.82 dev-libs/klibc/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/klibc/ChangeLog?rev=1.82&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/klibc/ChangeLog?rev=1.82&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/klibc/ChangeLog?r1=1.81&r2=1.82
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v
20 retrieving revision 1.81
21 retrieving revision 1.82
22 diff -u -r1.81 -r1.82
23 --- ChangeLog 17 Aug 2011 21:16:51 -0000 1.81
24 +++ ChangeLog 30 Aug 2011 01:37:01 -0000 1.82
25 @@ -1,6 +1,11 @@
26 # ChangeLog for dev-libs/klibc
27 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.81 2011/08/17 21:16:51 radhermit Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.82 2011/08/30 01:37:01 radhermit Exp $
30 +
31 +*klibc-1.5.25 (30 Aug 2011)
32 +
33 + 30 Aug 2011; Tim Harder <radhermit@g.o> +klibc-1.5.25.ebuild:
34 + Version bump.
35
36 *klibc-1.5.24 (17 Aug 2011)
37
38
39
40
41 1.1 dev-libs/klibc/klibc-1.5.25.ebuild
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/klibc/klibc-1.5.25.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/klibc/klibc-1.5.25.ebuild?rev=1.1&content-type=text/plain
45
46 Index: klibc-1.5.25.ebuild
47 ===================================================================
48 # Copyright 1999-2011 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50 # $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/klibc-1.5.25.ebuild,v 1.1 2011/08/30 01:37:01 radhermit Exp $
51
52 # Robin H. Johnson <robbat2@g.o>, 12 Nov 2007:
53 # This still needs major work.
54 # But it is significently better than the previous version.
55 # In that it will now build on biarch systems, such as ppc64-32ul.
56
57 # NOTES:
58 # ======
59 # We need to bring in the kernel sources seperately
60 # Because they have to be configured in a way that differs from the copy in
61 # /usr/src/. The sys-kernel/linux-headers are too stripped down to use
62 # unfortunetly.
63 # This will be able to go away once the klibc author updates his code
64 # to build again the headers provided by the kernel's 'headers_install' target.
65
66 inherit eutils multilib toolchain-funcs
67
68 DESCRIPTION="A minimal libc subset for use with initramfs."
69 HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc"
70 KV_MAJOR="2" KV_MINOR="6" KV_SUB="39"
71 PKV_EXTRA=""
72 if [ -n "${PKV_EXTRA}" ]; then
73 PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-${PKV_EXTRA}"
74 PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.bz2"
75 fi
76 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}"
77 KERNEL_URI="
78 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2
79 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.bz2"
80 SRC_URI="
81 mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.bz2
82 ${PATCH_URI}
83 ${KERNEL_URI}"
84
85 LICENSE="|| ( GPL-2 LGPL-2 )"
86 KEYWORDS="~amd64 ~arm -mips ~ppc ~x86"
87 SLOT="0"
88 IUSE="debug"
89
90 DEPEND="dev-lang/perl"
91 RDEPEND="${DEPEND}"
92
93 KS="${WORKDIR}/linux-${OKV}"
94
95 # Klibc has no PT_GNU_STACK support, so scanning for execstacks is moot
96 QA_EXECSTACK="*"
97 # Do not strip
98 RESTRICT="strip"
99
100 kernel_asm_arch() {
101 a="${1:${ARCH}}"
102 case ${a} in
103 # Merged arches
104 x86|amd64) echo x86 ;;
105 ppc*) echo powerpc ;;
106 # Non-merged
107 alpha|arm|ia64|m68k|mips|sh|sparc*) echo ${1} ;;
108 *) die "TODO: Update the code for your asm-ARCH symlink" ;;
109 esac
110 }
111
112 # For a given Gentoo ARCH,
113 # specify the kernel defconfig most relevant
114 kernel_defconfig() {
115 a="${1:${ARCH}}"
116 # most, but not all arches have a sanely named defconfig
117 case ${a} in
118 ppc64) echo ppc64_defconfig ;;
119 ppc) echo pmac32_defconfig ;;
120 sh*) die "TODO: Your arch is not supported by the klibc ebuild. Please suggest a defconfig in a bug." ;;
121 *) echo defconfig ;;
122 esac
123 }
124
125 src_unpack() {
126 unpack linux-${OKV}.tar.bz2 ${P}.tar.bz2
127 [ -n "${PKV}" ] && EPATCH_OPTS="-d ${KS} -p1" epatch "${DISTDIR}"/patch-${PKV}.bz2
128 cd "${S}"
129
130 # Symlink /usr/src/linux to ${S}/linux
131 ln -snf "${KS}" linux
132 #ln -snf "/usr" linux
133
134 # Build interp.o with EXTRA_KLIBCAFLAGS (.S source)
135 epatch "${FILESDIR}"/${PN}-1.4.11-interp-flags.patch
136
137 # Fix usage of -s, bug #201006
138 epatch "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch
139 }
140
141 # klibc has it's own ideas of arches
142 # They reflect userspace strictly.
143 # This functions maps from a Gentoo ARCH, to an arch that klibc expects
144 # Look at klibc-${S}/usr/klibc/arch for a list of these arches
145 klibc_arch() {
146 a="${1:${ARCH}}"
147 case ${a} in
148 amd64) echo x86_64;;
149 mips) die 'TODO: Use the $ABI' ;;
150 x86) echo i386;;
151 *) echo ${a} ;;
152 esac
153 }
154
155 src_compile() {
156 local myargs="all"
157 local myARCH="${ARCH}" myABI="${ABI}"
158 # TODO: For cross-compiling
159 # You should set ARCH and ABI here
160 CC="$(tc-getCC)"
161 HOSTCC="$(tc-getBUILD_CC)"
162 KLIBCARCH="$(klibc_arch ${ARCH})"
163 KLIBCASMARCH="$(kernel_asm_arch ${ARCH})"
164 libdir="$(get_libdir)"
165 # This should be the defconfig corresponding to your userspace!
166 # NOT your kernel. PPC64-32ul would choose 'ppc' for example.
167 defconfig=$(kernel_defconfig ${ARCH})
168 unset ABI ARCH # Unset these, because they interfere
169 unset KBUILD_OUTPUT # we are using a private copy
170
171 cd "${KS}"
172 emake ${defconfig} CC="${CC}" HOSTCC="${HOSTCC}" || die "No defconfig"
173 if [[ "${KLIBCARCH/arm}" != "${KLIBCARCH}" ]] && \
174 [[ "${CHOST/eabi}" != "${CHOST}" ]]; then
175 # The delete and insert are seperate statements
176 # so that they are reliably used.
177 sed -i \
178 -e '/CONFIG_AEABI/d' \
179 -e '1iCONFIG_AEABI=y' \
180 -e '/CONFIG_OABI_COMPAT/d' \
181 -e '1iCONFIG_OABI_COMPAT=y' \
182 "${KS}"/.config \
183 "${S}"/defconfig
184 fi
185 emake prepare CC="${CC}" HOSTCC="${HOSTCC}" || die "Failed to prepare kernel sources for header usage"
186
187 cd "${S}"
188
189 use debug && myargs="${myargs} V=1"
190 use test && myargs="${myargs} test"
191
192 emake \
193 EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \
194 EXTRA_KLIBCLDFLAGS="-z,noexecstack" \
195 HOSTCC="${HOSTCC}" CC="${CC}" \
196 INSTALLDIR="/usr/${libdir}/klibc" \
197 KLIBCARCH=${KLIBCARCH} \
198 KLIBCASMARCH=${KLIBCASMARCH} \
199 SHLIBDIR="/${libdir}" \
200 libdir="/usr/${libdir}" \
201 mandir="/usr/share/man" \
202 T="${T}" \
203 ${myargs} || die "Compile failed!"
204
205 #SHLIBDIR="/${libdir}" \
206
207 ARCH="${myARCH}" ABI="${myABI}"
208 }
209
210 src_install() {
211 local myargs
212 local myARCH="${ARCH}" myABI="${ABI}"
213 # TODO: For cross-compiling
214 # You should set ARCH and ABI here
215 CC="$(tc-getCC)"
216 HOSTCC="$(tc-getBUILD_CC)"
217 KLIBCARCH="$(klibc_arch ${ARCH})"
218 KLIBCASMARCH="$(kernel_asm_arch ${ARCH})"
219 libdir="$(get_libdir)"
220 # This should be the defconfig corresponding to your userspace!
221 # NOT your kernel. PPC64-32ul would choose 'ppc' for example.
222 defconfig=$(kernel_defconfig ${ARCH})
223
224 use debug && myargs="${myargs} V=1"
225
226 local klibc_prefix
227 if tc-is-cross-compiler ; then
228 klibc_prefix=$("${S}/klcc/${KLIBCARCH}-klcc" -print-klibc-prefix)
229 else
230 klibc_prefix=$("${S}/klcc/klcc" -print-klibc-prefix)
231 fi
232
233 unset ABI ARCH # Unset these, because they interfere
234 unset KBUILD_OUTPUT # we are using a private copy
235
236 emake \
237 EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \
238 EXTRA_KLIBCLDFLAGS="-z,noexecstack" \
239 HOSTCC="${HOSTCC}" CC="${CC}" \
240 INSTALLDIR="/usr/${libdir}/klibc" \
241 INSTALLROOT="${D}" \
242 KLIBCARCH=${KLIBCARCH} \
243 KLIBCASMARCH=${KLIBCASMARCH} \
244 SHLIBDIR="/${libdir}" \
245 libdir="/usr/${libdir}" \
246 mandir="/usr/share/man" \
247 ${myargs} \
248 install || die "Install failed!"
249
250 #SHLIBDIR="/${libdir}" \
251
252 # klibc doesn't support prelinking, so we need to mask it
253 cat > "${T}/70klibc" <<-EOF
254 PRELINK_PATH_MASK="/usr/${libdir}/klibc"
255 EOF
256
257 doenvd "${T}"/70klibc
258
259 # Fix the permissions (bug #178053) on /usr/${libdir}/klibc/include
260 # Actually I have no idea, why the includes have those weird-ass permissions
261 # on a particular system, might be due to inherited permissions from parent
262 # directory
263 find "${D}"/usr/${libdir}/klibc/include | xargs chmod o+rX
264
265 # Hardlinks becoming copies
266 for x in gunzip zcat ; do
267 rm -f "${D}/${klibc_prefix}/bin/${x}"
268 dosym gzip "${klibc_prefix}/bin/${x}"
269 done
270
271 # Restore now, so we can use the tc- functions
272 ARCH="${myARCH}" ABI="${myABI}"
273 if ! tc-is-cross-compiler ; then
274 cd "${S}"
275 insinto /usr/share/aclocal
276 doins contrib/klibc.m4
277
278 dodoc README usr/klibc/CAVEATS
279 docinto gzip; dodoc usr/gzip/README
280 fi
281
282 # Fix up the symlink
283 # Mainly for merged arches
284 linkname="${D}/usr/${libdir}/klibc/include/asm"
285 if [ -L "${linkname}" ] && [ ! -e "${linkname}" ] ; then
286 ln -snf asm-${KLIBCASMARCH} "${linkname}"
287 fi
288 }
289
290 src_test() {
291 if ! tc-is-cross-compiler ; then
292 cd "${S}"/usr/klibc/tests
293 ALL_TESTS="$(ls *.c |sed 's,\.c$,,g')"
294 BROKEN_TESTS="fcntl fnmatch testrand48"
295 failed=0
296 for t in $ALL_TESTS ; do
297 if has $t $BROKEN_TESTS ; then
298 echo "=== $t SKIP"
299 else
300 echo -n "=== $t "
301 ./$t </dev/null >/dev/null
302 rc=$?
303 if [ $rc -eq 0 ]; then
304 echo PASS
305 else
306 echo FAIL
307 failed=1
308 fi
309 fi
310 done
311 [ $failed -ne 0 ] && die "Some tests failed."
312 fi
313 }