[tor-commits] [vidalia/alpha] Properly package qtscriptgenerator extensions

chiiph at torproject.org chiiph at torproject.org
Fri Jan 6 13:56:33 UTC 2012


commit 3d4cc22f3a09ce753ece81f46dc5de933d65b0a7
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Mon Oct 31 22:01:08 2011 -0300

    Properly package qtscriptgenerator extensions
---
 cmake/VidaliaMacros.cmake |   38 ++++++++++++++++++++++++++++++++++++++
 pkg/osx/CMakeLists.txt    |   23 ++++++++++++++++++-----
 2 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/cmake/VidaliaMacros.cmake b/cmake/VidaliaMacros.cmake
index 7e468b2..5d7897c 100644
--- a/cmake/VidaliaMacros.cmake
+++ b/cmake/VidaliaMacros.cmake
@@ -172,6 +172,44 @@ endmacro(VIDALIA_GET_TOR_VERSION)
 if (APPLE)
   include(${Vidalia_SOURCE_DIR}/cmake/ParseArgumentsMacro.cmake)
 
+  macro(VIDALIA_COPY_PLUGINS)
+    parse_arguments(COPY_PLUGINS "DIR;APP_BUNDLE;FRAMEWORKS;COMPONENTS;TARGET" "" ${ARGN})
+
+    set(outdir "${COPY_PLUGINS_APP_BUNDLE}/Contents/MacOS/script/")
+    foreach(component ${COPY_PLUGINS_COMPONENTS})
+      add_custom_command(TARGET ${COPY_PLUGINS_TARGET}
+        COMMAND ${CMAKE_COMMAND} -E make_directory ${outdir}
+        COMMAND cp
+          ${COPY_PLUGINS_DIR}/libqtscript_${component}.dylib 
+          ${outdir}/libqtscript_${component}.dylib
+      )      
+    endforeach(component)
+  endmacro(VIDALIA_COPY_PLUGINS)
+  
+  macro(VIDALIA_DO_PLUGINS)
+    parse_arguments(DO_PLUGINS "DIR;APP_BUNDLE;FRAMEWORKS;COMPONENTS;TARGET" "" ${ARGN})
+ 
+    set(outdir "${DO_PLUGINS_APP_BUNDLE}/Contents/MacOS/script/")
+    
+    foreach(component ${DO_PLUGINS_COMPONENTS})
+      foreach(framework ${DO_PLUGINS_FRAMEWORKS})
+         add_custom_command(TARGET ${DO_PLUGINS_TARGET}
+           COMMAND install_name_tool -change
+             ${framework}.framework/Versions/4/${framework}
+             @executable_path/../Frameworks/${framework}.framework/Versions/4/${framework} 
+             ${outdir}/libqtscript_${component}.dylib
+         )
+      endforeach(framework)
+      add_custom_command(TARGET ${DO_PLUGINS_TARGET}
+        COMMAND install_name_tool -id
+          @executable_path/script/libqtscript_${component}.dylib 
+          ${outdir}/libqtscript_${component}.dylib
+      )
+    endforeach(component)
+
+    
+  endmacro(VIDALIA_DO_PLUGINS)
+
   ## Calls the install_name_tool utility to change the dependent shared
   ## library or framework install name to the corresponding library or
   ## framework that was previously installed in the .app bundle using
diff --git a/pkg/osx/CMakeLists.txt b/pkg/osx/CMakeLists.txt
index 85e81d5..0dbb1df 100644
--- a/pkg/osx/CMakeLists.txt
+++ b/pkg/osx/CMakeLists.txt
@@ -15,6 +15,19 @@ set(VIDALIA_APP_BUNDLE_ROOT ${Vidalia_BINARY_DIR}/src/vidalia/Vidalia.app)
 get_target_property(VIDALIA_EXECUTABLE Vidalia LOCATION)
 add_custom_target(dist-osx-libraries DEPENDS Vidalia)
 if (QT_USE_FRAMEWORKS)
+  vidalia_copy_plugins(
+    TARGET dist-osx-libraries
+    DIR ${SCRIPT_DIR}
+    APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+    COMPONENTS core gui network uitools xml
+  )
+  vidalia_do_plugins(
+    TARGET dist-osx-libraries
+    DIR ${SCRIPT_DIR}
+    APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+    FRAMEWORKS QtGui QtCore QtScript QtNetwork QtXml
+    COMPONENTS core gui network uitools xml
+  )
   if (USE_MARBLE)
     vidalia_install_dylib(MarbleWidget
       TARGET dist-osx-libraries
@@ -60,7 +73,7 @@ add_custom_target(dist-osx
 )
 add_dependencies(dist-osx dist-osx-libraries)
 
-if (TOR_SOURCE_DIR)
+if (TOR_SOURCE_DIR AND SCRIPT_DIR)
   get_filename_component(TOR_SOURCE_DIR ${TOR_SOURCE_DIR} ABSOLUTE)
 
   ## Determine Tor's version string used to build the .dmg filename
@@ -109,21 +122,21 @@ if (TOR_SOURCE_DIR)
     VERBATIM
   )
   add_dependencies(dist-osx-split-bundle dist-osx-bundle)
-else(TOR_SOURCE_DIR)
+else(TOR_SOURCE_DIR AND SCRIPT_DIR)
   message("-- Skipping dist-osx-bundle build target")
   add_custom_target(dist-osx-bundle
     COMMAND ${CMAKE_COMMAND} -E echo
       "!! The dist-osx-bundle target is not configured."
     COMMAND ${CMAKE_COMMAND} -E echo
-      "!! You must set the -DTOR_SOURCE_DIR CMake variables."
+      "!! You must set the -DTOR_SOURCE_DIR and -DSCRIPT_DIR CMake variables."
     COMMAND ${CMAKE_COMMAND} -E echo "!! Quitting."
   )
   add_custom_target(dist-osx-split-bundle
     COMMAND ${CMAKE_COMMAND} -E echo
       "!! The dist-osx-split-bundle target is not configured. Quitting."
     COMMAND ${CMAKE_COMMAND} -E echo
-      "!! You must set the -DTOR_SOURCE_DIR CMake variables."
+      "!! You must set the -DTOR_SOURCE_DIR and -DSCRIPT_DIR CMake variables."
     COMMAND ${CMAKE_COMMAND} -E echo "!! Quitting."
   )
-endif(TOR_SOURCE_DIR)
+endif(TOR_SOURCE_DIR AND SCRIPT_DIR)
 





More information about the tor-commits mailing list