-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·75 lines (64 loc) · 2.85 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
#!/bin/sh
if [ $# -lt 1 ];then
echo "You should input the dir of brcmSDK.tar.gz"
exit 1
fi
INSTALL_DIR=$1
SDK_PATH=${INSTALL_DIR}/brcmSDK
CURDIR=`pwd`
if [ ! -f ${INSTALL_DIR}/brcmSDK.tar.gz ];then
echo "brcmSDK.tar.gz does not exist"
exit 1
fi
if [ ! -d ${SDK_PATH} ];then
tar -zxf ${INSTALL_DIR}/brcmSDK.tar.gz -C ${INSTALL_DIR}
if [ $? -ne 0 ];then
echo "can not unzip brcmSDK.tar.gz "
exit 1
fi
fi
export PATH=${SDK_PATH}/tools/arm-linux-androideabi-4.7/bin:$PATH
echo "begin to config"
${CURDIR}/configure --prefix=${CURDIR}/out --host=arm-linux \
--with-cc=arm-linux-androideabi-gcc --with-linkcc=arm-linux-androideabi-gcc --with-ar=arm-linux-androideabi-ar \
--with-default-snmp-version="2" --with-sys-contact="contact" --with-sys-location="location" \
--with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp" --with-persistent-directory="/var/net-snmp" \
--disable-mibs --disable-embedded-perl --without-perl-modules \
--with-out-mib-modules="snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host" \
--with-ldflags="-pie -fPIE -nostdlib -Wl,--gc-sections -Wl,-Bsymbolic -L${SDK_PATH}/lib -Wl,--no-whole-archive -lcutils -lc -lm -lgcc \
-Wl,--no-undefined -Wl,--whole-archive -Wl,--fix-cortex-a8" \
--with-cflags="-pie -fPIE -I${SDK_PATH}/include/bionic/libc/include \
-I${SDK_PATH}/include/bionic/libm/include \
-I${SDK_PATH}/include/bionic/libc/arch-arm/include \
-I${SDK_PATH}/include/bionic/libc/kernel/common \
-I${SDK_PATH}/include/bionic/libc/kernel/arch-arm \
-Dmmap64=mmap -march=armv7-a -mfloat-abi=softfp -finline-functions -finline-limit=300 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop \
-frename-registers -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -msoft-float -DBDBG_DEBUG_BUILD=1 -D_GNU_SOURCE=1 -DLINUX -pipe -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DBSTD_CPU_ENDIAN=BSTD_ENDIAN_LITTLE -Wstrict-prototypes -Wno-unused-value" \
1>${CURDIR}/build.log 2>&1
if [ $? -ne 0 ];then
echo "can not config net-snmp, check build.log for more info"
exit 1
fi
echo "config net-snmp success"
sed -i 's/CC -shared \\/CC -shared -nostdlib \\/g' ${CURDIR}/libtool && \
sed -i "s/^LIBS\t\t=/LIBS\t\t= ${SDK_PATH//\//\\/}\/lib\/crtbegin_dynamic.o ${SDK_PATH//\//\\/}\/lib\/crtend_android.o/g" apps/Makefile
if [ $? -ne 0 ];then
echo "fix libtool or Makefile failed"
exit 1
fi
echo "begin to make"
make 1>>${CURDIR}/build.log 2>&1
if [ $? -ne 0 ];then
echo "make failed, check build.log for more info"
exit 1
fi
echo "make success"
echo "begin to install"
make install 1>>${CURDIR}/build.log 2>&1
if [ $? -ne 0 ];then
echo "install failed, check build.log for more info"
exit 1
fi
echo "install success"
mv ${CURDIR}/build.log ${CURDIR}/out/build.log