updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / renpy64 / Renpy64-build.sh
blob9c23877f4a07855f7a00eec87cab7c743d9bb2c7
1 #!/bin/sh
2 BUILD_DIR="/tmp/renpy64"
3 FILE_RUNTIME="renpy-6.10.2-sdk.tar.bz2"
4 FILE_DEPS="renpy-deps-6.10.1.tar.bz2"
6 RENPY_LATEST="/tmp/renpy64/renpy-6.10.2"
7 RENPY_DEPS="/tmp/renpy64/renpy-deps"
9 _runtime64="/tmp/renpy64/renpy-6.10.2/lib/linux-x86_64"
10 _python64="/tmp/renpy64/renpy-6.10.2/lib/linux-x86_64/lib/python2.5"
12 _runtime32="/tmp/renpy64/renpy-6.10.2/lib/linux-x86"
14 _runtime64new="/tmp/renpy64/renpy-deps/install"
15 _python64new="/tmp/renpy64/renpy-deps/install/lib/python2.5"
17 clear
19 usage() {
20 echo -e "Usage: $0 [-j|--with-jedit] || [-s|--with-scite] [-a|--with-all]\n"
21 echo "OPTIONS:"
22 echo " -j built-in jEdit editor (depends on 'java-runtime')"
23 echo " -s built-in SciTE editor (depends on 'gtk2')"
24 echo " -a built-in both editors"
25 echo ""
26 echo "EXAMPLE:"
27 echo " $0 --with-jedit"
28 echo ""
31 if [ "$1" == "" ]; then
32 usage
33 exit 0
36 while [ "$1" != "" ]; do
37 case "$1" in
38 --with-all|-a)
39 WITH_JEDIT="true"
40 WITH_SCITE="true"
41 shift
43 --with-jedit|-j)
44 WITH_JEDIT="true"
45 WITH_SCITE="false"
46 shift
48 --with-scite|-s)
49 WITH_JEDIT="false"
50 WITH_SCITE="true"
51 shift
54 usage
55 exit 1
57 esac
58 done
60 echo -e "Building renpy 6.10.2-3 with Linux x86_64 support patch\n"
62 cd ${BUILD_DIR}
63 echo -e "Decompressing renpy source...\n"
64 tar jxvf ${FILE_RUNTIME} > /dev/null 2>&1 || exit 1
65 echo -e "Decompressing renpy dependencies source...\n"
66 tar jxvf ${FILE_DEPS} > /dev/null 2>&1 || exit 1
68 cd ${RENPY_DEPS}
69 echo -e "Applying x86_64 build patches..."
70 patch -p0 < ${BUILD_DIR}/Renpy-build_python.patch || exit 1
71 patch -p0 < ${BUILD_DIR}/Renpy-build.patch || exit 1
72 echo -e "\nBuilding python...\n(This may take several minutes)\n"
73 ./build_python.sh > /dev/null 2>&1 || exit 1
74 echo -e "Building dependencies...\n(This may take several minutes)\n"
75 ./build.sh > /dev/null 2>&1 || exit 1
77 cd ${RENPY_LATEST}/lib
78 echo -e "Applying x86_64 renpy patches..."
79 patch -p0 < ${BUILD_DIR}/Renpy-python-x86_64.patch || exit 1
80 cd ${RENPY_LATEST}/launcher
81 patch -p0 -R < ${BUILD_DIR}/Renpy-distribute-x86_64.patch || exit 1
83 ###########################################
84 ## FIXME: Need patch for new game folder ##
85 ###########################################
87 source ${RENPY_DEPS}/env.sh || exit 1
88 cd ${RENPY_LATEST}/module
89 echo -e "\nBuilding py4renpy...\n"
90 python setup.py install_lib -d $PYTHONPATH > /dev/null 2>&1 || exit 1
92 echo -e "Copying Ren'Py x86_64 runtime...\n"
93 cp -Rf ${_runtime32} ${_runtime64} > /dev/null 2>&1 || exit 1
94 rm -Rf ${_python64}/_md5.so ${_python64}/_sha.so ${_python64}/_sha256.so ${_python64}/_sha512.so > /dev/null 2>&1 || exit 1
96 cp -Rf ${BUILD_DIR}/scale.py ${RENPY_LATEST}/renpy/display/scale.py > /dev/null 2>&1 || exit 1
98 cp -Rf ${_runtime64new}/bin/python ${_runtime64}/python.real || exit 1
100 cp -Rf ${_runtime64new}/lib/libavcodec.so.52.20.0 ${_runtime64}/lib/libavcodec.so.52 > /dev/null 2>&1 || exit 1
101 cp -Rf ${_runtime64new}/lib/libavformat.so.52.31.0 ${_runtime64}/lib/libavformat.so.52 > /dev/null 2>&1 || exit 1
102 cp -Rf ${_runtime64new}/lib/libavutil.so.49.15.0 ${_runtime64}/lib/libavutil.so.49 > /dev/null 2>&1 || exit 1
103 cp -Rf ${_runtime64new}/lib/libfreetype.so.6.3.22 ${_runtime64}/lib/libfreetype.so.6 > /dev/null 2>&1 || exit 1
104 cp -Rf ${_runtime64new}/lib/libfribidi.so.0.3.1 ${_runtime64}/lib/libfribidi.so.0 > /dev/null 2>&1 || exit 1
105 cp -Rf ${_runtime64new}/lib/libpython2.5.so.1.0 ${_runtime64}/lib/libpython2.5.so.1.0 > /dev/null 2>&1 || exit 1
106 cp -Rf ${_runtime64new}/lib/libSDL-1.2.so.0.11.2 ${_runtime64}/lib/libSDL-1.2.so.0 > /dev/null 2>&1 || exit 1
107 cp -Rf ${_runtime64new}/lib/libSDL_ttf-2.0.so.0.6.2 ${_runtime64}/lib/libSDL_ttf-2.0.so.0 > /dev/null 2>&1 || exit 1
109 cp -Rf ${_python64new}/lib-dynload/_hashlib.so ${_python64} > /dev/null 2>&1 || exit 1
110 cp -Rf ${_python64new}/lib-dynload/ossaudiodev.so ${_python64} > /dev/null 2>&1 || exit 1
111 cp -Rf ${_python64new}/lib-dynload/pyexpat.so ${_python64} > /dev/null 2>&1 || exit 1
112 cp -Rf ${_python64new}/lib-dynload/zlib.so ${_python64} > /dev/null 2>&1 || exit 1
113 cp -Rf ${_python64new}/lib-dynload/_socket.so ${_python64} > /dev/null 2>&1 || exit 1
114 cp -Rf ${_python64new}/lib-dynload/cPickle.so ${_python64} > /dev/null 2>&1 || exit 1
115 cp -Rf ${_python64new}/lib-dynload/cStringIO.so ${_python64} > /dev/null 2>&1 || exit 1
116 cp -Rf ${_python64new}/lib-dynload/parser.so ${_python64} > /dev/null 2>&1 || exit 1
117 cp -Rf ${_python64new}/lib-dynload/binascii.so ${_python64} > /dev/null 2>&1 || exit 1
118 cp -Rf ${_python64new}/lib-dynload/select.so ${_python64} > /dev/null 2>&1 || exit 1
119 cp -Rf ${_python64new}/lib-dynload/fcntl.so ${_python64} > /dev/null 2>&1 || exit 1
120 cp -Rf ${_python64new}/lib-dynload/grp.so ${_python64} > /dev/null 2>&1 || exit 1
121 cp -Rf ${_python64new}/lib-dynload/operator.so ${_python64} > /dev/null 2>&1 || exit 1
122 cp -Rf ${_python64new}/lib-dynload/_bisect.so ${_python64} > /dev/null 2>&1 || exit 1
123 cp -Rf ${_python64new}/lib-dynload/_heapq.so ${_python64} > /dev/null 2>&1 || exit 1
124 cp -Rf ${_python64new}/lib-dynload/collections.so ${_python64} > /dev/null 2>&1 || exit 1
125 cp -Rf ${_python64new}/lib-dynload/itertools.so ${_python64} > /dev/null 2>&1 || exit 1
126 cp -Rf ${_python64new}/lib-dynload/datetime.so ${_python64} > /dev/null 2>&1 || exit 1
127 cp -Rf ${_python64new}/lib-dynload/_random.so ${_python64} > /dev/null 2>&1 || exit 1
128 cp -Rf ${_python64new}/lib-dynload/time.so ${_python64} > /dev/null 2>&1 || exit 1
129 cp -Rf ${_python64new}/lib-dynload/strop.so ${_python64} > /dev/null 2>&1 || exit 1
130 cp -Rf ${_python64new}/lib-dynload/math.so ${_python64} > /dev/null 2>&1 || exit 1
131 cp -Rf ${_python64new}/lib-dynload/array.so ${_python64} > /dev/null 2>&1 || exit 1
132 cp -Rf ${_python64new}/lib-dynload/_ctypes.so ${_python64} > /dev/null 2>&1 || exit 1
133 cp -Rf ${_python64new}/lib-dynload/_weakref.so ${_python64} > /dev/null 2>&1 || exit 1
134 cp -Rf ${_python64new}/lib-dynload/_struct.so ${_python64} > /dev/null 2>&1 || exit 1
135 cp -Rf ${_python64new}/lib-dynload/bz2.so ${_python64} > /dev/null 2>&1 || exit 1
137 cp -Rf ${_runtime64new}/python/_renpy.so ${_python64} > /dev/null 2>&1 || exit 1
138 cp -Rf ${_runtime64new}/python/_renpy_font.so ${_python64} > /dev/null 2>&1 || exit 1
139 cp -Rf ${_runtime64new}/python/_renpybidi.so ${_python64} > /dev/null 2>&1 || exit 1
141 cp -Rf ${_runtime64new}/python/pygame/base.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
142 cp -Rf ${_runtime64new}/python/pygame/cdrom.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
143 cp -Rf ${_runtime64new}/python/pygame/color.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
144 cp -Rf ${_runtime64new}/python/pygame/constants.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
145 cp -Rf ${_runtime64new}/python/pygame/display.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
146 cp -Rf ${_runtime64new}/python/pygame/draw.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
147 cp -Rf ${_runtime64new}/python/pygame/event.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
148 cp -Rf ${_runtime64new}/python/pygame/fastevent.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
149 cp -Rf ${_runtime64new}/python/pygame/font.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
150 cp -Rf ${_runtime64new}/python/pygame/imageext.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
151 cp -Rf ${_runtime64new}/python/pygame/image.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
152 cp -Rf ${_runtime64new}/python/pygame/joystick.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
153 cp -Rf ${_runtime64new}/python/pygame/key.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
154 cp -Rf ${_runtime64new}/python/pygame/mask.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
155 cp -Rf ${_runtime64new}/python/pygame/mouse.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
156 cp -Rf ${_runtime64new}/python/pygame/overlay.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
157 cp -Rf ${_runtime64new}/python/pygame/pixelarray.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
158 cp -Rf ${_runtime64new}/python/pygame/rect.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
159 cp -Rf ${_runtime64new}/python/pygame/rwobject.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
160 cp -Rf ${_runtime64new}/python/pygame/surface.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
161 cp -Rf ${_runtime64new}/python/pygame/surflock.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
162 cp -Rf ${_runtime64new}/python/pygame/time.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
163 cp -Rf ${_runtime64new}/python/pygame/transform.so ${_python64}/pygame > /dev/null 2>&1 || exit 1
165 cp -Rf ${_runtime64new}/python/pysdlsound/sound.so ${_python64}/pysdlsound > /dev/null 2>&1 || exit 1
167 mkdir -p ${BUILD_DIR}/PACKAGE/usr/share/renpy64
168 mkdir -p ${BUILD_DIR}/PACKAGE/usr/bin
170 if [ "${WITH_JEDIT}" == "false" ]; then
171 echo -e "Removing Ren'py jEdit support...\n"
172 rm -rf ${RENPY_LATEST}/jedit
173 else
174 echo -e "Adding Ren'py jEdit support...\n"
177 if [ "${WITH_SCITE}" == "true" ]; then
178 echo -e "Copying Ren'py SciTE support...\n"
179 cd ${RENPY_LATEST}
180 bsdtar -x -f ${BUILD_DIR}/scite-renpy-20090803.zip > /dev/null 2>&1 || exit 1
182 echo -e "Decompressing SciTE 2.11 source...\n"
183 mkdir -p ${BUILD_DIR}/scite-x86_64
184 mkdir -p ${BUILD_DIR}/scite-x86_64/build
185 cd ${BUILD_DIR}/scite-x86_64
186 tar xzvf ${BUILD_DIR}/scite211.tgz > /dev/null 2>&1 || exit 1
188 echo -e "Building SciTE 2.11 for x86_64...\n"
189 cd ${BUILD_DIR}/scite-x86_64/scintilla/gtk
190 make > /dev/null 2>&1 || exit 1
191 cd ${BUILD_DIR}/scite-x86_64/scite/gtk
192 make prefix=${BUILD_DIR}/scite-x86_64/build > /dev/null 2>&1 || exit 1
193 make install prefix=${BUILD_DIR}/scite-x86_64/build > /dev/null 2>&1 || exit 1
195 echo -e "Copying SciTE x86_64 support...\n"
196 cp -rf ${BUILD_DIR}/scite-x86_64/build/bin/SciTE ${RENPY_LATEST}/scite/scite.linux-x86_64
199 echo -e "Copying renpy64 files...\n"
200 cp -fr ${RENPY_LATEST}/* ${BUILD_DIR}/PACKAGE/usr/share/renpy64 > /dev/null 2>&1 || exit 1
202 echo -e "Cleaning up temp files...\n"
203 rm -rf ${BUILD_DIR}/renpy-6.10.2 ${BUILD_DIR}/renpy-deps ${BUILD_DIR}/scite-x86_64
205 echo -e "Writing renpy64 wrapper...\n"
206 echo "if [ -d ~/renpy_projects ]; then
207 echo 'The renpy_projects is already existing, using it.'
208 else
209 mkdir ~/renpy_projects
211 cd ~/renpy_projects
212 /usr/share/renpy64/renpy.sh || zenity --error --text="There were an error while trying to run renpy64.\nRun "renpy64" in a terminal to see output.\n\nIf you updated core parts of your system, you\nmay need to recompile renpy64."
213 " > ${BUILD_DIR}/PACKAGE/usr/bin/renpy64
215 chmod +x ${BUILD_DIR}/PACKAGE/usr/bin/renpy64
217 echo -e "Adding renpy64 desktop files...\n"
218 mkdir -p ${BUILD_DIR}/PACKAGE/usr/share/pixmaps
219 cp ${BUILD_DIR}/renpy_logo.png ${BUILD_DIR}/PACKAGE/usr/share/pixmaps/renpy64.png
220 install -D -m644 ${BUILD_DIR}/renpy64.desktop ${BUILD_DIR}/PACKAGE/usr/share/applications/renpy64.desktop
222 cd ${BUILD_DIR}
223 echo -e "Building renpy64 source package...\n"
224 tar jcvf renpy64-6.10.2-3.source.tar.bz2 PACKAGE > /dev/null 2>&1 || exit 1
225 rm -Rf ${BUILD_DIR}/PACKAGE > /dev/null 2>&1 || exit 1
227 SOURCE_MD5SUM=`md5sum renpy64-6.10.2-3.source.tar.bz2 | cut -b1-32`
229 cat > "${BUILD_DIR}/PKGBUILD" << 'EOF'
230 #Contributor: Franz Rogar <franzrogar at gmail dot com>
231 pkgname=renpy64
232 pkgver=6.10.2
233 pkgrel=3
234 pkgdesc="A free and cross-platform engine that helps you use words, pictures, and sounds to tell stories with the computer."
235 arch=('any')
236 url="http://www.renpy.org"
237 license=('MIT')
240 if [ "${WITH_JEDIT}" == "true" ]; then
241 cat >> "${BUILD_DIR}/PKGBUILD" << 'EOF'
242 depends=('java-runtime' 'zenity')
244 elif [ "${WITH_SCITE}" == "true" ]; then
245 cat >> "${BUILD_DIR}/PKGBUILD" << 'EOF'
246 depends=('zenity' 'gtk2')
248 else
249 cat >> "${BUILD_DIR}/PKGBUILD" << 'EOF'
250 depends=('java-runtime' 'zenity' 'gtk2')
254 cat >> "${BUILD_DIR}/PKGBUILD" << EOF
255 source=('renpy64-6.10.2-3.source.tar.bz2')
256 md5sums=('${SOURCE_MD5SUM}')
260 cat >> "${BUILD_DIR}/PKGBUILD" << 'EOF'
261 build() {
262 cp -Rf $srcdir/PACKAGE/* ${pkgdir} || exit 1
266 echo -e "Building renpy64 6.10.2-3 package...\n"
267 makepkg -s
269 echo -e "Cleaning up temp files...\n"
270 rm -rf ${BUILD_DIR}/pkg ${BUILD_DIR}/src ${BUILD_DIR}/*.desktop \
271 ${BUILD_DIR}/*.patch ${BUILD_DIR}/*.png ${BUILD_DIR}/*.sh \
272 ${BUILD_DIR}/renpy-6.10.2-sdk.tar.bz2 ${BUILD_DIR}/PKGBUILD \
273 ${BUILD_DIR}/renpy-deps-6.10.1.tar.bz2 ${BUILD_DIR}/*.py \
274 ${BUILD_DIR}/renpy64-6.10.2-3.source.tar.bz2 ${BUILD_DIR}/*.zip \
275 ${BUILD_DIR}/*.tgz ${BUILD_DIR}/ChangeLog