properly cross-compile

SVN revision: 9000
This commit is contained in:
Carsten Haitzler 2004-02-17 07:11:28 +00:00
parent c17ec61deb
commit 6886d05af0
4 changed files with 73 additions and 67 deletions

View File

@ -4,10 +4,13 @@ dnl Process this file with autoconf to produce a configure script.
rm -f config.cache
AC_INIT(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_ISC_POSIX
AM_INIT_AUTOMAKE(eet, 0.9.0)
AM_CONFIG_HEADER(config.h)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC

View File

@ -1,73 +1,75 @@
#!/bin/sh
PROJ="eet"
SKIFF="/skiff/local"
HOSTARCH="i686-pc-linux-gnu"
TARGETCPU="arm"
TARGETARCH=$TARGETCPU"-pc-linux-gnu"
make clean distclean
./configure
export CC=$SKIFF"/bin/"$TARGETCPU"-linux-gcc"
export CFLAGS=-O9
./configure \
--host=$HOSTARCH \
--build=$TARGETARCH \
--target=$TARGETARCH
cp config.h config.h.bak
grep -v HAVE_FMEMOPEN config.h.bak > config.h
#cp config.h config.h.bak
#grep -v HAVE_OPEN_MEMSTREAM config.h.bak > config.h
rm config.h.bak
INST="/tmp/"$PROJ"-instroot"
sudo rm -rf $INST
CC="/skiff/local/bin/arm-linux-gcc"
ST="/skiff/local/bin/arm-linux-strip"
CFLAGS="-O2"
make
rm -rf "build"
mkdir "build"
DST=`pwd`"/build";
for I in find . -name "*.la" -print; do
sed s:"/usr/local":$INST:g < $I > "/tmp/.sed.tmp"
sudo cp "/tmp/.sed.tmp" $I
rm -f "/tmp/.sed.tmp"
done
mkdir $DST"/lib";
mkdir $DST"/bin";
mkdir $DST"/include";
#mkdir $DST"/share";
#mkdir $DST"/share/eet";
sudo \
make \
prefix=$INST \
exec_prefix=$INST \
bindir=$INST"/bin" \
sbindir=$INST"/sbin" \
sysconfdir=$INST"/etc" \
datadir=$INST"/share" \
includedir=$INST"/include" \
libdir=$INST"/lib" \
libexecdir=$INST"/libexec" \
localstatedir=$INST"/var/run" \
mandir=$INST"/share/man" \
infodir=$INST"/share/info" \
install
pushd src
## FIXUPS
for I in $INST"/bin/"* $INST"/sbin/"* $INST"/libexec/"*; do
J=`echo $I | sed s:$TARGETARCH"-"::g`
sudo mv $I $J
done
pushd lib
LIB="eet"
$CC \
*.c \
$CFLAGS \
-I. \
-I../.. \
-I/skiff/local/include \
-shared -fPIC -DPIC \
-Wl,-soname -Wl,"lib"$LIB".so.0.0.1" \
-o "lib"$LIB".so.0.0.1"
$ST -g "lib"$LIB".so.0.0.1"
rm -f "lib"$LIB".so"
ln -s "lib"$LIB".so.0.0.1" "lib"$LIB".so"
rm -f "lib"$LIB".so.0"
ln -s "lib"$LIB".so.0.0.1" "lib"$LIB".so.0"
rm -f "lib"$LIB".so.0.0"
ln -s "lib"$LIB".so.0.0.1" "lib"$LIB".so.0.0"
cp -a "lib"$LIB".so"* $DST"/lib";
cp -a "Eet.h" $DST"/include";
popd
CF=$INST"/bin/"$PROJ"-config"
sed s:"/usr/local":$SKIFF"/"$TARGETCPU"-linux":g < $CF > "/tmp/.sed.tmp"
sudo cp "/tmp/.sed.tmp" $CF
rm -f "/tmp/.sed.tmp"
pushd bin
BIN="eet"
$CC "eet_main.c" \
-I../.. -I../lib \
-I. \
-I/skiff/local/include \
-L. -L../lib \
-L/skiff/local/lib \
-leet -ljpeg -lz -lm \
-o $BIN
$ST $BIN
cp -a $BIN $DST"/bin";
popd
popd
for I in $INST"/lib/"*.la; do
sed s:"/usr/local":$SKIFF"/"$TARGETCPU"-linux":g < $I > "/tmp/.sed.tmp"
sudo cp "/tmp/.sed.tmp" $I
rm -f "/tmp/.sed.tmp"
done
#cp -ar data $DST"/share/eet"
## package it all up
PACK=$PROJ"-"$TARGETCPU"-inst.tar.gz"
DIR=$PWD
cd $INST
sudo tar zcvf $DIR"/"$PACK *
sudo chown $USER $DIR"/"$PACK
cd $DIR
sudo rm -rf $INST
## install it in our skiff tree
cd $SKIFF"/"$TARGETCPU"-linux"
sudo tar zxvf $DIR"/"$PACK
PD=`pwd`
pushd "build"
tar zcvf $PD"/data.tar.gz" *
pushd /skiff/local
sudo tar zxvf $PD"/data.tar.gz"
popd
popd

View File

@ -1,7 +1,6 @@
## Process this file with automake to produce Makefile.in
INCLUDES = \
-I../lib
INCLUDES = -I$(top_srcdir)/src/lib
bin_PROGRAMS = eet

View File

@ -5,9 +5,11 @@ AUTOMAKE_OPTIONS = 1.4 foreign
# A list of all the files in the current directory which can be regenerated
MAINTAINERCLEANFILES = Makefile.in
LDFLAGS = -L/usr/local/lib
INCLUDES = -I/usr/local/include \
-I$(includedir)
LDFLAGS =
INCLUDES = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include
lib_LTLIBRARIES = libeet.la
include_HEADERS = Eet.h