Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] set up cargo #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions implementations/duktape/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ app
app.zip
app-tiny
prefix
/target/
12 changes: 12 additions & 0 deletions implementations/duktape/Cargo.lock

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

13 changes: 13 additions & 0 deletions implementations/duktape/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "nucleus"
version = "0.1.0"
authors = [ "Tim Caswell <[email protected]>",
"Jeremiah Senkpiel <[email protected]>",
"Steve Klabnik <[email protected]>",
"Ashley Williams <[email protected]>" ]

[dependencies]
c-path = "0.1.1"

[lib]
crate-type = ["staticlib"]
18 changes: 9 additions & 9 deletions implementations/duktape/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ CC= cc -g
# Uncomment the following to make a static musl binary on linux
# CC= musl-gcc -Os -static

nucleus: main.o miniz.o duktape.o duv/duv.a ${LIBUV}/.libs/libuv.a env.o rust_path/target/release/libc_path.a
${CC} $^ -lm -lpthread -o $@ rust_path/target/release/libc_path.a -ldl
nucleus: main.o miniz.o duktape.o duv/duv.a ${LIBUV}/.libs/libuv.a env.o target/release/libnucleus.a
${CC} $^ -lm -lpthread -o $@ target/release/libnucleus.a

rust_path/target/release/libc_path.a: rust_path/src/lib.rs rust_path/src/helpers.rs
cd rust_path && cargo build --release
target/release/libnucleus.a:
cargo build --release

install: nucleus
install nucleus /usr/local/bin/

test: test-dir test-zip test-app test-app-tiny

test-dir: nucleus
./nucleus ../../test/manual -- 1 2 3
./nucleus ../../tests -- 1 2 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to revert these lines?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope!


test-zip: nucleus app.zip
./nucleus app.zip -- 4 5 6
Expand All @@ -42,14 +42,14 @@ app-tiny: app.zip prefix
prefix: nucleus
echo "#!$(shell pwd)/nucleus --" > prefix

app.zip: ../../test/manual/* ../../test/manual/deps/*
app.zip: ../../tests/* ../../tests/deps/*
rm -f app.zip
cd ../../test/manual; zip -9 -r ../../implementations/duktape/app.zip .; cd -
cd ../../tests; zip -9 -r ../implementations/duktape/app.zip .; cd -

env.o: env.c env.h
${CC} -std=gnu99 -Wall -Wextra -pedantic -Werror -c $< -o $@

main.o: main.c *.h
main.o: main.c
${CC} -std=gnu99 -Wall -Wextra -pedantic -Werror -c $< -o $@


Expand All @@ -72,7 +72,7 @@ miniz.o: ../../deps/miniz.c
${CC} -std=gnu99 -c $< -o $@

clean:
rm -rf nucleus *.o app.zip app prefix app-tiny rust_path/target
rm -f nucleus *.o app.zip app prefix app-tiny
${MAKE} -C duv clean

distclean: clean
Expand Down
2 changes: 0 additions & 2 deletions implementations/duktape/rust_path/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions implementations/duktape/rust_path/Cargo.toml

This file was deleted.

24 changes: 0 additions & 24 deletions implementations/duktape/rust_path/src/helpers.rs

This file was deleted.

54 changes: 0 additions & 54 deletions implementations/duktape/rust_path/src/lib.rs

This file was deleted.

1 change: 1 addition & 0 deletions implementations/duktape/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extern crate c_path;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just to get the linker to include the crate in the C library bundle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just requiring the c_path crate in the main. basically, lib.rs is where all the rust will go when we convert everything.