Skip to content

Instantly share code, notes, and snippets.

@certik
Created July 24, 2012 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save certik/3170576 to your computer and use it in GitHub Desktop.
Save certik/3170576 to your computer and use it in GitHub Desktop.
#! /bin/bash
set -e
# This script sets up the Wine environment so that one can start compiling
# NumPy for Windows.
#
# Setup:
#
# apt-get install wine
#
# Put the following packages into the $tarballs directory:
tarballs=$HOME/repos/numpy-vendor
TMPDIR=/tmp/numpy-windows
rm -rf $TMPDIR
mkdir $TMPDIR
# The script below should just work without modifications:
rm -rf $HOME/.wine
# The ALLUSERS=1 is essential --- the following line:
msiexec /i $tarballs/python-2.7.3.msi /qn ALLUSERS=1
# is then exactly equivalent to the following line:
#msiexec /i $tarballs/python-2.7.3.msi
# But doesn't require any user interaction. Without ALLUSERS=1, the installed
# Python will segfault on basic operations.
cd $TMPDIR
tar xzf $tarballs/nose-1.1.2.tar.gz
cd nose-1.1.2
wine "C:\Python27\python" setup.py install
cd ..
tar xzf $tarballs/Paver-1.0.5.tar.gz
cd Paver-1.0.5
wine "C:\Python27\python" setup.py install
cd ..
cd $HOME/.wine/drive_c/
mkdir MinGW
cd MinGW
tar xzf $tarballs/binutils-2.20-1-mingw32-bin.tar.gz
tar xzf $tarballs/gcc-g77-3.4.5-20051220-1.tar.gz
tar xzf $tarballs/gcc-core-3.4.5-20051220-1.tar.gz
tar xzf $tarballs/mingw-runtime-3.10.tar.gz
tar xzf $tarballs/gcc-g++-3.4.5-20051220-1.tar.gz
tar xzf $tarballs/w32api-3.7.tar.gz
cp $tarballs/msvcr90.dll lib/
# This library is installed by Wine, but it doesn't work with our "objdump", so
# we remove it:
rm $HOME/.wine/drive_c/windows/winsxs/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_deadbeef/msvcr90.dll
cd $TMPDIR
cat > regtmp <<EOF
REGEDIT4
[HKEY_CURRENT_USER\Environment]
"PATH"="C:\\\\MinGW\\\\bin;C:\\\\Python27"
EOF
wine regedit regtmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment