]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
bundle: export gtk theme/engine bundle code to the script
authorThomas Debesse <dev@illwieckz.net>
Mon, 17 Jun 2019 23:01:18 +0000 (01:01 +0200)
committerThomas Debesse <dev@illwieckz.net>
Wed, 19 Jun 2019 18:46:39 +0000 (20:46 +0200)
now triggered on libgtk bundling

CMakeLists.txt
library-bundler

index dd247e084bd1fd446c77799b43db6c2c39421aeb..154a873dbbed798b098b6912455ae64754963dce 100644 (file)
@@ -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 ()
index ca95ae00863d86b2e42141b310979fee8a46bb24..dccef52df8a5476441897496ae778ad90d578daa 100644 (file)
@@ -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
                ;;
        *)