3 # This script is to build the SkeinPyPy package for Windows/Linux and OSx
4 # This script should run under Linux and OSx, as well as Windows with Cygwin.
6 #############################
8 #############################
11 ##Select the build target
12 BUILD_TARGET=${1:-win32}
16 ##Do we need to create the final archive
17 ARCHIVE_FOR_DISTRIBUTION=1
18 ##Which version name are we appending to the final archive
19 BUILD_NAME=NewUI-Beta4
20 TARGET_DIR=${BUILD_TARGET}-SkeinPyPy-${BUILD_NAME}
22 ##Which versions of external programs to use
23 PYPY_VERSION=c-jit-latest
24 WIN_PORTABLE_PY_VERSION=2.7.2.1
25 WIN_PYSERIAL_VERSION=2.5
27 #############################
29 #############################
32 if [ -z `which $1` ]; then
33 echo "The $1 command must be somewhere in your \$PATH."
34 echo "Fix your \$PATH or install $2"
39 #############################
41 #############################
43 checkTool git "git: http://git-scm.com/"
44 checkTool curl "curl: http://curl.haxx.se/"
45 if [ $BUILD_TARGET = "win32" ]; then
46 #Check if we have 7zip, needed to extract and packup a bunch of packages for windows.
47 checkTool 7z "7zip: http://www.7-zip.org/"
49 #For building under MacOS we need gnutar instead of tar
50 if [ -z `which gnutar` ]; then
56 #############################
57 # Download all needed files.
58 #############################
60 if [ $BUILD_TARGET = "win32" ]; then
61 #Get portable python for windows and extract it. (Linux and Mac need to install python themselfs)
62 if [ ! -f "PortablePython_${WIN_PORTABLE_PY_VERSION}.exe" ]; then
63 curl -L -O http://ftp.nluug.nl/languages/python/portablepython/v2.7/PortablePython_${WIN_PORTABLE_PY_VERSION}.exe
65 if [ ! -f pyserial-${WIN_PYSERIAL_VERSION}.exe ]; then
66 curl -L -O http://sourceforge.net/projects/pyserial/files/pyserial/${WIN_PYSERIAL_VERSION}/pyserial-${WIN_PYSERIAL_VERSION}.win32.exe/download
67 mv download pyserial-${WIN_PYSERIAL_VERSION}.exe
69 if [ ! -f PyOpenGL-3.0.1.win32.exe ]; then
70 curl -L -O http://sourceforge.net/projects/pyopengl/files/PyOpenGL/3.0.1/PyOpenGL-3.0.1.win32.exe
73 if [ ! -f "pypy-${PYPY_VERSION}-win32.zip" ]; then
74 # curl -L -O https://bitbucket.org/pypy/pypy/downloads/pypy-${PYPY_VERSION}-win32.zip
75 curl -L -O http://buildbot.pypy.org/nightly/trunk/pypy-${PYPY_VERSION}-win32.zip
78 if [ ! -f "pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2" ]; then
79 # curl -L -O https://bitbucket.org/pypy/pypy/downloads/pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2
80 curl -L -O http://buildbot.pypy.org/nightly/trunk/pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2
84 #Get our own version of Printrun
85 if [ ! -d "Printrun" ]; then
86 git clone git://github.com/daid/Printrun.git
88 echo "Updating Printrun"
94 #############################
96 #############################
98 mkdir -p ${TARGET_DIR}
100 if [ $BUILD_TARGET = "win32" ]; then
101 #For windows extract portable python to include it.
102 7z x PortablePython_${WIN_PORTABLE_PY_VERSION}.exe \$_OUTDIR/App
103 7z x PortablePython_${WIN_PORTABLE_PY_VERSION}.exe \$_OUTDIR/Lib/site-packages
104 7z x pyserial-${WIN_PYSERIAL_VERSION}.exe PURELIB
105 7z x PyOpenGL-3.0.1.win32.exe PURELIB
107 mkdir -p ${TARGET_DIR}/python
108 mv \$_OUTDIR/App/* ${TARGET_DIR}/python
109 mv \$_OUTDIR/Lib/site-packages/wx* ${TARGET_DIR}/python/Lib/site-packages/
110 mv PURELIB/serial ${TARGET_DIR}/python/Lib
111 mv PURELIB/OpenGL ${TARGET_DIR}/python/Lib
115 #Clean up portable python a bit, to keep the package size down.
116 rm -rf ${TARGET_DIR}/python/PyScripter.*
117 rm -rf ${TARGET_DIR}/python/Doc
118 rm -rf ${TARGET_DIR}/python/locale
119 rm -rf ${TARGET_DIR}/python/tcl
120 rm -rf ${TARGET_DIR}/python/Lib/test
121 rm -rf ${TARGET_DIR}/python/Lib/distutils
122 rm -rf ${TARGET_DIR}/python/Lib/site-packages/wx-2.8-msw-unicode/wx/tools
123 rm -rf ${TARGET_DIR}/python/Lib/site-packages/wx-2.8-msw-unicode/wx/locale
124 #Remove the gle files because they require MSVCR71.dll, which is not included. We also don't need gle, so it's safe to remove it.
125 rm -rf ${TARGET_DIR}/python/Lib/OpenGL/DLLS/gle*
129 if [ $BUILD_TARGET = "win32" ]; then
130 7z x pypy-${PYPY_VERSION}-win32.zip -o${TARGET_DIR}
131 mv ${TARGET_DIR}/pypy-${PYPY_VERSION}* ${TARGET_DIR}/pypy
133 cd ${TARGET_DIR}; $TAR -xjf ../pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2; cd ..
134 mv ${TARGET_DIR}/pypy-*-${BUILD_TARGET} ${TARGET_DIR}/pypy
137 rm -rf ${TARGET_DIR}/pypy/lib-python/2.7/test
140 cp -a SkeinPyPy_NewUI ${TARGET_DIR}/SkeinPyPy
143 cp -a Printrun ${TARGET_DIR}/Printrun
144 rm -rf ${TARGET_DIR}/Printrun/.git*
147 if [ $BUILD_TARGET = "win32" ]; then
148 cp -a scripts/${BUILD_TARGET}/*.bat $TARGET_DIR/
150 cp -a scripts/${BUILD_TARGET}/*.sh $TARGET_DIR/
154 cp README ${TARGET_DIR}/README.txt
157 if (( ${ARCHIVE_FOR_DISTRIBUTION} )); then
158 if [ $BUILD_TARGET = "win32" ]; then
161 7z a ../${TARGET_DIR}.zip *
164 echo "Archiving to ${TARGET_DIR}.tar.gz"
165 $TAR cfp - ${TARGET_DIR} | gzip --best -c > ${TARGET_DIR}.tar.gz
168 echo "Installed into ${TARGET_DIR}"