Blob Blame History Raw
From 11bb8a3950acf5d61aaf78e4b7fd3c62ba997384 Mon Sep 17 00:00:00 2001
From: Antony Lee <anntzer.lee@gmail.com>
Date: Sun, 4 Apr 2021 15:35:27 +0200
Subject: [PATCH] Fix pkg-config handling.

---
 setup.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/setup.py b/setup.py
index 1f4f4c0..b06fd18 100644
--- a/setup.py
+++ b/setup.py
@@ -111,14 +111,18 @@ def finalize_options(self):
             is_arch = "Arch Linux" in Path("/etc/os-release").read_text()
         except OSError:
             is_arch = False
-        has_pkgconfig_raqm = False
-        if not is_arch:
+        if is_arch:
+            has_pkgconfig_raqm = False
+        else:
             try:
-                has_pkgconfig_raqm = get_pkgconfig(
-                    f"--atleast-version={MIN_RAQM_VERSION}", "raqm")
+                get_pkgconfig(f"--atleast-version={MIN_RAQM_VERSION}", "raqm")
             except (FileNotFoundError, CalledProcessError):
-                pass
-        if not has_pkgconfig_raqm:
+                has_pkgconfig_raqm = False
+            else:
+                has_pkgconfig_raqm = True
+        if has_pkgconfig_raqm:
+            ext.extra_compile_args += get_pkgconfig("--cflags", "raqm")
+        else:
             (tmp_include_dir / "raqm-version.h").write_text("")  # Touch it.
             with urllib.request.urlopen(
                     f"https://raw.githubusercontent.com/HOST-Oman/libraqm/"