From 34c83b7c3b178091078253b7ef580b7255eef441 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lars=20Sj=C3=B6strom?= <lars@radicore.se>
Date: Wed, 11 Jun 2025 22:24:38 +0200
Subject: [PATCH] fix(kexec-tools): build using autoconf

---
 pkgs/kexec-tools/default.nix | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/pkgs/kexec-tools/default.nix b/pkgs/kexec-tools/default.nix
index 7454821..b83a6a6 100644
--- a/pkgs/kexec-tools/default.nix
+++ b/pkgs/kexec-tools/default.nix
@@ -4,6 +4,7 @@
   buildPackages,
   fetchFromGitHub,
   autoconf,
+  autoreconfHook,
   zlib,
 }:
 
@@ -27,20 +28,27 @@ stdenv.mkDerivation {
     "pie"
   ];
 
-  buildCommand = ''
-    unpackPhase
-    mkdir -p $out
-    cd source
-    ./bootstrap
-    ./configure --prefix=/
-    make DESTDIR=$out install
+  preAutoreconf = "./bootstrap";
+
+  configurePlatforms = [
+    "build"
+    "host"
+  ];
+
+  configureFlags = [ "BUILD_CC=${buildPackages.stdenv.cc.targetPrefix}cc" "--prefix=/"];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+  installPhase = ''
+      make DESTDIR=$out install
   '';
 
-  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [
+    autoconf
+    autoreconfHook
+  ];
 
   buildInputs = [
     zlib
-    autoconf
   ];
 
   enableParallelBuilding = true;