forked from BIDData/BIDMach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdevlibs.sh
executable file
·82 lines (67 loc) · 2.22 KB
/
getdevlibs.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
78
79
80
#!/bin/bash
if [[ ${ARCH} == "" ]]; then
ARCH=`arch`
fi
BIDMACH_ROOT="${BASH_SOURCE[0]}"
if [ ! `uname` = "Darwin" ]; then
BIDMACH_ROOT=`readlink -f "${BIDMACH_ROOT}"`
else
while [ -L "${BIDMACH_ROOT}" ]; do
BIDMACH_ROOT=`readlink "${BIDMACH_ROOT}"`
done
fi
BIDMACH_ROOT=`dirname "$BIDMACH_ROOT"`
pushd "${BIDMACH_ROOT}" > /dev/null
BIDMACH_ROOT=`pwd`
BIDMACH_ROOT="$( echo ${BIDMACH_ROOT} | sed s+/cygdrive/c+c:+ )"
source ${BIDMACH_ROOT}/getcudaversion.sh
devdir="dev-cuda${CUDA_VERSION}"
echo "Fetching libs from ${devdir}"
source="http://people.eecs.berkeley.edu/~jfc/biddata"
cd ${BIDMACH_ROOT}/lib
if [ `uname` = "Darwin" ]; then
subdir="osx"
suffix="dylib"
curl -o liblist.txt ${source}/lib/${devdir}/liblist_osx.txt
elif [ "$OS" = "Windows_NT" ]; then
subdir="win"
suffix="dll"
curl -o liblist.txt ${source}/lib/${devdir}/liblist_win.txt
else
if [[ "${ARCH}" == arm* || "${ARCH}" == aarch* ]]; then
subdir="linux_arm"
suffix="so"
curl -o liblist.txt ${source}/lib/${devdir}/liblist_linux_arm.txt
else
subdir="linux"
suffix="so"
curl -o liblist.txt ${source}/lib/${devdir}/liblist_linux.txt
fi
fi
while read fname; do
echo -e "\nDownloading ${fname}"
curl --retry 2 -z ${fname} -o ${fname} "${source}/lib/${devdir}/${fname}"
chmod 755 ${fname}
done < liblist.txt
mkdir -p ${BIDMACH_ROOT}/cbin
cd ${BIDMACH_ROOT}/cbin
curl -o exelist.txt ${source}/cbin/exelist.txt
while read fname; do
echo -e "\nDownloading ${fname}"
curl --retry 2 -o ${fname} ${source}/cbin/${subdir}/${fname}
chmod 755 ${fname}
done < exelist.txt
chmod 755 ${BIDMACH_ROOT}/cbin/*
mv ${BIDMACH_ROOT}/lib/BIDMach.jar ${BIDMACH_ROOT}
cd ${BIDMACH_ROOT}
libs=`echo lib/*bidmat*.${suffix} lib/*iomp5*.${suffix}`
echo "Packing native libraries in the BIDMat jar"
jar uvf lib/BIDMat.jar $libs
rm -f ${BIDMACH_ROOT}/src/main/resources/lib/*.${suffix}
cp ${BIDMACH_ROOT}/lib/*bidmach*.${suffix} ${BIDMACH_ROOT}/src/main/resources/lib
cp ${BIDMACH_ROOT}/lib/*iomp5*.${suffix} ${BIDMACH_ROOT}/src/main/resources/lib
cd ${BIDMACH_ROOT}/src/main/resources
libs=`echo lib/*.${suffix}`
cd ${BIDMACH_ROOT}
echo "Packing native libraries in the BIDMach jar"
jar uvf BIDMach.jar $libs