Finished adding a basic flake

It can now build the Linux C2 beacon
This commit is contained in:
Andrew Rioux
2024-01-23 23:26:58 -05:00
parent b2278cc8e8
commit 4475d23d1d
10 changed files with 94 additions and 41 deletions

View File

@@ -28,3 +28,4 @@ packets = { path = "../packets" }
[build-dependencies]
cmake = "0.1"
fs_extra = "1.3.0"

View File

@@ -13,24 +13,37 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
fn main() {
let dst = cmake::Config::new(std::env!("SPARSE_BUILD_LIBPCAP"))
.define("BUILD_SHARED_LIBS", "OFF")
.define("BUILD_WITH_LIBNL", "OFF")
.define("DISABLE_BLUETOOTH", "ON")
.define("DISABLE_DAG", "ON")
.define("DISABLE_DBUS", "ON")
.define("DISABLE_DPDK", "ON")
.define("DISABLE_LINUX_USBMON", "ON")
.define("DISABLE_NETMAP", "ON")
.define("DISABLE_RDMA", "ON")
.define("DISABLE_SEPTEL", "ON")
.define("DISABLE_SNF", "ON")
.define("DISABLE_TC", "ON")
.define("PCAP_TYPE", "linux")
.build();
use fs_extra::dir::{copy, CopyOptions};
// panic!("hahahahah test {}", dst.display());
println!("cargo:rustc-link-search=native={}/lib", dst.display());
println!("cargo:rustc-link-lib=pcap");
fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" {
println!("cargo:rustc-lib-lib=pcap");
} else {
let libpcap_src = format!("{}/pcap_src", std::env::var("OUT_DIR").unwrap());
let mut options = CopyOptions::new();
options.copy_inside = true;
copy(std::env!("SPARSE_BUILD_LIBPCAP"), &libpcap_src, &options);
let dst = cmake::Config::new(&libpcap_src)
.define("BUILD_SHARED_LIBS", "OFF")
.define("BUILD_WITH_LIBNL", "OFF")
.define("DISABLE_BLUETOOTH", "ON")
.define("DISABLE_DAG", "ON")
.define("DISABLE_DBUS", "ON")
.define("DISABLE_DPDK", "ON")
.define("DISABLE_LINUX_USBMON", "ON")
.define("DISABLE_NETMAP", "ON")
.define("DISABLE_RDMA", "ON")
.define("DISABLE_SEPTEL", "ON")
.define("DISABLE_SNF", "ON")
.define("DISABLE_TC", "ON")
.define("PCAP_TYPE", "linux")
.build();
// panic!("hahahahah test {}", dst.display());
println!("cargo:rustc-link-search=native={}/lib", dst.display());
println!("cargo:rustc-link-search=native={}/lib64", dst.display());
println!("cargo:rustc-link-lib=static=pcap");
}
}