aboutsummarylogtreecommitdiffstats
path: root/archlinux.patch
blob: b29d9a146374c1b30704ce893809f2f40cd83bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
diff --git a/SConstruct b/SConstruct
index 4988d1b..6cfca85 100644
--- a/SConstruct
+++ b/SConstruct
@@ -51,6 +51,8 @@ env = Environment(
     "-fPIC",
     "-O2",
     "-Wunused",
+    "-Wno-deprecated-this-capture",
+    "-Wno-deprecated-declarations",
     "-Werror",
     "-Wshadow",
     "-Wno-unknown-warning-option",
diff --git a/src/SConscript b/src/SConscript
index c4a3e96..159e491 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -27,15 +27,18 @@ if arch == "Darwin":
     qt_env.AppendENVPath('PATH', os.path.join(qt_env['QTDIR'], "bin"))
     qt_host_bins = os.path.join(qt_env['QTDIR'], "bin")
 else:
-    # Use qmake6 to find paths
-    qt_install_prefix = subprocess.check_output(['qmake6', '-query', 'QT_INSTALL_PREFIX'], encoding='utf8').strip()
-    qt_install_headers = subprocess.check_output(['qmake6', '-query', 'QT_INSTALL_HEADERS'], encoding='utf8').strip()
-    qt_host_bins = subprocess.check_output(['qmake6', '-query', 'QT_HOST_BINS'], encoding='utf8').strip()
-
-    # Validation for Ubuntu/Debian 'libexec' vs 'bin'
-    if not os.path.exists(os.path.join(qt_host_bins, 'moc')):
-        if os.path.exists('/usr/lib/qt6/libexec/moc'):
-            qt_host_bins = '/usr/lib/qt6/libexec'
+    # Use cmake to find Qt6 paths (qmake6 on Arch points to Qt5)
+    try:
+        cmake_prefix = subprocess.check_output(['pkg-config', '--variable=prefix', 'Qt6'], encoding='utf8').strip()
+        qt_install_prefix = cmake_prefix
+        qt_install_headers = os.path.join(cmake_prefix, 'include', 'qt6')
+        qt_host_bins = os.path.join(cmake_prefix, 'lib', 'qt6', 'bin')
+    except subprocess.CalledProcessError:
+        # Fallback: try cmake module
+        cmake_prefix = '/usr'
+        qt_install_prefix = cmake_prefix
+        qt_install_headers = '/usr/include/qt6'
+        qt_host_bins = '/usr/lib/qt6/bin'
 
     qt_env['QTDIR'] = qt_install_prefix
     qt_dirs = [qt_install_headers]
@@ -58,12 +61,43 @@ else:
 qt_env['QT3DIR'] = qt_env['QTDIR']
 qt_env.Tool('qt3')
 
-# Define absolute paths to binaries
+# Define absolute paths to binaries - use /usr/bin as fallback
 moc_bin = os.path.join(qt_host_bins, 'moc')
-
 uic_bin = os.path.join(qt_host_bins, 'uic')
 rcc_bin = os.path.join(qt_host_bins, 'rcc')
 
+# Fallback to /usr/lib/qt6/<tool> for Qt6 tools on Arch Linux
+def get_moc_version(path):
+    try:
+        result = subprocess.run([path, '--version'], capture_output=True, text=True)
+        return result.stdout.strip()
+    except:
+        return ""
+
+for tool_name in ['moc', 'uic', 'rcc']:
+    tool_path = os.path.join(qt_host_bins, tool_name)
+    needs_fallback = True
+    if os.path.exists(tool_path):
+        # Check if it's actually Qt6 for moc
+        if tool_name == 'moc':
+            version = get_moc_version(tool_path)
+            if '6.' in version:
+                needs_fallback = False
+        else:
+            needs_fallback = False
+
+    if needs_fallback:
+        # Try /usr/lib/qt6/<tool> for Qt6 tools
+        alt_path = f'/usr/lib/qt6/{tool_name}'
+        if not os.path.exists(alt_path):
+            alt_path = f'/usr/bin/{tool_name}'
+        if tool_name == 'moc':
+            moc_bin = alt_path
+        elif tool_name == 'uic':
+            uic_bin = alt_path
+        elif tool_name == 'rcc':
+            rcc_bin = alt_path
+
 # Replace the command templates that SCons uses internally
 qt_env.Replace(
     QT_MOC = moc_bin,