Description: fpmake fails to find the rtl, use --globalunitdir instead of
 FPCDIR
Author: Michalis Kamburelis <michalis.kambi@gmail.com>
Source: https://github.com/castle-engine/castle-engine/commit/fb603a2a044dcc598bb87b266cfed93e7f25b25e

Index: castle-game-engine/Makefile
===================================================================
--- castle-game-engine.orig/Makefile
+++ castle-game-engine/Makefile
@@ -43,7 +43,14 @@
 all:
 	fpc fpmake.pp
 	@echo 'Running fpmake. If this fails saying that "rtl" is not found, remember to set FPCDIR environment variable, see http://wiki.freepascal.org/FPMake .'
-	./fpmake -v -o -Ur
+	# Workaround FPC >= 3.x problem (bug?) --- it ignores $FPCDIR, but --globalunitdir works
+	if [ '(' -n "$(FPCDIR)" ')' -a \
+		'(' $(shell fpc -iV) '!=' '2.6.4' ')' -a \
+		'(' $(shell fpc -iV) '!=' '2.6.2' ')' ]; then \
+		./fpmake --globalunitdir="$(FPCDIR)" -v -o -Ur; \
+	else \
+		./fpmake -v -o -Ur; \
+	fi
 
 # examples and tools -----------------------------------------------------------
 
