mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-03 05:28:53 +02:00
Add newlib for arm_none_eabi
* Add sysroot support to the binutils * Add a "nolibc" version of gcc, used only to build the newlib * Add newlib recipe * Fix "main" gcc recipe to depend on the built newlib and set the sysroot and default include search path properly. This recipe set can now be derived to build bare-metal cross compilers for any other CPU supported by gcc, binutils and newlib.
This commit is contained in:
@@ -5,7 +5,7 @@ srcGitRev="c20a732df8f8b6d0f32c872817f3a0498a5c4761"
|
||||
SRC_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
|
||||
CHECKSUM_SHA256="6d3b677cd8ef777bf6fb3186a15b5122e46345595a996370325c758b3d8a4ab6"
|
||||
SRC_FILENAME="binutils-$portVersion.tar.gz"
|
||||
REVISION="5"
|
||||
REVISION="6"
|
||||
LICENSE="
|
||||
GNU GPL v2
|
||||
GNU LGPL v2
|
||||
@@ -90,7 +90,7 @@ BUILD()
|
||||
CFLAGS=-O2 CXXFLAGS=-O2 runConfigure "$sourceDir/configure" \
|
||||
--exec-prefix=$installDir \
|
||||
--includedir=$includeDir/binutils \
|
||||
--docdir=$docDir \
|
||||
--docdir=$docDir --with-sysroot=/system/develop/$targetArch/ \
|
||||
--disable-nls --target=${targetArch}
|
||||
|
||||
make $jobArgs
|
||||
|
||||
@@ -8,7 +8,7 @@ srcGitRev="c20a732df8f8b6d0f32c872817f3a0498a5c4761"
|
||||
SRC_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
|
||||
CHECKSUM_SHA256="6d3b677cd8ef777bf6fb3186a15b5122e46345595a996370325c758b3d8a4ab6"
|
||||
SRC_FILENAME="$portVersionedName.tar.gz"
|
||||
REVISION="1"
|
||||
REVISION="2"
|
||||
LICENSE="
|
||||
GNU GPL v2
|
||||
GNU LGPL v2
|
||||
@@ -46,6 +46,7 @@ REQUIRES="
|
||||
"
|
||||
BUILD_REQUIRES="
|
||||
cmd:${targetU}_as$secondaryArchSuffix
|
||||
${targetU}_newlib$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel >= $haikuVersion
|
||||
@@ -96,7 +97,8 @@ BUILD()
|
||||
--docdir=$docDir --disable-nls --disable-libssp --with-gnu-ld \
|
||||
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
|
||||
--enable-multilib --disable-shared \
|
||||
--without-headers --with-newlib \
|
||||
--with-newlib --with-sysroot=/system/develop/$targetArch/ \
|
||||
--with-native-system-header-dir=/include \
|
||||
--with-pkgversion=$(echo $portVersion | cut -c 7-) --target=$targetArch
|
||||
|
||||
make $jobArgs all-gcc all-target-libgcc
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
SUMMARY="C/C++ cross-compiler for ARM"
|
||||
DESCRIPTION="
|
||||
Compiler for ARM processors.
|
||||
"
|
||||
HOMEPAGE="http://gcc.gnu.org"
|
||||
|
||||
srcGitRev="c20a732df8f8b6d0f32c872817f3a0498a5c4761"
|
||||
SRC_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
|
||||
CHECKSUM_SHA256="6d3b677cd8ef777bf6fb3186a15b5122e46345595a996370325c758b3d8a4ab6"
|
||||
SRC_FILENAME="$portVersionedName.tar.gz"
|
||||
REVISION="1"
|
||||
LICENSE="
|
||||
GNU GPL v2
|
||||
GNU LGPL v2
|
||||
"
|
||||
COPYRIGHT="1988-2013 Free Software Foundation, Inc."
|
||||
|
||||
|
||||
ARCHITECTURES="x86 x86_64 arm"
|
||||
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
|
||||
# x86_gcc2 is fine as primary target architecture as long as we're building
|
||||
# for a different secondary architecture.
|
||||
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
|
||||
fi
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
targetArch="arm-none-eabi"
|
||||
targetU="arm_none_eabi"
|
||||
|
||||
PROVIDES="
|
||||
${targetU}_gcc_nolibc$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_c++$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_cc$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_cpp$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_g++$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_gcc$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_gcc_4.8.2$secondaryArchSuffix = $portVersion compat >= 4
|
||||
cmd:${targetU}_gcov$secondaryArchSuffix = $portVersion compat >= 4
|
||||
lib:${targetU}_libstdc++$secondaryArchSuffix = $portVersion compat >= 4
|
||||
"
|
||||
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix >= $haikuVersion
|
||||
cmd:${targetU}_as$secondaryArchSuffix
|
||||
lib:libstdc++$secondaryArchSuffix
|
||||
"
|
||||
BUILD_REQUIRES="
|
||||
cmd:${targetU}_as$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel >= $haikuVersion
|
||||
cmd:autoconf
|
||||
cmd:awk
|
||||
cmd:bison
|
||||
cmd:find
|
||||
cmd:flex
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:ld$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:makeinfo
|
||||
cmd:sed
|
||||
cmd:strip
|
||||
cmd:tar
|
||||
cmd:xargs
|
||||
"
|
||||
|
||||
SOURCE_DIR="buildtools-$srcGitRev/gcc"
|
||||
|
||||
sourceDir=$(pwd)
|
||||
relativeInstallDir="develop/tools/${targetArch}"
|
||||
installDir="$prefix/$relativeInstallDir"
|
||||
objectsDir=$(pwd)/../${portVersionedName}-obj
|
||||
|
||||
BUILD()
|
||||
{
|
||||
rm -rf $objectsDir
|
||||
|
||||
# Touch some files generated by bison, so that bison won't run to update
|
||||
# them. Fixes issues with newer bison versions.
|
||||
# And while at it, touch gperf target, too (as gperf may not be installed).
|
||||
(cd $sourceDir/gcc; touch c-parse.c c-parse.h cexp.c cp/parse.c \
|
||||
cp/parse.h c-gperf.h)
|
||||
|
||||
mkdir -p $objectsDir
|
||||
cd $objectsDir
|
||||
|
||||
# Setting a quoted string in an environment variable is ugly (the quotes
|
||||
# are removed at various stages and need an absurd amount of escaping), so
|
||||
# let's use a file and --include instead.
|
||||
echo '#define LIBRARY_PATH_ENV "ARM_LIBRARY_PATH"' > haiku_host.h
|
||||
|
||||
CXXFLAGS="-O2 -include $objectsDir/haiku_host.h" \
|
||||
CFLAGS="-O2 -U_FORTIFY_SOURCE" "$sourceDir/configure" \
|
||||
--build=$effectiveTargetMachineTriple \
|
||||
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
|
||||
--docdir=$docDir --disable-nls --disable-libssp --with-gnu-ld \
|
||||
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
|
||||
--enable-multilib --disable-shared \
|
||||
--without-headers --with-newlib \
|
||||
--with-pkgversion=$(echo $portVersion | cut -c 7-) --target=$targetArch
|
||||
|
||||
make $jobArgs all-gcc all-target-libgcc
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd $objectsDir
|
||||
|
||||
make install-gcc install-target-libgcc
|
||||
|
||||
### Symlinks ##############################################
|
||||
|
||||
echo "Creating required symlinks"
|
||||
|
||||
# make all tools available via default paths
|
||||
mkdir -p $binDir
|
||||
for f in c++ cc cpp g++ gcc gcov; do
|
||||
symlinkRelative -sfn $installDir/bin/$targetArch-$f $binDir
|
||||
done
|
||||
|
||||
### Cleanup ###############################################
|
||||
|
||||
echo "Cleanup"
|
||||
rm -rf $installDir/info
|
||||
rm -rf $installDir/share
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
SUMMARY="A C library for embedded systems"
|
||||
DESCRIPTION="Newlib is a C library intended for use on embedded systems. It \
|
||||
is a conglomeration of several library parts, all under free software \
|
||||
licenses that make them easily usable on embedded products."
|
||||
LICENSE="
|
||||
BSD (3-clause)
|
||||
GNU LGPL v2.1
|
||||
"
|
||||
HOMEPAGE="http://www.sourceware.org/newlib/"
|
||||
|
||||
# This lists copyrights only for the parts used in this ARM compilation, other
|
||||
# targets may need more or less. Please update this if making a recipe for
|
||||
# another arch.
|
||||
COPYRIGHT="
|
||||
1994-2009 Red Hat, Inc
|
||||
1981-2000 The Regents of the University of California.
|
||||
1991 by AT&T.
|
||||
1998-2001 by Lucent Technologies
|
||||
1989, 1990 Advanced Micro Devices, Inc.
|
||||
1993 by Sun Microsystems, Inc.
|
||||
1986 HEWLETT-PACKARD COMPANY
|
||||
2001 Hans-Peter Nilsson
|
||||
2001 Christopher G. Demetriou
|
||||
2002 SuperH, Inc.
|
||||
1999 Kungliga Tekniska Högskolan
|
||||
2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
|
||||
1997 by Andrey A. Chernov, Moscow, Russia.
|
||||
1997-2002 FreeBSD Project.
|
||||
1984,2000 S.L. Moshier
|
||||
1999 Citrus Project
|
||||
1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
1991 DJ Delorie
|
||||
1990-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
2001 Mike Barcroft <mike@FreeBSD.org>
|
||||
2009 ARM Ltd
|
||||
2008 Ed Schouten <ed@FreeBSD.org>
|
||||
"
|
||||
REVISION="1"
|
||||
|
||||
ARCHITECTURES=""
|
||||
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
|
||||
# x86_gcc2 is fine as primary target architecture as long as we're building
|
||||
# for a different secondary architecture.
|
||||
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
|
||||
fi
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
SRC_URI="ftp://sourceware.org/pub/newlib/newlib-2.1.0.tar.gz"
|
||||
SOURCE_DIR="newlib-$portVersion"
|
||||
CHECKSUM_SHA256="3e4d5ab9f0508942b6231b8ade4f8e5048cf92c96ed574c2bd6bd3320a599a48"
|
||||
|
||||
targetArch="arm-none-eabi"
|
||||
targetU="arm_none_eabi"
|
||||
|
||||
PROVIDES="
|
||||
${targetU}_newlib$secondaryArchSuffix = $portVersion
|
||||
"
|
||||
|
||||
BUILD_PREREQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel >= $haikuVersion
|
||||
cmd:awk
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:makeinfo
|
||||
cmd:${targetU}_ld$secondaryArchSuffix
|
||||
${tagetU}_gcc_nolibc$secondaryArchSuffix
|
||||
"
|
||||
|
||||
sourceDir=$(pwd)
|
||||
installDir="$prefix/$relativeInstallDir/develop"
|
||||
objectsDir=$(pwd)/../${portVersionedName}-obj
|
||||
|
||||
BUILD()
|
||||
{
|
||||
#rm -rf $objectsDir
|
||||
mkdir -p $objectsDir
|
||||
cd $objectsDir
|
||||
|
||||
runConfigure $sourceDir/configure --target=arm-none-eabi \
|
||||
--prefix=$installDir
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd $objectsDir
|
||||
make install
|
||||
}
|
||||
Reference in New Issue
Block a user