This repository has been archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build_pi.sh
executable file
·111 lines (65 loc) · 1.86 KB
/
build_pi.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
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
#!/bin/bash
set -ex
ROOT="$(readlink -f $(dirname $0)/..)"
export RASPBERRY_PI=1
cd "$ROOT"
mkdir -p build
# Set up apt, and use it to get packages and sources.
if [ ! -e build/built.pi_apt ]; then
echo deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi | sudo tee /etc/apt/sources.list.d/raspian.list
sudo apt-get update
sudo apt-get install -y build-essential ccache cython git
sudo apt-get build-dep -y libsdl2-2.0-0
touch build/built.pi_apt
fi
# Make sure we have pygame_sdl2.
if [ ! -e pygame_sdl2 ] ; then
git clone https://github.com/renpy/pygame_sdl2 pygame_sdl2
fi
# Make sure we have renpy.
if [ ! -e renpy ] ; then
git clone https://github.com/renpy/renpy renpy
fi
# Build Python.
if [ ! -e build/built.pi_python ]; then
./renpy-deps/build_python.sh
touch build/built.pi_python
fi
# Build Ren'Py Dependencies.
if [ ! -e build/built.pi_deps ]; then
./renpy-deps/build.sh
touch build/built.pi_deps
fi
# Source in the built environment.
. env.sh
# Build pygame_sdl2.
export PYGAME_SDL2_INSTALL_HEADERS=1
export PYGAME_SDL2_CC="ccache gcc"
export PYGAME_SDL2_LD="ccache gcc"
export PYGAME_SDL2_CXX="ccache g++"
INCLUDE="$ROOT/install/include/pygame_sdl2"
pushd pygame_sdl2
python setup.py install_lib -d "$PYTHONPATH"
python setup.py install_headers -d "$INCLUDE"
popd
# Build Ren'Py.
export RENPY_RASPBERRY_PI=1
export RENPY_CC="ccache gcc"
export RENPY_LD="ccache gcc"
export RENPY_CXX="ccache g++"
pushd renpy/module
python setup.py install_lib -d "$PYTHONPATH"
popd
# Launch script.
cat > pi_renpy.sh <<EOT
#!/bin/sh
. "$ROOT/env.sh"
exec python -O "$ROOT/renpy/renpy.py" "\$@"
EOT
chmod +x pi_renpy.sh
# Build distro.
pushd "$ROOT/renpy-deps/renpython"
python -O build.py linux-`arch` "$ROOT/renpy" renpy.py
popd
rm -Rf renpy/lib
cp -a renpy/build/linux-armv7l/lib renpy