From 0456655b419f0a452031d740144bcac46e734cc9 Mon Sep 17 00:00:00 2001 From: emma Date: Mon, 15 Jul 2024 00:32:39 -0600 Subject: [PATCH] rework build system --- .gitignore | 3 +-- Cargo.toml | 11 ----------- Makefile | 15 +++++++++++++++ build.rs | 17 ----------------- src/lib.rs => limine.rs | 1 - 5 files changed, 16 insertions(+), 31 deletions(-) delete mode 100644 Cargo.toml create mode 100644 Makefile delete mode 100644 build.rs rename src/lib.rs => limine.rs (66%) diff --git a/.gitignore b/.gitignore index a9d37c5..7c4816a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -target -Cargo.lock +bindings.rlib diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 5c75a22..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "limine-sys" -description = "Rust sys bindings for the Limine boot protocol" -version = "0.2.0" -authors = ["mintsuki "] -license = "BSD-2-Clause" -repository = "https://github.com/limine-bootloader/limine-rs-sys" -build = "build.rs" - -[build-dependencies] -bindgen = "0.69.4" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7e298e2 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Emma Tebibyte +# SPDX-License-Identifier: FSFAP +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice and this +# notice are preserved. This file is offered as-is, without any warranty. + +.POSIX: + +bindings.rlib: limine.h limine.rs + bindgen --use-core limine.h | cat limine.rs - | rustc --crate-type=lib - -o $@ + +.PHONY: clean +clean: + rm -f bindings.rlib diff --git a/build.rs b/build.rs deleted file mode 100644 index f0eb7fc..0000000 --- a/build.rs +++ /dev/null @@ -1,17 +0,0 @@ -extern crate bindgen; - -use std::env; -use std::path::PathBuf; - -fn main() { - let bindings = bindgen::Builder::default() - .header("limine.h") - .use_core() - .generate() - .expect("Unable to generate bindings"); - - let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - bindings - .write_to_file(out_path.join("bindings.rs")) - .expect("Couldn't write bindings!"); -} diff --git a/src/lib.rs b/limine.rs similarity index 66% rename from src/lib.rs rename to limine.rs index 0af9da1..c42b8fa 100644 --- a/src/lib.rs +++ b/limine.rs @@ -3,4 +3,3 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -include!(concat!(env!("OUT_DIR"), "/bindings.rs"));