Skip to content

Commit a505369

Browse files
committed
attempt to build win32 installers
svn path=/trunk/matplotlib/; revision=7208
1 parent 4b7cd92 commit a505369

File tree

3 files changed

+43
-34
lines changed

3 files changed

+43
-34
lines changed

release/win32/Makefile

+39-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
1-
PYTHON = C:/Python26/python.exe
1+
PYDIR = C:/Python26
2+
PYTHON = ${PYDIR}/python.exe
23
SRCDIR = ${PWD}
34
WINSRCDIR = `${PWD}/data/mingw_path.sh ${PWD}`
45
ZLIBVERSION = 1.2.3
5-
PNGVERSION = 1.2.23
6+
PNGVERSION = 1.2.36
67
FREETYPEVERSION = 2.3.9
7-
#TCLTKVERSION = 8.4.19
88
TCLTKVERSION = 8.5.7
9-
MPLVERSION = 0.98.6svn
9+
MPLVERSION = 0.98.5.3
1010

1111
## You shouldn't need to configure past this point
1212

13-
CFLAGS = -Os
14-
CFLAGS += -I${SRCDIR}/zlib-${ZLIBVERSION}
15-
CFLAGS += -I${SRCDIR}/libpng-${PNGVERSION}
16-
CFLAGS += -I${SRCDIR}/freetype-${FREETYPEVERSION}/include
17-
CFLAGS += -I${SRCDIR}/tcl${TCLTKVERSION}-src/generic
18-
CFLAGS += -I${SRCDIR}/tcl${TCLTKVERSION}-src/win
19-
CFLAGS += -I${SRCDIR}/tk${TCLTKVERSION}-src/generic
20-
CFLAGS += -I${SRCDIR}/tk${TCLTKVERSION}-src/win
21-
CFLAGS += -I${SRCDIR}/tk${TCLTKVERSION}-src/X11
13+
CFLAGS = -Os
2214

23-
LDFLAGS = -L${SRCDIR}/zlib-${ZLIBVERSION}
24-
LDFLAGS += -L${SRCDIR}/libpng-${PNGVERSION}
25-
LDFLAGS += -L${SRCDIR}/freetype-${FREETYPEVERSION}
2615

2716
PY_INCLUDE = "${WINSRCDIR}\\zlib-${ZLIBVERSION};${WINSRCDIR}/libpng-${PNGVERSION};${WINSRCDIR}/freetype-${FREETYPEVERSION}/include;${WINSRCDIR}/tcl${TCLTKVERSION}/generic;${WINSRCDIR}/tcl${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/generic;${WINSRCDIR}/tk${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/xlib"
2817

@@ -47,15 +36,21 @@ zlib:
4736
rm -rf zlib-${ZLIBVERSION}
4837
tar xvfz zlib-${ZLIBVERSION}.tar.gz
4938
cd zlib-${ZLIBVERSION} &&\
39+
export CFLAGS=${CFLAGS} &&\
5040
./configure &&\
5141
make -j3
5242

43+
# for reasons not clear to me, part of png compilation was failing
44+
# because it could not find zlib.h, even with the CFLAGS which point
45+
# to it and even with tryting to pass --includedir to configure. So I
46+
# manually copy the zlib *.h files into the png dir - JDH
5347
png: zlib
5448
rm -rf libpng-${PNGVERSION}
55-
tar xvfj libpng-${PNGVERSION}.tar.bz2
49+
tar xvfj libpng-${PNGVERSION}.tar.bz2
5650
cd libpng-${PNGVERSION} &&\
57-
export CFLAGS="${CFLAGS}" &&\
58-
export LDFLAGS="${LDFLAGS}" &&\
51+
cp ${SRCDIR}/zlib-${ZLIBVERSION}/*.h . && \
52+
export CFLAGS="${CFLAGS} -I${SRCDIR}/zlib-${ZLIBVERSION}" &&\
53+
export LDFLAGS="-L${SRCDIR}/zlib-${ZLIBVERSION}" &&\
5954
./configure --disable-shared &&\
6055
make -j3 &&\
6156
cp .libs/libpng.a .
@@ -69,6 +64,16 @@ freetype:
6964
mingw32-make -j3 &&\
7065
cp objs/libfreetype.a .
7166

67+
freetype_hide:
68+
rm -rf freetype-${FREETYPEVERSION}
69+
tar xvfj freetype-${FREETYPEVERSION}.tar.bz2
70+
cd freetype-${FREETYPEVERSION} &&\
71+
export CFLAGS=${CFLAGS} &&\
72+
./configure --disable-shared &&\
73+
cp builds/win32/w32-mingw32.mk config.mk &&\
74+
make -j3 &&\
75+
cp objs/libfreetype.a .
76+
7277
tcltk:
7378
rm -rf tcl${TCLTKVERSION}
7479
rm -rf tk${TCLTKVERSION}
@@ -83,7 +88,21 @@ installers:
8388
cd matplotlib-${MPLVERSION} &&\
8489
rm -rf build &&\
8590
cp ../data/setup*.* . &&\
86-
${PYTHON} setupwin.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_wininst &&\
91+
${PYTHON} setupwin.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_wininst
8792
${PYTHON} setupwinegg.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_egg
8893

94+
95+
inplace:
96+
#rm -rf matplotlib-${MPLVERSION}
97+
#tar xvzf matplotlib-${MPLVERSION}.tar.gz
98+
cd matplotlib-${MPLVERSION} &&\
99+
rm -rf build lib/matplotlib/*.pyd lib/matplotlib/*.pyc lib/matplotlib/backends/*.pyd lib/matplotlib/backends/*.pyc &&\
100+
cp ../data/setup*.* . &&\
101+
${PYTHON} setup.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} --inplace
102+
cd matplotlib-${MPLVERSION}/lib &&\
103+
${PYTHON} -c 'import matplotlib; matplotlib.use("Agg"); from pylab import *; print matplotlib.__file__; plot([1,2,3]); savefig("test.png")'
104+
105+
test:
106+
${PYTHON} -c 'import matplotlib; matplotlib.use("Agg"); from pylab import *; print matplotlib.__file__; plot([1,2,3]); savefig("test.png")'
107+
89108
all: fetch_deps dependencies installers

release/win32/data/setupwin.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22

33
try:
44
# Python 2.6
5-
# Replace the msvcr func to return an empty list
5+
# Replace the msvcr func to return an 'msvcr71'
66
cygwinccompiler.get_msvcr
7-
cygwinccompiler.get_msvcr = lambda: []
7+
cygwinccompiler.get_msvcr = lambda: ['msvcr71']
88

99
except AttributeError:
10-
# Before Python 2.6
11-
# Wrap the init func to clear to dll libs
12-
def new_init(self, **kwargs):
13-
cygwinccompiler.CygwinCCompiler.__init__(self, **kwargs)
14-
self.dll_libraries = []
15-
cygwinccompiler.CygwinCCompiler.__init__ = new_init
10+
pass
1611

1712
execfile('setup.py')

release/win32/data/setupwinegg.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
cygwinccompiler.get_msvcr = lambda: []
88

99
except AttributeError:
10-
# Before Python 2.6
11-
# Wrap the init func to clear to dll libs
12-
def new_init(self, **kwargs):
13-
cygwinccompiler.CygwinCCompiler.__init__(self, **kwargs)
14-
self.dll_libraries = []
15-
cygwinccompiler.CygwinCCompiler.__init__ = new_init
10+
pass
1611

1712
from setuptools import setup
1813
execfile('setup.py',

0 commit comments

Comments
 (0)