From 4b0148a5d9b21365606e75e3031e243765374b6c Mon Sep 17 00:00:00 2001
From: Xiretza <xiretza@xiretza.xyz>
Date: Fri, 6 Aug 2021 13:54:00 +0200
Subject: [PATCH 1/3] Use system libfswatch install

---
 Makefile               | 14 +++++---------
 c_lib/c_libfswatch.gpr |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index c3bd85a..8d02469 100644
--- a/Makefile
+++ b/Makefile
@@ -3,16 +3,12 @@ DESTDIR=
 all: generated
 	gprbuild -p -P ada_libfswatch
 
-# warn if libfswatch/ is not populated
-libfswatch:
-	@echo "you need to install the libfswatch library in libfswatch/"
-	@exit 1
-
 # generate the Ada binding
-generated: libfswatch
-	(mkdir -p generated; cd libfswatch/include/libfswatch/c/ ; \
-		gcc -C -fdump-ada-spec libfswatch.h -D_TIMEZONE_DEFINED; \
-	       	mv *.ads ../../../../generated/)
+generated:
+	(mkdir -p generated; cd generated ; \
+		gcc -C -fdump-ada-spec ${MINGW_PREFIX}/include/libfswatch/c/libfswatch.h -D_TIMEZONE_DEFINED ; \
+        rename 'libfswatch_c_' '' *.ads ; \
+        sed -i 's/libfswatch_c_//g' *.ads)
 
 clean:
 	gprclean -P ada_libfswatch
diff --git a/c_lib/c_libfswatch.gpr b/c_lib/c_libfswatch.gpr
index a12b28f..a032dca 100644
--- a/c_lib/c_libfswatch.gpr
+++ b/c_lib/c_libfswatch.gpr
@@ -1,6 +1,6 @@
 library project C_Libfswatch is
 
-   libfswatch_prefix := External("LIBFSWATCH_PREFIX", "../libfswatch");
+   libfswatch_prefix := External("LIBFSWATCH_PREFIX", External("MINGW_PREFIX", "/usr"));
 
    type OS_Type is ("unix", "Windows_NT");
    OS : OS_Type := External ("OS", "unix");
-- 
2.32.0
