vcpkg/ports/harfbuzz/0001-circumvent-samefile-error.patch
Robert Adam 4634989574
[harfbuzz] work around upstream SameFileError (#16621)
During the configuration of harfbuzz several Python scripts are invoked
that are supposed to copy some files. For some reason however the
scripts end up being instructed to copy files to themselves at which
point a SameFileError is risen, causing the build to fail.

This is a workaround for the underlaying issue that is deemed to be
usptream. The upstream issues are
- https://github.com/mesonbuild/meson/issues/8375
- https://github.com/harfbuzz/harfbuzz/issues/2870

The workaround is to add a patch that makes sure these scripts check
whether source and target file are the same and only invoking the copy
action if they are not.

Fixes #16262
2021-03-11 12:16:08 -08:00

44 lines
1.7 KiB
Diff
Executable File

diff --git a/src/gen-harfbuzzcc.py b/src/gen-harfbuzzcc.py
index b25bcc7..97bf2ab 100644
--- a/src/gen-harfbuzzcc.py
+++ b/src/gen-harfbuzzcc.py
@@ -15,4 +15,8 @@ with open (OUTPUT, "wb") as f:
f.write ("".join ('#include "{}"\n'.format (os.path.basename (x)) for x in sources if x.endswith (".cc")).encode ())
# copy it also to src/
-shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT)))
+src = OUTPUT
+dst = os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))
+# Avoid SameFileError
+if not os.path.samefile(src, dst):
+ shutil.copyfile (src, dst)
diff --git a/src/gen-hb-version.py b/src/gen-hb-version.py
index 5ec2024..59d4754 100644
--- a/src/gen-hb-version.py
+++ b/src/gen-hb-version.py
@@ -33,4 +33,8 @@ with open (INPUT, "r", encoding='utf-8') as template:
.encode ())
# copy it also to src/
-shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT)))
+src = OUTPUT
+dst = os.path.join(CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))
+# Avoid SameFileError if src and dst is the same
+if not os.path.samefile(src, dst):
+ shutil.copyfile (src, dst)
diff --git a/src/gen-ragel-artifacts.py b/src/gen-ragel-artifacts.py
index b60ec3b..288e224 100644
--- a/src/gen-ragel-artifacts.py
+++ b/src/gen-ragel-artifacts.py
@@ -22,4 +22,8 @@ hh = rl.replace ('.rl', '.hh')
subprocess.Popen ([ragel, '-e', '-F1', '-o', hh, rl], cwd=outdir).wait ()
# copy it also to src/
-shutil.copyfile (os.path.join (outdir, hh), os.path.join (CURRENT_SOURCE_DIR, hh))
+src = os.path.join (outdir, hh)
+dst = os.path.join (CURRENT_SOURCE_DIR, hh)
+# Avoid SameFileError
+if not os.path.samefile(src, dst):
+ shutil.copyfile (src, dst)