Skip to content

Commit 81a37ce

Browse files
committed
Merge pull request #1 from tecott/master
Build on ubuntu 12.04
2 parents 53c9d0d + 3f11948 commit 81a37ce

File tree

4 files changed

+52
-13
lines changed

4 files changed

+52
-13
lines changed

3rdparty/blas.tgz

97.6 KB
Binary file not shown.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ def build(ctx):
4040

4141
To build the stack, run the following command from the top level of the repo.
4242

43+
On Ubuntu, you must first install a fortran compiler with lapack.
44+
45+
```
46+
$ sudo apt-get install gfortran liblapack-dev
47+
```
48+
49+
To build the stack run:
50+
4351
```
4452
$ src/waf configure clean build
4553
```

waftools/venv.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
@conf
1313
def venv(ctx, cmd):
14-
return "(source bin/activate && DYLD_LIBRARY_PATH=$VIRTUAL_ENV %s)" % cmd
14+
activate = os.path.join(ctx.out_dir, "bin", "activate")
15+
return "(. %s && DYLD_LIBRARY_PATH=$VIRTUAL_ENV %s)" % (activate, cmd)
1516

1617

1718
@conf

wscript

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# encoding: utf-8
33
import os
44
import shutil
5+
import sys
56
import tarfile
67

78
from waflib.Configure import conf
@@ -104,6 +105,28 @@ def build_mathjax(ctx, target):
104105
os.path.join(ctx.out_dir, ".mathjax-done")))
105106

106107

108+
@conf
109+
def build_blas(ctx, target):
110+
srcpath = ctx.env.SRCPATH
111+
libpath = os.path.join(ctx.out_dir, "lib")
112+
srcscript = """
113+
set -e
114+
base="blas"
115+
pushd %(srcpath)s/3rdparty
116+
rm -fr BLAS
117+
tar -xzf "$base.tgz"
118+
pushd BLAS
119+
gfortran -shared -O2 *.f -o libblas.so -fPIC
120+
gfortran -O2 -c *.f
121+
ar cr libblas.a *.o
122+
cp libblas.a libblas.so %(libpath)s
123+
popd
124+
rm -fr BLAS
125+
popd
126+
""" % locals()
127+
ctx.venv_exec(srcscript)
128+
129+
107130
@conf
108131
def build_cvxopt(ctx, target):
109132
srcpath = ctx.env.SRCPATH
@@ -131,9 +154,22 @@ def build(ctx):
131154
source="../bin/activate", target="../bin/pkg-config")
132155

133156
ctx.module("libpng-1.5.13", source="../bin/pkg-config", target="../bin/libpng-config")
134-
ctx.module("zeromq-3.2.2", source="../bin/pkg-config", target="../lib/libzmq.dylib")
157+
ctx.module("zeromq-3.2.2", source="../bin/pkg-config", target="../lib/libzmq.a")
135158
ctx(rule=ctx.build_freetype2, source="../bin/pkg-config", target="../bin/freetype-config")
136-
ctx(rule=ctx.build_gfortran, source="../bin/pkg-config", target="../bin/gfortran")
159+
160+
pkg = os.path.join(ctx.path.abspath(), "3rdparty", "site-packages")
161+
if sys.platform == "darwin":
162+
ctx(rule=ctx.build_gfortran, source="../bin/pkg-config", target="../bin/gfortran")
163+
readlinetar = "%s/readline-6.2.4.1.tar.gz" % pkg
164+
readlinecmd = ctx.venv("easy_install --no-find-links %s && touch ${TGT}" % readlinetar)
165+
ctx(rule=readlinecmd, source="../bin/pkg-config", target="../.readline-done")
166+
platform_deps = ["../bin/gfortran", "../.readline-done"]
167+
else:
168+
# We assume that a fortran compiler with lapack is installed.
169+
# It may be installed using:
170+
# sudo apt-get install liblapack-dev gfortran
171+
ctx(rule=ctx.build_blas, source="../bin/pkg-config", target="../lib/libblas.a")
172+
platform_deps = ["../lib/libblas.a"]
137173

138174
# qt_configure_flags = (
139175
# "-opensource -fast -no-qt3support -no-phonon "
@@ -144,15 +180,11 @@ def build(ctx):
144180
# "qt-everywhere-opensource-src-4.8.4", qt_configure_flags, 1,
145181
# source="../bin/pkg-config", target="../bin/qmake")
146182

147-
pkg = os.path.join(ctx.path.abspath(), "3rdparty", "site-packages")
148-
readlinetar = "%s/readline-6.2.4.1.tar.gz" % pkg
149-
readlinecmd = ctx.venv("easy_install --no-find-links %s && touch ${TGT}" % readlinetar)
150-
ctx(rule=readlinecmd, source="../bin/pkg-config", target="../.readline-done")
151-
152183
# Install numpy separately due to bug in scipy install script.
153184
site_packages = os.path.join("..", "lib", "python2.7", "site-packages")
154185
numpy = os.path.join(site_packages, "numpy", "__init__.py")
155-
ctx(rule=ctx.venv("pip install numpy==1.6.2"), source="../bin/pkg-config", target=numpy)
186+
ctx(rule=ctx.venv("pip install numpy==1.6.2 --no-index -f file://%s" % pkg),
187+
source="../bin/pkg-config", target=numpy)
156188

157189
# Install cvxopt separately due to misplaced setup.py file.
158190
cvxopt = os.path.join(site_packages, "cvxopt", "__init__.py")
@@ -163,13 +195,11 @@ def build(ctx):
163195
rule=ctx.venv("pip install --no-index -f file://%s -r %s && touch ${TGT}" % (pkg, reqs)),
164196
source=[
165197
numpy,
166-
"../bin/gfortran",
167198
"../bin/freetype-config",
168199
"../bin/libpng-config",
169200
# "../bin/qmake",
170-
"../lib/libzmq.dylib",
171-
"../.readline-done"
172-
],
201+
"../lib/libzmq.a",
202+
] + platform_deps,
173203
target="../.requirements-done")
174204

175205
ctx.add_manual_dependency("../.requirements-done", reqs)

0 commit comments

Comments
 (0)