luajit: yet another attempt to fix build

master
q3k 2021-06-24 18:06:31 +02:00
parent 057207fc72
commit 46f2d17dad
3 changed files with 20 additions and 5 deletions

View File

@ -28,6 +28,15 @@ licenses([
"notice", # MIT from expression "MIT"
])
filegroup(
name = "luajit2_srcs",
srcs = glob(["luajit2/**"]),
visibility = [
"//third_party/cargo/vendor:__subpackages__",
]
)
# Generated Targets
rust_library(
@ -35,6 +44,7 @@ rust_library(
srcs = glob(["**/*.rs"]),
crate_features = [
],
compile_data = glob(["luajit2/**"]),
crate_root = "src/lib.rs",
crate_type = "lib",
data = [],

View File

@ -62,7 +62,9 @@ impl Build {
let target = &self.target.as_ref().expect("TARGET not set")[..];
let host = &self.host.as_ref().expect("HOST not set")[..];
let out_dir = self.out_dir.as_ref().expect("OUT_DIR not set");
let source_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("luajit2");
// HACK: Bazel: get path to luajit sources as defined by cargo_build_script in mlua.
let luajit2 = std::env::var("LUAJIT2").unwrap();
let source_dir = Path::new(&luajit2);
let build_dir = out_dir.join("build");
let lib_dir = out_dir.join("lib");
let include_dir = out_dir.join("include");
@ -194,10 +196,10 @@ Error {}:
}
fn cp_r(src: &Path, dst: &Path) {
for f in fs::read_dir(src).unwrap() {
let f = f.unwrap();
for f in fs::read_dir(src).expect(&format!("read_dir failed {:?}", src)) {
let f = f.expect("f read filed");
let path = f.path();
let name = path.file_name().unwrap();
let name = path.file_name().expect("file_name failed");
// Skip git metadata
if name.to_str() == Some(".git") {

View File

@ -40,6 +40,7 @@ cargo_build_script(
name = "mlua_build_script",
srcs = glob(["**/*.rs"]),
build_script_env = {
"LUAJIT2": "${pwd}/third_party/cargo/vendor/luajit-src-210.1.3+restyfe08842/luajit2",
},
crate_features = [
"lua-src",
@ -48,7 +49,9 @@ cargo_build_script(
"vendored",
],
crate_root = "build/main.rs",
data = glob(["**"]),
data = glob(["**"]) + [
"//third_party/cargo/vendor/luajit-src-210.1.3+restyfe08842:luajit2_srcs",
],
edition = "2018",
links = "lua",
rustc_flags = [