Description: Force compilation of units in release mode and enable hardening.
 Compilation of units in release mode is mandatory in order to avoid FPC
 trying to recompile them during compilation of third party code.
 .
 Enable hardening by including related configuration file shipped by fpc.
Author: Abou Al Montacir <abou.almontacir@sfr.fr>
Origin: Debian
Forwarded: not-needed
Last-Update: 2025-02-08

Index: castle-game-engine/Makefile
===================================================================
--- castle-game-engine.orig/Makefile
+++ castle-game-engine/Makefile
@@ -479,12 +479,7 @@ build-using-fpmake:
 	@echo 'Running fpmake.'
 	@echo '  If this fails saying that "rtl" is not found -> set FPCDIR environment variable, see http://wiki.freepascal.org/FPMake .'
 	@echo '  If this fails saying that "opengl" package is not found -> you maybe have broken FPC installation without Package.fpc files, consider using "export CASTLE_PACKAGE_NO_DEPENDENCIES=true" as a workaround.'
-# Workaround FPC >= 3.x problem (bug?) --- it ignores $FPCDIR, but --globalunitdir works
-	if [ '(' -n "$(FPCDIR)" ')' ]; then \
-	   ./fpmake --globalunitdir="$(FPCDIR)"; \
-	else \
-	   ./fpmake; \
-	fi
+	./fpmake -v -o -Ur
 
 # Full test that fpmake compilation process works
 # (see https://castle-engine.io/fpmake )
diff --git a/castle-fpc.cfg b/castle-fpc.cfg
index 7e0af003..f3f25b9b 100644
--- a/castle-fpc.cfg
+++ b/castle-fpc.cfg
@@ -455,4 +455,7 @@
   -Xs
 #ENDIF
 
+# When compiling on Debian we enable hardening
+#INCLUDE hardening
+
 # eof --------------------------------------------------------------------------
