rework build system

This commit is contained in:
Emma Tebibyte 2024-07-15 00:32:39 -06:00
parent ac074972f7
commit 0456655b41
Signed by: emma
GPG Key ID: 06FA419A1698C270
5 changed files with 16 additions and 31 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
target bindings.rlib
Cargo.lock

View File

@ -1,11 +0,0 @@
[package]
name = "limine-sys"
description = "Rust sys bindings for the Limine boot protocol"
version = "0.2.0"
authors = ["mintsuki <mintsuki@protonmail.com>"]
license = "BSD-2-Clause"
repository = "https://github.com/limine-bootloader/limine-rs-sys"
build = "build.rs"
[build-dependencies]
bindgen = "0.69.4"

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
# 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

View File

@ -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!");
}

View File

@ -3,4 +3,3 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));