About

Supporting the site

App Repository‎ > ‎Archives‎ > ‎

python-2.7.1

Overview

Python requires zlib, openssl, ncurses, bzip, and SQlite3.

Python is not very cross-compile friendly because it uses some binaries generated during the compilation procedure for the rest of the compilation. Therefore we do a two-pass compilation, one natively to get the required binaries, and once again to cross-compile. All the dependencies are statically linked to make deployment easier.

Preparation

Make sure you have a cross-compiling virtual machine properly setup.

Compilation

export DEST=/mnt/DroboFS/Shares/DroboApps/python2
cd ~/code/

wget http://zlib.net/zlib-1.2.5.tar.gz
tar zxf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --prefix=$DEST --static
make clean && make
ZLIB=`pwd`
cd ..

wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz
tar zxf openssl-1.0.0d.tar.gz
cd openssl-1.0.0d
./Configure linux-generic32 -DL_ENDIAN --prefix=$DEST --openssldir=$DEST/etc/ssl no-shared no-zlib-dynamic --with-zlib-include=$ZLIB --with-zlib-lib=$ZLIB
cp Makefile Makefile.old
sed "s/CFLAG= /CFLAG=${CFLAGS} /g" Makefile.old > Makefile
make clean && make
OPENSSL=`pwd`
cd ..

wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar zxf ncurses-5.9.tar.gz
cd ncurses-5.9/
./configure --host=arm-none-linux-gnueabi --prefix=$DEST --without-shared
make clean && make
cd include
ln -s curses.h ncurses.h
cd ..
NCURSES=`pwd`
cd ..

wget http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar zxf bzip2-1.0.6.tar.gz 
cd bzip2-1.0.6/
make clean
make libbz2.a CC=$CC AR=$AR RANLIB=$RANLIB CFLAGS="$CFLAGS -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64"
BZIP=`pwd`
cd ..

wget http://www.sqlite.org/sqlite-autoconf-3070602.tar.gz
tar zxf sqlite-autoconf-3070602.tar.gz
cd sqlite-autoconf-3070602/
./configure --host=arm-none-linux-gnueabi --prefix=$DEST --enable-shared=no
make clean && make
SQLITE=`pwd`
cd ..

wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar zxf Python-2.7.1.tgz
cd Python-2.7.1/
. ~/uncrosscompile.sh
./configure
make python Parser/pgen
mv python hostpython
mv Parser/pgen Parser/hostpgen
make distclean

. ~/crosscompile.sh
wget .../configure.patch
patch configure configure.patch
wget .../Makefile.pre.in.patch
patch Makefile.pre.in Makefile.pre.in.patch
wget .../setup.py.patch
patch setup.py setup.py.patch
CFLAGS="$CFLAGS -I$ZLIB -I$OPENSSL/include -I$NCURSES/include -I$BZIP -I$SQLITE" LDFLAGS="$LDFLAGS -L$ZLIB -L$OPENSSL -L$NCURSES/lib -L$BZIP -L$SQLITE/.libs" LIBS="-lsqlite3 -lncurses -lssl -lcrypto -lz -ldl" ./configure --host=arm-none-linux-gnueabi --prefix=$DEST
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-none-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yes
make install HOSTPYTHON=./hostpython BLDSHARED="arm-none-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yes

Packaging

cd $DEST
~/bin/package.sh

Installing

DroboAdmin link: Install python-2.7.1 (this link only works if you have not changed the DroboFS name). Otherwise, download below and place it in you DroboApps share.

Final remarks

This is not a conventional DroboApp in the sense that once installed, it is ready for use. This one just makes the Python binaries and libraries available for further use, and does not attempt to change the DroboFS configuration in any way. A good start to make it easier to use can be found here. Also, you can create a link to the perl binary in the proper folder in an SSH session like this:

cd /usr/bin
ln -s /mnt/DroboFS/Shares/DroboApps/python2/bin/python .

To get easy_install execute these commands after Python is installed on the DroboFS:

mkdir -p /mnt/DroboFS/Shares/DroboApps/python2/tmp
cd /mnt/DroboFS/Shares/DroboApps/python2/tmp
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=/mnt/DroboFS/Shares/DroboApps/python2

Note: You should replace the above URL for the setuptools.egg with the latest from the easy_install page.

Using easy_install can be problematic, since it uses /tmp to download data. Since /tmp is on the Drobo's flash memory, it means that there is not much space left, and that it should not be used for temporary storage. Instead, one way of using easy_install would be to do this:

mkdir -p /mnt/DroboFS/tmp
mount -o loop /mnt/DroboFS/tmp /tmp
easy_install --prefix=/mnt/DroboFS/Shares/DroboApps/python2 PACKAGE_NAME_HERE
umount /tmp

WARNING: using the above sequence of steps may cause trouble with other running DroboApps. Make sure that if you do the above sequence of steps, that there are no active connections (e.g., file transfers, Time Machine backups, open files on shares, etc) to the DroboFS. Doing the above with active, open connections may lead to data loss. You have been warned.

Please visit the DroboSpace forums to leave your comments, suggestions and feedback.

ċ
configure.patch
Download
  1k v. 2 May 14, 2011, 10:43 AM Ricardo Padilha
ċ
Makefile.pre.in.patch
Download
  4k v. 2 May 14, 2011, 10:44 AM Ricardo Padilha
ċ
python2.tgz
Download
DroboApp for DroboFS   15923k v. 3 May 16, 2011, 1:24 PM Ricardo Padilha
ą
python-logo.gif
View Download
  2k v. 2 May 14, 2011, 10:58 AM Ricardo Padilha
ċ
setup.py.patch
Download
  3k v. 2 May 14, 2011, 10:44 AM Ricardo Padilha
Comments