Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

[win] Implement a script to find non-stripped libs in the package

Dmitry Kazakove1c2471c7fe3
diff --git a/packaging/windows/find-libs-with-debug.py b/packaging/windows/find-libs-with-debug.py
new file mode 100644
index 0000000000..4537ce7690
--- /dev/null
+++ b/packaging/windows/find-libs-with-debug.py
@@ -0,0 +1,51 @@
+# SPDX-FileCopyrightText: 2026 Dmitry Kazakov <[email protected]>
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import argparse
+import os
+import subprocess
+import warnings
+import sys
+glob_patterns = ['*.dll', '*.exe', '*.com', '*.pyd']
+
+def find_files(directory):
+ for root, _, files in os.walk(directory):
+ for pattern in glob_patterns:
+ for fname in files:
+ if fname.lower().endswith(pattern[1:]):
+ yield os.path.join(root, fname)
+
+def has_debug_section(objdumpOutput):
+ for line in objdumpOutput.splitlines():
+ if '.debug_' in line:
+ return True
+ return False
+
+parser = argparse.ArgumentParser(description=f'Searches for {', '.join(glob_patterns)} files with DEBUG section present.')
+parser.add_argument('-d', '--directory', default=os.getcwd(), help='Directory to search (default: current directory)')
+args = parser.parse_args()
+
+OBJDUMP = False
+for arg in ("objdump", "llvm-objdump"):
+ commandToRun = f"{arg} --version"
+ ret = subprocess.call(commandToRun, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
+ if ret != 1:
+ OBJDUMP = arg
+if not OBJDUMP:
+ warnings.warn("ERROR: objdump is not working.")
+ sys.exit(1)
+
+anyLibsWithDebugFound = False
+
+for file in find_files(args.directory):
+ try:
+ result = subprocess.run([OBJDUMP, '-h', file], capture_output=True, text=True, check=True)
+ if has_debug_section(result.stdout):
+ anyLibsWithDebugFound = True
+ print(result.stdout)
+ except Exception as e:
+ warnings.warn(f"ERROR: Failed to parse: {file}")
+ raise e
+
+if anyLibsWithDebugFound:
+ sys.exit(2)
\ No newline at end of file