blob: 8135180121e53de6bfd014e3bb070c961ba6e66e (
plain)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#!/bin/sh
# globals
ROOT=~/root
VENDOR=$ROOT/vendor
# ------------------------------------------------------------------------
# OpenBLAS
BLAS_URL="https://github.com/xianyi/OpenBLAS.git"
BLAS_TAG="v0.3.17"
build_blas()
{
git clone $BLAS_URL blas
cd blas && git checkout $BLAS_TAG
NO_SHARED=1 TARGET=GENERIC PREFIX=$ROOT make -j2
NO_SHARED=1 make install PREFIX=$ROOT
rm -rf $ROOT/lib/cmake
rm -rf $ROOT/lib/pkgconfig
mv $ROOT/include/lapacke.h \
$ROOT/include/lapack.h \
$ROOT/include/cblas.h \
$ROOT/include/f77blas.h \
$ROOT/include/lapacke_utils.h \
$ROOT/include/openblas_config.h \
$ROOT/include/lapacke_config.h \
$ROOT/include/lapacke_mangling.h \
$ROOT/include/vendor/blas
cd $VENDOR
echo $BLAS_TAG > blas/build.tag
}
# ------------------------------------------------------------------------
# NLOpt
NLOPT_URL="https://github.com/stevengj/nlopt.git"
NLOPT_TAG="v2.7.0"
build_nlopt()
{
git clone $NLOPT_URL
cd nlopt && git checkout $NLOPT_TAG && mkdir build && cd build
cmake \
-DCMAKE_INSTALL_PREFIX=$ROOT \
-DBUILD_SHARED_LIBS=OFF \
-DNLOPT_PYTHON=OFF \
-DNLOPT_MATLAB=OFF \
-DNLOPT_OCTAVE=OFF \
-DNLOPT_CXX=OFF \
-DNLOPT_GUILE=OFF \
-DNLOPT_SWIG=OFF \
-DNLOPT_FORTRAN=OFF \
-DCMAKE_BUILD_TYPE=Release \
..
make -j2
sed -i -n '/nlopt.[ah]$/p' install_manifest.txt
make install
# remove unwanted files
rm -f $ROOT/nlopt.hpp
rm -f $ROOT/nlopt.f
rm -rf $ROOT/lib/cmake
# rm -rf $ROOT/man
mv $ROOT/include/nlopt.h $ROOT/include/vendor/nlopt.h
cd $VENDOR
echo $NLOPT_TAG > nlopt/build.tag
}
# ------------------------------------------------------------------------
# musl libc
MUSL_URL="git://git.musl-libc.org/musl"
MUSL_TAG="v1.2.2"
build_musl()
{
git clone $MUSL_URL
cd musl && git checkout $MUSL_TAG
./configure \
--prefix=$ROOT \
--includedir=$ROOT/include/vendor/libc \
--disable-shared
make -j2
make install
mv $ROOT/lib/rcrt1.o \
$ROOT/lib/crt1.o \
$ROOT/lib/Scrt1.o \
$ROOT/lib/musl-gcc.specs \
$ROOT/lib/crt
mv $ROOT/lib/crti.o $ROOT/lib/crtn.o $ROOT/lib/crt/x86_64
rm $ROOT/bin/musl-gcc
cd $VENDOR
echo $MUSL_TAG > musl/build.tag
}
# ------------------------------------------------------------------------
# musl libc
ZLIB_URL="https://github.com/madler/zlib.git"
ZLIB_TAG="v1.2.11"
build_zlib()
{
git clone $ZLIB_URL zlib
cd zlib && git checkout $ZLIB_TAG
prefix=$ROOT ./configure --static
make -j2
make install
mv $ROOT/include/zlib.h $ROOT/include/zconf.h $ROOT/include/vendor
cd $VENDOR
echo $ZLIB_TAG > zlib/build.tag
}
# ------------------------------------------------------------------------
# utility functions
update()
{
base=$1
tag=$2
if [ -d $base ] && [ `cat $base/build.tag` = $tag ]; then
echo "$base: up to date"
else
build_$base
fi
}
# ------------------------------------------------------------------------
# main point of entry
update nlopt $NLOPT_TAG
update musl $MUSL_TAG
update blas $BLAS_TAG
update zlib $ZLIB_TAG
|