forked from epics-modules/mrfioc2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-epics.sh
executable file
·103 lines (75 loc) · 2.23 KB
/
build-epics.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
set -e -x
# Build Base for use with https://travis-ci.org
#
# Set environment variables
# BASE= 3.14 3.15 or 3.16 (VCS branch)
# STATIC= static or shared
die() {
echo "$1" >&2
exit 1
}
[ "$BASE" ] || exit 0
CDIR="$HOME/.cache/base-$BASE-$STATIC"
if [ ! -e "$CDIR/built" ]
then
install -d "$CDIR"
( cd "$CDIR" && git clone --depth 50 --branch $BASE https://github.com/epics-base/epics-base.git base )
EPICS_BASE="$CDIR/base"
case "$STATIC" in
static)
cat << EOF >> "$EPICS_BASE/configure/CONFIG_SITE"
SHARED_LIBRARIES=NO
STATIC_BUILD=YES
EOF
;;
*) ;;
esac
EPICS_HOST_ARCH=`sh $EPICS_BASE/startup/EpicsHostArch`
case "$CMPLR" in
clang)
echo "Host compiler is clang"
cat << EOF >> "$EPICS_BASE/configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH"
GNU = NO
CMPLR_CLASS = clang
CC = clang
CCC = clang++
EOF
# hack
sed -i -e 's/CMPLR_CLASS = gcc/CMPLR_CLASS = clang/' "$EPICS_BASE/configure/CONFIG.gnuCommon"
clang --version
;;
*)
echo "Host compiler is default"
gcc --version
;;
esac
make -C "$EPICS_BASE" -j2
if [ "$BASE" = "3.14" ]; then
( cd "$CDIR" && wget https://www.aps.anl.gov/epics/download/extensions/extensionsTop_20120904.tar.gz && tar -xzf extensionsTop_*.tar.gz)
( cd "$CDIR" && wget https://www.aps.anl.gov/epics/download/extensions/msi1-7.tar.gz && tar -xzf msi1-7.tar.gz && mv msi1-7 extensions/src/msi)
cat << EOF > "$CDIR/extensions/configure/RELEASE"
EPICS_BASE=$EPICS_BASE
EPICS_EXTENSIONS=\$(TOP)
EOF
( cd "$CDIR/extensions" && make )
cp "$CDIR/extensions/bin/$EPICS_HOST_ARCH/msi" "$EPICS_BASE/bin/$EPICS_HOST_ARCH/"
echo 'MSI:=$(EPICS_BASE)/bin/$(EPICS_HOST_ARCH)/msi' >> "$EPICS_BASE/configure/CONFIG_SITE"
fi
touch "$CDIR/built"
fi
EPICS_HOST_ARCH=`sh $EPICS_BASE/startup/EpicsHostArch`
CDIR="$HOME/.cache/devlib2"
if [ ! -e "$CDIR/built" ]
then
install -d "$CDIR"
( cd "$CDIR" && git clone --depth 50 --branch master https://github.com/epics-modules/devlib2.git devlib2 )
DEVLIB2="$CDIR/devlib2"
echo "EPICS_BASE=$EPICS_BASE" > "$DEVLIB2/configure/RELEASE.local"
make -C "$DEVLIB2" -j2
touch "$CDIR/built"
fi
cat << EOF > configure/RELEASE
DEVLIB2=$DEVLIB2
EPICS_BASE=$EPICS_BASE
EOF