testdisk/compile.sh

260 lines
7.7 KiB
Bash
Raw Normal View History

2007-10-29 22:38:52 +01:00
#!/bin/sh
# default, host is empty, no cross compilation
# ./compile.sh [ i586-pc-msdosdjgpp | i386-pc-cygwin | i386-pc-mingw32 | powerpc-mac-darwin ]
# Comment the version definition to not compile the library
VER_E2FSPROGS=
VER_PROGSREISERFS=0.3.1-rc8
VER_NTFSPROGS=2.0.0
2010-09-11 17:58:22 +02:00
#VER_LIBEWF=20090510
VER_LIBEWF=20100226
2010-10-23 20:07:08 +02:00
smp_mflags="-j 2"
2007-10-29 22:38:52 +01:00
crosscompile_target=
prefix=/usr/
if [ "$CC" = "gcc295" ];
then
VER_NTFSPROGS=
fi
if [ -z "$1" ];
then
compiledir=.
else
compiledir=$1
if [ "$1" != "$CC" ];
then
VER_E2FSPROGS=1.41.8
2007-10-29 22:38:52 +01:00
crosscompile_target=$1
TESTDISKCC=$crosscompile_target-gcc
fi
fi
prefix=/usr/$crosscompile_target
LYNX=links
LIBEXT=$compiledir/e2fsprogs-$VER_E2FSPROGS/lib/ext2fs/libext2fs.a
LIBNTFS=$compiledir/ntfsprogs-$VER_NTFSPROGS/libntfs/.libs/libntfs.a
LIBREISER=$compiledir/progsreiserfs-$VER_PROGSREISERFS/libreiserfs/.libs/libreiserfs.a
LIBEWF=$compiledir/ewf-$VER_NTFSPROGS/libewf/.libs/libewf.a
pwd_saved=`pwd`
confdir=`(dirname "$0") 2>/dev/null`
cd $confdir
confdir=`pwd`
cd $pwd_saved
PWDSRC=`pwd|sed 's#^\w:/#/#'`/$compiledir
CONFIGUREOPT=
mkdir -p $compiledir
echo "This script will try to compile e2fsprogs progsreiserfs ntfsprogs libraries"
if [ "$VER_E2FSPROGS" != "" ];
then
CONFIGUREOPT="$CONFIGUREOPT --with-ext2fs-lib=${PWDSRC}/e2fsprogs-${VER_E2FSPROGS}/lib --with-ext2fs-includes=${PWDSRC}/e2fsprogs-${VER_E2FSPROGS}/lib"
if [ ! -e $compiledir/e2fsprogs-$VER_E2FSPROGS/configure ];
2007-10-29 22:38:52 +01:00
then
if [ ! -e e2fsprogs-$VER_E2FSPROGS.tar.gz ];
then
2007-10-29 22:38:52 +01:00
$LYNX http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-$VER_E2FSPROGS.tar.gz
fi
if [ -e e2fsprogs-$VER_E2FSPROGS.tar.gz ];
2007-10-29 22:38:52 +01:00
then
tar xzf e2fsprogs-$VER_E2FSPROGS.tar.gz -C $compiledir
fi
fi
if [ ! -e $compiledir/e2fsprogs-$VER_E2FSPROGS/Makefile ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/e2fsprogs-$VER_E2FSPROGS/configure ];
2007-10-29 22:38:52 +01:00
then
2008-06-10 12:53:38 +02:00
rm -f $compiledir/Makefile
2007-10-29 22:38:52 +01:00
cd $compiledir/e2fsprogs-$VER_E2FSPROGS
case "$crosscompile_target" in
arm-marvell-linux-gnu)
CC=$TESTDISKCC CFLAGS="$CFLAGS -g -O2 -DOMIT_COM_ERR" ./configure --host=$crosscompile_target --prefix=$prefix --disable-tls
;;
*)
CC=$TESTDISKCC CFLAGS="$CFLAGS -g -O2 -DOMIT_COM_ERR" ./configure --host=$crosscompile_target --prefix=$prefix
;;
esac
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi
if [ ! -e $LIBEXT ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/e2fsprogs-$VER_E2FSPROGS/Makefile ];
2007-10-29 22:38:52 +01:00
then
cd $compiledir/e2fsprogs-$VER_E2FSPROGS
2010-10-23 20:07:08 +02:00
make $smp_mflags libs
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi
fi
if [ "$VER_PROGSREISERFS" != "" ];
then
CONFIGUREOPT="$CONFIGUREOPT --with-reiserfs-lib=${PWDSRC}/progsreiserfs-${VER_PROGSREISERFS}/libreiserfs/.libs/ --with-reiserfs-includes=${PWDSRC}/progsreiserfs-${VER_PROGSREISERFS}/include/ --with-dal-lib=${PWDSRC}/progsreiserfs-${VER_PROGSREISERFS}/libdal/.libs/"
if [ ! -e $compiledir/progsreiserfs-$VER_PROGSREISERFS/configure ];
2007-10-29 22:38:52 +01:00
then
if [ ! -e progsreiserfs-$VER_PROGSREISERFS.tar.gz ];
then
2007-10-29 22:38:52 +01:00
$LYNX http://reiserfs.osdn.org.ua/snapshots/progsreiserfs-$VER_PROGSREISERFS.tar.gz
fi
if [ -e progsreiserfs-$VER_PROGSREISERFS.tar.gz ];
2007-10-29 22:38:52 +01:00
then
tar xzf progsreiserfs-$VER_PROGSREISERFS.tar.gz -C $compiledir
fi
fi
if [ ! -e $compiledir/progsreiserfs-$VER_PROGSREISERFS/Makefile ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/progsreiserfs-$VER_PROGSREISERFS/configure ];
2007-10-29 22:38:52 +01:00
then
2008-06-10 12:53:38 +02:00
# rm -f $compiledir/Makefile
2007-10-29 22:38:52 +01:00
cd $compiledir/progsreiserfs-$VER_PROGSREISERFS
./configure --host=$crosscompile_target --prefix=$prefix --disable-nls --disable-Werror
cd $pwd_saved
fi
fi
#vim /home/kmaster/src/testdisk/powerpc-apple-darwin/progsreiserfs-0.3.1-rc8/libtool
#%s/AR="ar"/AR="powerpc-apple-darwin-ar"/
if [ ! -e $LIBREISER ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/progsreiserfs-$VER_PROGSREISERFS/Makefile ];
2007-10-29 22:38:52 +01:00
then
cd $compiledir/progsreiserfs-$VER_PROGSREISERFS
2010-10-23 20:07:08 +02:00
make $smp_mflags
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi
fi
if [ "$VER_NTFSPROGS" != "" ];
then
CONFIGUREOPT="$CONFIGUREOPT --with-ntfs-lib=${PWDSRC}/ntfsprogs-${VER_NTFSPROGS}/libntfs/.libs/ --with-ntfs-includes=${PWDSRC}/ntfsprogs-${VER_NTFSPROGS}/include/"
if [ ! -e $compiledir/ntfsprogs-$VER_NTFSPROGS/configure ];
2007-10-29 22:38:52 +01:00
then
if [ ! -e ntfsprogs-$VER_NTFSPROGS.tar.gz ];
then
2007-10-29 22:38:52 +01:00
$LYNX http://prdownloads.sourceforge.net/linux-ntfs/ntfsprogs-$VER_NTFSPROGS.tar.gz
fi
if [ -e ntfsprogs-$VER_NTFSPROGS.tar.gz ];
2007-10-29 22:38:52 +01:00
then
tar xzf ntfsprogs-$VER_NTFSPROGS.tar.gz -C $compiledir
fi
fi
if [ ! -e $compiledir/ntfsprogs-$VER_NTFSPROGS/Makefile ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/ntfsprogs-$VER_NTFSPROGS/configure ];
2007-10-29 22:38:52 +01:00
then
2008-06-10 12:53:38 +02:00
# rm -f $compiledir/Makefile
2007-10-29 22:38:52 +01:00
cd $compiledir/ntfsprogs-$VER_NTFSPROGS
# --disable-default-device-io-ops is need for NT 4
CC=$TESTDISKCC ./configure --host=$crosscompile_target --prefix=$prefix --disable-default-device-io-ops --disable-crypto
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi
if [ ! -e $LIBNTFS ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/ntfsprogs-$VER_NTFSPROGS/Makefile ];
2007-10-29 22:38:52 +01:00
then
cd $compiledir/ntfsprogs-$VER_NTFSPROGS
2010-10-23 20:07:08 +02:00
make $smp_mflags libs
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi
fi
if [ "$VER_LIBEWF" != "" ];
then
CONFIGUREOPT="$CONFIGUREOPT --with-ewf-lib=${PWDSRC}/libewf-${VER_LIBEWF}/libewf/.libs/ --with-ewf-includes=${PWDSRC}/libewf-${VER_LIBEWF}/include/"
if [ ! -e $compiledir/libewf-$VER_LIBEWF/configure ];
2007-10-29 22:38:52 +01:00
then
2008-03-23 16:22:02 +01:00
if [ ! -e libewf-$VER_LIBEWF.tar.gz ];
then
2008-03-23 16:22:02 +01:00
if [ ! -e libewf-beta-$VER_LIBEWF.tar.gz ];
then
$LYNX "http://sourceforge.net/project/platformdownload.php?group_id=167783"
2008-03-23 16:22:02 +01:00
fi
fi
if [ -e libewf-$VER_LIBEWF.tar.gz ];
2007-10-29 22:38:52 +01:00
then
tar xzf libewf-$VER_LIBEWF.tar.gz -C $compiledir
fi
if [ -e libewf-beta-$VER_LIBEWF.tar.gz ];
then
tar xzf libewf-beta-$VER_LIBEWF.tar.gz -C $compiledir
fi
2007-10-29 22:38:52 +01:00
fi
if [ ! -e $compiledir/libewf-$VER_LIBEWF/Makefile ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/libewf-$VER_LIBEWF/configure ];
2007-10-29 22:38:52 +01:00
then
2008-06-10 12:53:38 +02:00
# rm -f $compiledir/Makefile
2007-10-29 22:38:52 +01:00
cd $compiledir/libewf-$VER_LIBEWF
CC=$TESTDISKCC ./configure --host=$crosscompile_target --prefix=$prefix
cd $pwd_saved
fi
fi
if [ ! -e $LIBEWF ];
2007-10-29 22:38:52 +01:00
then
if [ -e $compiledir/libewf-$VER_LIBEWF/Makefile ];
2007-10-29 22:38:52 +01:00
then
cd $compiledir/libewf-$VER_LIBEWF
2010-10-23 20:07:08 +02:00
make $smp_mflags lib
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi
fi
echo "Try to compile TestDisk"
CC=$TESTDISKCC
export CC
if [ -d $compiledir ];
then
if [ ! -e $compiledir/Makefile ];
then
cd $compiledir
2007-11-28 22:42:36 +01:00
case "$crosscompile_target" in
powerpc-apple-darwin)
2007-10-29 22:38:52 +01:00
# libewf should work under MacOSX but it hasn't been tested
# use --with-ncurses-lib=$prefix/usr/lib to get binaries that don't need libncurses
# but users may be unable to navigate...
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT --without-ewf --enable-sudo --with-sudo-bin=/usr/bin/sudo
2007-11-28 22:42:36 +01:00
;;
i686-apple-darwin9)
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT --enable-sudo --with-sudo-bin=/usr/bin/sudo
;;
2007-11-28 22:42:36 +01:00
i586-pc-msdosdjgpp)
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT --without-ewf --without-iconv
;;
i386-pc-cygwin)
2010-10-23 20:07:08 +02:00
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT
2007-11-28 22:42:36 +01:00
;;
i386-mingw32)
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT --without-iconv --enable-missing-uuid-ok
;;
2010-09-11 17:58:22 +02:00
i686-pc-mingw32|x86_64-pc-mingw32)
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT --enable-missing-uuid-ok
;;
arm-marvell-linux-gnu)
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT --without-ewf --without-ntfs
;;
2007-11-28 22:42:36 +01:00
*)
2007-10-29 22:38:52 +01:00
$confdir/configure --host=$crosscompile_target --prefix=$prefix $CONFIGUREOPT
2007-11-28 22:42:36 +01:00
;;
esac
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
if [ -e $compiledir/Makefile ];
then
cd $compiledir
2010-10-23 20:07:08 +02:00
make $smp_mflags
2007-10-29 22:38:52 +01:00
cd $pwd_saved
fi
fi