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.
This commit is contained in:
Přemysl Eric Janouch 2021-10-26 11:26:39 +02:00
parent 2efad7453a
commit 27a9869a6a
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 22 additions and 0 deletions

View File

@ -264,6 +264,9 @@ elseif (WITH_GUI)
DESTINATION share/icons/hicolor) DESTINATION share/icons/hicolor)
install (SCRIPT cmake/Win32Cleanup.cmake) install (SCRIPT cmake/Win32Cleanup.cmake)
install (CODE "execute_process (COMMAND
sh \"${PROJECT_SOURCE_DIR}/cmake/Win32CleanupAdwaita.sh\"
WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX})")
endif () endif ()
# Do some unit tests # Do some unit tests

View File

@ -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