Skip to content

Commit

Permalink
Rename library to rustls-ffi (rustls#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsha authored and kevinburke committed Oct 30, 2021
1 parent 0e72529 commit 14bb717
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: make src/crustls.h
- run: make src/rustls.h
- run: git diff --exit-code

cargo-fmt:
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "crustls"
name = "rustls-ffi"
version = "0.7.1"
authors = ["Jacob Hoffman-Andrews <[email protected]>"]
description = "C-to-rustls bindings"
edition = "2018"
links = "crustls"
links = "rustls_ffi"

[dependencies]
# Keep in sync with RUSTLS_CRATE_VERSION in lib.rs
Expand All @@ -19,5 +19,5 @@ log = "0.4.14"
cbindgen = "*"

[lib]
name = "crustls"
name = "rustls_ffi"
crate-type = ["lib", "staticlib"]
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,29 @@ test: all
target:
mkdir -p $@

src/crustls.h: src/*.rs cbindgen.toml
src/rustls.h: src/*.rs cbindgen.toml
cargo check
cbindgen --lang C > $@

target/$(PROFILE)/libcrustls.a: src/*.rs Cargo.toml
target/$(PROFILE)/librustls_ffi.a: src/*.rs Cargo.toml
RUSTFLAGS="-C metadata=rustls-ffi" cargo build $(CARGOFLAGS)

target/%.o: tests/%.c src/crustls.h tests/common.h | target
target/%.o: tests/%.c src/rustls.h tests/common.h | target
$(CC) -o $@ -c $< $(CFLAGS)

target/client: target/client.o target/common.o target/$(PROFILE)/libcrustls.a
target/client: target/client.o target/common.o target/$(PROFILE)/librustls_ffi.a
$(CC) -o $@ $^ $(LDFLAGS)

target/server: target/server.o target/common.o target/$(PROFILE)/libcrustls.a
target/server: target/server.o target/common.o target/$(PROFILE)/librustls_ffi.a
$(CC) -o $@ $^ $(LDFLAGS)

install: target/$(PROFILE)/libcrustls.a src/crustls.h
install: target/$(PROFILE)/librustls_ffi.a src/rustls.h
mkdir -p $(DESTDIR)/lib
install target/$(PROFILE)/libcrustls.a $(DESTDIR)/lib/
install target/$(PROFILE)/librustls_ffi.a $(DESTDIR)/lib/librustls.a
mkdir -p $(DESTDIR)/include
install src/crustls.h $(DESTDIR)/include/crustls.h
install src/rustls.h $(DESTDIR)/include/
ln -s librustls.a $(DESTDIR)/lib/libcrustls.a
ln -s rustls.h $(DESTDIR)/include/crustls.h

clean:
rm -rf target
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
let include_dir = out_dir.join("include");

fs::create_dir_all(&include_dir).unwrap();
fs::copy("src/crustls.h", include_dir.join("crustls.h")).unwrap();
fs::copy("src/rustls.h", include_dir.join("rustls.h")).unwrap();

println!("cargo:include={}", include_dir.to_str().unwrap());
}
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#endif

/* crustls.h is autogenerated in the Makefile using cbindgen. */
#include "crustls.h"
#include "rustls.h"
#include "common.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion tests/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <stdlib.h>
#include <errno.h>

#include "crustls.h"
#include "rustls.h"
#include "common.h"

void
Expand Down
2 changes: 1 addition & 1 deletion tests/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#endif /* _WIN32 */

/* crustls.h is autogenerated in the Makefile using cbindgen. */
#include "crustls.h"
#include "rustls.h"
#include "common.h"

enum crustls_demo_result
Expand Down

0 comments on commit 14bb717

Please sign in to comment.