Browse Source

Improve messages when compiling for Linux/*BSD

- Don't display messages when enabling PulseAudio/ALSA/D-Bus/udev
  as these become noisy in incremental builds.
- Improve warning and error messages to be more descriptive
  and consistent.

(cherry picked from commit 4c5deea83e7e4d4b9b57446e1cabd3da2e0b2b0f)
Hugo Locurcio 4 years ago
parent
commit
f2ab6bd01c
1 changed files with 20 additions and 21 deletions
  1. 20 21
      platform/x11/detect.py

+ 20 - 21
platform/x11/detect.py

@@ -19,40 +19,42 @@ def can_build():
     # Check the minimal dependencies
     x11_error = os.system("pkg-config --version > /dev/null")
     if x11_error:
+        print("Error: pkg-config not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config x11 --modversion > /dev/null ")
+    x11_error = os.system("pkg-config x11 --modversion > /dev/null")
     if x11_error:
+        print("Error: X11 libraries not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config xcursor --modversion > /dev/null ")
+    x11_error = os.system("pkg-config xcursor --modversion > /dev/null")
     if x11_error:
-        print("xcursor not found.. x11 disabled.")
+        print("Error: Xcursor library not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config xinerama --modversion > /dev/null ")
+    x11_error = os.system("pkg-config xinerama --modversion > /dev/null")
     if x11_error:
-        print("xinerama not found.. x11 disabled.")
+        print("Error: Xinerama library not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config xext --modversion > /dev/null ")
+    x11_error = os.system("pkg-config xext --modversion > /dev/null")
     if x11_error:
-        print("xext not found.. x11 disabled.")
+        print("Error: Xext library not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config xrandr --modversion > /dev/null ")
+    x11_error = os.system("pkg-config xrandr --modversion > /dev/null")
     if x11_error:
-        print("xrandr not found.. x11 disabled.")
+        print("Error: XrandR library not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config xrender --modversion > /dev/null ")
+    x11_error = os.system("pkg-config xrender --modversion > /dev/null")
     if x11_error:
-        print("xrender not found.. x11 disabled.")
+        print("Error: XRender library not found. Aborting.")
         return False
 
-    x11_error = os.system("pkg-config xi --modversion > /dev/null ")
+    x11_error = os.system("pkg-config xi --modversion > /dev/null")
     if x11_error:
-        print("xi not found.. Aborting.")
+        print("Error: Xi library not found. Aborting.")
         return False
 
     return True
@@ -138,7 +140,7 @@ def configure(env):
                 # A convenience so you don't need to write use_lto too when using SCons
                 env["use_lto"] = True
         else:
-            print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.")
+            print("Using LLD with GCC is not supported yet. Try compiling with 'use_llvm=yes'.")
             sys.exit(255)
 
     if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]:
@@ -318,28 +320,25 @@ def configure(env):
     ## Flags
 
     if os.system("pkg-config --exists alsa") == 0:  # 0 means found
-        print("Enabling ALSA")
         env["alsa"] = True
         env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
     else:
-        print("ALSA libraries not found, disabling driver")
+        print("Warning: ALSA libraries not found. Disabling the ALSA audio driver.")
 
     if env["pulseaudio"]:
         if os.system("pkg-config --exists libpulse") == 0:  # 0 means found
-            print("Enabling PulseAudio")
             env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"])
             env.ParseConfig("pkg-config --cflags libpulse")
         else:
-            print("PulseAudio development libraries not found, disabling driver")
+            print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.")
 
     if platform.system() == "Linux":
         env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
         if env["udev"]:
             if os.system("pkg-config --exists libudev") == 0:  # 0 means found
-                print("Enabling udev support")
                 env.Append(CPPDEFINES=["UDEV_ENABLED"])
             else:
-                print("libudev development libraries not found, disabling udev support")
+                print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
     else:
         env["udev"] = False  # Linux specific
 
@@ -368,7 +367,7 @@ def configure(env):
         gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE)
         if not gnu_ld_version:
             print(
-                "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld"
+                "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold or LLD."
             )
         else:
             if float(gnu_ld_version.group(1)) >= 2.30: