Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
9e402e8f
Commit
9e402e8f
authored
May 10, 2017
by
zhangjinpeng1987
Committed by
siddontang
May 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more compression types (#57)
parent
3961c3a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
build.rs
librocksdb_sys/build.rs
+2
-1
build.sh
librocksdb_sys/build.sh
+17
-3
lib.rs
librocksdb_sys/src/lib.rs
+2
-0
No files found.
librocksdb_sys/build.rs
View file @
9e402e8f
...
@@ -41,7 +41,7 @@ fn main() {
...
@@ -41,7 +41,7 @@ fn main() {
let
p
=
PathBuf
::
from
(
fest_dir
.clone
())
.join
(
"build.sh"
);
let
p
=
PathBuf
::
from
(
fest_dir
.clone
())
.join
(
"build.sh"
);
let
crocksdb_path
=
PathBuf
::
from
(
fest_dir
)
.join
(
"crocksdb"
);
let
crocksdb_path
=
PathBuf
::
from
(
fest_dir
)
.join
(
"crocksdb"
);
env
::
set_var
(
"CROCKSDB_PATH"
,
crocksdb_path
.to_str
()
.unwrap
());
env
::
set_var
(
"CROCKSDB_PATH"
,
crocksdb_path
.to_str
()
.unwrap
());
for
lib
in
&
[
"z"
,
"snappy"
,
"bz2"
,
"lz4"
,
"rocksdb"
]
{
for
lib
in
&
[
"z"
,
"snappy"
,
"bz2"
,
"lz4"
,
"
zstd"
,
"
rocksdb"
]
{
let
lib_name
=
format!
(
"lib{}.a"
,
lib
);
let
lib_name
=
format!
(
"lib{}.a"
,
lib
);
let
src
=
build
.join
(
&
lib_name
);
let
src
=
build
.join
(
&
lib_name
);
let
dst
=
dst
.join
(
&
lib_name
);
let
dst
=
dst
.join
(
&
lib_name
);
...
@@ -84,6 +84,7 @@ fn main() {
...
@@ -84,6 +84,7 @@ fn main() {
println!
(
"cargo:rustc-link-lib=static=z"
);
println!
(
"cargo:rustc-link-lib=static=z"
);
println!
(
"cargo:rustc-link-lib=static=bz2"
);
println!
(
"cargo:rustc-link-lib=static=bz2"
);
println!
(
"cargo:rustc-link-lib=static=lz4"
);
println!
(
"cargo:rustc-link-lib=static=lz4"
);
println!
(
"cargo:rustc-link-lib=static=zstd"
);
println!
(
"cargo:rustc-link-lib=static=snappy"
);
println!
(
"cargo:rustc-link-lib=static=snappy"
);
println!
(
"cargo:rustc-link-search=native={}"
,
dst
.display
());
println!
(
"cargo:rustc-link-search=native={}"
,
dst
.display
());
...
...
librocksdb_sys/build.sh
View file @
9e402e8f
...
@@ -105,6 +105,20 @@ function compile_lz4() {
...
@@ -105,6 +105,20 @@ function compile_lz4() {
cd
../..
cd
../..
}
}
function
compile_zstd
()
{
if
[[
-f
libzstd.a
]]
;
then
return
fi
rm
-rf
zstd-1.2.0
download https://github.com/facebook/zstd/archive/v1.2.0.tar.gz zstd-1.2.0.tar.gz d7777b0aafa7002a4dee1e2db42afe30
tar
xvzf zstd-1.2.0.tar.gz
cd
zstd-1.2.0/lib
make
CPPFLAGS
=
'-fPIC -I. -I./common'
-j
$con
mv
libzstd.a ../..
cd
../..
}
function
compile_rocksdb
()
{
function
compile_rocksdb
()
{
if
[[
-f
librocksdb.a
]]
;
then
if
[[
-f
librocksdb.a
]]
;
then
return
return
...
@@ -120,8 +134,8 @@ function compile_rocksdb() {
...
@@ -120,8 +134,8 @@ function compile_rocksdb() {
cd
rocksdb-
$vernum
cd
rocksdb-
$vernum
cp
$CROCKSDB_PATH
/c.cc ./db/c.cc
cp
$CROCKSDB_PATH
/c.cc ./db/c.cc
cp
$CROCKSDB_PATH
/rocksdb/c.h ./include/rocksdb/c.h
cp
$CROCKSDB_PATH
/rocksdb/c.h ./include/rocksdb/c.h
export
EXTRA_CFLAGS
=
"-fPIC -I
${
wd
}
/zlib-1.2.11 -I
${
wd
}
/bzip2-1.0.6 -I
${
wd
}
/snappy-1.1.1 -I
${
wd
}
/lz4-r131/lib"
export
EXTRA_CFLAGS
=
"-fPIC -I
${
wd
}
/zlib-1.2.11 -I
${
wd
}
/bzip2-1.0.6 -I
${
wd
}
/snappy-1.1.1 -I
${
wd
}
/lz4-r131/lib
-I
${
wd
}
/zstd-1.2.0/lib
"
export
EXTRA_CXXFLAGS
=
"-DZLIB -DBZIP2 -DSNAPPY -DLZ4
$EXTRA_CFLAGS
"
export
EXTRA_CXXFLAGS
=
"-DZLIB -DBZIP2 -DSNAPPY -DLZ4
-DZSTD
$EXTRA_CFLAGS
"
make static_lib
-j
$con
make static_lib
-j
$con
mv
librocksdb.a ../
mv
librocksdb.a ../
cd
..
cd
..
...
@@ -142,7 +156,7 @@ function find_library() {
...
@@ -142,7 +156,7 @@ function find_library() {
}
}
if
[[
$#
-eq
0
]]
;
then
if
[[
$#
-eq
0
]]
;
then
error
$0
[
compile_bz2
\|
compile_z
\|
compile_lz4
\|
compile_rocksdb
\|
compile_snappy
\|
find_library]
error
$0
[
compile_bz2
\|
compile_z
\|
compile_lz4
\|
compile_
zstd
\|
compile_
rocksdb
\|
compile_snappy
\|
find_library]
fi
fi
$@
$@
librocksdb_sys/src/lib.rs
View file @
9e402e8f
...
@@ -62,6 +62,8 @@ pub enum DBCompressionType {
...
@@ -62,6 +62,8 @@ pub enum DBCompressionType {
DBBz2
=
3
,
DBBz2
=
3
,
DBLz4
=
4
,
DBLz4
=
4
,
DBLz4hc
=
5
,
DBLz4hc
=
5
,
// DBXpress = 6, not support currently.
DBZstd
=
7
,
}
}
#[repr(C)]
#[repr(C)]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment