1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
|
#! /bin/sh
case $1 in
--help) echo Usage:
echo "$0 \<target_host_triplet\> (default i686-\*-mingw32)"
echo " Expects to find build root in /usr/\<target_host_triplet\>/sys-root/mingw"
;;
i686*mingw32|x86_64*mingw32)
export TARGET_HOST=$1
;;
esac
echo -n Checking for cross compiling environment ...
for target_host in ${TARGET_HOST} i686-w64-mingw32 i686-pc-mingw32 x86_64-w64-mingw32 x86_64-pc-mingw32 none ; do
if test ${target_host} = none ; then
echo ${target_host}
echo Cross compiling environment not found in /usr
exit 1
fi
if test -d /usr/${target_host}; then
export TARGET_HOST=${target_host}
echo /usr/${target_host}
break
fi
done
case $TARGET_HOST in
i686*) openssl_cross=mingw
;;
x86_64*) openssl_cross=mingw64
;;
esac
build_manager=no
build_client=yes
build_libs=yes
build_server=no
export XCOMPILE_ROOT="/usr/${TARGET_HOST}/sys-root/mingw"
guess=`../config.guess`
export BUILD_HOST=`../config.sub ${guess}`
export PATH="/usr/${TARGET_HOST}/bin:${XCOMPILE_ROOT}/bin:${PATH}"
export CC=`which ${TARGET_HOST}-gcc`
export CXX=`which ${TARGET_HOST}-g++`
export AR=`which ${TARGET_HOST}-ar`
export LD=`which ${TARGET_HOST}-ld`
export RANLIB=`which ${TARGET_HOST}-ranlib`
export WINDRES=`which ${TARGET_HOST}-windres`
export CPPFLAGS="-D_WIN32_WINDOWS=0x0410 -DMINGW_WIN32 -I${XCOMPILE_ROOT}/include"
export CFLAGS="${CPPFLAGS}"
export CXXFLAGS="-gstabs -g3 -fpermissive"
export LDFLAGS="-L/usr/${TARGET_HOST}/lib -L${XCOMPILE_ROOT}/lib"
export CURL_CONFIG="${XCOMPILE_ROOT}/bin/curl-config"
export WX_CONFIG_PATH="${XCOMPILE_ROOT}/bin/wx-config"
pkgsearchpath="dummy"
for dir in `find /usr/${TARGET_HOST} -name pkgconfig` ; do
pkgsearchpath="${pkgsearchpath}:${dir}"
done
for dir in `find /usr/lib -name pkgconfig` ; do
pkgsearchpath="${pkgsearchpath}:${dir}"
done
for dir in `find /usr/share -name pkgconfig` ; do
pkgsearchpath="${pkgsearchpath}:${dir}"
done
export PKG_CONFIG_PATH=`echo ${pkgsearchpath} | sed 's/dummy://'`
if ! ( test -e ../configure && find .. -name configure -mtime -1 ) ; then
cd ..
./_autosetup
cd xcompile
fi
if test $build_manager != no -o $build_libs != no ; then
if ! test -f ${XCOMPILE_ROOT}/lib/libjpeg.a ; then
jpegver=9a
wget http://ijg.org/files/jpegsrc.v${jpegver}.tar.gz
tar zxf jpegsrc.v${jpegver}.tar.gz
/bin/rm jpegsrc.v${jpegver}.tar.gz
cd jpeg-${jpegver}
./configure --prefix=${XCOMPILE_ROOT}/ --disable-shared --host=$TARGET_HOST --build=$BUILD_HOST
make -j 4 all
make install
cd ..
rm -rf jpeg-${jpegver}
fi
# if ! test -f ${XCOMPILE_ROOT}/lib/libbmp.a ; then
# svn checkout svn://svn.code.sf.net/p/libbmp/svn/trunk libbmp
# cd libbmp
# sed -e 's/ gcc/'${TARGET_HOST}'-gcc/' -e 's/ g++/'${TARGET_HOST}'-g++/' -e 's/ar/'${TARGET_HOST}'-ar/' Makefile > Makefile.mingw
# make -f Makefile.mingw libbmp.a bmp_go
# cp bmp.h ${XCOMPILE_ROOT}/include
# cp libbmp.a ${XCOMPILE_ROOT}/lib
# cd ..
# rm -rf libbmp
# fi
fi
if test $build_client != no -o $build_manager != no -o $build_libs != no ; then
if ! test -f ${XCOMPILE_ROOT}/lib/libssl.a ; then
opensslver=1.0.1g
wget http://www.openssl.org/source/openssl-${opensslver}.tar.gz
tar zxf openssl-${opensslver}.tar.gz
/bin/rm openssl-${opensslver}.tar.gz
cd openssl-${opensslver}
./Configure --prefix=${XCOMPILE_ROOT}/ ${CFLAGS} ${LDFLAGS} no-shared zlib $openssl_cross
make -j 4 all
make install
cd ..
rm -rf openssl-${opensslver}
fi
fi
if test $build_client != no -o $build_manager != no ; then
if ! test -f ${XCOMPILE_ROOT}/lib/libcurl.a ; then
curlver=7.36.0
wget http://curl.haxx.se/download/curl-${curlver}.tar.bz2
tar jxf curl-${curlver}.tar.bz2
/bin/rm curl-${curlver}.tar.bz2
cd curl-${curlver}
./configure --prefix=${XCOMPILE_ROOT} --enable-static --disable-shared --host=$TARGET_HOST --build=$BUILD_HOST --with-zlib=${XCOMPILE_ROOT}
make -j 4 all
make install
cd ..
rm -rf curl-${curlver}
fi
fi
if test $build_client != no ; then
thisdir=`pwd`
if ! test -f ${XCOMPILE_ROOT}/include/nvapi.h ; then
rsync -va ../coprocs/NVIDIA/include/* ${XCOMPILE_ROOT}/include
fi
nvdir=
if ! test -f ${XCOMPILE_ROOT}/lib/libnvapi.a ; then
mkdir NVIDIA
case $target_host in
i[56]86-*) nvdir=../coprocs/NVIDIA/mswin/Win32/Release/lib
;;
x86*|x64*) nvdir=../coprocs/NVIDIA/mswin/x64/Release/lib
;;
esac
if test x$nvdir != x ; then
rsync -va $nvdir/* NVIDIA
cd NVIDIA
obj=`ar t nvapi.lib | head -1`
objdir=`dirname $obj`
mkdir -p $objdir
ar x nvapi.lib
cd $objdir
ar cr libnvapi.a *.obj
mv *.a ${XCOMPILE_ROOT}/lib
fi
fi
cd $thisdir
rm -rf NVIDIA
fi
if test $build_manager != no ; then
if ! test -f ${XCOMPILE_ROOT}/lib/libwx_baseu_net-3.0-i686-w64-mingw32.dll.a ; then
wxver=3.0.0
filename=wxWidgets-${wxver}.tar.bz2
wget http://sourceforge.net/projects/wxwindows/files/3.0.0/$filename/download
mv download $filename
tar jxf $filename
# rm -f $filename
cd wxWidgets-${wxver}
enables="--with-msw --with-libpng --with-libjpeg --with-libtiff --with-opengl --with-zlib --enable-toolbar --enable-statusbar --enable-statbmp --enable-intl --enable-accessibility --enable-catch_segvs --enable-std_containers --enable-std_iostreams --enable-std_string --enable-std_string_conv_in_wxstring --enable-permissive --enable-xlocale --enable-config --enable-protocols --enable-ftp --enable-http --enable-fileproto --enable-sockets --enable-ole --enable-dataobj --enable-ipc --enable-baseevtloop --enable-selectloop --enable-any --enable-base64 --enable-dialupman --enable-uxtheme "
./configure -C --host=$TARGET_HOST --build=$BUILD_HOST ${enables} --with-libcurl=${XCOMPILE_ROOT} --with-ssl=${XCOMPILE_ROOT} --with-winsock --prefix=${XCOMPILE_ROOT}
make all
make install
/bin/cp lib/*.a ${XCOMPILE_ROOT}/lib
/bin/cp lib/*.dll ${XCOMPILE_ROOT}/bin
/bin/mv -f ${XCOMPILE_ROOT}/lib/wx*.dll ${XCOMPILE_ROOT}/bin
cd ..
rm -rf wxWidgets-${wxver}
fi
fi
if test $build_manager != no -o $build_libs != no ; then
if ! test -f ${XCOMPILE_ROOT}/include/GL/glut.h -a -f ${XCOMPILE_ROOT}/lib/libfreeglut_static.a ; then
svn co http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut freeglut
cd freeglut
mkdir build
cd build
/usr/bin/cmake -D GNU_HOST=${TARGET_HOST} \
-D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain.cmake \
-D CMAKE_INSTALL_PREFIX=${XCOMPILE_ROOT}\
-D FREEGLUT_BUILD_STATIC_LIBS=ON \
-D FREEGLUT_BUILD_SHARED_LIBS=OFF \
-D FREEGLUT_BUILD_DEMOS=OFF \
..
make -j 4 all
make install
cd ../..
/bin/rm -rf freeglut
fi
fi
enables="--enable-static --disable-shared"
if test $build_client != no ; then
enables="${enables} --enable-client"
else
enables="${enables} --disable-client"
fi
if test $build_server != no ; then
enables="${enables} --enable-server"
else
enables="${enables} --disable-server"
fi
if test $build_libs != no ; then
enables="${enables} --enable-libraries"
else
enables="${enables} --disable-libraries"
fi
if test $build_manager != no ; then
enables="${enables} --enable-manager"
else
enables="${enables} --disable-manager"
fi
../configure -C --host=$TARGET_HOST --build=$BUILD_HOST ${enables} --with-libcurl=${XCOMPILE_ROOT} --with-ssl=${XCOMPILE_ROOT} --with-winsock --prefix=${XCOMPILE_ROOT}
make -j 4 all
#exit 0
|