This repository has been archived by the owner on Nov 15, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
make.osx
117 lines (91 loc) · 3.74 KB
/
make.osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# -*- makefile -*-
# build mpl into a local install dir with
# make -f make.osx PREFIX=/Users/jdhunter/dev PYVERSION=2.6 fetch deps mpl_install
# (see README.osx for more details)
MPLVERSION=1.1.0
PYVERSION=2.6
PYTHON=python${PYVERSION}
MACOSX_DEPLOYMENT_TARGET=10.6
OSX_SDK_VER=10.6
ARCH_FLAGS=-arch i386 -arch x86_64
# Dependency versions and URLs
#
# Adjusting these version numbers should be enough most of the time,
# but the download URLs are subject to change.
ZLIBVERSION=1.2.5
PNGVERSION=1.5.1
FREETYPEVERSION=2.4.4
ZLIBFILE=zlib-${ZLIBVERSION}.tar.gz
ZLIBDIR=$(basename $(basename ${ZLIBFILE}))
ZLIBURL=http://sourceforge.net/projects/libpng/files/zlib/${ZLIBVERSION}/${ZLIBFILE}/download
PNGFILE=libpng-${PNGVERSION}.tar.gz
PNGDIR=$(basename $(basename ${PNGFILE}))
PNGURL=http://sourceforge.net/projects/libpng/files/libpng15/${PNGVERSION}/${PNGFILE}/download
FREETYPEFILE=freetype-${FREETYPEVERSION}.tar.bz2
FREETYPEDIR=$(basename $(basename ${FREETYPEFILE}))
FREETYPEURL=http://download.savannah.gnu.org/releases/freetype/${FREETYPEFILE}
## You shouldn't need to configure past this point
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export CFLAGS=${ARCH_FLAGS} -I${PREFIX}/include -I${PREFIX}/include/freetype2 -isysroot /Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk
export LDFLAGS=${ARCH_FLAGS} -L${PREFIX}/lib -syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk
export MACOSX_DEPLOYMENT_TARGET
help:
@echo "Interesting targets: clean, fetch, deps, mpl_build, mpl_install_std"
@echo "See README.osx for details"
check-prefix:
@if [ ! -d "$(PREFIX)" ]; then echo Set PREFIX to a directory - see README.osx; exit 1; fi
clean:
rm -rf ${ZLIBFILE} ${PNGFILE} ${FREETYPEFILE} \
bdist_mpkg-${BDISTMPKGVERSION}.tar.gz \
bdist_mpkg-${BDISTMPKGVERSION} setupext.pyc \
lib/matplotlib/mpl-data/matplotlib.conf lib/matplotlib/mpl-data/matplotlibrc \
zlib-${ZLIBVERSION} libpng-${PNGVERSION} freetype-${FREETYPEVERSION} \
build
fetch:
${PYTHON} -c 'import urllib; urllib.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\
${PYTHON} -c 'import urllib; urllib.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\
${PYTHON} -c 'import urllib; urllib.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'
zlib: check-prefix
rm -rf ${ZLIBDIR} &&\
tar xvfz ${ZLIBFILE} &&\
cd ${ZLIBDIR} &&\
./configure --prefix=${PREFIX} &&\
${MAKE} -j3 install
png: check-prefix zlib
rm -rf ${PNGDIR} &&\
tar xvfz ${PNGFILE} && \
cd ${PNGDIR} &&\
./configure --disable-dependency-tracking --prefix=${PREFIX} &&\
${MAKE} -j3 install
freetype: check-prefix zlib
rm -rf ${FREETYPEDIR} &&\
tar xvfj ${FREETYPEFILE} &&\
cd ${FREETYPEDIR} &&\
./configure --prefix=${PREFIX} &&\
${MAKE} -j3 install &&\
cp objs/.libs/libfreetype.a .
deps: zlib png freetype
echo 'all done'
# Various build and install targets
#
# The values of PKG_CONFIG_PATH, MACOSX_DEPLOYMENT_TARGET, CFLAGS,
# LDFLAGS affect the compilation; note that variables are
# automatically put into the environment by make.
mpl_build: check-prefix
${PYTHON} setup.py build
mpl_install: check-prefix
${PYTHON} setup.py install --prefix=${PREFIX}
mpl_install_std: check-prefix
${PYTHON} setup.py install
mpl_install_egg: check-prefix
${PYTHON} setupegg.py install
mpl_install_develop: check-prefix
${PYTHON} setupegg.py develop
binaries: check-prefix
@if [ -z "$(PYVERSION)" ]; then echo Must set PYVERSION; exit 1; fi
unset PKG_CONFIG_PATH &&\
cp release/osx/data/setup.cfg release/osx/data/ReadMe.txt . &&\
rm -f ${PREFIX}/lib/*.dylib &&\
VERSIONER_PYTHON_PREFER_32_BIT=yes bdist_mpkg --readme=ReadMe.txt &&\
hdiutil create -srcdir dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx${OSX_SDK_VER}.mpkg dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx${OSX_SDK_VER}.dmg &&\
VERSIONER_PYTHON_PREFER_32_BIT=yes ${PYTHON} setupegg.py bdist_egg