Fix check-* scripts when harfbuzz is a subproject

When harfbuzz is a subproject paths are in the form
"subprojects/harfbuzz/src/...". Instead of removing "src/" prefix, take
the absolute path and make it relative to current source dir.

This fix regression introduced in
https://github.com/harfbuzz/harfbuzz/pull/3394.
diff --git a/src/check-header-guards.py b/src/check-header-guards.py
index b45ffe1..35ae6be 100755
--- a/src/check-header-guards.py
+++ b/src/check-header-guards.py
@@ -2,19 +2,20 @@
 
 import sys, os, re
 
-os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
+srcdir = os.getenv ('srcdir', os.path.dirname (__file__))
+base_srcdir = os.getenv ('base_srcdir', srcdir)
 
-def removeprefix(s, prefix):
-    if s.startswith(prefix):
-        return s[len(prefix):]
-    else:
-        return s[:]
+os.chdir (srcdir)
+
+def removeprefix(s):
+	abs_path = os.path.join(base_srcdir, s)
+	return os.path.relpath(abs_path, srcdir)
 
 
 HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \
 	[x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')]
 HBSOURCES = [
-    removeprefix(x, 'src%s' % os.path.sep) for x in os.getenv ('HBSOURCES', '').split ()
+    removeprefix(x) for x in os.getenv ('HBSOURCES', '').split ()
 ] or [
     x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))
 ]