Skip to content

Commit

Permalink
Enable convenient local rebuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
coldfix committed Mar 29, 2017
1 parent bb4b03b commit 8512fc6
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 13 deletions.
29 changes: 29 additions & 0 deletions tests/travis/activate
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly

deactivate () {
[[ -v _OLD_PATH ]] && export PATH=$_OLD_PATH
[[ -v _OLD_LUA_PATH ]] && export LUA_PATH=$_OLD_LUA_PATH
[[ -v _OLD_LUA_CPATH ]] && export LUA_CPATH=$_OLD_LUA_CPATH
[[ -z $LUA_PATH ]] && unset LUA_PATH
[[ -z $LUA_CPATH ]] && unset LUA_CPATH
unset MAD_ROOT _OLD_PATH _OLD_LUA_PATH _OLD_LUA_CPATH
unalias lua lua51 luajit 2>/dev/null
[[ $1 == nondestructive ]] || unset -f deactivate
rehash
}

deactivate nondestructive

export MAD_ROOT=$(readlink -f "$(dirname $0)"/../..)

_OLD_PATH=$PATH
_OLD_LUA_PATH=$LUA_PATH
_OLD_LUA_CPATH=$LUA_CPATH
export PATH=$MAD_ROOT/install/bin:$PATH
export LUA_PATH="$MAD_ROOT/install/share/lua/5.1/?.lua;$LUA_PATH"
export LUA_CPATH="$MAD_ROOT/install/lib/lua/5.1/?.so;$LUA_CPATH"
alias lua="rlwrap lua"
alias lua51="rlwrap lua51"
alias luajit="rlwrap luajit"
rehash
33 changes: 33 additions & 0 deletions tests/travis/build_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/zsh

# Do this manually:
# cd src; make cleanall -f Makefile.linux
# git clean -xdf
# git stash

set -ex

./tests/travis/build_luajit.sh
./tests/travis/build_lpeg.sh

./tests/travis/build_lapack.sh
./tests/travis/build_fftw3.sh
./tests/travis/build_nfft3.sh
./tests/travis/build_nlopt2.sh

cd src
make -f Makefile.linux cleanall
make -f Makefile.linux
cd ..

./tests/travis/build_luarocks.sh
. tests/travis/activate

ln -s $(readlink -f src/mad) install/bin
ln -s $(readlink -f lib/luajit/bin/luajit) install/bin/luajit
ln -s luajit install/bin/lua
ln -s luajit install/bin/lua51

luarocks install luacov
luarocks install cluacov
luarocks install lyaml
7 changes: 4 additions & 3 deletions tests/travis/build_fftw3.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#! /bin/bash
set -ex
cd lib
wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4.tar.gz
tar xzf fftw-3.3.4.tar.gz
mv fftw-3.3.4 fftw3
[[ -e fftw-3.3.4.tar.gz ]] || wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4.tar.gz
[[ -e fftw3 ]] || (tar xzf fftw-3.3.4.tar.gz && \
mv fftw-3.3.4 fftw3)
cd fftw3
./configure --disable-shared
make clean
make
cp .libs/libfftw3.a ../../bin/linux
4 changes: 3 additions & 1 deletion tests/travis/build_lapack.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#! /bin/bash
set -ex
svn co https://icl.utk.edu/svn/lapack-dev/lapack/trunk lib/lapack
HERE=$(readlink -f "$(dirname $BASH_SOURCE)")
[[ -e lib/lapack ]] || svn co https://icl.utk.edu/svn/lapack-dev/lapack/trunk lib/lapack
cd lib/lapack
cp make.inc.example make.inc
patch -p0 <${HERE}/patch_lapack.diff
make clean
make lapack_install lapacklib blaslib
cp liblapack.a librefblas.a ../../bin/linux
1 change: 1 addition & 0 deletions tests/travis/build_lpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# NOTE: this must be built after luajit!
set -ex
cd lib/lpeg
make clean
make
cp liblpeg.a ../../bin/linux
3 changes: 2 additions & 1 deletion tests/travis/build_luajit.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#! /bin/bash
set -ex
git clone http://github.com/MethodicalAcceleratorDesign/LuaJIT.git lib/luajit
[[ -e lib/luajit ]] || git clone http://github.com/MethodicalAcceleratorDesign/LuaJIT.git lib/luajit
cd lib/luajit
git checkout mad-patch
git pull
make clean
make amalg PREFIX=`pwd`
make install PREFIX=`pwd`
Expand Down
5 changes: 3 additions & 2 deletions tests/travis/build_luarocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ cd lib

# acquire source
LUAROCKS=luarocks-2.4.2
wget http://luarocks.org/releases/$LUAROCKS.tar.gz
tar -xzf $LUAROCKS.tar.gz
[[ -e $LUAROCKS.tar.gz ]] || wget http://luarocks.org/releases/$LUAROCKS.tar.gz
[[ -e $LUAROCKS ]] || tar -xzf $LUAROCKS.tar.gz

# build
cd $LUAROCKS
Expand All @@ -18,5 +18,6 @@ cd $LUAROCKS
--with-lua-include=$LUA_ROOT/include/luajit-2.1 \
--with-lua=$LUA_ROOT \
--lua-suffix=jit
make clean
make build
make install
7 changes: 4 additions & 3 deletions tests/travis/build_nfft3.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#! /bin/bash
set -ex
cd lib
wget http://www.nfft.org/download/nfft-3.3.1.tar.gz
tar xzf nfft-3.3.1.tar.gz
mv nfft-3.3.1 nfft3
[[ -e nfft-3.3.1.tar.gz ]] || wget http://www.nfft.org/download/nfft-3.3.1.tar.gz
[[ -e nfft3 ]] || (tar xzf nfft-3.3.1.tar.gz && \
mv nfft-3.3.1 nfft3)
cd nfft3
./configure --disable-shared \
--with-fftw3=`pwd`/../fftw3 \
--with-fftw3-libdir=`pwd`/../fftw3/.libs \
--with-fftw3-includedir=`pwd`/../fftw3/api
make clean
make
cp .libs/libnfft3.a ../../bin/linux
7 changes: 4 additions & 3 deletions tests/travis/build_nlopt2.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#! /bin/bash
set -ex
cd lib
wget http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz
tar xzf nlopt-2.4.2.tar.gz
mv nlopt-2.4.2 nlopt2
[[ -e nlopt-2.4.2.tar.gz ]] || wget http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz
[[ -e nlopt2 ]] || (tar xzf nlopt-2.4.2.tar.gz && \
mv nlopt-2.4.2 nlopt2)
cd nlopt2
./configure --disable-shared
make clean
make
cp .libs/libnlopt.a ../../bin/linux/libnlopt2.a
23 changes: 23 additions & 0 deletions tests/travis/patch_lapack.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- make.inc 2017-03-15 11:36:45.343057823 +0100
+++ make.inc 2017-03-15 11:39:55.082679220 +0100
@@ -17,9 +17,9 @@
# should not compile LAPACK with flags such as -ffpe-trap=overflow.
#
FORTRAN = gfortran
-OPTS = -O2 -frecursive
+OPTS = -O2 -frecursive -fPIC
DRVOPTS = $(OPTS)
-NOOPT = -O0 -frecursive
+NOOPT = -O0 -frecursive -fPIC
LOADER = gfortran
LOADOPTS =
#
@@ -52,7 +52,7 @@
# CC is the C compiler, normally invoked with options CFLAGS.
#
CC = gcc
-CFLAGS = -O3
+CFLAGS = -O3 -fPIC
#
# The archiver and the flag(s) to use when building archive (library)
# If you system has no ranlib, set RANLIB = echo.

0 comments on commit 8512fc6

Please sign in to comment.