From 829d0c617059e1949f40f6a8fa86e53ab0d81fba Mon Sep 17 00:00:00 2001
From: 360tetsu360 <tetsuhiko.game.minecraft@gmail.com>
Date: Fri, 23 Aug 2024 03:16:17 +0000
Subject: [PATCH] Fix build script

---
 solver/build.rs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/solver/build.rs b/solver/build.rs
index f0d0c9f..38e4086 100644
--- a/solver/build.rs
+++ b/solver/build.rs
@@ -1,3 +1,5 @@
+use std::env;
+
 const C_SOURCE: [&str; 64] = [
     // qfits
     "ext/astrometry/qfits-an/anqfits.c",
@@ -74,6 +76,7 @@ const C_SOURCE: [&str; 64] = [
 
 fn main() {
     println!("cargo::rerun-if-changed=ext");
+    let build_dir = env::var("GITHUB_WORKSPACE").unwrap_or("/atomskygaze".to_string());
     cc::Build::new()
         .warnings(false)
         .extra_warnings(false)
@@ -85,8 +88,17 @@ fn main() {
         .include("ext/astrometry")
         .include("ext/astrometry/include")
         .include("ext/astrometry/include/astrometry")
+        .include(format!(
+            "{}/build/buildroot-2024.02/output/staging/usr/include",
+            build_dir
+        ))
         .compile("stellarsolver");
 
+    println!(
+        "cargo:rustc-link-search=native={}/build/buildroot-2024.02/output/target/usr/lib",
+        build_dir
+    );
+
     println!("cargo:rustc-link-lib=gsl");
     println!("cargo:rustc-link-lib=gslcblas");
 }