forked from spring/pr-downloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crosscompile.sh
executable file
·76 lines (66 loc) · 2.11 KB
/
crosscompile.sh
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
#!/bin/sh
set -e
export PREFIX=$(pwd)/mingwlibs
export MINGWHOST=i586-mingw32msvc
export MINGW32CXX=${MINGWHOST}-g++
export MINGW32CC=${MINGWHOST}-gcc
export MINGW32CPP=${MINGWHOST}-cpp
export MINGW32RC=${MINGWHOST}-windres
export MINGW32AR=${MINGWHOST}-ar
export MINGW32RANLIB=${MINGWHOST}-ranlib
export MINGW32RC=${MINGWHOST}-windres
export DOWNLOAD="wget -c"
export PARALLEL="8"
export ZLIBVER=1.2.7
echo "Using ${PREFIX} for mingwlibs"
if [ ! -s "$(pwd)/src/Downloader/IDownloader.h" ]; then
echo "Please run this script from the root directory with scripts/crosscompile.sh."
exit
fi
mkdir -p ${PREFIX}/include
mkdir -p ${PREFIX}/lib
if [ ! -s ${PREFIX}/lib/libz.a ]; then
if [ ! -s zlib-${ZLIBVER}.tar.gz ]; then
${DOWNLOAD} "http://prdownloads.sourceforge.net/libpng/zlib-${ZLIBVER}.tar.gz?download" -O zlib-${ZLIBVER}.tar.gz
fi
tar xifz zlib-${ZLIBVER}.tar.gz
cd zlib-${ZLIBVER}
export CC=${MINGW32CC}
export CPP=${MINGW32CPP}
export LDSHARED=${MINGW32CC}
export AR="${MINGW32AR}"
export RANLIB=${MINGW32RANLIB}
./configure --prefix=${PREFIX}
make install -j ${PARALLEL}
#${CC} -shared -o zlib1.dll -Wl,--out-implib=libz.dll.a [!em]*.o
#cp zlib1.dll ../mingwlibs/dll
cp zlib.h ../mingwlibs/include
cp zconf.h ../mingwlibs/include
cd ..
fi
if [ ! -s ${PREFIX}/lib/libcurl.a ]; then
export CC=${MINGW32CC}
export CXX=${MINGW32CXX}
wget -c http://curl.haxx.se/download/curl-7.24.0.tar.bz2
tar xifj curl-7.24.0.tar.bz2
cd curl-7.24.0
./configure --host=${MINGWHOST} --prefix=${PREFIX} \
--disable-ftp --disable-dict --disable-imap --disable-pop3 \
--disable-smtp --disable-telnet --disable-tftp --disable-ldap \
--disable-rtsp --disable-manual --disable-shared
make install -j ${PARALLEL}
cd ..
fi
rm -f CMakeCache.txt
if [ ! -s win32.cmake ]; then
(
echo "SET(CMAKE_SYSTEM_NAME Windows)"
echo "SET(CMAKE_C_COMPILER $MINGW32CC)"
echo "SET(CMAKE_CXX_COMPILER $MINGW32CXX)"
echo "SET(CMAKE_FIND_ROOT_PATH /usr/$MINGWHOST)"
echo "SET(MINGWLIBS ./mingwlibs)"
echo "SET(CMAKE_RC_COMPILER $MINGW32RC)"
) >win32.cmake
fi
cmake . -DCMAKE_TOOLCHAIN_FILE=win32.cmake -DCMAKE_INSTALL_PREFIX=dist
make install -j ${PARALELL}