Created
October 26, 2013 14:52
-
-
Save kevinburke/7170273 to your computer and use it in GitHub Desktop.
pypy compile script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
NAME=pypy | |
VERSION=2.1 | |
FOLDER=$NAME-$VERSION-src | |
BINARY=$FOLDER.tar.bz2 | |
URL=https://bitbucket.org/pypy/pypy/downloads/$BINARY | |
if hash pypy 2>/dev/null; then | |
PYTHON="`which pypy`"; | |
elif grep -q "Amazon Linux" /etc/system-release; then # cent6 | |
PYTHON=/usr/bin/python2.7 | |
elif [[ ( `uname` -eq "Darwin" ) && ( -x '/usr/local/bin/python' ) ]]; then | |
PYTHON=/usr/local/bin/python | |
else | |
PYTHON=/usr/local/python/bin/python | |
fi | |
if [ -f "$BINARY" ]; then | |
echo "binary already downloaded. skipping..." | |
else | |
wget $URL | |
tar -xvf $BINARY | |
fi | |
SQLITE_VERSION=3.8.1 | |
SQLITE_NAME=sqlite3 | |
SQLITE_FOLDER=$NAME-$VERSION | |
SQLITE_SITE_FOLDER=$PWD/$SQLITE_NAME/sqlite-autoconf-3080100 | |
SQLITE_PKG=$FOLDER.tar.gz | |
SQLITE_URL=http://www.sqlite.org/2013/sqlite-autoconf-3080100.tar.gz | |
mkdir -p $SQLITE_NAME | |
pushd $SQLITE_NAME | |
if [ -f $SQLITE_PKG ]; then | |
echo "sqlite binary already downloaded, skipping..." | |
else | |
wget $SQLITE_URL -O $SQLITE_PKG | |
tar -xvf $SQLITE_PKG | |
fi | |
pushd $SQLITE_SITE_FOLDER | |
ls -alh | |
./configure --prefix=$PWD | |
make && make install | |
popd | |
popd | |
if [ `uname` == "Darwin" ]; then | |
# mac instructions | |
echo "on a mac, skipping yum install" | |
else | |
# centos instructions | |
sudo yum install -y libffi-devel ncurses-devel bzip2-devel sqlite-devel \ | |
tcl-devel | |
fi | |
# Run these to force a new build.. | |
# rm -f $FOLDER/pypy-c.bkp | |
# mv $FOLDER/pypy/goal/pypy-c $FOLDER/pypy-c.bkp | |
if [ ! -x "$FOLDER/pypy/goal/pypy-c" ]; then | |
echo "Compiling pypy... (get a coffee, this will take a while)" | |
pushd $FOLDER/pypy/goal | |
LD_LIBRARY_PATH=$SQLITE_SITE_FOLDER/lib:$LD_LIBRARY_PATH $PYTHON ../../rpython/bin/rpython -O2 targetpypystandalone | |
popd | |
fi | |
mkdir -p tmp | |
ARCHIVE=$NAME-archive | |
ARCHIVE_TAR=$ARCHIVE.tar.bz2 | |
if [ ! -f $PWD/tmp/$ARCHIVE_TAR ]; then | |
LD_LIBRARY_PATH=$SQLITE_SITE_FOLDER/lib:$LD_LIBRARY_PATH $PYTHON $FOLDER/pypy/tool/release/package.py --without-tk $FOLDER $ARCHIVE pypy $PWD/tmp | |
tar --strip-components 1 -xvf tmp/$ARCHIVE_TAR | |
fi | |
pushd $FOLDER | |
ls -alh | |
popd | |
ls -alh | |
pwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment