Skip to content

Commit

Permalink
Split out separate sys package
Browse files Browse the repository at this point in the history
When you have an lz4 dependency in another linked C library you don't
need the full wrapper, just a way to compile and link lz4. This commit
splits this part out into a separate sys crate to create this
possiblity.
  • Loading branch information
thijsc committed Nov 24, 2016
1 parent ea7efdb commit fec9042
Show file tree
Hide file tree
Showing 44 changed files with 177 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "liblz4"]
path = liblz4
path = lz4-sys/liblz4
url = https://github.com/Cyan4973/lz4.git
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "lz4"
license = "MIT"
version = "1.19.173"
authors = [ "Artem V. Navrotskiy <bozaro@buzzsoft.ru>" ]
build = "src/build.rs"
build = "build.rs"
description = "Rust LZ4 bindings library."
repository = "https://github.com/bozaro/lz4-rs"
documentation = "https://bozaro.github.io/lz4-rs/lz4/"
Expand All @@ -15,6 +15,7 @@ doc = false

[dependencies]
libc = "0.2.17"
lz4-sys = { path = "lz4-sys", version = "1.19.173" }

[dev-dependencies]
rand = "0.3.14"
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extern crate skeptic;

fn main() {
skeptic::generate_doc_tests(&["README.md"]);
}
14 changes: 14 additions & 0 deletions lz4-sys/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions lz4-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "lz4-sys"
license = "MIT"
links = "lz4"
version = "1.19.173"
authors = [ "Artem V. Navrotskiy <bozaro@buzzsoft.ru>" ]
build = "build.rs"
description = "Rust LZ4 sys package."
repository = "https://github.com/bozaro/lz4-rs"

[dependencies]
libc = "0.2.17"

[build-dependencies]
gcc = "0.3.38"
3 changes: 0 additions & 3 deletions src/build.rs → lz4-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate gcc;
extern crate skeptic;

use std::env;

Expand All @@ -21,6 +20,4 @@ fn main() {
_ => {}
}
compiler.compile("liblz4.a");

skeptic::generate_doc_tests(&["README.md"]);
}
2 changes: 2 additions & 0 deletions src/liblz4.rs → lz4-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate libc;

use std::fmt::Display;
use std::fmt::Formatter;
use std::io::Error;
Expand Down
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
62c5a5336dd59f3d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":10934594877106663419,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.3.38"]},"features":"None","deps":[],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a181c744148c47ab
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":10649368907568964211,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.2.14"]},"features":"None","deps":[],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
52882c79464c6203
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":16430485267315036644,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.2.17"]},"features":"Some([\"default\", \"use_std\"])","deps":[],"rustflags":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4dcd00ef20838953
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1bd446d9a6fd2783
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":4086851835445132369,"profile":11154289914177168617,"local":{"variant":"MtimeBased","fields":[[1479985363,0],[47,85,115,101,114,115,47,116,104,105,106,115,47,111,112,101,110,115,111,117,114,99,101,47,108,122,52,45,114,115,47,108,122,52,45,115,121,115,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,108,122,52,45,115,121,115,45,102,56,98,52,50,51,99,55,50,50,57,99,53,50,97,54,47,100,101,112,45,98,117,105,108,100,45,115,99,114,105,112,116,45,98,117,105,108,100,45,115,99,114,105,112,116,45,98,117,105,108,100]]},"features":"None","deps":[["gcc v0.3.38",4440502422605251938]],"rustflags":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":0,"target":0,"profile":0,"local":{"variant":"Precalculated","fields":["1479985359.000000000s (/Users/thijs/opensource/lz4-rs/lz4-sys/build.rs)"]},"features":"","deps":[],"rustflags":[]}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3af191810829233a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":596805854859732480,"profile":11154289914177168617,"local":{"variant":"MtimeBased","fields":[[1479985366,0],[47,85,115,101,114,115,47,116,104,105,106,115,47,111,112,101,110,115,111,117,114,99,101,47,108,122,52,45,114,115,47,108,122,52,45,115,121,115,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,108,122,52,45,115,121,115,45,102,56,98,52,50,51,99,55,50,50,57,99,53,50,97,54,47,100,101,112,45,108,105,98,45,108,122,52,45,115,121,115]]},"features":"None","deps":[],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
629b4196ea83e8b7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":8028671582974977263,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.0.3"]},"features":"None","deps":[["getopts v0.2.14",12341987322513293729]],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a0cbec03dc158cb8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":15004223012595257668,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.3.14"]},"features":"None","deps":[["libc v0.2.17",243841195395811410]],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e4b317f9127d2e14
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":11210667810463921453,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.6.1"]},"features":"None","deps":[["pulldown-cmark v0.0.3",13251986947104152418],["tempdir v0.3.5",4750383001660746962]],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d2ec0ae12bc0ec41
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":1581289781513190462,"target":11374385560762608064,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.3.5"]},"features":"None","deps":[["rand v0.3.14",13298027834421070752]],"rustflags":[]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.build_script_build</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
97 changes: 97 additions & 0 deletions lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
TARGET = Some("x86_64-apple-darwin")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=3
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/lz4.o" "-c" "liblz4/lib/lz4.c"
ExitStatus(ExitStatus(0))
TARGET = Some("x86_64-apple-darwin")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=3
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/lz4frame.o" "-c" "liblz4/lib/lz4frame.c"
ExitStatus(ExitStatus(0))
TARGET = Some("x86_64-apple-darwin")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=3
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/lz4hc.o" "-c" "liblz4/lib/lz4hc.c"
ExitStatus(ExitStatus(0))
TARGET = Some("x86_64-apple-darwin")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=3
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/xxhash.o" "-c" "liblz4/lib/xxhash.c"
ExitStatus(ExitStatus(0))
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
running: "ar" "crs" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4.a" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/lz4.o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/lz4frame.o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/lz4hc.o" "/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out/liblz4/lib/xxhash.o"
ExitStatus(ExitStatus(0))
cargo:rustc-link-lib=static=lz4
cargo:rustc-link-search=native=/Users/thijs/opensource/lz4-rs/lz4-sys/target/debug/build/lz4-sys-f8b423c7229c52a6/out
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate libc;

pub mod liblz4;
extern crate lz4_sys as liblz4;

mod decoder;
mod encoder;
Expand Down

0 comments on commit fec9042

Please sign in to comment.