~alexander-voigt2/asteroidbusters/CrossCompilation

« back to all changes in this revision

Viewing changes to sdl-cross-install.sh

  • Committer: Alexander Voigt
  • Date: 2011-01-15 22:34:13 UTC
  • Revision ID: alexander.voigt@physik.tu-dresden.de-20110115223413-x54u6yq8mxctyxnq
add cross compilation helper scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
#
 
3
# SDL Cross-Build Download Script v 1.0
 
4
# =====================================
 
5
# (c) 2006 Dana Olson <dolson@icculus.org>
 
6
# Updated 20080617 by Saul D.
 
7
#
 
8
# SDL 1.2 - http://www.libsdl.org/download-1.2.php
 
9
# SDL_image - http://www.libsdl.org/projects/SDL_image/
 
10
# SDL_mixer - http://www.libsdl.org/projects/SDL_mixer/
 
11
# SDL_net - http://www.libsdl.org/projects/SDL_net/
 
12
# SDL_ttf - http://www.libsdl.org/projects/SDL_ttf/
 
13
 
 
14
# Path to install to. Default is /opt/SDL-1.2.13
 
15
INSTPATH=$1
 
16
if [ "$1" == "" ] ; then
 
17
        INSTPATH=/opt/SDL-1.2.13
 
18
        echo Install path not specified\; using default.
 
19
fi
 
20
 
 
21
# Check and warn if destination exists.
 
22
if [ -e "$INSTPATH" ] ; then
 
23
  echo WARNING!!! Install path already exists!
 
24
fi
 
25
 
 
26
# Allow user to confirm install.
 
27
echo SDL libraries will be installed to $INSTPATH.
 
28
echo Press Enter to continue, ^C to abort.
 
29
read junk
 
30
 
 
31
# Create the patch and subdirectory.
 
32
mkdir -p $INSTPATH/archives/
 
33
 
 
34
# Make sure the directory could be created.
 
35
if [ ! -e "$INSTPATH/archives" ] ; then
 
36
  echo Couldn\'t create install path. Aborting.
 
37
  exit 1
 
38
fi
 
39
echo Installing...
 
40
 
 
41
# Download the SDL archives. Add to this list if you want more libraries.
 
42
cd $INSTPATH/archives/
 
43
for i in \
 
44
http://www.libsdl.org/release/SDL-devel-1.2.13-mingw32.tar.gz \
 
45
http://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-1.2.6-VC8.zip \
 
46
http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-devel-1.2.8-VC8.zip \
 
47
http://www.libsdl.org/projects/SDL_net/release/SDL_net-devel-1.2.7-VC8.zip \
 
48
http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-devel-2.0.9-VC8.zip
 
49
  do wget -c $i
 
50
done
 
51
cd ..
 
52
 
 
53
# Extract the main SDL archive.
 
54
tar zxf archives/SDL-devel-1.2.13-mingw32.tar.gz
 
55
 
 
56
# Extract the addon archives.
 
57
for i in archives/*.zip
 
58
  do unzip $i
 
59
done
 
60
 
 
61
# Make a directory to hold the SDL runtime for Win32.
 
62
mkdir SDL-1.2.13/runtime/
 
63
 
 
64
# Move all the DLLs and README file into here.
 
65
mv */*/*.dll SDL-1.2.13/runtime/
 
66
mv SDL-1.2.13/README-SDL.txt SDL-1.2.13/runtime/
 
67
 
 
68
# Move all the addon libraries into the lib dir.
 
69
mv SDL_*/*/*.lib SDL-1.2.13/lib/
 
70
 
 
71
# Move all the addon headers into the include dir.
 
72
mv SDL_*/*/*.h SDL-1.2.13/include/
 
73
 
 
74
# Remove unneeded directories.
 
75
rm -rf SDL_*/
 
76
 
 
77
# Make a symlink, so that the sdl-config can be found.
 
78
cd SDL-1.2.13/bin/
 
79
ln -s sdl-config i586-mingw32msvc-sdl-config
 
80
 
 
81
# Patch the sdl-config script to point to install path.
 
82
echo "--- i586-mingw32msvc-sdl-config" > sdlcfgfix.patch
 
83
echo "+++ i586-mingw32msvc-sdl-config.fix" >> sdlcfgfix.patch
 
84
echo "@@ -1,6 +1,6 @@" >> sdlcfgfix.patch
 
85
echo " #!/bin/sh" >> sdlcfgfix.patch
 
86
echo " " >> sdlcfgfix.patch
 
87
echo "-prefix=/Users/hercules/tmp/SDL-1.2.13" >> sdlcfgfix.patch
 
88
echo "+prefix=$INSTPATH" >> sdlcfgfix.patch
 
89
echo " exec_prefix=\${prefix}" >> sdlcfgfix.patch
 
90
echo " exec_prefix_set=no" >> sdlcfgfix.patch
 
91
echo " " >> sdlcfgfix.patch
 
92
patch < sdlcfgfix.patch
 
93
mv sdlcfgfix.patch ../../archives/
 
94
 
 
95
# Set proper permissions on some files.
 
96
cd ../../
 
97
chmod -x SDL-1.2.13/lib/* SDL-1.2.13/runtime/*
 
98
 
 
99
# Move everything into install dir.
 
100
mv SDL-1.2.13/ tempsdlinstalldir129
 
101
mv tempsdlinstalldir129/* ./
 
102
rm -r tempsdlinstalldir129/
 
103
 
 
104
# Done!
 
105
echo
 
106
echo Everything is done! SDL was installed in $INSTPATH.
 
107
echo This line should work to cross-compile:
 
108
echo PATH=$INSTPATH/bin:\$PATH ./configure --target=i586-mingw32msvc --host=i586-mingw32msvc --build=i586-linux
 
109
echo
 
110
exit 0