forked from tmm1/matzruby
-
Notifications
You must be signed in to change notification settings - Fork 4
/
espconfig
executable file
·59 lines (54 loc) · 1.95 KB
/
espconfig
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
#!/bin/bash
# configure ESP MBARI Ruby build for workstation -- 10/22/23 brent@mbari.org
# for gcc x86 add:
# -fno-stack-protector
# to CFLAGS
# Also note that gcc >=4.7 requires -fno-tree-dce
# gcc version >= 10 targeting i386 requires STACK_WIPE_SITES 0x4xxx
# otherwise produces broken binaries at -O2 or higher
# Use:
# espconfig CC=gcc-9
#
# Requires zlib1g-dev package
# Requires obsolete libreadline.so.5 & /usr/include/readline
# (typically built from source)
#
: ${CC:=gcc}
: ${CFLAGS:="-O2 -g -Wclobbered -fno-tree-dce -fno-stack-protector"}
[ "$MBARIcflags" ] && CFLAGS="$CFLAGS $MBARIcflags"
: ${CXXFLAGS:=$CFLAGS}
read gcc version fullVersion extra <<< "$($CC -v 2>&1 | tail -1)" || exit
IFS=. read gccMajor gccMinor gccExtra <<< "$fullVersion"
unset IFS
[ $gccMajor -ge 4 ] && CFLAGS="$CFLAGS -fno-stack-protector -fno-tree-dce"
[ ${wipeSites+x} ] || {
wipeSites=0x8770
[ $gccMajor -gt 9 ] && wipeSites=0x4770
}
[ "$wipeSites" ] && CFLAGS="$CFLAGS -DSTACK_WIPE_SITES=$wipeSites"
for mod in mbarilib termios .; do
[ -r $mod/Makefile ] && make -C $mod MINIRUBY=miniruby distclean
done
export CC CFLAGS CXXFLAGS
[ `which dpkg-architecture` ] && {
rm -f ext/readline/libreadline.so*
lib="/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`"
#link Ruby readline extension with libreadline.5
[ "$readline5" ] || readline5=$lib/libreadline.so.5
if [ -r $readline5 ]; then
ln -s $readline5 ext/readline/libreadline.so || exit $?
else
echo "WARNING: Missing $readline5 (version 6 is incompatible)" >&2
sleep 5
fi
#find the proper tcl support file in Debian's multiarch scheme
tcfg=
usr="/usr$lib"
[ -r "$usr/tclConfig.sh" ] &&
tcfg="--with-tclConfig-file=$usr/tclConfig.sh"
[ -r "$usr/tkConfig.sh" ] &&
tcfg="$tcfg --with-tkConfig-file=$usr/tkConfig.sh"
}
rm -f config.cache configure `find ext -name Makefile` &&
autoconf && exec configure --prefix=/opt/mbari \
--enable-mbari-api --enable-pthread --disable-ucontext $tcfg $@