Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-embedded
Navigation:
Lists: gentoo-embedded: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-embedded@g.o
From: david@...
Subject: uclibc things
Date: Tue, 18 Nov 2003 11:05:01 -0800
So, I've been working on some uclibc stuff of my own for a while.
Then the embedded project came back to life and I'm not sure if I
should continue working on it, or wait for other people to finish
stuff.  Anyway, I figure somebody might be able to get some use out of
the ebuilds I produced for uclibc.  These ebuilds will get you a
stage1 gcc and uclibc, I didn't quite get around to the stage2 gcc
built on uclibc... anyway
take from these what you will.
Dave

If people are interested I'll post the patches as well.  I just didn't
want to make the email too big.
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.13.90.0.14.ebuild,v 1.6 2003/03/27 00:26:09 seemant Exp $

IUSE="nls bootstrap static build"

# NOTE to Maintainer:  ChangeLog states that it no longer use perl to build
#                      the manpages, but seems this is incorrect ....

inherit libtool flag-o-matic

# Generate borked binaries.  Bug #6730
filter-flags "-fomit-frame-pointer -fssa"

S=${WORKDIR}/${P}
DESCRIPTION="Tools necessary to build programs"
SRC_URI="ftp://ftp.gnu.org/gnu/binutils/${P}.tar.bz2"
HOMEPAGE="http://sources.redhat.com/binutils/"

SLOT="0"
LICENSE="GPL-2 | LGPL-2"
KEYWORDS="~x86 ~ppc ~alpha  ~sparc"

DEPEND="virtual/glibc
	>=sys-apps/portage-2.0.21
	nls? ( sys-devel/gettext )
	|| ( dev-lang/perl 
	     ( !build?     ( dev-lang/perl ) )
	     ( !bootstrap? ( dev-lang/perl ) )
	    )"
# This is a hairy one.  Basically depend on dev-lang/perl
# if "build" or "bootstrap" not in USE.

src_unpack() {
	unpack ${P}.tar.bz2
	cd ${S}
	epatch ${FILESDIR}/2.14/binutils-001-debian.patch
	epatch ${FILESDIR}/2.14/binutils-002-uclibc.patch
}

src_compile() {
	
	./configure \
		--program-prefix=i686-uclibc- \
		${myconf} || die
		
#	make headers -C bfd CFLAGS=-O || die
	emake || die

	if [ -z "`use build`" ]
	then
		if [ -z "`use bootstrap`" ]
		then
			#nuke the manpages to recreate them (only use this if we have perl)
			find . -name '*.1' -exec rm -f {} \; || :
		fi
		#make the info pages (makeinfo included with gcc is used)
		make info || die
	fi
}

src_install() {

emake prefix=${D}/opt/fdi \
	install || die

#	insinto /usr/include
#	doins include/libiberty.h
	
	#c++filt is included with gcc -- what are these GNU people thinking?
	#but not the manpage, so leave that!
#	rm -f ${D}/usr/bin/c++filt #${D}/usr/share/man/man1/c++filt*
	
	# By default strip has a symlink going from /usr/${CHOST}/bin/strip to
	# /usr/bin/strip we should reverse it:

#	rm ${D}/usr/${CHOST}/bin/strip; mv ${D}/usr/bin/strip ${D}/usr/${CHOST}/bin/strip
	# The strip symlink gets created in the loop below
	
	# By default ar, as, ld, nm, ranlib and strip are in two places; create
	# symlinks.  This will reduce the size of the tbz2 significantly.  We also
	# move all the stuff in /usr/bin to /usr/${CHOST}/bin and create the
	# appropriate symlinks.  Things are cleaner that way.
	cd ${D}/opt/bin
	local x=""
	for x in * strip
	do
	if [ ! -e ../${CHOST}/bin/${x} ]
		then
			mv ${x} ../${CHOST}/bin/${x}
		else	
			rm -f ${x}
		fi
		ln -s ../${CHOST}/bin/${x} ${x}
	done
	
	cd ${S}
	if [ -z "`use build`" ]
	then
		make prefix=${D}/opt/fdi \
			install-info || die			
	fi
}

# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit crosscompile flag-o-matic

# Short one-line description of this package.
DESCRIPTION="GCC compiler for mips CPU"
HOMEPAGE="http://www.mips-linux.org/"
SRC_URI="http://www.futuretel.com/gcc-3.2.2.tar.bz2"

LICENSE="GPL-2"

# The SLOT variable is used to tell Portage if it's OK to keep multiple
# versions of the same package installed at the same time. For example,
# if we have a libfoo-1.2.2 and libfoo-1.3.2 (which is not compatible
# with 1.2.2), it would be optimal to instruct Portage to not remove
# libfoo-1.2.2 if we decide to upgrade to libfoo-1.3.2. To do this,
# we specify SLOT="1.2" in libfoo-1.2.2 and SLOT="1.3" in libfoo-1.3.2.
# emerge clean understands SLOTs, and will keep the most recent version
# of each SLOT and remove everything else.
# Note that normal applications should use SLOT="0" if possible, since
# there should only be exactly one version installed at a time.
# DO NOT USE SLOT=""! This tells Portage to disable SLOTs for this package.
SLOT="uclibc"

# Using KEYWORDS, we can record masking information *inside* an ebuild
# instead of relying on an external package.mask file. Right now, you
# should set the KEYWORDS variable for every ebuild so that it contains
# the names of all the architectures with which the ebuild works. We have
# 4 official architecture names right now: "~x86", "~ppc", "~sparc"
# and "~alpha".  The ~ in front of the architecture indicates that the
# package is new and should be considered unstable until testing proves its
# stability.  Once packages go stable the ~ prefix is removed.
# So, if you've confirmed that your ebuild works on x86 and ppc,
# you'd specify: KEYWORDS="~x86 ~ppc"
# For packages that are platform-independent (like Java, PHP or Perl
# applications) specify all keywords.
# For binary packages, use -* and then list the archs the bin package
# exists for.  If the package was for an x86 binary package, then
# KEYWORDS would be set like this: KEYWORDS="-* x86"
# DO NOT USE KEYWORDS="*". This is deprecated and only for backward
# compatibility reasons.
KEYWORDS="~x86"
IUSE="stage1"

DEPEND=">=gcc-3.2.2
>=binutils-2.14.90.0.6
"

# Run-time dependencies, same as DEPEND if RDEPEND isn't defined:
#RDEPEND=""

# Source directory; the dir where the sources can be found (automatically
# unpacked) inside ${WORKDIR}.  S will get a default setting of ${WORKDIR}/${P}
# if you omit this line.
S=${WORKDIR}/gcc-3.2.2

src_unpack() {
	unpack gcc-3.2.2.tar.bz2

	cd ${S}
	
	if [ "${NOT_STAGE}" = "1" ]; then
		# mad hackery copied from Charles
		export PATH=/usr/${CCHOST}/bin/:${PATH}
		cd ${S}
		local result=`grep TARGET_LIBGCC2_CLFAGS ${S}/gcc/config/mips/t-linux` || true
		echo ${result} 1>&2
		
		if [ -z "${result}" ]; then
			echo >> ${S}/gcc/config/mips/t-linux
			echo 'TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -D__gthr_posix_h/' >> ${S}/gcc/config/mips/t-linux
		else
			# change this!!!! it needs to be some sane sed/awk combo
			perl -pi -e 's/^(TARGET_LIBGCC2_CLFAGS.*)/$1 -Dinhibit_libc \
-D__gthr_posix_h/' ${S}/gcc/config/mips/t-linux
		fi
	fi
	
	if [ "${UCLIBC}" = "1" ]; then
		einfo "Configuring for uclibc enviornment"
		epatch ${FILESDIR}/gcc-001-disable-mathf.patch
		epatch ${FILESDIR}/gcc-006-include-search.patch
		epatch ${FILESDIR}/gcc-810-libstd++-locale.patch

		# time for some build hackery, stolen from buildroot enviornment!
		LIST=`grep -lr "dynamic-linker.*\.so[\.0-9]*" *`
		for i in $LIST; do
			sed -e 's/-dynamic-linker.*\.so[\.0-9]*}/-dynamic-linker \/usr\/${CCHOST}\/lib\/ld-uClibc.so.0}/g' $i > $i.bak
			mv $i.bak $i
			done;

		# prevent glibc start files from leaking in
		# maybe these neet to be /usr/${CCHOST} instead of ${S}
		sed -e 's/standard_startfile_prefix_1=\".*/standard_startfile_prefix_1=\"${S}\/lib\/\";/g' gcc/gcc.c > gcc/gcc.bak
		cp gcc/gcc.bak gcc/gcc.c
		sed -e 's/standard_startfile_prefix_2=\".*/standard_startfile_prefix_2=\"${S}\/lib\/\";/g' gcc/gcc.c > gcc/gcc.bak
		cp gcc/gcc.bak gcc/gcc.c

		# prevent glibc include files from leaking in, slimy bastards!
		sed -e 's/^NATIVE_SYSTEM_HEADER_DIR.*/NATIVE_SYSTEM_HEADER_DIR=${S}\/include\//g' gcc/Makefile.in > gcc/Makefile.bak
		cp gcc/Makefile.bak gcc/Makefile.in
		sed -e 's/^CROSS_SYSTEM_HEADER_DIR.*/CROSS_SYSTEM_HEADER_DIR=${S}\/include\//g' gcc/Makefile.in > gcc/Makefile.bak
		cp gcc/Makefile.bak gcc/Makefile.in
		sed -e 's/^#define.*STANDARD_INCLUDE_DIR.*/#define STANDARD_INCLUDE_DIR \"${S}\/include\//g' gcc/cppdefault.h > gcc/cppdefault.bak
		cp gcc/cppdefault.bak gcc/cppdefault.h

		# prevent system glibc files from being found by collect 2
		sed -e 's/\/lib/${S}\/lib\//g' gcc/collect2.c > gcc/collect2.bak
		cp gcc/collect2.bak gcc/collect2.c
		sed -e 's/\/usr/\/${S}\//g' gcc/collect2.c > gcc/collect2.bak
		cp gcc/collect2.bak gcc/collect2.c

		# prevent gcc from using unwind-dw2-fde-glibc code
		sed -e 's/^#ifndef inhibit_libc/#define inhibit_libc\\n/#ifndef inhibit_libc/g' gcc/unwind-dw2-fde-glibc.c > gcc/unwind-dw2-fde-glibc.bak
		cp gcc/unwind-dw2-fde-glibc.bak gcc/unwind-dw2-fde-glibc.c
	fi

}

src_compile() {

#	[ ! cross-target ] && [ ! cross-build ] ||  \
#		die "This ebuild is only for cross compilation! Change your compiler \
#enviornment with gcc-config accordingly"

	cd ${S}

	# we are boot strapping! hells yeah
	if [ "${STAGE}" = "1" ]; then
		einfo "Building stage1(basic) toolchain sans glibc"

		./configure \
		    	--enable-target-optspace \
			--enable-languages=c \
			--with-gnu-ld \
			--disable-shared \
			--disable-nls \
			--disable-__cxa_atexit \
			--program-prefix=i386-uclibc- \
				 || die "./configure failed"

	else
		einfo "Building stage2(full) toolchain"

		econf \
			--enable-target-optspace \
			--disable-nls \
			--with-gnu-ld \
			--enable-languages=c,c++ \
			--enable-shaed \
			--with-headers=${ROOT}${LOC}/include
		# possibly need to change with-headers
	fi

	emake
}

src_install() {
	emake DESTDIR=${D} install || die

}

--
gentoo-embedded@g.o mailing list
Navigation:
Lists: gentoo-embedded: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
IRC Meeting
Next by thread:
uclinux and 2.6
Previous by date:
Re: some uClibc experience
Next by date:
uclinux and 2.6


Updated Jun 17, 2009

Summary: Archive of the gentoo-embedded mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.