switch to gcc build script

This commit is contained in:
Chris West (Faux) 2017-07-13 13:49:36 +01:00
parent 0126dd5220
commit eaf79f46ed
5 changed files with 12 additions and 7 deletions

View File

@ -6,3 +6,6 @@ authors = ["Chris West (Faux) <git@goeswhere.com>"]
[dependencies] [dependencies]
lazy_static = "0.2.8" lazy_static = "0.2.8"
libc = "0.2.26" libc = "0.2.26"
[build-dependencies]
gcc = "0.3.51"

1
apt-pkg-c/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lib.o

View File

@ -1,11 +1,10 @@
CXXFLAGS=-Wall -Wextra -g CXXFLAGS=-Wall -Wextra -g
all: libapt-pkg-c.a all: clean check
lib.o: lib.cpp lib.h check: lib.o
libapt-pkg-c.a: lib.o lib.o: lib.cpp
ar rcs $@ $<
clean: clean:
$(RM) libapt-pkg-c.a lib.o $(RM) lib.o

View File

@ -1,3 +1,5 @@
extern crate gcc;
fn main() { fn main() {
println!("cargo:rustc-link-search=apt-pkg-c") gcc::compile_library("libapt-pkg-c.a", &["apt-pkg-c/lib.cpp"]);
} }

View File

@ -9,7 +9,7 @@ use libc::c_char;
pub type PCache = *mut c_void; pub type PCache = *mut c_void;
pub type PPkgIterator = *mut c_void; pub type PPkgIterator = *mut c_void;
#[link(name = "apt-pkg-c")] #[link(name = "apt-pkg-c", kind = "static")]
#[link(name = "apt-pkg")] #[link(name = "apt-pkg")]
#[link(name = "stdc++")] #[link(name = "stdc++")]
extern { extern {