forked from google/leveldb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_mac.sh
executable file
·136 lines (126 loc) · 3.62 KB
/
make_mac.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh
cd `dirname $0`
# install JDK 8+ and set $JAVA_INCLUDE if JDK is not in default path
if [ "$JAVA_INCLUDE" = "" ]; then JAVA_INCLUDE=/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers; fi
CORE_FILES="\
db/builder.cc \
db/db_impl.cc \
db/db_iter.cc \
db/dbformat.cc \
db/dumpfile.cc \
db/filename.cc \
db/log_reader.cc \
db/log_writer.cc \
db/memtable.cc \
db/repair.cc \
db/table_cache.cc \
db/version_edit.cc \
db/version_set.cc \
db/write_batch.cc \
table/block.cc \
table/block_builder.cc \
table/filter_block.cc \
table/format.cc \
table/iterator.cc \
table/merger.cc \
table/table.cc \
table/table_builder.cc \
table/two_level_iterator.cc \
util/arena.cc \
util/bloom.cc \
util/cache.cc \
util/coding.cc \
util/comparator.cc \
util/crc32c.cc \
util/env.cc \
util/env_posix.cc \
util/filter_policy.cc \
util/hash.cc \
util/histogram.cc \
util/logging.cc \
util/options.cc \
util/status.cc \
crc32c/crc32c_portable.cc \
snappy/snappy.cc \
snappy/snappy-sinksource.cc \
snappy/snappy-stubs-internal.cc \
"
OBJ_FILES="\
builder.o \
db_impl.o \
db_iter.o \
dbformat.o \
dumpfile.o \
filename.o \
log_reader.o \
log_writer.o \
memtable.o \
repair.o \
table_cache.o \
version_edit.o \
version_set.o \
write_batch.o \
block.o \
block_builder.o \
filter_block.o \
format.o \
iterator.o \
merger.o \
table.o \
table_builder.o \
two_level_iterator.o \
arena.o \
bloom.o \
cache.o \
coding.o \
comparator.o \
crc32c.o \
env.o \
env_posix.o \
filter_policy.o \
hash.o \
histogram.o \
logging.o \
options.o \
status.o \
crc32c_portable.o \
snappy.o \
snappy-sinksource.o \
snappy-stubs-internal.o \
"
BENCHMARK_FILES="\
benchmark/benchmark.cc \
benchmark/benchmark_api_internal.cc \
benchmark/benchmark_name.cc \
benchmark/benchmark_register.cc \
benchmark/benchmark_runner.cc \
benchmark/colorprint.cc \
benchmark/commandlineflags.cc \
benchmark/complexity.cc \
benchmark/console_reporter.cc \
benchmark/counter.cc \
benchmark/csv_reporter.cc \
benchmark/json_reporter.cc \
benchmark/perf_counters.cc \
benchmark/reporter.cc \
benchmark/sleep.cc \
benchmark/statistics.cc \
benchmark/string_util.cc \
benchmark/sysinfo.cc \
benchmark/timers.cc \
"
COMPILE="g++ -std=c++11 -mmacosx-version-min=10.9 -DNDEBUG -DLEVELDB_PLATFORM_POSIX -DHAVE_CRC32C=1 -DHAVE_SNAPPY=1 -DHAVE_BUILTIN_EXPECT=1 -DHAVE_BYTESWAP_H=1 -DHAVE_BUILTIN_CTZ=1 -DHAVE_FULLFSYNC=1 -DHAVE_O_CLOEXEC=1 -I. -Iinclude -Isnappy -Igtest -Igmock -I${JAVA_INCLUDE} -m64 -mavx -mbmi2 -O3 -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fmerge-all-constants -fno-builtin-memcmp -pipe -pthread"
echo building libleveldbjni64.dylib ...
$COMPILE -c -o crc32c_.o crc32c/crc32c.cc
$COMPILE -c -msse4.2 -fPIC -o crc32c_sse42.o crc32c/crc32c_sse42.cc
$COMPILE -DLEVELDB_SHARED_LIBRARY -DLEVELDB_COMPILE_LIBRARY -DENABLE_JNI -shared -fPIC -fvisibility=hidden -dynamiclib -o libleveldbjni64.dylib $CORE_FILES util/jni.cc crc32c/crc32c.cc crc32c_sse42.o
echo building libleveldb.a ...
$COMPILE -c $CORE_FILES
ar -rs libleveldb.a $OBJ_FILES crc32c_.o crc32c_sse42.o
rm -f *.o 2> /dev/null
echo building db-tools ...
$COMPILE -o leveldbutil db/leveldbutil.cc -lpthread libleveldb.a
$COMPILE -o db_bench benchmarks/db_bench.cc -lpthread libleveldb.a util/testutil.cc
$COMPILE -o db_test db/db_test.cc -lpthread libleveldb.a util/testutil.cc gtest/src/gtest-all.cc gmock/src/gmock-all.cc $BENCHMARK_FILES
$COMPILE -o env_test util/env_test.cc -lpthread libleveldb.a util/testutil.cc gtest/src/gtest-all.cc gmock/src/gmock-all.cc
$COMPILE -o version_set_test db/version_set_test.cc -lpthread libleveldb.a util/testutil.cc gtest/src/gtest-all.cc gmock/src/gmock-all.cc