From 40c7c39cfa26bfa29d2fc3e7157e0c9aa976a838 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 20 Jun 2026 20:22:33 +0200 Subject: [PATCH] feat: support GNU/Hurd Recognize & handle GNU/Hurd as separate platform, so OS == hurd. Follow the Linux behaviour in a couple of places, as the underlying GNU toolchain is mostly the same. --- pylib/gyp/common.py | 2 ++ pylib/gyp/common_test.py | 1 + pylib/gyp/generator/make.py | 4 ++-- test_gyp.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py index 223ce47b..deb7cc1b 100644 --- a/pylib/gyp/common.py +++ b/pylib/gyp/common.py @@ -506,6 +506,8 @@ def GetFlavorByPlatform(): return "zos" if sys.platform == "os400": return "os400" + if re.fullmatch("gnu\\d+", sys.platform): + return "hurd" return "linux" diff --git a/pylib/gyp/common_test.py b/pylib/gyp/common_test.py index b5988816..5de7bcf6 100755 --- a/pylib/gyp/common_test.py +++ b/pylib/gyp/common_test.py @@ -76,6 +76,7 @@ def test_platform_default(self): self.assertFlavor("linux", "linux2", {}) self.assertFlavor("linux", "linux3", {}) self.assertFlavor("linux", "linux", {}) + self.assertFlavor("hurd", "gnu0", {}) def test_param(self): self.assertFlavor("foobar", "linux2", {"flavor": "foobar"}) diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py index 16b6f4e8..96fbbd1f 100644 --- a/pylib/gyp/generator/make.py +++ b/pylib/gyp/generator/make.py @@ -1888,7 +1888,7 @@ def WriteTarget( self.flavor not in ("mac", "openbsd", "netbsd", "win") and not self.is_standalone_static_library ): - if self.flavor in ("linux", "android", "openharmony"): + if self.flavor in ("linux", "android", "openharmony", "hurd"): self.WriteMakeRule( [self.output_binary], link_deps, @@ -1902,7 +1902,7 @@ def WriteTarget( part_of_all, postbuilds=postbuilds, ) - elif self.flavor in ("linux", "android", "openharmony"): + elif self.flavor in ("linux", "android", "openharmony", "hurd"): self.WriteMakeRule( [self.output_binary], link_deps, diff --git a/test_gyp.py b/test_gyp.py index 70c81ae8..810dfbed 100755 --- a/test_gyp.py +++ b/test_gyp.py @@ -128,6 +128,7 @@ def main(argv=None): # https://bugs.chromium.org/p/gyp/issues/detail?id=530 # 'darwin': ['make', 'ninja', 'xcode', 'xcode-ninja'], "darwin": ["make", "ninja", "xcode"], + "gnu0": ["make", "ninja"], }[sys.platform] gyp_options = []