-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
88 lines (76 loc) · 2.69 KB
/
Copy pathbuild.sh
File metadata and controls
88 lines (76 loc) · 2.69 KB
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
#!/bin/bash
# Download libaries
# curl
curl -OL http://curl.haxx.se/download/curl-7.57.0.tar.gz && \
tar -xzf curl-7.57.0.tar.gz
# jansson
curl -O http://www.digip.org/jansson/releases/jansson-2.11.tar.gz && \
tar -xzf jansson-2.11.tar.gz
# zlib
curl -OL https://www.zlib.net/zlib-1.2.11.tar.gz && \
tar -xzf zlib-1.2.11.tar.gz
# miner
curl -OL https://github.com/BitzenyCoreDevelopers/cpuminer/archive/master.zip && \
unzip master.zip
CXXFLAGS='-std=c++14 -Wno-error=unused-command-line-argument'
for API in 19 21
do
if [ ${API} -eq 19 ]; then
ARCHS=(arm x86)
else
ARCHS=(arm aarch64 x86 x86_64)
fi
for ARCH in ${ARCHS[@]}
do
export TOOLCHAIN=/Android/toolchain-${API}-${ARCH}
export SYSROOT=$TOOLCHAIN/sysroot
export PATH=$PATH:$TOOLCHAIN/bin:$SYSROOT/usr/local/bin
if [ ${ARCH} == arm ]; then
TARGET=arm-linux-androideabi
elif [ ${ARCH} == x86 ]; then
TARGET=i686-linux-android
else
TARGET=${ARCH}-linux-android
fi
# cross compile environment variables
export CC=${TARGET}-clang
export CXX=${TARGET}-clang++
export AR=${TARGET}-ar
export AS=${TARGET}-as
export LD=${TARGET}-ld
export RANLIB=${TARGET}-ranlib
export NM=${TARGET}-nm
export STRIP=${TARGET}-strip
export CHOST=${TARGET}
echo "=================="
echo $CC
echo "=================="
# curl
pushd `pwd`
cd curl-7.57.0 && ./configure --prefix=$HOME/usr/${API}/${ARCH} --host=${TARGET} && \
make && make install && make clean
popd
# jansson
pushd `pwd`
cd jansson-2.11 && ./configure --prefix=$HOME/usr/${API}/${ARCH} --host=${TARGET} && \
make && make install && make clean
popd
# zlib
pushd `pwd`
cd zlib-1.2.11 && ./configure --prefix=$HOME/usr/${API}/${ARCH} && \
make && make install && make clean
popd
# miner
pushd `pwd`
cd cpuminer-master && \
mkdir -p m4 && cp $HOME/usr/${API}/${ARCH}/share/aclocal/libcurl.m4 m4 && \
sed -i -e 's/aclocal/aclocal -I m4/' autogen.sh && \
echo 'minerd_LDFLAGS += -fPIE -pie' >> Makefile.am && \
echo 'minerd_CPPFLAGS += -fPIE' >> Makefile.am && \
echo 'ACLOCAL_AMFLAGS = -I m4' >> Makefile.am && \
./autogen.sh && \
./configure --prefix=$HOME/miner/${API}/${ARCH} --host=${TARGET} --with-libcurl=$HOME/usr/${API}/${ARCH} CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer" && \
make && make install && make clean
popd
done
done