184 lines
3.9 KiB
Bash
Executable file
184 lines
3.9 KiB
Bash
Executable file
#!/bin/bash -e
|
|
|
|
function clearBuild() {
|
|
if [ -d ${JOEY}/SDL2/build ]; then
|
|
rm -rf ${JOEY}/SDL2/build
|
|
fi
|
|
mkdir -p ${JOEY}/SDL2/build
|
|
}
|
|
|
|
|
|
function clearInstalled() {
|
|
if [ -d ${JOEY}/SDL2/installed ]; then
|
|
rm -rf ${JOEY}/SDL2/installed
|
|
fi
|
|
mkdir -p ${JOEY}/SDL2/installed
|
|
}
|
|
|
|
|
|
function checkFiles() {
|
|
if [ ! -d SDL ]; then
|
|
hg clone http://hg.libsdl.org/SDL
|
|
cd SDL
|
|
#hg up release-2.0.9
|
|
cd ..
|
|
fi
|
|
if [ ! -d libmodplug ]; then
|
|
git clone https://github.com/Konstanty/libmodplug.git
|
|
cd libmodplug
|
|
libtoolize --force
|
|
aclocal
|
|
autoheader
|
|
automake --force-missing --add-missing
|
|
autoconf
|
|
cd ..
|
|
fi
|
|
if [ ! -d SDL_mixer ]; then
|
|
hg clone http://hg.libsdl.org/SDL_mixer
|
|
cd SDL_mixer
|
|
#hg up release-2.0.4
|
|
cd ..
|
|
fi
|
|
}
|
|
|
|
|
|
function doBuild() {
|
|
clearBuild
|
|
cd build
|
|
../SDL/configure \
|
|
--target="${CROSS}" \
|
|
--host="${CROSS}" \
|
|
--build=x86_64-linux \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--prefix=${PREFIX}
|
|
make
|
|
make install
|
|
cd ..
|
|
|
|
clearBuild
|
|
cd build
|
|
../libmodplug/configure \
|
|
--target="${CROSS}" \
|
|
--host="${CROSS}" \
|
|
--build=x86_64-linux \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--prefix=${PREFIX}
|
|
make
|
|
make install
|
|
cd ..
|
|
|
|
clearBuild
|
|
cd build
|
|
MODPLUG_CFLAGS="-I${PREFIX}/include -DMODPLUG_STATIC" \
|
|
MODPLUG_LIBS="-L${PREFIX}/lib -lmodplug -lstdc++ -lm" \
|
|
../SDL_mixer/configure \
|
|
--target="${CROSS}" \
|
|
--host="${CROSS}" \
|
|
--build=x86_64-linux \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--prefix=${PREFIX} \
|
|
--with-sdl-prefix=${PREFIX} \
|
|
--disable-music-cmd \
|
|
--disable-music-wave \
|
|
--enable-music-mod-modplug \
|
|
--disable-music-mod-modplug-shared \
|
|
--disable-music-mod-mikmod \
|
|
--disable-music-midi \
|
|
--disable-music-ogg \
|
|
--disable-music-flac \
|
|
--disable-music-opus \
|
|
--disable-music-mp3 \
|
|
--disable-music-mp3-mpg123
|
|
make
|
|
make install
|
|
cd ..
|
|
}
|
|
|
|
|
|
ARCH=$1
|
|
|
|
if [ "${ARCH}x" == "x" ]; then
|
|
echo "$0 [arch | \"all\"] | [reset]"
|
|
echo '(Where "arch" is linux32, linux64, windows32, windows64, macos32, or macos64.)'
|
|
exit 0
|
|
fi
|
|
|
|
set -x
|
|
|
|
mkdir -p ${JOEY}/SDL2
|
|
pushd ${JOEY}/SDL2
|
|
|
|
checkFiles
|
|
|
|
if [ "${ARCH}x" == "resetx" ]; then
|
|
clearInstalled
|
|
fi
|
|
|
|
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux64x" ]; then
|
|
TARGET=${JOEY}/joeylib/joeylib/lib/linux/x64
|
|
PREFIX=${JOEY}/SDL2/installed/linux/x64
|
|
CROSS=x86_64-linux-gnu
|
|
export CC="${CROSS}-gcc"
|
|
export CXX="${CROSS}-g++"
|
|
doBuild
|
|
fi
|
|
|
|
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux32x" ]; then
|
|
TARGET=${JOEY}/joeylib/joeylib/lib/linux/x86
|
|
PREFIX=${JOEY}/SDL2/installed/linux/x86
|
|
CROSS=x86_64-linux-gnu
|
|
export CC="${CROSS}-gcc -m32"
|
|
export CXX="${CROSS}-g++ -m32"
|
|
doBuild
|
|
fi
|
|
|
|
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows64x" ]; then
|
|
TARGET=${JOEY}/joeylib/joeylib/lib/windows/x64
|
|
PREFIX=${JOEY}/SDL2/installed/windows/x64
|
|
CROSS=x86_64-w64-mingw32
|
|
export CC="${CROSS}-gcc -static-libgcc"
|
|
export CXX="${CROSS}-g++ -static-libstdc++"
|
|
doBuild
|
|
fi
|
|
|
|
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows32x" ]; then
|
|
TARGET=${JOEY}/joeylib/joeylib/lib/windows/x86
|
|
PREFIX=${JOEY}/SDL2/installed/windows/x86
|
|
CROSS=i686-w64-mingw32
|
|
export CC="${CROSS}-gcc -static-libgcc"
|
|
doBuild
|
|
fi
|
|
|
|
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos64x" ]; then
|
|
TARGET=${JOEY}/joeylib/joeylib/lib/macos/x64
|
|
PREFIX=${JOEY}/SDL2/installed/macos/x64
|
|
CROSS=x86_64-apple-darwin15
|
|
export CC="o64-clang"
|
|
doBuild
|
|
fi
|
|
|
|
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos32x" ]; then
|
|
TARGET=${JOEY}/joeylib/joeylib/lib/macos/x86
|
|
PREFIX=${JOEY}/SDL2/installed/macos/x86
|
|
CROSS=i386-apple-darwin15
|
|
export CC="o32-clang"
|
|
doBuild
|
|
fi
|
|
|
|
#if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "raspbian" ]; then
|
|
#***FIX***
|
|
#TARGET=${JOEY}/joeylib/joeylib/pi/raspbian
|
|
#PREFIX=${JOEY}/SDL2/installed/pi/raspbian
|
|
#CROSS=arm-linux-gnueabihf
|
|
#export CC="${CROSS}-gcc -static-libgcc --sysroot=${JOEY}/sdks/pi/raspbian -I${PREFIX}/include -L${PREFIX}/lib"
|
|
#doBuild
|
|
#fi
|
|
|
|
export CXX=""
|
|
export CC=""
|
|
rm -rf build
|
|
popd
|
|
set +x
|