aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-26 11:26:39 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-26 11:31:50 +0200
commit27a9869a6a68a2898e08b7c977941b6781788ecb (patch)
treed2c97cd9501e319ab9b36e6f2baea8e3143d2c87
parent2efad7453a53ec1b3b9a38d78a841fb7200d10ea (diff)
downloadtdv-27a9869a6a68a2898e08b7c977941b6781788ecb.tar.gz
tdv-27a9869a6a68a2898e08b7c977941b6781788ecb.tar.xz
tdv-27a9869a6a68a2898e08b7c977941b6781788ecb.zip
Trim down the Windows build a bit
Remove most unused Adwaita icons and cursors, it's about 30 mebibytes of raw bullshit that doesn't seem to be missing in any shape or form. Rather sadly, the script is too complex to be rewritten in CMake script.
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/Win32CleanupAdwaita.sh19
2 files changed, 22 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 657f7c7..8505abe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,6 +264,9 @@ elseif (WITH_GUI)
DESTINATION share/icons/hicolor)
install (SCRIPT cmake/Win32Cleanup.cmake)
+ install (CODE "execute_process (COMMAND
+ sh \"${PROJECT_SOURCE_DIR}/cmake/Win32CleanupAdwaita.sh\"
+ WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX})")
endif ()
# Do some unit tests
diff --git a/cmake/Win32CleanupAdwaita.sh b/cmake/Win32CleanupAdwaita.sh
new file mode 100644
index 0000000..194f959
--- /dev/null
+++ b/cmake/Win32CleanupAdwaita.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+# Removes unused icons from the Adwaita theme, it could be even more aggressive,
+# since it keeps around lots of sizes and all the GTK+ stock icons
+export LC_ALL=C
+find share/icons/Adwaita -type f | awk 'BEGIN {
+ while (("grep -aho \"[a-z][a-z-]*\" *.dll *.exe" | getline) > 0)
+ good[$0] = 1
+} /[.](png|svg|cur|ani)$/ {
+ # Cut out the basename without extensions
+ match($0, /[^\/]+$/)
+ base = substr($0, RSTART)
+ sub(/[.].+$/, "", base)
+
+ # Try matching while cutting off suffixes
+ while (!(keep = good[base]) &&
+ sub(/-(ltr|rtl|symbolic)$/, "", base)) {}
+ if (!keep)
+ print
+}' | xargs rm