From dbb7fd445d637ddb6ac28bc1d5a5add840ff7968 Mon Sep 17 00:00:00 2001 From: c0repwn3r Date: Mon, 26 Jun 2023 12:38:19 -0400 Subject: [PATCH] update package build system --- .gitignore | 4 +-- Cargo.lock | 5 ++-- nebula-ffi/Cargo.toml | 3 ++- nebula-ffi/src/lib.rs | 2 +- packages/void_amd64_tfcli/build.sh | 25 +++++++++++++++++++ .../build.sh | 2 +- .../tfclient/run | 0 tfcli/Cargo.toml | 3 ++- 8 files changed, 36 insertions(+), 8 deletions(-) create mode 100755 packages/void_amd64_tfcli/build.sh rename packages/{void_amd64 => void_amd64_tfclient}/build.sh (89%) rename packages/{void_amd64 => void_amd64_tfclient}/tfclient/run (100%) diff --git a/.gitignore b/.gitignore index 12adf4a..edd74bf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ pg_data tfclient/tmpexec.bin -packages/void_amd64/work -packages/void_amd64/*.xbps \ No newline at end of file +packages/void_amd64_tfclient/work +packages/void_amd64_tfclient/*.xbps \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 068467a..e6b777f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2073,7 +2073,7 @@ dependencies = [ [[package]] name = "nebula-ffi" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bindgen", "gobuild", @@ -3431,11 +3431,12 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "tfcli" -version = "0.1.1" +version = "0.1.2" dependencies = [ "clap 4.2.7", "dirs 5.0.1", "ipnet", + "openssl-sys", "qr2term", "reqwest", "serde", diff --git a/nebula-ffi/Cargo.toml b/nebula-ffi/Cargo.toml index e1b6fb7..739288f 100644 --- a/nebula-ffi/Cargo.toml +++ b/nebula-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nebula-ffi" -version = "0.1.0" +version = "0.1.1" edition = "2021" description = "A Rust wrapper crate for communicating with Nebula via a CGO FFI." license = "GPL-3.0-or-later" @@ -10,6 +10,7 @@ repository = "https://git.e3t.cc/~core/trifid" [dependencies] + [build-dependencies] gobuild = "0.1.0-alpha.2" bindgen = "0.66.1" \ No newline at end of file diff --git a/nebula-ffi/src/lib.rs b/nebula-ffi/src/lib.rs index 6cf7f36..d1da1d1 100644 --- a/nebula-ffi/src/lib.rs +++ b/nebula-ffi/src/lib.rs @@ -64,7 +64,7 @@ impl NebulaInstance { let res; unsafe { - res = generated::NebulaSetup(config_path_bytes.as_mut_ptr().cast::(), config_test_u8); + res = generated::NebulaSetup(config_path_bytes.as_mut_ptr().cast::(), config_test_u8); } let res = cstring_to_string(res); diff --git a/packages/void_amd64_tfcli/build.sh b/packages/void_amd64_tfcli/build.sh new file mode 100755 index 0000000..bd66868 --- /dev/null +++ b/packages/void_amd64_tfcli/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +cd $1 || exit +cd tfcli || exit + +echo "Building for release, v$2_$3 (+static) (--target x86_64-unknown-musl)" +cargo build --release --target x86_64-unknown-linux-musl + +cd ../packages/void || exit + +echo "Creating workdir" +rm -rf work +mkdir work +mkdir -p work/usr/bin +mkdir -p work/etc/sv + +echo "Copying tfcli binary" + +cp ../../target/release/tfcli work/usr/bin/tfcli +chmod 755 work/usr/bin/tfcli + +echo "Building XBPS package" + +xbps-create -A x86_64 -B trifid-build -H https://hub.e3t.cc/~core/trifid -l GPL-3.0-or-later -m "c0repwn3r " -n "tfcli-$2_$3" -s "A command-line client for managing trifid-api servers" work \ No newline at end of file diff --git a/packages/void_amd64/build.sh b/packages/void_amd64_tfclient/build.sh similarity index 89% rename from packages/void_amd64/build.sh rename to packages/void_amd64_tfclient/build.sh index b65bf46..f8fb79c 100755 --- a/packages/void_amd64/build.sh +++ b/packages/void_amd64_tfclient/build.sh @@ -23,4 +23,4 @@ cp -r tfclient work/etc/sv echo "Building XBPS package" -xbps-create -A x86_64 -B trifid-build -H https://hub.e3t.cc/~core/trifid -l GPL-3.0-or-later -m "c0repwn3r " -n "tfclient-$2_$3" -s "An open-source Rust= Defined Networking client" work \ No newline at end of file +xbps-create -A x86_64 -B trifid-build -H https://hub.e3t.cc/~core/trifid -l GPL-3.0-or-later -m "c0repwn3r " -n "tfclient-$2_$3" -s "An open-source Rust Defined Networking client" work \ No newline at end of file diff --git a/packages/void_amd64/tfclient/run b/packages/void_amd64_tfclient/tfclient/run similarity index 100% rename from packages/void_amd64/tfclient/run rename to packages/void_amd64_tfclient/tfclient/run diff --git a/tfcli/Cargo.toml b/tfcli/Cargo.toml index fbebddd..e731e50 100644 --- a/tfcli/Cargo.toml +++ b/tfcli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tfcli" -version = "0.1.1" +version = "0.1.2" edition = "2021" description = "Command-line client for managing trifid-api" license = "GPL-3.0-or-later" @@ -20,3 +20,4 @@ dirs = "5.0.1" qr2term = "0.3.1" ipnet = "2.7.2" serde_json = "1.0.96" +openssl-sys = { version = "0.9.83", features = ["vendored"] } \ No newline at end of file