Skip to content

Instantly share code, notes, and snippets.

@sushihangover
Last active August 29, 2015 13:56
Show Gist options
  • Save sushihangover/8949755 to your computer and use it in GitHub Desktop.
Save sushihangover/8949755 to your computer and use it in GitHub Desktop.
Ellcc Build fix for OS-X (ellcc/gnu/build)
#!/bin/sh
# ELLCC GNU tools build script.
# Get the staging directory.
prefix=`cd ..; pwd`
# Figure out the compilers to use.
. ../build-setup $*
echo Configured to $WHY.
echo C compiler: $cc $CFLAGS
echo C++ compiler: $cxx $CXXFLAGS
echo In: gnu-build$builddir
# Configure for GNU tools.
mkdir -p gnu-build$builddir
# Configure for binutils.
# binutils are build to support all targets in the target list.
echo Configuring package binutils for $targets
make DIR=gnu-build$builddir CC=$cc CXX=$cxx AR=$ar TARGET=$host OS=$os \
targetlist=$targetlist haslibs=$haslibs \
bindir=$bindir prefix=$prefix build=$build \
binutils.configure || exit 1
make -C gnu-build$builddir/binutils || exit 1
# Configure for assemblers for all targets.
for t in $targets; do
echo Configuring the assembler for $t
make DIR=gnu-build$builddir CC=$cc CXX=$cxx AR=$ar TARGET=$host OS=$os \
target=$t haslibs=$haslibs \
bindir=$bindir prefix=$prefix build=$build \
gas.configure || exit 1
make -C gnu-build$builddir/binutils/$t || exit 1
done
# Configure for GDB.
# GDB is built to support all GDB targets.
echo Configuring package gdb for $targets
make DIR=gnu-build$builddir CC=$cc CXX=$cxx AR=$ar TARGET=$host OS=$os \
targetlist=$targetlist haslibs=$haslibs \
bindir=$bindir prefix=$prefix build=$build \
gdb.configure || exit 1
make -C gnu-build$builddir/gdb || exit 1
if [ "$host" != "$build" ] ; then
# The host system is not the build system.
# Build only binutils, the assemblers, and gdb.
# Finally, install into the target specific bin dir.
mkdir -p $bindir
make TARGETDIR=$builddir BINDIR=$bindir installcross || exit 1
exit 0
fi
# Configure for QEMU.
# The QEMU system targets.
qemu_target_list="i386-softmmu x86_64-softmmu arm-softmmu \
microblaze-softmmu mips-softmmu mipsel-softmmu \
ppc-softmmu ppc64-softmmu sparc-softmmu"
if [ `uname` = "Linux" ] ; then
# The QEMU Linux user space targets.
qemu_target_list="$qemu_target_list i386-linux-user \
x86_64-linux-user arm-linux-user armeb-linux-user \
microblaze-linux-user mips-linux-user mipsel-linux-user \
ppc-linux-user ppc64-linux-user ppc64abi32-linux-user sparc-linux-user"
fi
echo Configuring package qemu for $targets
if [! -e `which brew` ]; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
brew link gettext --force
qemu_target_list=`echo $qemu_target_list | sed -e "s/ /,/g"`
make DIR=src/qemu CC=$cc HCC=$hcc AR=$ar TARGET=$host OS=$os \
targetlist=$qemu_target_list haslibs=$haslibs \
bindir=$bindir prefix=$prefix build=$build \
qemu.configure || exit 1
make -C src/qemu || exit 1
brew unlink gettext
# Finally, install into the target specific bin dir.
mkdir -p $bindir
make TARGETDIR=$builddir BINDIR=$bindir install || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment