forked from facebook/rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUILD.sh
executable file
·67 lines (62 loc) · 1.69 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
#!/bin/bash
BUILD_ARCH=`uname -m`
case $CROSS_COMPILE in
"aarch64-linux-gnu-")
# FIXME: not specific to Cavium ThunderX
ARCH_FLAGS="-march=armv8-a+crc+crypto -mtune=thunderx"
EXTRA_AMFLAGS="--host=aarch64-linux-gnu"
;;
"arm-linux-gnueabihf-")
ARCH_FLAGS="-march=armv7-a -mtune="
EXTRA_AMFLAGS="--host=arm-linux-gnueabihf"
;;
*)
# FIXME: workaround for bzip2
# gcc -fPIC -O2 -g -D_FILE_OFFSET_BITS=64 -march=native -mtune=native -fuse-ld=gold -c blocksort.c
# blocksort.c: In function 'fallbackSort':
# blocksort.c:329:1: internal compiler error: Segmentation fault
case $BUILD_ARCH in
"aarch64")
ARCH_FLAGS="-march=native"
;;
*)
ARCH_FLAGS="-march=native -mtune=native"
;;
esac
EXTRA_AMFLAGS="--host=$BUILD_ARCH-linux"
;;
esac
# build process of rocksdbjni depends on JDK
if test "x$JAVA_HOME" == "x"; then
case $BUILD_ARCH in
"aarch64")
BUILD_ARCH=arm64
;;
"armv7l")
BUILD_ARCH=armhf
;;
"x86_64")
BUILD_ARCH=amd64
;;
esac
# NOTE: OpenJDK 8 is verified to run IRI on x86_64, ARMv7-A, and Aarch64
# while OpenJDK 10 is not.
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-$BUILD_ARCH
fi
if test "x$DEBUG" == "x"; then
NPROC=`getconf _NPROCESSORS_ONLN`
else
NPROC=1
fi
set -x
make \
CC=${CROSS_COMPILE}gcc \
CXX=${CROSS_COMPILE}g++ \
AR=${CROSS_COMPILE}ar \
STRIP=${CROSS_COMPILE}strip \
EXTRA_CFLAGS="${ARCH_FLAGS} -fuse-ld=gold" \
EXTRA_CXXFLAGS="${ARCH_FLAGS} -static-libstdc++ -fuse-ld=gold" \
EXTRA_LDFLAGS="-Wl,-Bsymbolic-functions -Wl,--icf=all" \
EXTRA_AMFLAGS="${EXTRA_AMFLAGS}" \
DEBUG_LEVEL=0 \
rocksdbjavastatic -j${NPROC}