author | Philipp Wiesemann <philipp.wiesemann@arcor.de> |
Wed, 27 Jul 2016 20:47:08 +0200 | |
changeset 10211 | 2e4c1b2fce79 |
parent 9288 | 573ebcb470a3 |
permissions | -rwxr-xr-x |
9283
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1 |
#!/bin/bash |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
2 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
3 |
SDKDIR="/emsdk_portable" |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 |
ENVSCRIPT="$SDKDIR/emsdk_env.sh" |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 |
if [ ! -f "$ENVSCRIPT" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 |
echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 |
exit 1 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 |
fi |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
|
9284
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
10 |
TARBALL="$1" |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
11 |
if [ -z $1 ]; then |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
12 |
TARBALL=sdl-emscripten.tar.xz |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
13 |
fi |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
14 |
|
9283
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
15 |
cd `dirname "$0"` |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
16 |
cd .. |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
17 |
SDLBASE=`pwd` |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
19 |
if [ -z "$MAKE" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
20 |
OSTYPE=`uname -s` |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
21 |
if [ "$OSTYPE" == "Linux" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
22 |
NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l` |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
23 |
let NCPU=$NCPU+1 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
24 |
elif [ "$OSTYPE" = "Darwin" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
25 |
NCPU=`sysctl -n hw.ncpu` |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 |
elif [ "$OSTYPE" = "SunOS" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
27 |
NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'` |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
28 |
else |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
29 |
NCPU=1 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
30 |
fi |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
31 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
32 |
if [ -z "$NCPU" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
33 |
NCPU=1 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
34 |
elif [ "$NCPU" = "0" ]; then |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
35 |
NCPU=1 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
36 |
fi |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
37 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
38 |
MAKE="make -j$NCPU" |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
39 |
fi |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
40 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
41 |
echo "\$MAKE is '$MAKE'" |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
42 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
43 |
echo "Setting up Emscripten SDK environment..." |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
44 |
source "$ENVSCRIPT" |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
45 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
46 |
echo "Setting up..." |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
47 |
set -x |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
48 |
cd "$SDLBASE" |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
49 |
rm -rf buildbot |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
50 |
mkdir buildbot |
9284
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
51 |
pushd buildbot |
9283
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
52 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
53 |
echo "Configuring..." |
9288
573ebcb470a3
Actually fix Unix scripts this time. :)
Ryan C. Gordon <icculus@icculus.org>
parents:
9285
diff
changeset
|
54 |
emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" |
9283
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
55 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
56 |
echo "Building..." |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
57 |
emmake $MAKE |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
58 |
|
9284
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
59 |
echo "Moving things around..." |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
60 |
emmake $MAKE install |
9285
559ac7dd4ee4
I don't know if Unix scripts are useful at all on Emscripten, but fix them up.
Ryan C. Gordon <icculus@icculus.org>
parents:
9284
diff
changeset
|
61 |
# Fix up a few things to a real install path |
9288
573ebcb470a3
Actually fix Unix scripts this time. :)
Ryan C. Gordon <icculus@icculus.org>
parents:
9285
diff
changeset
|
62 |
perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config |
9284
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
63 |
mkdir -p ./usr |
9288
573ebcb470a3
Actually fix Unix scripts this time. :)
Ryan C. Gordon <icculus@icculus.org>
parents:
9285
diff
changeset
|
64 |
mv ./emscripten-sdl2-installed ./usr/local |
9284
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
65 |
popd |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
66 |
tar -cJvvf $TARBALL -C buildbot usr |
f5fb020fb928
A little more work on the Emscripten buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
9283
diff
changeset
|
67 |
rm -rf buildbot |
9283
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
68 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
69 |
exit 0 |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
70 |
|
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
71 |
# end of emscripten-buildbot.sh ... |
6723e3e133ea
Added buildbot script for Emscripten port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
72 |