diff options
Diffstat (limited to 'init')
-rwxr-xr-x | init | 57 |
1 files changed, 57 insertions, 0 deletions
@@ -0,0 +1,57 @@ +#!/bin/sh + +# this script should only be run once per initialization of the repo +# it's job is to pull in code external to the source tree +# after it completes, simply run make + +# TODO: set up cross compiling directories + +inc=$PWD/include/vendor +lib=$PWD/lib +root=$PWD + +if [ -d vendor -a -z $1 ]; then + echo already initialized, remove vendor directory or force argument to rerun +else + # setup directories + mkdir -p vendor 1>&2 2>/dev/null + mkdir -p $lib 1>&2 2>/dev/null + mkdir -p $inc 1>&2 2>/dev/null + + # install musl + # dependencies: nil + if [ -d $inc/libc ]; then + echo libc found, skipping + else + git clone git://git.musl-libc.org/musl vendor/musl + cd vendor/musl && ./configure && make + + cp -r obj/include $inc/libc + cp -r obj/crt $lib/crt + cp -r lib/*.a $lib + fi + + cd $root + + # install OpenBLAS + # dependencies: gfortran + # warning: this is a _monster_ + if [ -d $inc/blas ]; then + echo blas found, skipping + else + git clone https://github.com/xianyi/OpenBLAS.git vendor/blas + cd vendor/blas && make USE_THREAD=0 -j4 + + cp libopenblas_*.a $lib/libblas.a + mkdir -p $inc/blas + cp cblas.h common*.h config.h param.h $inc/blas + + # install LAPACKE ...ugh... + cd lapack-netlib && cp make.inc.example make.inc && make -j4 + cd LAPACKE && make && cd .. + cp liblapack.a liblapacke.a $lib + cp LAPACKE/include/lapack*.h $inc/blas + fi + + cd $root +fi |