From 4cd8e40a8492955b65f6278e597a9b10f4ae7119 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 18 Jun 2019 01:01:18 +0200 Subject: [PATCH] bundle: export gtk theme/engine bundle code to the script now triggered on libgtk bundling --- CMakeLists.txt | 26 ++++++++++---------------- library-bundler | 30 +++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd247e08..154a873d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,24 +225,18 @@ if (BUILD_BINARIES) macro (bundle_stuff target) if (BUNDLE_LIBRARIES AND WIN32) - add_custom_command(TARGET ${target} POST_BUILD - COMMAND bash - ARGS -c "mkdir -p '${PROJECT_BINARY_DIR}/share/themes'; mkdir -p '${PROJECT_BINARY_DIR}/lib'; mingw=\"$(echo '${CMAKE_C_COMPILER}' | sed -e 's|/bin/.*||')\"; [ -d '${PROJECT_BINARY_DIR}/share/themes/MS-Windows' ] || cp -r --preserve=timestamps \"$mingw/share/themes/MS-Windows\" '${PROJECT_BINARY_DIR}/share/themes/'; [ -d '${PROJECT_BINARY_DIR}/lib/gdk-pixbuf-2.0' ] || cp -r --preserve=timestamps \"$mingw/lib/gdk-pixbuf-2.0\" '${PROJECT_BINARY_DIR}/lib/'; [ -d '${PROJECT_BINARY_DIR}/lib/gtk-2.0' ] || cp -r --preserve=timestamps \"$mingw/lib/gtk-2.0\" '${PROJECT_BINARY_DIR}/lib/'" - VERBATIM - ) - - file(GLOB DLL_FILES ${PROJECT_BINARY_DIR}/*.dll) + file(GLOB DLL_FILES ${PROJECT_BINARY_DIR}/*.dll) - install(FILES - ${DLL_FILES} - DESTINATION ${CMAKE_INSTALL_PREFIX} - ) + install(FILES + ${DLL_FILES} + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) - install(DIRECTORY - ${PROJECT_BINARY_DIR}/lib - ${PROJECT_BINARY_DIR}/share - DESTINATION ${CMAKE_INSTALL_PREFIX} - ) + install(DIRECTORY + ${PROJECT_BINARY_DIR}/lib + ${PROJECT_BINARY_DIR}/share + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) endif () endmacro () endif () diff --git a/library-bundler b/library-bundler index ca95ae00..dccef52d 100644 --- a/library-bundler +++ b/library-bundler @@ -15,7 +15,35 @@ case "${system_name}" in | while read dll_file do dll_basename="$(basename "${dll_file}")" - cp -n --preserve=timestamps "${dll_file}" "${bundle_dir}/${dll_basename}" + + if [ -f "${bundle_dir}/${dll_basename}" ] + then + continue + fi + + cp --preserve=timestamps "${dll_file}" "${bundle_dir}/${dll_basename}" + + if [ "${dll_basename}" = 'libgtk-win32-2.0-0.dll' ] + then + mingw="$(which 'libgtk-win32-2.0-0.dll' | cut -f2 -d'/')" + + for component_dir in \ + 'share/themes/MS-Windows' \ + 'lib/gdk-pixbuf-2.0' \ + 'lib/gtk-2.0' + do + if ! [ -d "${bundle_dir}/${component_dir}" ] + then + mkdir --parents "${bundle_dir}/$(dirname "${component_dir}")" + cp -r --preserve=timestamps "/${mingw}/${component_dir}" \ + "${bundle_dir}/${component_dir}" + fi + done + + find "${bundle_dir}/lib" -type f -name '*.a' -exec rm {} \; + find "${bundle_dir}/lib" -type f -name '*.h' -exec rm {} \; + find "${bundle_dir}/lib" -type d -exec rmdir --ignore-fail-on-non-empty {} \; + fi done ;; *) -- 2.39.2