-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
77 lines (61 loc) · 1.62 KB
/
build.sh
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
#!/bin/bash
# look for gsl and gslcblas libraries
gslLibPath=""
gslLibName=""
cblasLibPath=""
cblasLibName=""
if [[ "$OSTYPE" == "linux-gnu" ]]; then
if [[ -e "/usr/local/lib/libgsl.so.25.0.0" ]]; then
gslLibPath="/usr/local/lib/libgsl.so.25.0.0"
gslLibName="libgsl.so.25"
cblasLibPath="/usr/local/lib/libgslcblas.so.0.0.0"
cblasLibName="libgslcblas.so.0"
else
echo "Could not find libgsl.so.25.0.0"
exit
fi
else
# assume mac
if [[ -e "/usr/local/lib/libgsl.dylib" ]]; then
gslLibPath="/usr/local/lib/libgsl.25.dylib"
gslLibName="libgsl.25.dylib"
cblasLibPath="/usr/local/lib/libgslcblas.0.dylib"
cblasLibName="libgslcblas.0.dylib"
else
echo "Could not find libgsl.dylib"
exit
fi
fi
pythonDir="./python"
csourceDir="./c-source"
distDir="./dist"
# build libgs2.so
cd $csourceDir
make clean
make
make library
cd ..
# build python
cd $pythonDir
source env/bin/activate
pip install -r requirements.txt
pyinstaller --hidden-import pkg_resources.py2_warn main.py --onefile
deactivate
cd ..
# bundle
mkdir -p "$distDir/lib/" "$distDir/config/" "$distDir/res/"
cd $distDir
cp "../$pythonDir/config/prod-config.ini" "./config/config.ini"
cp "../$pythonDir/dist/main" "./main"
cp "../$csourceDir/build/libgs2.so" "./lib/libgs2.so"
cp "../$csourceDir/res/example1.csv" "./res/example.csv"
cd ..
# copy in gsl and cblas
cp "$gslLibPath" "$distDir/$gslLibName"
cp "$cblasLibPath" "$distDir/$cblasLibName"
# clean up artifacts
rm -r "$pythonDir/build/"
rm -r "$pythonDir/dist/"
rm -r "$pythonDir/main.spec"
cd $csourceDir
make clean