[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r4033: Merged trunk's pkg directory in extension-api branch. (in vidalia/branches/extension-api/pkg: . osx rpm win32 win32/fa)



Author: tyree731
Date: 2009-08-13 15:59:29 -0400 (Thu, 13 Aug 2009)
New Revision: 4033

Added:
   vidalia/branches/extension-api/pkg/osx/InstallTorbutton.scpt.in
   vidalia/branches/extension-api/pkg/osx/pkg-dmg
   vidalia/branches/extension-api/pkg/osx/polipo.conf
Removed:
   vidalia/branches/extension-api/pkg/osx/builddmg.sh.in
Modified:
   vidalia/branches/extension-api/pkg/
   vidalia/branches/extension-api/pkg/CMakeLists.txt
   vidalia/branches/extension-api/pkg/osx/CMakeLists.txt
   vidalia/branches/extension-api/pkg/osx/build-bundle.txt
   vidalia/branches/extension-api/pkg/osx/bundle-ds_store
   vidalia/branches/extension-api/pkg/osx/nonbundle-ds_store
   vidalia/branches/extension-api/pkg/osx/vidalia.conf.sample
   vidalia/branches/extension-api/pkg/package.sh
   vidalia/branches/extension-api/pkg/rpm/vidalia.spec.in
   vidalia/branches/extension-api/pkg/win32/CMakeLists.txt
   vidalia/branches/extension-api/pkg/win32/build-vidalia-installer.txt
   vidalia/branches/extension-api/pkg/win32/fa/vidalia_fa.po
   vidalia/branches/extension-api/pkg/win32/vidalia-bundle.nsi.in
   vidalia/branches/extension-api/pkg/win32/vidalia.nsi.in
   vidalia/branches/extension-api/pkg/win32/vidalia.wxs.in
Log:
Merged trunk's pkg directory in extension-api branch.


Property changes on: vidalia/branches/extension-api/pkg
___________________________________________________________________
Added: svn:mergeinfo
   + /vidalia/branches/marble/pkg:3435-3484
/vidalia/trunk/pkg:3787-3820,3822-4032

Modified: vidalia/branches/extension-api/pkg/CMakeLists.txt
===================================================================
--- vidalia/branches/extension-api/pkg/CMakeLists.txt	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/CMakeLists.txt	2009-08-13 19:59:29 UTC (rev 4033)
@@ -25,3 +25,20 @@
   ${CMAKE_CURRENT_BINARY_DIR}/package.sh
   COPYONLY
 )
+
+set(basename "vidalia-${VERSION}")
+set(tarname "${basename}.tar.gz")
+add_custom_target(dist
+  COMMAND svn export
+    ${Vidalia_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${basename}
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}
+    tar czf ${tarname} ${basename}/
+  COMMAND ${CMAKE_COMMAND} -E copy
+    ${CMAKE_CURRENT_BINARY_DIR}/${tarname} ${Vidalia_BINARY_DIR}
+  COMMAND ${CMAKE_COMMAND} -E remove -f
+    ${CMAKE_CURRENT_BINARY_DIR}/${tarname}
+  COMMAND ${CMAKE_COMMAND} -E remove_directory
+    ${CMAKE_CURRENT_BINARY_DIR}/${basename}
+  COMMENT "Creating ${tarname}"
+)
+

Modified: vidalia/branches/extension-api/pkg/osx/CMakeLists.txt
===================================================================
--- vidalia/branches/extension-api/pkg/osx/CMakeLists.txt	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/osx/CMakeLists.txt	2009-08-13 19:59:29 UTC (rev 4033)
@@ -10,153 +10,193 @@
 ##  the terms described in the LICENSE file.
 ##
 
-## OS X Packaging Files
-configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/builddmg.sh.in
-  ${CMAKE_CURRENT_BINARY_DIR}/builddmg.sh
-)
 
+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)
-  set(bindir ${Vidalia_BINARY_DIR}/src/vidalia/Vidalia.app/Contents/MacOS)
-  add_custom_target(dist-osx
-    COMMAND cp 
-      ${QT_QTCORE_LIBRARY}/QtCore ${bindir}/
-    COMMAND cp
-      ${QT_QTGUI_LIBRARY}/QtGui ${bindir}/
-    COMMAND cp 
-      ${QT_QTNETWORK_LIBRARY}/QtNetwork ${bindir}/
-    COMMAND cp 
-      ${QT_QTXML_LIBRARY}/QtXml ${bindir}/
+  vidalia_install_qt4_framework(QtCore
+    TARGET dist-osx-libraries NAME QtCore
+    LIBRARY ${QT_QTCORE_LIBRARY}/QtCore
+    APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+  )
+  vidalia_install_qt4_framework(QtGui
+    TARGET dist-osx-libraries NAME QtGui
+    LIBRARY ${QT_QTGUI_LIBRARY}/QtGui
+    APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+    DEPENDS_FRAMEWORKS ${QtCore}
+  )
+  vidalia_install_qt4_framework(QtNetwork
+    TARGET dist-osx-libraries NAME QtNetwork
+    LIBRARY ${QT_QTNETWORK_LIBRARY}/QtNetwork
+    APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+    DEPENDS_FRAMEWORKS ${QtCore}
+  )
+  vidalia_install_qt4_framework(QtXml
+    TARGET dist-osx-libraries NAME QtXml
+    LIBRARY ${QT_QTXML_LIBRARY}/QtXml
+    APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+    DEPENDS_FRAMEWORKS ${QtCore}
+  )
+  vidalia_install_name_tool(${VIDALIA_EXECUTABLE}
+    TARGET dist-osx-libraries
+    FRAMEWORKS ${QtCore} ${QtGui} ${QtNetwork} ${QtXml}
+  )
+  if (USE_MARBLE)
+    vidalia_install_qt4_framework(QtSvg
+      TARGET dist-osx-libraries NAME QtSvg
+      LIBRARY ${QT_QTSVG_LIBRARY}/QtSvg
+      APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+      DEPENDS_FRAMEWORKS ${QtCore} ${QtGui}
+    )
+    vidalia_install_qt4_framework(QtScript
+      TARGET dist-osx-libraries NAME QtScript
+      LIBRARY ${QT_QTSCRIPT_LIBRARY}/QtScript
+      APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+      DEPENDS_FRAMEWORKS ${QtCore}
+    )
+    vidalia_install_qt4_framework(QtDBus
+      TARGET dist-osx-libraries NAME QtDBus
+      LIBRARY ${QT_QTDBUS_LIBRARY}/QtDBus
+      APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+      DEPENDS_FRAMEWORKS ${QtCore} ${QtXml}
+    )
+    vidalia_install_qt4_framework(QtPhonon
+      TARGET dist-osx-libraries NAME phonon
+      LIBRARY ${QT_PHONON_LIBRARY}/phonon
+      APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+      DEPENDS_FRAMEWORKS ${QtCore} ${QtGui} ${QtXml} ${QtDBus}
+    )
+    vidalia_install_qt4_framework(QtWebKit
+      TARGET dist-osx-libraries NAME QtWebKit
+      LIBRARY ${QT_QTWEBKIT_LIBRARY}/QtWebKit
+      APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+      DEPENDS_FRAMEWORKS ${QtCore} ${QtGui} ${QtNetwork} ${QtXml} ${QtDBus}
+                         ${QtPhonon}
+    )
+    vidalia_install_dylib(MarbleWidget
+      TARGET dist-osx-libraries
+      LIBRARY ${MARBLEWIDGET_LIBRARY}
+      APP_BUNDLE ${VIDALIA_APP_BUNDLE_ROOT}
+      DEPENDS_FRAMEWORKS ${QtCore} ${QtGui} ${QtNetwork} ${QtXml} ${QtSvg}
+                         ${QtDBus} ${QtScript} ${QtWebKit}
+    )
+    vidalia_install_name_tool(${VIDALIA_EXECUTABLE}
+      TARGET dist-osx-libraries
+      FRAMEWORKS ${QtSvg} ${QtDBus} ${QtScript} ${QtWebKit}
+      LIBRARIES ${MARBLEWIDGET_LIBRARY}
+    )
+  endif(USE_MARBLE)
+endif(QT_USE_FRAMEWORKS)
 
-    COMMAND install_name_tool
-      -id @executable_path/QtCore ${bindir}/QtCore
-    COMMAND install_name_tool
-      -id @executable_path/QtGui ${bindir}/QtGui
-    COMMAND install_name_tool
-      -id @executable_path/QtNetwork ${bindir}/QtNetwork
-    COMMAND install_name_tool
-      -id @executable_path/QtXml ${bindir}/QtXml
+if (OSX_FAT_BINARY)
+  set(DMG_ARCH "universal")
+else(OSX_FAT_BINARY)
+  set(DMG_ARCH ${CMAKE_OSX_ARCHITECTURES})
+endif(OSX_FAT_BINARY)
 
-    COMMAND install_name_tool
-      -change QtCore.framework/Versions/4/QtCore
-              @executable_path/QtCore ${bindir}/Vidalia
-    COMMAND install_name_tool
-      -change QtGui.framework/Versions/4/QtGui
-              @executable_path/QtGui ${bindir}/Vidalia
-    COMMAND install_name_tool
-      -change QtNetwork.framework/Versions/4/QtNetwork
-              @executable_path/QtNetwork ${bindir}/Vidalia
-    COMMAND install_name_tool
-      -change QtXml.framework/Versions/4/QtXml
-              @executable_path/QtXml ${bindir}/Vidalia
+add_custom_target(dist-osx
+  COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pkg-dmg
+    --source ${VIDALIA_APP_BUNDLE_ROOT}
+    --target ${Vidalia_BINARY_DIR}/vidalia-${VERSION}-${DMG_ARCH}.dmg
+    --sourcefile --volname "Vidalia ${VERSION}"
+    --icon ${Vidalia_SOURCE_DIR}/src/vidalia/res/icons/Vidalia.icns
+    --symlink "/Applications:/Drag to here"
+    --mkdir /.background
+    --copy ${CMAKE_CURRENT_SOURCE_DIR}/background.png:/.background/
+    --copy ${CMAKE_CURRENT_SOURCE_DIR}/nonbundle-ds_store:/.DS_Store
+    --mkdir /Licenses
+    --copy ${Vidalia_SOURCE_DIR}/LICENSE:/Licenses/License.txt
+    --copy ${Vidalia_SOURCE_DIR}/LICENSE-GPLV2:/Licenses/License-GPLv2.txt
+    --copy ${Vidalia_SOURCE_DIR}/LICENSE-GPLV3:/Licenses/License-GPLv3.txt
+    --copy ${Vidalia_SOURCE_DIR}/LICENSE-OPENSSL:/Licenses/License-OpenSSL.txt
+    --copy ${Vidalia_SOURCE_DIR}/README:/ReadMe.txt
+    --copy ${Vidalia_SOURCE_DIR}/CHANGELOG:/Changes.txt
+  COMMENT "Creating vidalia-${VERSION}-${DMG_ARCH}.dmg"
+  VERBATIM
+)
+add_dependencies(dist-osx dist-osx-libraries)
 
-    COMMAND install_name_tool
-      -change QtCore.framework/Versions/4/QtCore
-              @executable_path/QtCore ${bindir}/QtGui
-    COMMAND install_name_tool
-      -change QtCore.framework/Versions/4/QtCore
-              @executable_path/QtCore ${bindir}/QtNetwork
-    COMMAND install_name_tool
-      -change QtCore.framework/Versions/4/QtCore
-              @executable_path/QtCore ${bindir}/QtXml
+if (TOR_SOURCE_DIR AND POLIPO_SOURCE_DIR AND TORBUTTON_XPI)
+  get_filename_component(TOR_SOURCE_DIR ${TOR_SOURCE_DIR} ABSOLUTE)
+  get_filename_component(POLIPO_SOURCE_DIR ${POLIPO_SOURCE_DIR} ABSOLUTE)
+  get_filename_component(TORBUTTON_XPI ${TORBUTTON_XPI} ABSOLUTE)
 
-    DEPENDS ${bindir}/Vidalia
+  ## Determine Tor's version string used to build the .dmg filename
+  vidalia_get_tor_version(TOR_VERSION "${TOR_SOURCE_DIR}/src/or/tor")
+  if (TOR_VERSION)
+    message(STATUS "Found Tor ${TOR_VERSION}")
+  else (TOR_VERSION)
+    message(FATAL_ERROR "Unable to determine version of ${TOR_SOURCE_DIR}/src/or/tor")
+  endif(TOR_VERSION)
+
+  ## Configure the Torbutton installation script file
+  get_filename_component(TORBUTTON_XPI_FILENAME ${TORBUTTON_XPI} NAME)
+  configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/InstallTorbutton.scpt.in
+    ${CMAKE_CURRENT_BINARY_DIR}/InstallTorbutton.scpt
   )
-  if (USE_MARBLE)
-    get_filename_component(marblewidget ${MARBLEWIDGET_LIBRARY} NAME)
 
-    add_custom_command(TARGET dist-osx
-      COMMAND cp
-        ${QT_QTSVG_LIBRARY}/QtSvg ${bindir}/
-      COMMAND cp
-        ${QT_QTWEBKIT_LIBRARY}/QtWebKit ${bindir}/
-      COMMAND cp
-        ${QT_QTSCRIPT_LIBRARY}/QtScript ${bindir}/
-      COMMAND cp
-        ${QT_QTDBUS_LIBRARY}/QtDBus ${bindir}/
-      COMMAND cp
-        ${MARBLEWIDGET_LIBRARY} ${bindir}/
+  set(bundle_DMG "vidalia-bundle-${TOR_VERSION}-${VERSION}-${DMG_ARCH}.dmg")
+  add_custom_target(dist-osx-bundle
+    COMMAND osacompile
+      -o "${CMAKE_CURRENT_BINARY_DIR}/Install Torbutton for Firefox.app"
+          ${CMAKE_CURRENT_BINARY_DIR}/InstallTorbutton.scpt
+    COMMAND ${CMAKE_COMMAND} -E copy
+      ${TORBUTTON_XPI}
+      "${CMAKE_CURRENT_BINARY_DIR}/Install Torbutton for Firefox.app/"
+    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pkg-dmg
+      --source ${VIDALIA_APP_BUNDLE_ROOT}
+      --target ${Vidalia_BINARY_DIR}/${bundle_DMG}
+      --sourcefile --volname "Vidalia Bundle ${VERSION}"
+      --icon ${Vidalia_SOURCE_DIR}/src/vidalia/res/icons/Vidalia.icns
+      --symlink "/Applications:/Drag to here"
+      --mkdir /.background
+      --copy ${CMAKE_CURRENT_SOURCE_DIR}/bundle-background.png:/.background/
+      --copy ${CMAKE_CURRENT_SOURCE_DIR}/bundle-ds_store:/.DS_Store
+      --copy ${CMAKE_CURRENT_SOURCE_DIR}/vidalia.conf.sample:/Vidalia.app/Contents/Resources/vidalia.conf
+      --mkdir /Licenses
+      --copy ${Vidalia_SOURCE_DIR}/LICENSE:/Licenses/License.txt
+      --copy ${Vidalia_SOURCE_DIR}/LICENSE-GPLV2:/Licenses/License-GPLv2.txt
+      --copy ${Vidalia_SOURCE_DIR}/LICENSE-GPLV3:/Licenses/License-GPLv3.txt
+      --copy ${Vidalia_SOURCE_DIR}/LICENSE-OPENSSL:/Licenses/License-OpenSSL.txt
+      --copy ${Vidalia_SOURCE_DIR}/CHANGELOG:/Changes.txt
+      --copy ${TOR_SOURCE_DIR}/src/or/tor:/Vidalia.app/Contents/MacOS/
+      --copy ${TOR_SOURCE_DIR}/src/tools/tor-checkkey:/Vidalia.app/Contents/MacOS/
+      --copy ${TOR_SOURCE_DIR}/src/tools/tor-gencert:/Vidalia.app/Contents/MacOS/
+      --copy ${TOR_SOURCE_DIR}/src/tools/tor-resolve:/Vidalia.app/Contents/MacOS/
+      --copy ${TOR_SOURCE_DIR}/src/config/geoip:/Vidalia.app/Contents/Resources/
+      --copy ${TOR_SOURCE_DIR}/src/config/torrc.sample:/Vidalia.app/Contents/Resources/
+      --copy ${POLIPO_SOURCE_DIR}/polipo:/Vidalia.app/Contents/MacOS/
+      --copy ${CMAKE_CURRENT_SOURCE_DIR}/polipo.conf:/Vidalia.app/Contents/Resources/
+      --copy "${CMAKE_CURRENT_BINARY_DIR}/Install Torbutton for Firefox.app:/"
+    COMMENT "Creating ${bundle_DMG}"
+    VERBATIM
+  )
+  add_dependencies(dist-osx-bundle dist-osx-libraries)
 
-      COMMAND install_name_tool
-        -id @executable_path/QtSvg ${bindir}/QtSvg
-      COMMAND install_name_tool
-        -id @executable_path/QtWebKit ${bindir}/QtWebKit
-      COMMAND install_name_tool
-        -id @executable_path/QtScript ${bindir}/QtScript
-      COMMAND install_name_tool
-        -id @executable_path/QtDBus ${bindir}/QtDBus
-      COMMAND install_name_tool
-        -id @executable_path/${marblewidget} ${bindir}/${marblewidget}
+  add_custom_target(dist-osx-split-bundle
+    COMMAND hdiutil segment -segmentSize 1.5m 
+      -o "${Vidalia_BINARY_DIR}/split-${bundle_DMG}" "${Vidalia_BINARY_DIR}/${bundle_DMG}"
+    COMMENT "Creating split-${bundle_DMG}"
+    VERBATIM
+  )
+  add_dependencies(dist-osx-split-bundle dist-osx-bundle)
+else(TOR_SOURCE_DIR AND POLIPO_SOURCE_DIR AND TORBUTTON_XPI)
+  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,-DPOLIPO_SOURCE_DIR and TORBUTTON_XPI 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, -DPOLIPO_SOURCE_DIR and TORBUTTON_XPI CMake variables."
+    COMMAND ${CMAKE_COMMAND} -E echo "!! Quitting."
+  )
+endif(TOR_SOURCE_DIR AND POLIPO_SOURCE_DIR AND TORBUTTON_XPI)
 
-      COMMAND install_name_tool
-        -change QtSvg.framework/Versions/4/QtSvg
-                @executable_path/QtSvg ${bindir}/Vidalia
-      COMMAND install_name_tool
-        -change QtWebKit.framework/Versions/4/QtWebKit
-                @executable_path/QtWebKit ${bindir}/Vidalia
-      COMMAND install_name_tool
-        -change QtScript.framework/Versions/4/QtScript
-                @executable_path/QtScript ${bindir}/Vidalia
-      COMMAND install_name_tool
-        -change QtDBus.framework/Versions/4/QtDBus
-                @executable_path/QtDBus ${bindir}/Vidalia
-      COMMAND install_name_tool
-        -change @executable_path/lib/${marblewidget}
-                @executable_path/${marblewidget} ${bindir}/Vidalia
-      COMMAND install_name_tool
-        -change ${MARBLEWIDGET_LIBRARY}
-                @executable_path/${marblewidget} ${bindir}/Vidalia
-
-      COMMAND install_name_tool
-        -change QtCore.framework/Versions/4/QtCore
-                @executable_path/QtCore ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtGui.framework/Versions/4/QtGui
-                @executable_path/QtGui ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtNetwork.framework/Versions/4/QtNetwork
-                @executable_path/QtNetwork ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtXml.framework/Versions/4/QtXml
-                @executable_path/QtXml ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtSvg.framework/Versions/4/QtSvg
-                @executable_path/QtSvg ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtScript.framework/Versions/4/QtScript
-                @executable_path/QtScript ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtWebKit.framework/Versions/4/QtWebKit
-                @executable_path/QtWebKit ${bindir}/${marblewidget}
-      COMMAND install_name_tool
-        -change QtDBus.framework/Versions/4/QtDBus
-                @executable_path/QtDBus ${bindir}/${marblewidget}
-
-      COMMAND install_name_tool
-        -change QtGui.framework/Versions/4/QtGui
-                @executable_path/QtGui ${bindir}/QtSvg
-      COMMAND install_name_tool
-        -change QtCore.framework/Versions/4/QtCore
-                @executable_path/QtCore ${bindir}/QtSvg
-      COMMAND install_name_tool
-        -change QtGui.framework/Versions/4/QtGui
-                @executable_path/QtGui ${bindir}/QtWebKit
-      COMMAND install_name_tool
-        -change QtNetwork.framework/Versions/4/QtNetwork
-                @executable_path/QtNetwork ${bindir}/QtWebKit
-      COMMAND install_name_tool
-        -change QtCore.framework/Versions/4/QtCore
-                @executable_path/QtCore ${bindir}/QtWebKit
-      COMMAND install_name_tool
-        -change QtCore.framework/Versions/4/QtCore
-                @executable_path/QtCore ${bindir}/QtScript
-      COMMAND install_name_tool
-        -change QtXml.framework/Versions/4/QtXml
-                @executable_path/QtXml ${bindir}/QtDBus
-      COMMAND install_name_tool
-        -change QtCore.framework/Versions/4/QtCore
-                @executable_path/QtCore ${bindir}/QtDBus
-    )
-  endif(USE_MARBLE)
-endif(QT_USE_FRAMEWORKS)
-

Copied: vidalia/branches/extension-api/pkg/osx/InstallTorbutton.scpt.in (from rev 4032, vidalia/trunk/pkg/osx/InstallTorbutton.scpt.in)
===================================================================
--- vidalia/branches/extension-api/pkg/osx/InstallTorbutton.scpt.in	                        (rev 0)
+++ vidalia/branches/extension-api/pkg/osx/InstallTorbutton.scpt.in	2009-08-13 19:59:29 UTC (rev 4033)
@@ -0,0 +1,22 @@
+--
+--  $Id$
+-- 
+--  This file is part of Vidalia, and is subject to the license terms in the
+--  LICENSE file, found in the top level directory of this distribution. If 
+--  you did not receive the LICENSE file with this file, you may obtain it
+--  from the Vidalia source package distributed by the Vidalia Project at
+--  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+--  may be copied, modified, propagated, or distributed except according to
+--  the terms described in the LICENSE file.
+--
+
+try
+  set p to path to me
+  set p to POSIX path of p
+  do shell script "open -a Firefox " & quoted form of p & "@TORBUTTON_XPI_FILENAME@"
+on error errStr
+  display dialog 
+    "We were unable to install Torbutton. Please make sure Firefox is installed and try again."
+    buttons {"OK"}
+end try
+

Modified: vidalia/branches/extension-api/pkg/osx/build-bundle.txt
===================================================================
--- vidalia/branches/extension-api/pkg/osx/build-bundle.txt	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/osx/build-bundle.txt	2009-08-13 19:59:29 UTC (rev 4033)
@@ -18,7 +18,7 @@
 
 
 Qt
-4. Download and extract the open source version of Qt 4.2 or higher from 
+4. Download and extract the open source version of Qt 4.3 or higher from 
    Trolltech at the following address:
    http://www.trolltech.com/developer/downloads/qt/mac
 
@@ -39,58 +39,52 @@
 http://www.pps.jussieu.fr/~jch/software/files/polipo/.
 
 7a. Download the Tor modifications to Polipo from:
-https://svn.torproject.org/svn/tor/trunk/contrib/polipo/.  
+https://git.torproject.org/checkout/tor/master/contrib/polipo/.  
 
 Alternatively, download a tarball with the Polipo source and Tor
 modifications together from:
 http://interloper.org/tmp/polipo/polipo-1.0.4-with-tor-mods.tgz
 
 8. Follow the directions to build polipo at
-  https://www.torproject.org/svn/trunk/contrib/polipo/README
+  https://git.torproject.org/checkout/tor/master/contrib/polipo/README
 
 
 Tor
 9. Download and extract the latest Tor source from
    https://www.torproject.org/download
 
-   Note the location in which you extract Tor's source, because you will need
-   to specify it in Step 14.
-   
+   Note the location to which you extract Tor's source, because you will need
+   to specify it in Step 12.
+
 10. Configure Tor with the following:
-   ./configure --prefix=/Applications/Vidalia.app --bindir=/Applications/Vidalia.app --sysconfdir=/Applications/Vidalia.app
+   ./configure --prefix=/Applications/Vidalia.app \
+               --bindir=/Applications/Vidalia.app/Contents/MacOS \
+               --sysconfdir=/Applications/Vidalia.app/Contents/Resources
 
+11. Build Tor by running 'make'. You do NOT need to run 'make install'
+afterwards.
 
+
 Vidalia
-11. Configure Vidalia with the following:
+12. Configure Vidalia with the following:
 
       export MACOSX_DEPLOYMENT_TARGET=10.4
-      cmake -DOSX_FAT_BINARY=1 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk  . 
+      mkdir build && cd build
+      cmake -DOSX_FAT_BINARY=1 \
+            -DTOR_SOURCE_DIR=<path-to-tor> \
+            -DPOLIPO_SOURCE_DIR=<path-to-polipo> \
+            -DTORBUTTON_XPI=<path-torbutton.xpi> ..
 
-   The Vidalia binary on OS X links to Qt statically, so you will need to have
-   your Qt installation configured appropriately.
+13. Run `make dist-osx-bundle` to build Vidalia and package all of the
+components (Vidalia, Tor, Polipo and Torbutton) into a single .dmg. The resulting
+.dmg will be placed in the 'build' directory created in Step 11.
 
-12. Run `make` to build Vidalia.
+14. (Optional) Run 'make dist-osx-split-bundle' if you would like to build
+the split OS X bundle.
 
-13. Download the latest Torbutton and LICENSE file from https://torbutton.torproject.org/dev/.
-Remember where you put this file.
+NOTE: Steps 1-6 only need to be done once initially, unless you need to
+change the packaged version of Libevent or Qt. Step 7 also only needs to
+be done once, unless Polipo ever gets updated. Steps 9-11 need to be
+repeated when the bundled version of Tor changes. Steps 12-13 need to be
+repeated when the bundled version of Vidalia changes.
 
-   
-Finish
-14. From Vidalia's pkg/ directory in Vidalia's source, run the following:
-     ./package.sh osx-bundle <path-to-tor> <path-to-polipo> <path-to-torbutton-file>
-  
-  Example:
-     ./package.sh osx-bundle ~/tor-0.2.1.7-alpha ~/tmp/polipo-1.0.4 ~/tmp/torbutton-1.2.0-fx
-
-  The script that builds the .dmg (pkg/osx/bundle/builddmg.sh) gets Tor's
-  version number from the directory name, so it should be named appropriately,
-  as in the example above.
-  
-The resulting .dmg will be placed in the 'pkg' directory under Vidalia's source.
-
-NOTE: Steps 1-6 only need to be done once initially, unless you need to change the
-packaged version of Libevent or Qt. Step 7 also only needs to be done once,
-unless Privoxy ever gets updated. Steps 9-10 need to be repeated when the
-bundled version of Tor changes. Steps 11-12 need to be repeated when the
-bundled version of Vidalia changes.
-

Modified: vidalia/branches/extension-api/pkg/osx/bundle-ds_store
===================================================================
(Binary files differ)

Modified: vidalia/branches/extension-api/pkg/osx/nonbundle-ds_store
===================================================================
(Binary files differ)

Copied: vidalia/branches/extension-api/pkg/osx/pkg-dmg (from rev 4032, vidalia/trunk/pkg/osx/pkg-dmg)
===================================================================
--- vidalia/branches/extension-api/pkg/osx/pkg-dmg	                        (rev 0)
+++ vidalia/branches/extension-api/pkg/osx/pkg-dmg	2009-08-13 19:59:29 UTC (rev 4033)
@@ -0,0 +1,1520 @@
+#!/usr/bin/perl
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is pkg-dmg, a Mac OS X disk image (.dmg) packager
+#
+# The Initial Developer of the Original Code is
+# Mark Mentovai <mark@xxxxxxxxxxxx>.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+use strict;
+use warnings;
+
+=pod
+
+=head1 NAME
+
+B<pkg-dmg> - Mac OS X disk image (.dmg) packager
+
+=head1 SYNOPSIS
+
+B<pkg-dmg>
+B<--source> I<source-folder>
+B<--target> I<target-image>
+[B<--format> I<format>]
+[B<--volname> I<volume-name>]
+[B<--tempdir> I<temp-dir>]
+[B<--mkdir> I<directory>]
+[B<--copy> I<source>[:I<dest>]]
+[B<--symlink> I<source>[:I<dest>]]
+[B<--license> I<file>]
+[B<--resource> I<file>]
+[B<--icon> I<icns-file>]
+[B<--attribute> I<a>:I<file>[:I<file>...]
+[B<--idme>]
+[B<--sourcefile>]
+[B<--verbosity> I<level>]
+[B<--dry-run>]
+
+=head1 DESCRIPTION
+
+I<pkg-dmg> takes a directory identified by I<source-folder> and transforms
+it into a disk image stored as I<target-image>.  The disk image will
+occupy the least space possible for its format, or the least space that the
+authors have been able to figure out how to achieve.
+
+=head1 OPTIONS
+
+=over 5
+
+==item B<--source> I<source-folder>
+
+Identifies the directory that will be packaged up.  This directory is not
+touched, a copy will be made in a temporary directory for staging purposes.
+See B<--tempdir>.
+
+==item B<--target> I<target-image>
+
+The disk image to create.  If it exists and is not in use, it will be
+overwritten.  If I<target-image> already contains a suitable extension,
+it will be used unmodified.  If no extension is present, or the extension
+is incorrect for the selected format, the proper extension will be added.
+See B<--format>.
+
+==item B<--format> I<format>
+
+The format to create the disk image in.  Valid values for I<format> are:
+     - UDZO - zlib-compressed, read-only; extension I<.dmg>
+     - UDBZ - bzip2-compressed, read-only; extension I<.dmg>;
+              create and use on 10.4 ("Tiger") and later only
+     - UDRW - read-write; extension I<.dmg>
+     - UDSP - read-write, sparse; extension I<.sparseimage>
+
+UDZO is the default format.
+
+See L<hdiutil(1)> for a description of these formats.
+
+=item B<--volname> I<volume-name>
+
+The name of the volume in the disk image.  If not specified, I<volume-name>
+defaults to the name of the source directory from B<--source>.
+
+=item B<--tempdir> I<temp-dir>
+
+A temporary directory to stage intermediate files in.  I<temp-dir> must
+have enough space available to accommodate twice the size of the files
+being packaged.  If not specified, defaults to the same directory that
+the I<target-image> is to be placed in.  B<pkg-dmg> will remove any
+temporary files it places in I<temp-dir>.
+
+=item B<--mkdir> I<directory>
+
+Specifies a directory that should be created in the disk image.
+I<directory> and any ancestor directories will be created.  This is
+useful in conjunction with B<--copy>, when copying files to directories
+that may not exist in I<source-folder>.  B<--mkdir> may appear multiple
+times.
+
+=item B<--copy> I<source>[:I<dest>]
+
+Additional files to copy into the disk image.  If I<dest> is
+specified, I<source> is copied to the location I<dest> identifies,
+otherwise, I<source> is copied to the root of the new volume.  B<--copy>
+provides a way to package up a I<source-folder> by adding files to it
+without modifying the original I<source-folder>.  B<--copy> may appear
+multiple times.
+
+This option is useful for adding .DS_Store files and window backgrounds
+to disk images.
+
+=item B<--symlink> I<source>[:I<dest>]
+
+Like B<--copy>, but allows symlinks to point out of the volume. Empty symlink
+destinations are interpreted as "like the source path, but inside the dmg"
+
+This option is useful for adding symlinks to external resources,
+e.g. to /Applications.
+
+=item B<--license> I<file>
+
+A plain text file containing a license agreement to be displayed before
+the disk image is mounted.  English is the only supported language.  To
+include license agreements in other languages, in multiple languages,
+or to use formatted text, prepare a resource and use L<--resource>.
+
+=item B<--resource> I<file>
+
+A resource file to merge into I<target-image>.  If I<format> is UDZO or
+UDBZ, the disk image will be flattened to a single-fork file that contains
+the resource but may be freely transferred without any special encodings.
+I<file> must be in a format suitable for L<Rez(1)>.  See L<Rez(1)> for a
+description of the format, and L<hdiutil(1)> for a discussion on flattened
+disk images.  B<--resource> may appear multiple times.
+
+This option is useful for adding license agreements and other messages
+to disk images.
+
+=item B<--icon> I<icns-file>
+
+Specifies an I<icns> file that will be used as the icon for the root of
+the volume.  This file will be copied to the new volume and the custom
+icon attribute will be set on the root folder.
+
+=item B<--attribute> I<a>:I<file>[:I<file>...]
+
+Sets the attributes of I<file> to the attribute list in I<a>.  See
+L<SetFile(1)>
+
+=item B<--idme>
+
+Enable IDME to make the disk image "Internet-enabled."  The first time
+the image is mounted, if IDME processing is enabled on the system, the
+contents of the image will be copied out of the image and the image will
+be placed in the trash with IDME disabled.
+
+=item B<--sourcefile>
+
+If this option is present, I<source-folder> is treated as a file, and is
+placed as a file within the volume's root folder.  Without this option,
+I<source-folder> is treated as the volume root itself.
+
+=item B<--verbosity> I<level>
+
+Adjusts the level of loudness of B<pkg-dmg>.  The possible values for
+I<level> are:
+     0 - Only error messages are displayed.
+     1 - Print error messages and command invocations.
+     2 - Print everything, including command output.
+
+The default I<level> is 2.
+
+=item B<--dry-run>
+
+When specified, the commands that would be executed are printed, without
+actually executing them.  When commands depend on the output of previous
+commands, dummy values are displayed.
+
+=back
+
+=head1 NON-OPTIONS
+
+=over 5
+
+=item
+
+Resource forks aren't copied.
+
+=item
+
+The root folder of the created volume is designated as the folder
+to open when the volume is mounted.  See L<bless(8)>.
+
+=item
+
+All files in the volume are set to be world-readable, only writable
+by the owner, and world-executable when appropriate.  All other
+permissions bits are cleared.
+
+=item
+
+When possible, disk images are created without any partition tables.  This
+is what L<hdiutil(1)> refers to as I<-layout NONE>, and saves a handful of
+kilobytes.  The alternative, I<SPUD>, contains a partition table that
+is not terribly handy on disk images that are not intended to represent any
+physical disk.
+
+=item
+
+Read-write images are created with journaling off.  Any read-write image
+created by this tool is expected to be transient, and the goal of this tool
+is to create images which consume a minimum of space.
+
+=back
+
+=head1 EXAMPLE
+
+pkg-dmg --source /Applications/DeerPark.app --target ~/DeerPark.dmg
+  --sourcefile --volname DeerPark --icon ~/DeerPark.icns
+  --mkdir /.background
+  --copy DeerParkBackground.png:/.background/background.png
+  --copy DeerParkDSStore:/.DS_Store
+  --symlink /Applications:"/Drag to here"
+
+=head1 REQUIREMENTS
+
+I<pkg-dmg> has been tested with Mac OS X releases 10.2 ("Jaguar")
+through 10.4 ("Tiger").  Certain adjustments to behavior are made
+depending on the host system's release.  Mac OS X 10.3 ("Panther") or
+later are recommended.
+
+=head1 LICENSE
+
+MPL 1.1/GPL 2.0/LGPL 2.1.  Your choice.
+
+=head1 AUTHOR
+
+Mark Mentovai
+
+=head1 SEE ALSO
+
+L<bless(8)>, L<diskutil(8)>, L<hdid(8)>, L<hdiutil(1)>, L<Rez(1)>,
+L<rsync(1)>, L<SetFile(1)>
+
+=cut
+
+use Fcntl;
+use POSIX;
+use Getopt::Long;
+
+sub argumentEscape(@);
+sub cleanupDie($);
+sub command(@);
+sub commandInternal($@);
+sub commandInternalVerbosity($$@);
+sub commandOutput(@);
+sub commandOutputVerbosity($@);
+sub commandVerbosity($@);
+sub copyFiles($@);
+sub diskImageMaker($$$$$$$$);
+sub giveExtension($$);
+sub hdidMountImage($@);
+sub isFormatCompressed($);
+sub licenseMaker($$);
+sub pathSplit($);
+sub setAttributes($@);
+sub trapSignal($);
+sub usage();
+
+# Variables used as globals
+my(@gCleanup, %gConfig, $gDarwinMajor, $gDryRun, $gVerbosity);
+
+# Use the commands by name if they're expected to be in the user's
+# $PATH (/bin:/sbin:/usr/bin:/usr/sbin).  Otherwise, go by absolute
+# path.  These may be overridden with --config.
+%gConfig = ('cmd_bless'          => 'bless',
+            'cmd_chmod'          => 'chmod',
+            'cmd_diskutil'       => 'diskutil',
+            'cmd_du'             => 'du',
+            'cmd_hdid'           => 'hdid',
+            'cmd_hdiutil'        => 'hdiutil',
+            'cmd_mkdir'          => 'mkdir',
+            'cmd_mktemp'         => 'mktemp',
+            'cmd_Rez'            => '/Developer/Tools/Rez',
+            'cmd_rm'             => 'rm',
+            'cmd_rsync'          => 'rsync',
+            'cmd_SetFile'        => '/Developer/Tools/SetFile',
+
+            # create_directly indicates whether hdiutil create supports
+            # -srcfolder and -srcdevice.  It does on >= 10.3 (Panther).
+            # This is fixed up for earlier systems below.  If false,
+            # hdiutil create is used to create empty disk images that
+            # are manually filled.
+            'create_directly'    => 1,
+
+            # If hdiutil attach -mountpoint exists, use it to avoid
+            # mounting disk images in the default /Volumes.  This reduces
+            # the likelihood that someone will notice a mounted image and
+            # interfere with it.  Only available on >= 10.3 (Panther),
+            # fixed up for earlier systems below.
+            #
+            # This is presently turned off for all systems, because there
+            # is an infrequent synchronization problem during ejection.
+            # diskutil eject might return before the image is actually
+            # unmounted.  If pkg-dmg then attempts to clean up its
+            # temporary directory, it could remove items from a read-write
+            # disk image or attempt to remove items from a read-only disk
+            # image (or a read-only item from a read-write image) and fail,
+            # causing pkg-dmg to abort.  This problem is experienced
+            # under Tiger, which appears to eject asynchronously where
+            # previous systems treated it as a synchronous operation.
+            # Using hdiutil attach -mountpoint didn't always keep images
+            # from showing up on the desktop anyway.
+            'hdiutil_mountpoint' => 0,
+
+            # hdiutil makehybrid results in optimized disk images that
+            # consume less space and mount more quickly.  Use it when
+            # it's available, but that's only on >= 10.3 (Panther).
+            # If false, hdiutil create is used instead.  Fixed up for
+            # earlier systems below.
+            'makehybrid'         => 1,
+
+            # hdiutil create doesn't allow specifying a folder to open
+            # at volume mount time, so those images are mounted and
+            # their root folders made holy with bless -openfolder.  But
+            # only on >= 10.3 (Panther).  Earlier systems are out of luck.
+            # Even on Panther, bless refuses to run unless root.
+            # Fixed up below.
+            'openfolder_bless'   => 1,
+
+            # It's possible to save a few more kilobytes by including the
+            # partition only without any partition table in the image.
+            # This is a good idea on any system, so turn this option off.
+            #
+            # Except it's buggy.  "-layout NONE" seems to be creating
+            # disk images with more data than just the partition table
+            # stripped out.  You might wind up losing the end of the
+            # filesystem - the last file (or several) might be incomplete.
+            'partition_table'    => 1,
+
+            # To create a partition table-less image from something
+            # created by makehybrid, the hybrid image needs to be
+            # mounted and a new image made from the device associated
+            # with the relevant partition.  This requires >= 10.4
+            # (Tiger), presumably because earlier systems have
+            # problems creating images from devices themselves attached
+            # to images.  If this is false, makehybrid images will
+            # have partition tables, regardless of the partition_table
+            # setting.  Fixed up for earlier systems below.
+            'recursive_access'   => 1);
+
+# --verbosity
+$gVerbosity = 2;
+
+# --dry-run
+$gDryRun = 0;
+
+# %gConfig fix-ups based on features and bugs present in certain releases.
+my($ignore, $uname_r, $uname_s);
+($uname_s, $ignore, $uname_r, $ignore, $ignore) = POSIX::uname();
+if($uname_s eq 'Darwin') {
+  ($gDarwinMajor, $ignore) = split(/\./, $uname_r, 2);
+
+  # $major is the Darwin major release, which for our purposes, is 4 higher
+  # than the interesting digit in a Mac OS X release.
+  if($gDarwinMajor <= 6) {
+    # <= 10.2 (Jaguar)
+    # hdiutil create does not support -srcfolder or -srcdevice
+    $gConfig{'create_directly'} = 0;
+    # hdiutil attach does not support -mountpoint
+    $gConfig{'hdiutil_mountpoint'} = 0;
+    # hdiutil mkhybrid does not exist
+    $gConfig{'makehybrid'} = 0;
+  }
+  if($gDarwinMajor <= 7) {
+    # <= 10.3 (Panther)
+    # Can't mount a disk image and then make a disk image from the device
+    $gConfig{'recursive_access'} = 0;
+    # bless does not support -openfolder on 10.2 (Jaguar) and must run
+    # as root under 10.3 (Panther)
+    $gConfig{'openfolder_bless'} = 0;
+  }
+}
+else {
+  # If it's not Mac OS X, just assume all of those good features are
+  # available.  They're not, but things will fail long before they
+  # have a chance to make a difference.
+  #
+  # Now, if someone wanted to document some of these private formats...
+  print STDERR ($0.": warning, not running on Mac OS X, ".
+   "this could be interesting.\n");
+}
+
+# Non-global variables used in Getopt
+my(@attributes, @copyFiles, @createSymlinks, $iconFile, $idme, $licenseFile,
+ @makeDirs, $outputFormat, @resourceFiles, $sourceFile, $sourceFolder,
+ $targetImage, $tempDir, $volumeName);
+
+# --format
+$outputFormat = 'UDZO';
+
+# --idme
+$idme = 0;
+
+# --sourcefile
+$sourceFile = 0;
+
+# Leaving this might screw up the Apple tools.
+delete $ENV{'NEXT_ROOT'};
+
+# This script can get pretty messy, so trap a few signals.
+$SIG{'INT'} = \&trapSignal;
+$SIG{'HUP'} = \&trapSignal;
+$SIG{'TERM'} = \&trapSignal;
+
+Getopt::Long::Configure('pass_through');
+GetOptions('source=s'    => \$sourceFolder,
+           'target=s'    => \$targetImage,
+           'volname=s'   => \$volumeName,
+           'format=s'    => \$outputFormat,
+           'tempdir=s'   => \$tempDir,
+           'mkdir=s'     => \@makeDirs,
+           'copy=s'      => \@copyFiles,
+           'symlink=s'   => \@createSymlinks,
+           'license=s'   => \$licenseFile,
+           'resource=s'  => \@resourceFiles,
+           'icon=s'      => \$iconFile,
+           'attribute=s' => \@attributes,
+           'idme'        => \$idme,
+           'sourcefile'  => \$sourceFile,
+           'verbosity=i' => \$gVerbosity,
+           'dry-run'     => \$gDryRun,
+           'config=s'    => \%gConfig); # "hidden" option not in usage()
+
+if(@ARGV) {
+  # All arguments are parsed by Getopt
+  usage();
+  exit(1);
+}
+
+if($gVerbosity<0 || $gVerbosity>2) {
+  usage();
+  exit(1);
+}
+
+if(!defined($sourceFolder) || $sourceFolder eq '' ||
+ !defined($targetImage) || $targetImage eq '') {
+  # --source and --target are required arguments
+  usage();
+  exit(1);
+}
+
+# Make sure $sourceFolder doesn't contain trailing slashes.  It messes with
+# rsync.
+while(substr($sourceFolder, -1) eq '/') {
+  chop($sourceFolder);
+}
+
+if(!defined($volumeName)) {
+  # Default volumeName is the name of the source directory.
+  my(@components);
+  @components = pathSplit($sourceFolder);
+  $volumeName = pop(@components);
+}
+
+my(@tempDirComponents, $targetImageFilename);
+@tempDirComponents = pathSplit($targetImage);
+$targetImageFilename = pop(@tempDirComponents);
+
+if(defined($tempDir)) {
+  @tempDirComponents = pathSplit($tempDir);
+}
+else {
+  # Default tempDir is the same directory as what is specified for
+  # targetImage
+  $tempDir = join('/', @tempDirComponents);
+}
+
+# Ensure that the path of the target image has a suitable extension.  If
+# it didn't, hdiutil would add one, and we wouldn't be able to find the
+# file.
+#
+# Note that $targetImageFilename is not being reset.  This is because it's
+# used to build other names below, and we don't need to be adding all sorts
+# of extra unnecessary extensions to the name.
+my($originalTargetImage, $requiredExtension);
+$originalTargetImage = $targetImage;
+if($outputFormat eq 'UDSP') {
+  $requiredExtension = '.sparseimage';
+}
+else {
+  $requiredExtension = '.dmg';
+}
+$targetImage = giveExtension($originalTargetImage, $requiredExtension);
+
+if($targetImage ne $originalTargetImage) {
+  print STDERR ($0.": warning: target image extension is being added\n");
+  print STDERR ('  The new filename is '.
+   giveExtension($targetImageFilename,$requiredExtension)."\n");
+}
+
+# Make a temporary directory in $tempDir for our own nefarious purposes.
+my(@output, $tempSubdir, $tempSubdirTemplate);
+$tempSubdirTemplate=join('/', @tempDirComponents,
+ 'pkg-dmg.'.$$.'.XXXXXXXX');
+if(!(@output = commandOutput($gConfig{'cmd_mktemp'}, '-d',
+ $tempSubdirTemplate)) || $#output != 0) {
+  cleanupDie('mktemp failed');
+}
+
+if($gDryRun) {
+  (@output)=($tempSubdirTemplate);
+}
+
+($tempSubdir) = @output;
+
+push(@gCleanup,
+ sub {commandVerbosity(0, $gConfig{'cmd_rm'}, '-rf', $tempSubdir);});
+
+my($tempMount, $tempRoot, @tempsToMake);
+$tempRoot = $tempSubdir.'/stage';
+$tempMount = $tempSubdir.'/mount';
+push(@tempsToMake, $tempRoot);
+if($gConfig{'hdiutil_mountpoint'}) {
+  push(@tempsToMake, $tempMount);
+}
+
+if(command($gConfig{'cmd_mkdir'}, @tempsToMake) != 0) {
+  cleanupDie('mkdir tempRoot/tempMount failed');
+}
+
+# This cleanup object is not strictly necessary, because $tempRoot is inside
+# of $tempSubdir, but the rest of the script relies on this object being
+# on the cleanup stack and expects to remove it.
+push(@gCleanup,
+ sub {commandVerbosity(0, $gConfig{'cmd_rm'}, '-rf', $tempRoot);});
+
+# If $sourceFile is true, it means that $sourceFolder is to be treated as
+# a file and placed as a file within the volume root, as opposed to being
+# treated as the volume root itself.  rsync will do this by default, if no
+# trailing '/' is present.  With a trailing '/', $sourceFolder becomes
+# $tempRoot, instead of becoming an entry in $tempRoot.
+if(command($gConfig{'cmd_rsync'}, '-a', '--copy-unsafe-links',
+ $sourceFolder.($sourceFile?'':'/'),$tempRoot) != 0) {
+  cleanupDie('rsync failed');
+}
+
+if(@makeDirs) {
+  my($makeDir, @tempDirsToMake);
+  foreach $makeDir (@makeDirs) {
+    if($makeDir =~ /^\//) {
+      push(@tempDirsToMake, $tempRoot.$makeDir);
+    }
+    else {
+      push(@tempDirsToMake, $tempRoot.'/'.$makeDir);
+    }
+  }
+  if(command($gConfig{'cmd_mkdir'}, '-p', @tempDirsToMake) != 0) {
+    cleanupDie('mkdir failed');
+  }
+}
+
+# copy files and/or create symlinks
+copyFiles($tempRoot, 'copy', @copyFiles);
+copyFiles($tempRoot, 'symlink', @createSymlinks);
+
+if($gConfig{'create_directly'}) {
+  # If create_directly is false, the contents will be rsynced into a
+  # disk image and they would lose their attributes.
+  setAttributes($tempRoot, @attributes);
+}
+
+if(defined($iconFile)) {
+  if(command($gConfig{'cmd_rsync'}, '-a', '--copy-unsafe-links', $iconFile,
+   $tempRoot.'/.VolumeIcon.icns') != 0) {
+    cleanupDie('rsync failed for volume icon');
+  }
+
+  # It's pointless to set the attributes of the root when diskutil create
+  # -srcfolder is being used.  In that case, the attributes will be set
+  # later, after the image is already created.
+  if(isFormatCompressed($outputFormat) &&
+   (command($gConfig{'cmd_SetFile'}, '-a', 'C', $tempRoot) != 0)) {
+    cleanupDie('SetFile failed');
+  }
+}
+
+if(command($gConfig{'cmd_chmod'}, '-R', 'a+rX,a-st,u+w,go-w',
+ $tempRoot) != 0) {
+  cleanupDie('chmod failed');
+}
+
+my($unflattenable);
+if(isFormatCompressed($outputFormat)) {
+  $unflattenable = 1;
+}
+else {
+  $unflattenable = 0;
+}
+
+diskImageMaker($tempRoot, $targetImage, $outputFormat, $volumeName,
+ $tempSubdir, $tempMount, $targetImageFilename, defined($iconFile));
+
+if(defined($licenseFile) && $licenseFile ne '') {
+  my($licenseResource);
+  $licenseResource = $tempSubdir.'/license.r';
+  if(!licenseMaker($licenseFile, $licenseResource)) {
+    cleanupDie('licenseMaker failed');
+  }
+  push(@resourceFiles, $licenseResource);
+  # Don't add a cleanup object because licenseResource is in tempSubdir.
+}
+
+if(@resourceFiles) {
+  # Add resources, such as a license agreement.
+
+  # Only unflatten read-only and compressed images.  It's not supported
+  # on other image times.
+  if($unflattenable &&
+   (command($gConfig{'cmd_hdiutil'}, 'unflatten', $targetImage)) != 0) {
+    cleanupDie('hdiutil unflatten failed');
+  }
+  # Don't push flatten onto the cleanup stack.  If we fail now, we'll be
+  # removing $targetImage anyway.
+
+  # Type definitions come from Carbon.r.
+  if(command($gConfig{'cmd_Rez'}, 'Carbon.r', @resourceFiles, '-a', '-o',
+   $targetImage) != 0) {
+    cleanupDie('Rez failed');
+  }
+
+  # Flatten.  This merges the resource fork into the data fork, so no
+  # special encoding is needed to transfer the file.
+  if($unflattenable &&
+   (command($gConfig{'cmd_hdiutil'}, 'flatten', $targetImage)) != 0) {
+    cleanupDie('hdiutil flatten failed');
+  }
+}
+
+# $tempSubdir is no longer needed.  It's buried on the stack below the
+# rm of the fresh image file.  Splice in this fashion is equivalent to
+# pop-save, pop, push-save.
+splice(@gCleanup, -2, 1);
+# No need to remove licenseResource separately, it's in tempSubdir.
+if(command($gConfig{'cmd_rm'}, '-rf', $tempSubdir) != 0) {
+  cleanupDie('rm -rf tempSubdir failed');
+}
+
+if($idme) {
+  if(command($gConfig{'cmd_hdiutil'}, 'internet-enable', '-yes',
+   $targetImage) != 0) {
+    cleanupDie('hdiutil internet-enable failed');
+  }
+}
+
+# Done.
+
+exit(0);
+
+# argumentEscape(@arguments)
+#
+# Takes a list of @arguments and makes them shell-safe.
+sub argumentEscape(@) {
+  my(@arguments);
+  @arguments = @_;
+  my($argument, @argumentsOut);
+  foreach $argument (@arguments) {
+    $argument =~ s%([^A-Za-z0-9_\-/.=+,])%\\$1%g;
+    push(@argumentsOut, $argument);
+  }
+  return @argumentsOut;
+}
+
+# cleanupDie($message)
+#
+# Displays $message as an error message, and then runs through the
+# @gCleanup stack, performing any cleanup operations needed before
+# exiting.  Does not return, exits with exit status 1.
+sub cleanupDie($) {
+  my($message);
+  ($message) = @_;
+  print STDERR ($0.': '.$message.(@gCleanup?' (cleaning up)':'')."\n");
+  while(@gCleanup) {
+    my($subroutine);
+    $subroutine = pop(@gCleanup);
+    &$subroutine;
+  }
+  exit(1);
+}
+
+# command(@arguments)
+#
+# Runs the specified command at the verbosity level defined by $gVerbosity.
+# Returns nonzero on failure, returning the exit status if appropriate.
+# Discards command output.
+sub command(@) {
+  my(@arguments);
+  @arguments = @_;
+  return commandVerbosity($gVerbosity,@arguments);
+}
+
+# commandInternal($command, @arguments)
+#
+# Runs the specified internal command at the verbosity level defined by
+# $gVerbosity.
+# Returns zero(!) on failure, because commandInternal is supposed to be a
+# direct replacement for the Perl system call wrappers, which, unlike shell
+# commands and C equivalent system calls, return true (instead of 0) to
+# indicate success.
+sub commandInternal($@) {
+  my(@arguments, $command);
+  ($command, @arguments) = @_;
+  return commandInternalVerbosity($gVerbosity, $command, @arguments);
+}
+
+# commandInternalVerbosity($verbosity, $command, @arguments)
+#
+# Run an internal command, printing a bogus command invocation message if
+# $verbosity is true.
+#
+# If $command is unlink:
+# Removes the files specified by @arguments.  Wraps unlink.
+#
+# If $command is symlink:
+# Creates the symlink specified by @arguments. Wraps symlink.
+sub commandInternalVerbosity($$@) {
+  my(@arguments, $command, $verbosity);
+  ($verbosity, $command, @arguments) = @_;
+  if($command eq 'unlink') {
+    if($verbosity || $gDryRun) {
+      print(join(' ', 'rm', '-f', argumentEscape(@arguments))."\n");
+    }
+    if($gDryRun) {
+      return $#arguments+1;
+    }
+    return unlink(@arguments);
+  }
+  elsif($command eq 'symlink') {
+    if($verbosity || $gDryRun) {
+      print(join(' ', 'ln', '-s', argumentEscape(@arguments))."\n");
+    }
+    if($gDryRun) {
+      return 1;
+    }
+    my($source, $target);
+    ($source, $target) = @arguments;
+    return symlink($source, $target);
+  }
+}
+
+# commandOutput(@arguments)
+#
+# Runs the specified command at the verbosity level defined by $gVerbosity.
+# Output is returned in an array of lines.  undef is returned on failure.
+# The exit status is available in $?.
+sub commandOutput(@) {
+  my(@arguments);
+  @arguments = @_;
+  return commandOutputVerbosity($gVerbosity, @arguments);
+}
+
+# commandOutputVerbosity($verbosity, @arguments)
+#
+# Runs the specified command at the verbosity level defined by the
+# $verbosity argument.  Output is returned in an array of lines.  undef is
+# returned on failure.  The exit status is available in $?.
+#
+# If an error occurs in fork or exec, an error message is printed to
+# stderr and undef is returned.
+#
+# If $verbosity is 0, the command invocation is not printed, and its
+# stdout is not echoed back to stdout.
+#
+# If $verbosity is 1, the command invocation is printed.
+#
+# If $verbosity is 2, the command invocation is printed and the output
+# from stdout is echoed back to stdout.
+#
+# Regardless of $verbosity, stderr is left connected.
+sub commandOutputVerbosity($@) {
+  my(@arguments, $verbosity);
+  ($verbosity, @arguments) = @_;
+  my($pid);
+  if($verbosity || $gDryRun) {
+    print(join(' ', argumentEscape(@arguments))."\n");
+  }
+  if($gDryRun) {
+    return(1);
+  }
+  if (!defined($pid = open(*COMMAND, '-|'))) {
+    printf STDERR ($0.': fork: '.$!."\n");
+    return undef;
+  }
+  elsif ($pid) {
+    # parent
+    my(@lines);
+    while(!eof(*COMMAND)) {
+      my($line);
+      chop($line = <COMMAND>);
+      if($verbosity > 1) {
+        print($line."\n");
+      }
+      push(@lines, $line);
+    }
+    close(*COMMAND);
+    if ($? == -1) {
+      printf STDERR ($0.': fork: '.$!."\n");
+      return undef;
+    }
+    elsif ($? & 127) {
+      printf STDERR ($0.': exited on signal '.($? & 127).
+       ($? & 128 ? ', core dumped' : '')."\n");
+      return undef;
+    }
+    return @lines;
+  }
+  else {
+    # child; this form of exec is immune to shell games
+    if(!exec {$arguments[0]} (@arguments)) {
+      printf STDERR ($0.': exec: '.$!."\n");
+      exit(-1);
+    }
+  }
+}
+
+# commandVerbosity($verbosity, @arguments)
+#
+# Runs the specified command at the verbosity level defined by the
+# $verbosity argument.  Returns nonzero on failure, returning the exit
+# status if appropriate.  Discards command output.
+sub commandVerbosity($@) {
+  my(@arguments, $verbosity);
+  ($verbosity, @arguments) = @_;
+  if(!defined(commandOutputVerbosity($verbosity, @arguments))) {
+    return -1;
+  }
+  return $?;
+}
+
+# copyFiles($tempRoot, $method, @arguments)
+#
+# Copies files or create symlinks in the disk image.
+# See --copy and --symlink descriptions for details.
+# If $method is 'copy', @arguments are interpreted as source:target, if $method
+# is 'symlink', @arguments are interpreted as symlink:target.
+sub copyFiles($@) {
+  my(@fileList, $method, $tempRoot);
+  ($tempRoot, $method, @fileList) = @_;
+  my($file, $isSymlink);
+  $isSymlink = ($method eq 'symlink');
+  foreach $file (@fileList) {
+    my($source, $target);
+    ($source, $target) = split(/:/, $file);
+    if(!defined($target) and $isSymlink) {
+      # empty symlink targets would result in an invalid target and fail,
+      # but they shall be interpreted as "like source path, but inside dmg"
+      $target = $source;
+    }
+    if(!defined($target)) {
+      $target = $tempRoot;
+    }
+    elsif($target =~ /^\//) {
+      $target = $tempRoot.$target;
+    }
+    else {
+      $target = $tempRoot.'/'.$target;
+    }
+
+    my($success);
+    if($isSymlink) {
+      $success = commandInternal('symlink', $source, $target);
+    }
+    else {
+      $success = !command($gConfig{'cmd_rsync'}, '-a', '--copy-unsafe-links',
+                          $source, $target);
+    }
+    if(!$success) {
+      cleanupDie('copyFiles failed for method '.$method);
+    }
+  }
+}
+
+# diskImageMaker($source, $destination, $format, $name, $tempDir, $tempMount,
+#  $baseName, $setRootIcon)
+#
+# Creates a disk image in $destination of format $format corresponding to the
+# source directory $source.  $name is the volume name.  $tempDir is a good
+# place to write temporary files, which should be empty (aside from the other
+# things that this script might create there, like stage and mount).
+# $tempMount is a mount point for temporary disk images.  $baseName is the
+# name of the disk image, and is presently unused.  $setRootIcon is true if
+# a volume icon was added to the staged $source and indicates that the
+# custom volume icon bit on the volume root needs to be set.
+sub diskImageMaker($$$$$$$$) {
+  my($baseName, $destination, $format, $name, $setRootIcon, $source,
+   $tempDir, $tempMount);
+  ($source, $destination, $format, $name, $tempDir, $tempMount,
+   $baseName, $setRootIcon) = @_;
+  if(isFormatCompressed($format)) {
+    my($uncompressedImage);
+
+    if($gConfig{'makehybrid'}) {
+      my($hybridImage);
+      $hybridImage = giveExtension($tempDir.'/hybrid', '.dmg');
+
+      if(command($gConfig{'cmd_hdiutil'}, 'makehybrid', '-hfs',
+       '-hfs-volume-name', $name, '-hfs-openfolder', $source, '-ov',
+       $source, '-o', $hybridImage) != 0) {
+        cleanupDie('hdiutil makehybrid failed');
+      }
+
+      $uncompressedImage = $hybridImage;
+
+      # $source is no longer needed and will be removed before anything
+      # else can fail.  splice in this form is the same as pop/push.
+      splice(@gCleanup, -1, 1,
+       sub {commandInternalVerbosity(0, 'unlink', $hybridImage);});
+
+      if(command($gConfig{'cmd_rm'}, '-rf', $source) != 0) {
+        cleanupDie('rm -rf failed');
+      }
+
+      if(!$gConfig{'partition_table'} && $gConfig{'recursive_access'}) {
+        # Even if we do want to create disk images without partition tables,
+        # it's impossible unless recursive_access is set.
+        my($rootDevice, $partitionDevice, $partitionMountPoint);
+
+        if(!(($rootDevice, $partitionDevice, $partitionMountPoint) =
+         hdidMountImage($tempMount, '-readonly', $hybridImage))) {
+          cleanupDie('hdid mount failed');
+        }
+
+        push(@gCleanup, sub {commandVerbosity(0,
+         $gConfig{'cmd_diskutil'}, 'eject', $rootDevice);});
+
+        my($udrwImage);
+        $udrwImage = giveExtension($tempDir.'/udrw', '.dmg');
+
+        if(command($gConfig{'cmd_hdiutil'}, 'create', '-format', 'UDRW',
+         '-ov', '-srcdevice', $partitionDevice, $udrwImage) != 0) {
+          cleanupDie('hdiutil create failed');
+        }
+
+        $uncompressedImage = $udrwImage;
+
+        # Going to eject before anything else can fail.  Get the eject off
+        # the stack.
+        pop(@gCleanup);
+
+        # $hybridImage will be removed soon, but until then, it needs to
+        # stay on the cleanup stack.  It needs to wait until after
+        # ejection.  $udrwImage is staying around.  Make it appear as
+        # though it's been done before $hybridImage.
+        #
+        # splice in this form is the same as popping one element to
+        # @tempCleanup and pushing the subroutine.
+        my(@tempCleanup);
+        @tempCleanup = splice(@gCleanup, -1, 1,
+         sub {commandInternalVerbosity(0, 'unlink', $udrwImage);});
+        push(@gCleanup, @tempCleanup);
+
+        if(command($gConfig{'cmd_diskutil'}, 'eject', $rootDevice) != 0) {
+          cleanupDie('diskutil eject failed');
+        }
+
+        # Pop unlink of $uncompressedImage
+        pop(@gCleanup);
+
+        if(commandInternal('unlink', $hybridImage) != 1) {
+          cleanupDie('unlink hybridImage failed: '.$!);
+        }
+      }
+    }
+    else {
+      # makehybrid is not available, fall back to making a UDRW and
+      # converting to a compressed image.  It ought to be possible to
+      # create a compressed image directly, but those come out far too
+      # large (journaling?) and need to be read-write to fix up the
+      # volume icon anyway.  Luckily, we can take advantage of a single
+      # call back into this function.
+      my($udrwImage);
+      $udrwImage = giveExtension($tempDir.'/udrw', '.dmg');
+
+      diskImageMaker($source, $udrwImage, 'UDRW', $name, $tempDir,
+       $tempMount, $baseName, $setRootIcon);
+
+      # The call back into diskImageMaker already removed $source.
+
+      $uncompressedImage = $udrwImage;
+    }
+
+    # The uncompressed disk image is now in its final form.  Compress it.
+    # Jaguar doesn't support hdiutil convert -ov, but it always allows
+    # overwriting.
+    # bzip2-compressed UDBZ images can only be created and mounted on 10.4
+    # and later.  The bzip2-level imagekey is only effective when creating
+    # images in 10.5.  In 10.4, bzip2-level is harmlessly ignored, and the
+    # default value of 1 is always used.
+    if(command($gConfig{'cmd_hdiutil'}, 'convert', '-format', $format,
+     '-imagekey', ($format eq 'UDBZ' ? 'bzip2-level=9' : 'zlib-level=9'),
+     (defined($gDarwinMajor) && $gDarwinMajor <= 6 ? () : ('-ov')),
+     $uncompressedImage, '-o', $destination) != 0) {
+      cleanupDie('hdiutil convert failed');
+    }
+
+    # $uncompressedImage is going to be unlinked before anything else can
+    # fail.  splice in this form is the same as pop/push.
+    splice(@gCleanup, -1, 1,
+     sub {commandInternalVerbosity(0, 'unlink', $destination);});
+
+    if(commandInternal('unlink', $uncompressedImage) != 1) {
+      cleanupDie('unlink uncompressedImage failed: '.$!);
+    }
+
+    # At this point, the only thing that the compressed block has added to
+    # the cleanup stack is the removal of $destination.  $source has already
+    # been removed, and its cleanup entry has been removed as well.
+  }
+  elsif($format eq 'UDRW' || $format eq 'UDSP') {
+    my(@extraArguments);
+    if(!$gConfig{'partition_table'}) {
+      @extraArguments = ('-layout', 'NONE');
+    }
+
+    if($gConfig{'create_directly'}) {
+      # Use -fs HFS+ to suppress the journal.
+      if(command($gConfig{'cmd_hdiutil'}, 'create', '-format', $format,
+       @extraArguments, '-fs', 'HFS+', '-volname', $name,
+       '-ov', '-srcfolder', $source, $destination) != 0) {
+        cleanupDie('hdiutil create failed');
+      }
+
+      # $source is no longer needed and will be removed before anything
+      # else can fail.  splice in this form is the same as pop/push.
+      splice(@gCleanup, -1, 1,
+       sub {commandInternalVerbosity(0, 'unlink', $destination);});
+
+      if(command($gConfig{'cmd_rm'}, '-rf', $source) != 0) {
+        cleanupDie('rm -rf failed');
+      }
+    }
+    else {
+      # hdiutil create does not support -srcfolder or -srcdevice, it only
+      # knows how to create blank images.  Figure out how large an image
+      # is needed, create it, and fill it.  This is needed for Jaguar.
+
+      # Use native block size for hdiutil create -sectors.
+      delete $ENV{'BLOCKSIZE'};
+
+      my(@duOutput, $ignore, $sizeBlocks, $sizeOverhead, $sizeTotal, $type);
+      if(!(@output = commandOutput($gConfig{'cmd_du'}, '-s', $tempRoot)) ||
+       $? != 0) {
+        cleanupDie('du failed');
+      }
+      ($sizeBlocks, $ignore) = split(' ', $output[0], 2);
+
+      # The filesystem itself takes up 152 blocks of its own blocks for the
+      # filesystem up to 8192 blocks, plus 64 blocks for every additional
+      # 4096 blocks or portion thereof.
+      $sizeOverhead = 152 + 64 * POSIX::ceil(
+       (($sizeBlocks - 8192) > 0) ? (($sizeBlocks - 8192) / (4096 - 64)) : 0);
+
+      # The number of blocks must be divisible by 8.
+      my($mod);
+      if($mod = ($sizeOverhead % 8)) {
+        $sizeOverhead += 8 - $mod;
+      }
+
+      # sectors is taken as the size of a disk, not a filesystem, so the
+      # partition table eats into it.
+      if($gConfig{'partition_table'}) {
+        $sizeOverhead += 80;
+      }
+
+      # That was hard.  Leave some breathing room anyway.  Use 1024 sectors
+      # (512kB).  These read-write images wouldn't be useful if they didn't
+      # have at least a little free space.
+      $sizeTotal = $sizeBlocks + $sizeOverhead + 1024;
+
+      # Minimum sizes - these numbers are larger on Jaguar than on later
+      # systems.  Just use the Jaguar numbers, since it's unlikely to wind
+      # up here on any other release.
+      if($gConfig{'partition_table'} && $sizeTotal < 8272) {
+        $sizeTotal = 8272;
+      }
+      if(!$gConfig{'partition_table'} && $sizeTotal < 8192) {
+        $sizeTotal = 8192;
+      }
+
+      # hdiutil create without -srcfolder or -srcdevice will not accept
+      # -format.  It uses -type.  Fortunately, the two supported formats
+      # here map directly to the only two supported types.
+      if ($format eq 'UDSP') {
+        $type = 'SPARSE';
+      }
+      else {
+        $type = 'UDIF';
+      }
+
+      if(command($gConfig{'cmd_hdiutil'}, 'create', '-type', $type,
+       @extraArguments, '-fs', 'HFS+', '-volname', $name,
+       '-ov', '-sectors', $sizeTotal, $destination) != 0) {
+        cleanupDie('hdiutil create failed');
+      }
+
+      push(@gCleanup,
+       sub {commandInternalVerbosity(0, 'unlink', $destination);});
+
+      # The rsync will occur shortly.
+    }
+
+    my($mounted, $rootDevice, $partitionDevice, $partitionMountPoint);
+
+    $mounted=0;
+    if(!$gConfig{'create_directly'} || $gConfig{'openfolder_bless'} ||
+     $setRootIcon) {
+      # The disk image only needs to be mounted if:
+      #  create_directly is false, because the content needs to be copied
+      #  openfolder_bless is true, because bless -openfolder needs to run
+      #  setRootIcon is true, because the root needs its attributes set.
+      if(!(($rootDevice, $partitionDevice, $partitionMountPoint) =
+       hdidMountImage($tempMount, $destination))) {
+        cleanupDie('hdid mount failed');
+      }
+
+      $mounted=1;
+
+      push(@gCleanup, sub {commandVerbosity(0,
+       $gConfig{'cmd_diskutil'}, 'eject', $rootDevice);});
+    }
+
+    if(!$gConfig{'create_directly'}) {
+      # Couldn't create and copy directly in one fell swoop.  Now that
+      # the volume is mounted, copy the files.  --copy-unsafe-links is
+      # unnecessary since it was used to copy everything to the staging
+      # area.  There can be no more unsafe links.
+      if(command($gConfig{'cmd_rsync'}, '-a',
+       $source.'/',$partitionMountPoint) != 0) {
+        cleanupDie('rsync to new volume failed');
+      }
+
+      # We need to get the rm -rf of $source off the stack, because it's
+      # being cleaned up here.  There are two items now on top of it:
+      # removing the target image and, above that, ejecting it.  Splice it
+      # out.
+      my(@tempCleanup);
+      @tempCleanup = splice(@gCleanup, -2);
+      # The next splice is the same as popping once and pushing @tempCleanup.
+      splice(@gCleanup, -1, 1, @tempCleanup);
+
+      if(command($gConfig{'cmd_rm'}, '-rf', $source) != 0) {
+        cleanupDie('rm -rf failed');
+      }
+    }
+
+    if($gConfig{'openfolder_bless'}) {
+      # On Tiger, the bless docs say to use --openfolder, but only
+      # --openfolder is accepted on Panther.  Tiger takes it with a single
+      # dash too.  Jaguar is out of luck.
+      if(command($gConfig{'cmd_bless'}, '-openfolder',
+       $partitionMountPoint) != 0) {
+        cleanupDie('bless failed');
+      }
+    }
+
+    setAttributes($partitionMountPoint, @attributes);
+
+    if($setRootIcon) {
+      # When "hdiutil create -srcfolder" is used, the root folder's
+      # attributes are not copied to the new volume.  Fix up.
+
+      if(command($gConfig{'cmd_SetFile'}, '-a', 'C',
+       $partitionMountPoint) != 0) {
+        cleanupDie('SetFile failed');
+      }
+    }
+
+    if($mounted) {
+      # Pop diskutil eject
+      pop(@gCleanup);
+
+      if(command($gConfig{'cmd_diskutil'}, 'eject', $rootDevice) != 0) {
+        cleanupDie('diskutil eject failed');
+      }
+    }
+
+    # End of UDRW/UDSP section.  At this point, $source has been removed
+    # and its cleanup entry has been removed from the stack.
+  }
+  else {
+    cleanupDie('unrecognized format');
+    print STDERR ($0.": unrecognized format\n");
+    exit(1);
+  }
+}
+
+# giveExtension($file, $extension)
+#
+# If $file does not end in $extension, $extension is added.  The new
+# filename is returned.
+sub giveExtension($$) {
+  my($extension, $file);
+  ($file, $extension) = @_;
+  if(substr($file, -length($extension)) ne $extension) {
+    return $file.$extension;
+  }
+  return $file;
+}
+
+# hdidMountImage($mountPoint, @arguments)
+#
+# Runs the hdid command with arguments specified by @arguments.
+# @arguments may be a single-element array containing the name of the
+# disk image to mount.  Returns a three-element array, with elements
+# corresponding to:
+#  - The root device of the mounted image, suitable for ejection
+#  - The device corresponding to the mounted partition
+#  - The mounted partition's mount point
+#
+# If running on a system that supports easy mounting at points outside
+# of the default /Volumes with hdiutil attach, it is used instead of hdid,
+# and $mountPoint is used as the mount point.
+#
+# The root device will differ from the partition device when the disk
+# image contains a partition table, otherwise, they will be identical.
+#
+# If hdid fails, undef is returned.
+sub hdidMountImage($@) {
+  my(@arguments, @command, $mountPoint);
+  ($mountPoint, @arguments) = @_;
+  my(@output);
+
+  if($gConfig{'hdiutil_mountpoint'}) {
+    @command=($gConfig{'cmd_hdiutil'}, 'attach', @arguments,
+     '-mountpoint', $mountPoint);
+  }
+  else {
+    @command=($gConfig{'cmd_hdid'}, @arguments);
+  }
+
+  if(!(@output = commandOutput(@command)) ||
+   $? != 0) {
+    return undef;
+  }
+
+  if($gDryRun) {
+    return('/dev/diskX','/dev/diskXsY','/Volumes/'.$volumeName);
+  }
+
+  my($line, $restOfLine, $rootDevice);
+
+  foreach $line (@output) {
+    my($device, $mountpoint);
+    if($line !~ /^\/dev\//) {
+      # Consider only lines that correspond to /dev entries
+      next;
+    }
+    ($device, $restOfLine) = split(' ', $line, 2);
+
+    if(!defined($rootDevice) || $rootDevice eq '') {
+      # If this is the first device seen, it's the root device to be
+      # used for ejection.  Keep it.
+      $rootDevice = $device;
+    }
+
+    if($restOfLine =~ /(\/.*)/) {
+      # The first partition with a mount point is the interesting one.  It's
+      # usually Apple_HFS and usually the last one in the list, but beware of
+      # the possibility of other filesystem types and the Apple_Free partition.
+      # If the disk image contains no partition table, the partition will not
+      # have a type, so look for the mount point by looking for a slash.
+      $mountpoint = $1;
+      return($rootDevice, $device, $mountpoint);
+    }
+  }
+
+  # No mount point?  This is bad.  If there's a root device, eject it.
+  if(defined($rootDevice) && $rootDevice ne '') {
+    # Failing anyway, so don't care about failure
+    commandVerbosity(0, $gConfig{'cmd_diskutil'}, 'eject', $rootDevice);
+  }
+
+  return undef;
+}
+
+# isFormatCompressed($format)
+#
+# Returns true if $format corresponds to a compressed disk image format.
+# Returns false otherwise.
+sub isFormatCompressed($) {
+  my($format);
+  ($format) = @_;
+  return $format eq 'UDZO' || $format eq 'UDBZ';
+}
+
+# licenseMaker($text, $resource)
+#
+# Takes a plain text file at path $text and creates a license agreement
+# resource containing the text at path $license.  English-only, and
+# no special formatting.  This is the bare-bones stuff.  For more
+# intricate license agreements, create your own resource.
+#
+# ftp://ftp.apple.com/developer/Development_Kits/SLAs_for_UDIFs_1.0.dmg
+sub licenseMaker($$) {
+  my($resource, $text);
+  ($text, $resource) = @_;
+  if(!sysopen(*TEXT, $text, O_RDONLY)) {
+    print STDERR ($0.': licenseMaker: sysopen text: '.$!."\n");
+    return 0;
+  }
+  if(!sysopen(*RESOURCE, $resource, O_WRONLY|O_CREAT|O_EXCL)) {
+    print STDERR ($0.': licenseMaker: sysopen resource: '.$!."\n");
+    return 0;
+  }
+  print RESOURCE << '__EOT__';
+// See /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h for language IDs.
+data 'LPic' (5000) {
+  // Default language ID, 0 = English
+  $"0000"
+  // Number of entries in list
+  $"0001"
+
+  // Entry 1
+  // Language ID, 0 = English
+  $"0000"
+  // Resource ID, 0 = STR#/TEXT/styl 5000
+  $"0000"
+  // Multibyte language, 0 = no
+  $"0000"
+};
+
+resource 'STR#' (5000, "English") {
+  {
+    // Language (unused?) = English
+    "English",
+    // Agree
+    "Agree",
+    // Disagree
+    "Disagree",
+__EOT__
+    # This stuff needs double-quotes for interpolations to work.
+    print RESOURCE ("    // Print, ellipsis is 0xC9\n");
+    print RESOURCE ("    \"Print\xc9\",\n");
+    print RESOURCE ("    // Save As, ellipsis is 0xC9\n");
+    print RESOURCE ("    \"Save As\xc9\",\n");
+    print RESOURCE ('    // Descriptive text, curly quotes are 0xD2 and 0xD3'.
+     "\n");
+    print RESOURCE ('    "If you agree to the terms of this license '.
+     "agreement, click \xd2Agree\xd3 to access the software.  If you ".
+     "do not agree, press \xd2Disagree.\xd3\"\n");
+print RESOURCE << '__EOT__';
+  };
+};
+
+// Beware of 1024(?) byte (character?) line length limitation.  Split up long
+// lines.
+// If straight quotes are used ("), remember to escape them (\").
+// Newline is \n, to leave a blank line, use two of them.
+// 0xD2 and 0xD3 are curly double-quotes ("), 0xD4 and 0xD5 are curly
+//   single quotes ('), 0xD5 is also the apostrophe.
+data 'TEXT' (5000, "English") {
+__EOT__
+
+  while(!eof(*TEXT)) {
+    my($line);
+    chop($line = <TEXT>);
+
+    while(defined($line)) {
+      my($chunk);
+
+      # Rez doesn't care for lines longer than (1024?) characters.  Split
+      # at less than half of that limit, in case everything needs to be
+      # backwhacked.
+      if(length($line)>500) {
+        $chunk = substr($line, 0, 500);
+        $line = substr($line, 500);
+      }
+      else {
+        $chunk = $line;
+        $line = undef;
+      }
+
+      if(length($chunk) > 0) {
+        # Unsafe characters are the double-quote (") and backslash (\), escape
+        # them with backslashes.
+        $chunk =~ s/(["\\])/\\$1/g;
+
+        print RESOURCE '  "'.$chunk.'"'."\n";
+      }
+    }
+    print RESOURCE '  "\n"'."\n";
+  }
+  close(*TEXT);
+
+  print RESOURCE << '__EOT__';
+};
+
+data 'styl' (5000, "English") {
+  // Number of styles following = 1
+  $"0001"
+
+  // Style 1.  This is used to display the first two lines in bold text.
+  // Start character = 0
+  $"0000 0000"
+  // Height = 16
+  $"0010"
+  // Ascent = 12
+  $"000C"
+  // Font family = 1024 (Lucida Grande)
+  $"0400"
+  // Style bitfield, 0x1=bold 0x2=italic 0x4=underline 0x8=outline
+  // 0x10=shadow 0x20=condensed 0x40=extended
+  $"00"
+  // Style, unused?
+  $"02"
+  // Size = 12 point
+  $"000C"
+  // Color, RGB
+  $"0000 0000 0000"
+};
+__EOT__
+  close(*RESOURCE);
+
+  return 1;
+}
+
+# pathSplit($pathname)
+#
+# Splits $pathname into an array of path components.
+sub pathSplit($) {
+  my($pathname);
+  ($pathname) = @_;
+  return split(/\//, $pathname);
+}
+
+# setAttributes($root, @attributeList)
+#
+# @attributeList is an array, each element of which must be in the form
+# <a>:<file>.  <a> is a list of attributes, per SetFile.  <file> is a file
+# which is taken as relative to $root (even if it appears as an absolute
+# path.)  SetFile is called to set the attributes on each file in
+# @attributeList.
+sub setAttributes($@) {
+  my(@attributes, $root);
+  ($root, @attributes) = @_;
+  my($attribute);
+  foreach $attribute (@attributes) {
+    my($attrList, $file, @fileList, @fixedFileList);
+    ($attrList, @fileList) = split(/:/, $attribute);
+    if(!defined($attrList) || !@fileList) {
+      cleanupDie('--attribute requires <attributes>:<file>');
+    }
+    @fixedFileList=();
+    foreach $file (@fileList) {
+      if($file =~ /^\//) {
+        push(@fixedFileList, $root.$file);
+      }
+      else {
+        push(@fixedFileList, $root.'/'.$file);
+      }
+    }
+    if(command($gConfig{'cmd_SetFile'}, '-a', $attrList, @fixedFileList)) {
+      cleanupDie('SetFile failed to set attributes');
+    }
+  }
+  return;
+}
+
+sub trapSignal($) {
+  my($signalName);
+  ($signalName) = @_;
+  cleanupDie('exiting on SIG'.$signalName);
+}
+
+sub usage() {
+  print STDERR (
+"usage: pkg-dmg --source <source-folder>\n".
+"               --target <target-image>\n".
+"              [--format <format>]           (default: UDZO)\n".
+"              [--volname <volume-name>]     (default: same name as source)\n".
+"              [--tempdir <temp-dir>]        (default: same dir as target)\n".
+"              [--mkdir <directory>]         (make directory in image)\n".
+"              [--copy <source>[:<dest>]]    (extra files to add)\n".
+"              [--symlink <source>[:<dest>]] (extra symlinks to add)\n".
+"              [--license <file>]            (plain text license agreement)\n".
+"              [--resource <file>]           (flat .r files to merge)\n".
+"              [--icon <icns-file>]          (volume icon)\n".
+"              [--attribute <a>:<file>]      (set file attributes)\n".
+"              [--idme]                      (make Internet-enabled image)\n".
+"              [--sourcefile]                (treat --source as a file)\n".
+"              [--verbosity <level>]         (0, 1, 2; default=2)\n".
+"              [--dry-run]                   (print what would be done)\n");
+  return;
+}

Copied: vidalia/branches/extension-api/pkg/osx/polipo.conf (from rev 4032, vidalia/trunk/pkg/osx/polipo.conf)
===================================================================
--- vidalia/branches/extension-api/pkg/osx/polipo.conf	                        (rev 0)
+++ vidalia/branches/extension-api/pkg/osx/polipo.conf	2009-08-13 19:59:29 UTC (rev 4033)
@@ -0,0 +1,161 @@
+### Basic configuration
+### *******************
+
+# Uncomment one of these if you want to allow remote clients to
+# connect:
+
+# proxyAddress = "::0"        # both IPv4 and IPv6
+# proxyAddress = "0.0.0.0"    # IPv4 only
+
+proxyAddress = "127.0.0.1"
+proxyPort = 8118
+
+# If you do that, you'll want to restrict the set of hosts allowed to
+# connect:
+
+# allowedClients = "127.0.0.1, 134.157.168.57"
+# allowedClients = "127.0.0.1, 134.157.168.0/24"
+
+allowedClients = 127.0.0.1
+allowedPorts = 1-65535
+
+# Uncomment this if you want your Polipo to identify itself by
+# something else than the host name:
+
+proxyName = "localhost"
+
+# Uncomment this if there's only one user using this instance of Polipo:
+
+cacheIsShared = false
+
+# Uncomment this if you want to use a parent proxy:
+
+# parentProxy = "squid.example.org:3128"
+
+# Uncomment this if you want to use a parent SOCKS proxy:
+
+socksParentProxy = "localhost:9050"
+socksProxyType = socks5
+
+
+### Memory
+### ******
+
+# Uncomment this if you want Polipo to use a ridiculously small amount
+# of memory (a hundred C-64 worth or so):
+
+# chunkHighMark = 819200
+# objectHighMark = 128
+
+# Uncomment this if you've got plenty of memory:
+
+# chunkHighMark = 50331648
+# objectHighMark = 16384
+
+chunkHighMark = 33554432
+
+### On-disk data
+### ************
+
+# Uncomment this if you want to disable the on-disk cache:
+
+diskCacheRoot = ""
+
+# Uncomment this if you want to put the on-disk cache in a
+# non-standard location:
+
+# diskCacheRoot = "~/.polipo-cache/"
+
+# Uncomment this if you want to disable the local web server:
+
+localDocumentRoot = ""
+
+# Uncomment this if you want to enable the pages under /polipo/index?
+# and /polipo/servers?.  This is a serious privacy leak if your proxy
+# is shared.
+
+# disableIndexing = false
+# disableServersList = false
+
+disableLocalInterface = true
+disableConfiguration = true
+
+### Domain Name System
+### ******************
+
+# Uncomment this if you want to contact IPv4 hosts only (and make DNS
+# queries somewhat faster):
+#
+# dnsQueryIPv6 = no
+
+# Uncomment this if you want Polipo to prefer IPv4 to IPv6 for
+# double-stack hosts:
+#
+# dnsQueryIPv6 = reluctantly
+
+# Uncomment this to disable Polipo's DNS resolver and use the system's
+# default resolver instead.  If you do that, Polipo will freeze during
+# every DNS query:
+
+dnsUseGethostbyname = yes
+
+
+### HTTP
+### ****
+
+# Uncomment this if you want to enable detection of proxy loops.
+# This will cause your hostname (or whatever you put into proxyName
+# above) to be included in every request:
+
+disableVia = true
+
+# Uncomment this if you want to slightly reduce the amount of
+# information that you leak about yourself:
+
+# censoredHeaders = from, accept-language
+# censorReferer = maybe
+
+censoredHeaders = from,accept-language,x-pad,link
+censorReferer = maybe
+
+# Uncomment this if you're paranoid.  This will break a lot of sites,
+# though:
+
+# censoredHeaders = set-cookie, cookie, cookie2, from, accept-language
+# censorReferer = true
+
+# Uncomment this if you want to use Poor Man's Multiplexing; increase
+# the sizes if you're on a fast line.  They should each amount to a few
+# seconds' worth of transfer; if pmmSize is small, you'll want
+# pmmFirstSize to be larger.
+
+# Note that PMM is somewhat unreliable.
+
+# pmmFirstSize = 16384
+# pmmSize = 8192
+
+# Uncomment this if your user-agent does something reasonable with
+# Warning headers (most don't):
+
+# relaxTransparency = maybe
+
+# Uncomment this if you never want to revalidate instances for which
+# data is available (this is not a good idea):
+
+# relaxTransparency = yes
+
+# Uncomment this if you have no network:
+
+# proxyOffline = yes
+
+# Uncomment this if you want to avoid revalidating instances with a
+# Vary header (this is not a good idea):
+
+# mindlesslyCacheVary = true
+
+# Suggestions from Incognito configuration
+maxConnectionAge = 5m
+maxConnectionRequests = 120
+serverMaxSlots = 8
+serverSlots = 2
+tunnelAllowedPorts = 1-65535

Modified: vidalia/branches/extension-api/pkg/osx/vidalia.conf.sample
===================================================================
--- vidalia/branches/extension-api/pkg/osx/vidalia.conf.sample	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/osx/vidalia.conf.sample	2009-08-13 19:59:29 UTC (rev 4033)
@@ -1,9 +1,9 @@
 [General]
-ProxyExecutable=/Applications/Vidalia.app/polipo
-ProxyExecutableArguments=-c, /Applications/Vidalia.app/tor-polipo.conf
+ProxyExecutable=/Applications/Vidalia.app/Contents/MacOS/polipo
+ProxyExecutableArguments=-c, /Applications/Vidalia.app/Contents/Resources/tor-polipo.conf
 RunProxyAtStart=true
 InterfaceStyle=Macintosh (Aqua)
 
 [Tor]
-TorExecutable=/Applications/Vidalia.app/tor
+TorExecutable=/Applications/Vidalia.app/Contents/MacOS/tor
 DataDirectory=~/.tor/

Modified: vidalia/branches/extension-api/pkg/package.sh
===================================================================
--- vidalia/branches/extension-api/pkg/package.sh	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/package.sh	2009-08-13 19:59:29 UTC (rev 4033)
@@ -16,113 +16,13 @@
 # Check for proper script arguments
 if [ "$#" -eq 0 ]
 then
-  echo "Usage: $0 <tarball|win32|osx|osx-bundle|osx-split-bundle>"
+  echo "Usage: $0 <rpm>"
   exit 1
 fi
 
 # Make the distribution depending on what type was requested
 case "$1" in
 #
-# Source tarball (.tar.gz)
-#
-"tarball")
-  # Put the tarball in the current directory
-  destdir=`pwd`
-  srcdir=`dirname $(pwd) | sed -e "s/.*\///"`
-  tarball="$destdir/$srcdir.tar.gz"
-  
-  echo "Creating source tarball: $tarball"  
-  pushd "../.." 1>/dev/null
-  filelist=`svn ls -R $srcdir/ | 
-              sed -e "s/^/$srcdir\/&/" | 
-              sed -e "/\/$/d" |
-              sed -e "s/\n/ /"`
-  tar -czf "$tarball" $filelist
-  popd -1 1>/dev/null
-  ;;
- 
-#
-# OS X .dmg
-#
-"osx")
-  mkdir ../LEGAL 
-  mkdir ../.background
-  cp -R ../README ../src/vidalia/Vidalia.app ../
-  cp osx/background.png ../.background/
-  cp osx/nonbundle-ds_store ../.DS_Store
-  cp ../CREDITS ../CHANGELOG ../Vidalia.app/
-  cp ../LICENSE ../LICENSE-GPLV2 ../LICENSE-GPLV3 ../LICENSE-LGPLV3 ../LICENSE-OPENSSL ../LEGAL/
-  cp -R ../LEGAL ../Vidalia.app/
-  srcdir="../"
-  srcfiles="Vidalia.app README LEGAL .background .DS_Store"
-  osx/builddmg.sh "$srcdir" "$srcfiles"
-  ;;
-
-#
-# OS X (Bundle)
-#
-"osx-bundle")
-  if [ $# -ne 4 ]
-  then
-    echo "Usage: $0 osx-bundle <path-to-tor> <path-to-polipo> <path-to-torbutton-file>"
-    exit 1
-  fi
-  torpath="$2"
-  polipopath="$3"
-  torbuttonpath="$4"
-  torversion=`echo "$torpath" | sed -e "s/.*\///" | sed -e "s/tor-//"`
-  
-  mkdir ../LEGAL
-  mkdir ../.background
-  cp -R ../README ../src/vidalia/Vidalia.app ../
-  cp osx/background.png ../.background/
-  cp osx/bundle-ds_store ../.DS_Store
-  cp osx/vidalia.conf.sample ../Vidalia.app/Contents/Resources/vidalia.conf
-  cp ../CREDITS ../CHANGELOG ../Vidalia.app/
-  cp ../LICENSE ../LICENSE-GPLV2 ../LICENSE-GPLV3 ../LICENSE-LGPLV3 ../LICENSE-OPENSSL ../LEGAL/
-  cp -R ../LEGAL ../Vidalia.app/
-  cp $torpath/src/or/tor $torpath/src/tools/tor-checkkey $torpath/src/tools/tor-gencert $torpath/src/tools/tor-resolve ../Vidalia.app/
-  cp $torpath/src/config/geoip $torpath/src/config/torrc.sample ../Vidalia.app/
-  cp $polipopath/polipo $polipopath/contrib/tor-polipo.conf ../Vidalia.app/
-  cp $torbuttonpath ../Vidalia.app/
-  srcdir="../"
-  srcfiles="Vidalia.app README LEGAL .background .DS_Store"
-  osx/builddmg.sh "$srcdir" "$srcfiles" "bundle" "$torversion"
-  ;;
-
-#
-# OS X (Split Bundle)
-#
-"osx-split-bundle")
-  if [ $# -ne 4 ]
-  then
-    echo "Usage: $0 osx-split-bundle <path-to-tor> <path-to-polipo> <path-to-torbutton-file>"
-    exit 1
-  fi
-  torpath="$2"
-  polipopath="$3"
-  torbuttonpath="$4"
-  torversion=`echo "$torpath" | sed -e "s/.*\///" | sed -e "s/tor-//"`
-  
-  mkdir ../LEGAL
-  mkdir ../.background
-  cp -R ../README ../src/vidalia/Vidalia.app ../
-  cp osx/background.png ../.background/
-  cp osx/bundle-ds_store ../.DS_Store
-  cp osx/vidalia.conf.sample ../Vidalia.app/Contents/Resources/vidalia.conf
-  cp ../CREDITS ../CHANGELOG ../Vidalia.app/
-  cp ../LICENSE ../LICENSE-GPLV2 ../LICENSE-GPLV3 ../LICENSE-LGPLV3 ../LICENSE-OPENSSL ../LEGAL/
-  cp -R ../LEGAL ../Vidalia.app/
-  cp $torpath/src/or/tor $torpath/src/tools/tor-checkkey $torpath/src/tools/tor-gencert $torpath/src/tools/tor-resolve ../Vidalia.app/
-  cp $torpath/src/config/geoip $torpath/src/config/torrc.sample ../Vidalia.app/
-  cp $polipopath/polipo $polipopath/contrib/tor-polipo.conf ../Vidalia.app/
-  cp $torbuttonpath ../Vidalia.app/
-  srcdir="../"
-  srcfiles="Vidalia.app README LEGAL .background .DS_Store"
-  osx/builddmg.sh "$srcdir" "$srcfiles" "split-bundle" "$torversion"
-  ;;
-  
-#
 #  rpm package
 #
 "rpm")

Modified: vidalia/branches/extension-api/pkg/rpm/vidalia.spec.in
===================================================================
--- vidalia/branches/extension-api/pkg/rpm/vidalia.spec.in	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/rpm/vidalia.spec.in	2009-08-13 19:59:29 UTC (rev 4033)
@@ -1,159 +1,144 @@
-##
-##  $Id$
-## 
-##  This file is part of Vidalia, and is subject to the license terms in the
-##  LICENSE file, found in the top level directory of this distribution. If 
-##  you did not receive the LICENSE file with this file, you may obtain it
-##  from the Vidalia source package distributed by the Vidalia Project at
-##  http://www.vidalia-project.net/. No part of Vidalia, including this file,
-##  may be copied, modified, propagated, or distributed except according to
-##  the terms described in the LICENSE file.
-##
+Name:             vidalia
+Version:          @VERSION@
+Release:          2%{?dist}
+Summary:          GUI controller for the Tor Onion Routing Network
 
-#%package vidalia
+Group:            Applications/Internet
+License:          GPLv2+
+URL:              https://www.torproject.org/vidalia/
+Source0:          https://www.torproject.org/%{name}/dist/%{name}-%{version}.tar.gz
+Source1:          %{name}.desktop
+BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
 
-%define _prefix   /usr/local
-%define _mandir   %{_prefix}/share/man
+BuildRequires:    desktop-file-utils
+BuildRequires:    openssl-devel
+BuildRequires:    qt4-devel
+BuildRequires:    cmake
 
-Name          : vidalia
-Version       : @VERSION@
-Release       : RH5_3
-#
-License       : GPL
-Summary       : A Tor GUI for Linux
-Group         : Applications/Internet
+Requires:         tor
+Requires:         privoxy
+Requires:         hicolor-icon-theme
 
-URL           : https://www.torproject.org/vidalia/
-Vendor        : Matt Edman, Justin Hipple
-Packager      : Oliver Niesner <digi_news@xxxxxx> 
 
-Source0       : %{name}-%{version}.tar.gz
+%description
+Vidalia is a cross-platform controller GUI for Tor, built using the Qt 
+framework. Vidalia allows you to start and stop Tor, view the status of Tor at 
+a glance, and monitor Tor's bandwidth usage. Vidalia also makes it easy to 
+contribute to the Tor network by helping you setup a Tor server, if you wish.
 
-#AutoReq      : No
-#AutoProv     : No
 
-Requires      : tor >= 0.2.0.34
-BuildRequires : qt4 >= 4.2
-# This fails on some systems because they lack a cmake rpm, such as
-# Redhat 5 and earlier
-BuildRequires : cmake >= 2.4
-BuildRoot     : /var/tmp/%{name}-buildroot
+%package doc
+Summary:        Documentation for %{name}
+Group:          Documentation
+BuildRequires:  doxygen
+Requires:       %{name} = %{version}-%{release}
 
-%description
 
-Vidalia is an easy-to-use Tor controller GUI
+%description doc
+Doxygen generated documentations for %{name}.
 
+
 %prep
-rm -rf %{buildroot}
+%setup -q
 
-#######################################################################
-# setup macro
-# -a num  : Only unpack source number after changing to the directory
-# -b num  : Only unpack source number before changing to the directory
-# -c      : Create directory before unpacking.
-# -D      : Do not delete the directory before unpacking
-# -n name : Name the directory as name
-# -q      : Run quiety with minimum output
-# -T      : Disable the automatic unpacking of the archives.
-#######################################################################
-%setup
-%build  
 
-cmake -DQT_QMAKE_EXECUTABLE=/usr/lib/qt4/bin/qmake . && make
+%build
+%if 0%{?_qt4_bindir:1}
+PATH=%{_qt4_bindir}:$PATH; export PATH
+%else
+PATH=%{_libdir}/qt4/bin:$PATH; export PATH
+%endif
 
+%cmake .
 
-#########################################################
-# Common Red Hat RPM macros (rpm --showrc for more info)
-# {_sourcedir} : /usr/src/redhat/SOURCES
-# {_builddir}  : /usr/src/redhat/BUILD
-# {_tmppath}   : /var/tmp
-# {_libdir}    : /usr/lib
-# {_bindir}    : /usr/bin
-# {_datadir}   : /usr/share
-# {_mandir}    : /usr/share/man
-# {_docdir}    : /usr/share/doc
-# {buildroot}
-# {name}
-# {version}
-# {release}
-#########################################################
+make %{?_smp_mflags}
 
-%install
+cd doc
+doxygen Doxyfile.in
 
-make install DESTDIR=%{buildroot}
-#mkdir -p %{_prefix}/share/man/man1/
-#cp %{buildroot}/doc/vidalia.1 %{_prefix}/share/man/man1
-#%post
 
-%clean
+%install
 rm -rf %{buildroot}
 
-%files
-%{_prefix}/bin/vidalia
-%{_prefix}/share/applications/vidalia.desktop
-#%{_prefix}/share/man/man1/vidalia.1
-#%{_builddir}/%{name}-%{version}/doc/vidalia.1
-%{_prefix}/share/icons/hicolor/128x128/apps/vidalia.png
-%{_prefix}/share/icons/hicolor/16x16/apps/vidalia.png
-%{_prefix}/share/icons/hicolor/22x22/apps/vidalia.png
-%{_prefix}/share/icons/hicolor/32x32/apps/vidalia.png
-%{_prefix}/share/icons/hicolor/48x48/apps/vidalia.png
-%{_prefix}/share/icons/hicolor/64x64/apps/vidalia.png
+make install \
+     INSTALL="install -p" \
+     DESTDIR=%{buildroot}
 
+rm -rf  %{buildroot}%{_datadir}/applications/%{name}.desktop
 
-#####################################################
-# defattr sets the default attributes for all files
-#####################################################
-%defattr(-, root, root)
+install -Dpm0644 doc/%{name}.1 \
+        %{buildroot}%{_mandir}/man1/%{name}.1
 
-%changelog
-* Wed May 06 2009 Oliver Niesner <digi_news@xxxxxx> 0.1.12
-- fix rebuild errors due wrong version usage of qmake
-- added additional icons
+desktop-file-install \
+        %if 0%{?rhel}
+        --vendor="" \
+        %endif
+        --dir %{buildroot}%{_datadir}/applications \
+        %{SOURCE1}
 
-* Sat Apr 11 2009 Andrew Lewman <andrew@xxxxxxxxxxxxxx> 0.1.6-2
-- fix required Tor version
-- start integration into "package.sh"
+mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}-doxygen/
+install -Dpm0644 doc/html/* \
+        %{buildroot}%{_docdir}/%{name}-%{version}-doxygen/
 
-* Mon Mar 23 2009 Oliver Niesner <digi_news@xxxxxx> 0.1.12
-- bump to 0.1.12
 
-* Mon Nov 3 2008 Oliver Niesner <digi_news@xxxxxx> 0.1.6-1
-- bump to 0.1.10
+%post
+touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
 
-* Wed Jul 30 2008  Oliver Niesner <digi_news@xxxxxx> 0.1.6-1
-- bump to 0.1.6 
-- fix man path 
 
-* Mon Mar 31 2008 Oliver Niesner <digi_news@xxxxxx> 0.1.2-1
-- bump to 0.1.2
+%postun
+if [ $1 -eq 0 ] ; then
+    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
+    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+fi
 
-* Tue Mar 04 2008 Oliver Niesner <digi_news@xxxxxx> 0.1.0-1
-- bump to 0.1.0 and modifications to meet cmake requirements!
 
-* Mon Nov 26 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.16-1
-- bump to 0.0.16
+%posttrans
+gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 
-* Thu Oct 29 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.15-1
--  bump to 0.0.15
 
-* Thu Aug 30 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.14-1
-- bump to 0.0.14
+%clean
+rm -rf %{buildroot}
 
-* Thu Aug 07 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.13-1
-- bump to 0.0.13
 
-* Thu Jun 05 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.12-1
-- bump to 0.0.12
+%files
+%defattr(-,root,root,-)
+%doc CHANGELOG CREDITS HACKING LICENSE LICENSE-GPLV2 LICENSE-GPLV3 LICENSE-OPENSSL README
+%{_bindir}/%{name}
+%{_mandir}/man1/%{name}*
+%{_datadir}/applications/%{name}.desktop
+%{_datadir}/icons/hicolor/*/apps/%{name}.png
 
-* Thu Feb 08 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.11-1
-- bump to 0.0.11 release
 
-* Mon Jan 08 2007 Oliver Niesner <digi_news@xxxxxx> 0.0.10-1
-- bump to 0.0.10 release
+%files doc
+%defattr(-,root,root,-)
+%{_docdir}/%{name}-%{version}-doxygen/
 
-* Mon Nov 06 2006 Oliver Niesner <digi_news@xxxxxx> 0.0.9-1
-- first release build for 0.0.9
 
-* Tue Oct 11 2006 Oliver Niesner <digi_news@xxxxxx> 0.0.8-1
-- initial release
+%changelog
+* Sat Jun 13 2009 Matt Edman <edmanm@xxxxxxxxxxxxxxxxxxx> - 0.2.1-1
+- Added to Vidalia Subversion repository
+
+* Mon Jun 01 2009 Simon Wesp <cassmodiah@xxxxxxxxxxxxxxxxx> - 0.1.13-2
+- Merge builds for fedora and epel
+
+* Mon Jun 01 2009 Simon Wesp <cassmodiah@xxxxxxxxxxxxxxxxx> - 0.1.13-1
+- Update to 0.1.13
+- Adjust to fedora and epel
+
+* Sun Apr 06 2009 Simon Wesp <cassmodiah@xxxxxxxxxxxxxxxxx> - 0.1.12-1
+- New upstream release
+- Correct typo in URL
+- Add R: hicolor for new handling of icons
+- Add update-icon-cache sniplet
+- Use summary of upstream for Desktopfile and in spec file
+- Create doxygen-documentations
+
+* Sun Feb 15 2009 Simon Wesp <cassmodiah@xxxxxxxxxxxxxxxxx> - 0.1.10-2
+- Correct Qt in Summary
+- Correct Qt in desktop-file-source
+- Add a german Translation in the desktop-file-source
+- Using CMAKE-macro instead of cmake
+- Add more files to more documentation
+
+* Tue Feb 10 2009 Simon Wesp <cassmodiah@xxxxxxxxxxxxxxxxx> - 0.1.10-1
+- Initial Package build

Modified: vidalia/branches/extension-api/pkg/win32/CMakeLists.txt
===================================================================
--- vidalia/branches/extension-api/pkg/win32/CMakeLists.txt	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/win32/CMakeLists.txt	2009-08-13 19:59:29 UTC (rev 4033)
@@ -168,7 +168,7 @@
   COMMAND ${WIX_LIGHT_EXECUTABLE}
       ${CMAKE_CURRENT_BINARY_DIR}/vidalia.wixobj
       ${CMAKE_CURRENT_BINARY_DIR}/WixUI_Custom.wixobj
-      -o ${CMAKE_CURRENT_BINARY_DIR}/vidalia-${VERSION}.msi
+      -o ${Vidalia_BINARY_DIR}/vidalia-${VERSION}.msi
       -ext ${WIX_BINARY_DIR}/WixUIExtension.dll
   
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vidalia.wxs 

Modified: vidalia/branches/extension-api/pkg/win32/build-vidalia-installer.txt
===================================================================
--- vidalia/branches/extension-api/pkg/win32/build-vidalia-installer.txt	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/win32/build-vidalia-installer.txt	2009-08-13 19:59:29 UTC (rev 4033)
@@ -44,44 +44,18 @@
   
   Configure Vidalia as follows:
 
-    cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=minsizerel ..
+    cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=minsizerel \
+          -DMINGW_BINARY_DIR=C:\<PathToMinGW>\bin            \
+          -DOPENSSL_BINARY_DIR=C:\<PathToOpenSSL>\bin ..
 
+  MINGW_BINARY_DIR should point to the MinGW installation directory that
+  contains mingwm10.dll. OPENSSL_BINARY_DIR should point to the OpenSSL
+  installation directory that contains ssleay32.dll and libeay32.dll.
+
   Finally, compile Vidalia by running:
   
     make
 
-
-1.2. Collect Required Dependencies 
-
-  Create a "bin" directory by running the following command from your build
-  directory:
-
-    mkdir bin
-
-
-  Copy the following Qt .dll files from your Qt installation into your "bin"
-  directory:
-
-    copy $QTDIR\QtCore4.dll bin\
-    copy $QTDIR\QtGui4.dll bin\
-    copy $QTDIR\QtNetwork4.dll bin\
-    copy $QTDIR\QtXml4.dll bin\
-  
-  where "$QTDIR" is the path to your Qt installation.
-
-
-  Copy the MinGW .dll file into your "bin" directory:
-
-    copy $MINGWDIR\bin\mingwm10.dll bin\
-
-  where "$MINGWDIR" is the path to your MinGW installation.
-
-
-  Copy the Vidalia executable into your "bin" directory:
-
-    copy src\vidalia\vidalia.exe bin\
-
-
 1.3. Create the Executable Installer
 
   Open Windows Explorer and navigate to

Modified: vidalia/branches/extension-api/pkg/win32/fa/vidalia_fa.po
===================================================================
--- vidalia/branches/extension-api/pkg/win32/fa/vidalia_fa.po	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/win32/fa/vidalia_fa.po	2009-08-13 19:59:29 UTC (rev 4033)
@@ -3,8 +3,8 @@
 "Project-Id-Version: Vidalia\n"
 "Report-Msgid-Bugs-To: translations@xxxxxxxxxxxxxxxxxxx\n"
 "POT-Creation-Date: 2008-07-12 05:29+0000\n"
-"PO-Revision-Date: 2008-07-17 03:19+0000\n"
-"Last-Translator: Matt <edmanm@xxxxxxxxxxxxxxxxxxx>\n"
+"PO-Revision-Date: 2009-06-23 05:14+0000\n"
+"Last-Translator: Nami B <pesarefahmideh@xxxxxxxxx>\n"
 "Language-Team: translations@xxxxxxxxxxxxxxxxxxx\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -38,24 +38,28 @@
 "\n"
 "$_CLICK"
 msgstr ""
-"ا?ن دست?ار شما را در سرتاسر ?ار?ذار? تور، و?دال?ا، ?ر?وا?س? و د?مه تور هدا?ت "
-"م? ?ند.\n"
+"این دستیار شما را در طی بارگذاری تُر، ویدالیا، پریواکسی، و تُرباتِن "
+"راه‌نمایی می‌کند.\n"
 "\n"
-"ا?ر شما ??شتر تور، و?دال?ا، ?ر?وا?س? ?ا فا?رفا?س را ?ار?ذار? ?رده ا?د، "
-"خواهشمند است ??ش از ادامه دادن ا?ن ?ار?ذار? اطم?نان ??دا ?ن?د ?ه آنها درحال "
-"اجرا نم? باشند.\n"
-"\n"
+"تُر سیستمی برای استفاده از اینترنت به‌صورت ناشناس است و به شما کمک می‌کند که "
+"کارهایی مثل گردش و نوشتن در وب، پیام فوری، IRC را مخفی کنید.\n"
+"پریواکسی یک پراکسی برای فیلتر کردن وب است که از حریم شخصی شما محافظت می‌کند "
+"و تبلیغات را حذف می‌کند.\n"
+"تُرباتِن یک افزونه‌ی فایرفاکس است که به شما اجازه می‌دهد امکان گردش ناشناس "
+"در وب را به‌سرعت فعال یا غیرفعال کنید.\n"
+"اگر پیش از این تُر، ویدالیا، پریواکس، یا فایرفاکس را نصب کرده‌اید، خواهشمند "
+"است از بسته بودن آن‌ها در حین نصب این برنامه اطمینان پیدا کنید.\n"
 "$_CLICK"
 
 #, fuzzy
 msgctxt "BundleWelcomeTitle"
 msgid "Welcome to the ${BUNDLE_NAME} Setup Wizard"
-msgstr "به دست?ار بر?ا?? ${BUNDLE_NAME} خوش آمد?د"
+msgstr "به دستیار تنظیم ${BUNDLE_NAME} خوش آمدید"
 
 #, fuzzy
 msgctxt "BundleLinkText"
 msgid "${TOR_NAME} installation documentation"
-msgstr "مستندات ?ار?ذار? ${TOR_NAME}"
+msgstr "مستندات بارگذاری ${TOR_NAME}"
 
 #, fuzzy
 msgctxt "BundleFinishText"

Modified: vidalia/branches/extension-api/pkg/win32/vidalia-bundle.nsi.in
===================================================================
--- vidalia/branches/extension-api/pkg/win32/vidalia-bundle.nsi.in	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/win32/vidalia-bundle.nsi.in	2009-08-13 19:59:29 UTC (rev 4033)
@@ -24,7 +24,7 @@
 
 !define TOR_NAME            "Tor"
 !define TOR_EXEC            "tor.exe"
-!define TOR_APPVERSION      "0.2.1.5"
+!define TOR_APPVERSION      "0.2.1.19"
 !define TOR_DESC            "${TOR_NAME} ${TOR_APPVERSION}"
 
 !define PRIVOXY_NAME        "Privoxy"
@@ -33,7 +33,7 @@
 !define PRIVOXY_DESC        "${PRIVOXY_NAME} ${PRIVOXY_APPVERSION}"
 
 !define TORBUTTON_NAME      "Torbutton"
-!define TORBUTTON_APPVERSION "1.2.0"
+!define TORBUTTON_APPVERSION "1.2.1-fx"
 !define TORBUTTON_DESC      "${TORBUTTON_NAME} ${TORBUTTON_APPVERSION}"
 
 !define BUNDLE_NAME         "Vidalia Bundle"
@@ -163,6 +163,7 @@
       File "@QT_BINARY_DIR@\QtXml4.dll"
       File "@MINGW_BINARY_DIR@\mingwm10.dll"
       File "@OPENSSL_BINARY_DIR@\ssleay32.dll"
+      File "@OPENSSL_BINARY_DIR@\libeay32.dll"
       File "@Vidalia_SOURCE_DIR@\README"
       File "@Vidalia_SOURCE_DIR@\CHANGELOG"
       File "@Vidalia_SOURCE_DIR@\LICENSE"
@@ -177,7 +178,7 @@
       CreateDirectory "$APPDATA\Vidalia"
       SetOutPath "$APPDATA\Vidalia"
       File "@Vidalia_SOURCE_DIR@\pkg\geoip-cache"
-      
+
       ;If there's already a torrc config file, ask if they want to
       ;overwrite it with the new one.
       StrCpy $configfile "torrc"
@@ -248,7 +249,10 @@
        File "@TOR_PACKAGE_DIR@\tor.exe"
        File "@TOR_PACKAGE_DIR@\tor-resolve.exe"
        WriteIniStr "$INSTDIR\Tor\Tor Website.url" "InternetShortcut" "URL" "https://www.torproject.org";
-
+       ; Include tor's geoip file, too
+       SetOutPath "$APPDATA\Tor"
+       File "@TOR_PACKAGE_DIR@\geoip"
+       
        ; If the user is also installing Vidalia, then don't confuse them by
        ; an extra torrc in %APPDATA%\Tor
        SectionGetFlags ${Vidalia} $0
@@ -256,7 +260,6 @@
        IntCmp $0 ${SF_SELECTED} skiptorrc
 
        StrCpy $configfile "torrc"
-       SetOutPath "$APPDATA\Tor"
 
        ; If there's already a torrc config file, ask if they want to
        ; overwrite it with the new one.

Modified: vidalia/branches/extension-api/pkg/win32/vidalia.nsi.in
===================================================================
--- vidalia/branches/extension-api/pkg/win32/vidalia.nsi.in	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/win32/vidalia.nsi.in	2009-08-13 19:59:29 UTC (rev 4033)
@@ -140,6 +140,7 @@
   File "@Vidalia_BINARY_DIR@\src\vidalia\${VIDALIA_EXEC}"
   File "@MINGW_BINARY_DIR@\mingwm10.dll"
   File "@OPENSSL_BINARY_DIR@\ssleay32.dll"
+  File "@OPENSSL_BINARY_DIR@\libeay32.dll"
   File "@QT_BINARY_DIR@\QtCore4.dll"
   File "@QT_BINARY_DIR@\QtGui4.dll"
   File "@QT_BINARY_DIR@\QtNetwork4.dll"

Modified: vidalia/branches/extension-api/pkg/win32/vidalia.wxs.in
===================================================================
--- vidalia/branches/extension-api/pkg/win32/vidalia.wxs.in	2009-08-13 04:37:11 UTC (rev 4032)
+++ vidalia/branches/extension-api/pkg/win32/vidalia.wxs.in	2009-08-13 19:59:29 UTC (rev 4033)
@@ -6,23 +6,24 @@
 
   <?define VidaliaVersion="@VER_MAJOR@.@VER_MINOR@.@VER_PATCH@" ?>
   <?define VidaliaUpgradeCode="B7FBFE11-D7CA-4895-A1FB-1D7E065E4D04" ?>
-  <?define VidaliaProductGuid="B3C22D59-D907-4559-9569-92AAA34DB6F0" ?>
-  <?define VidaliaDocumentsGuid="6A51C86C-A7D4-407f-9B84-7ADCE016E939" ?>
-  <?define QtLibraryGuid="00F354CB-B313-4100-8900-11293A66B385" ?>
-  <?define QtImageFormatPluginsGuid="9A0F1EA5-3A5F-4456-B211-9368C24E22F3" ?>
-  <?define MinGWLibraryGuid="2287E844-F9CD-4129-8BD0-50D071698194" ?>
-  <?define OpenSSLLibraryGuid="C3EDC2EC-D0B1-452a-83A6-85B0BC94735B" ?>
-  <?define MarbleWidgetLibraryGuid="A2968B8D-0E23-4649-B8F3-A988A04F823C" ?>
-  <?define MarblePluginsGuid="B4665EC1-3082-4fca-AA7E-60512ED62EF6" ?>
-  <?define MarbleLegendsDataGuid="FA6F733F-8249-4b2b-B978-2AA04E06F5D5" ?>
-  <?define MarbleBlueMarbleDataGuid="392FEE6B-374A-447a-AECC-0422915305DB" ?>
-  <?define MarbleCityLightsDataGuid="DBF9FBE7-012D-4457-ABB4-9085F7E784F8" ?>
-  <?define MarbleMwdbiiDataGuid="56ACE658-6892-408a-91E5-7B5BD23D8829" ?>
-  <?define MarbleSrtmDataGuid="2C3A9C67-92CB-4fc6-A2F6-AD9118AFD58C" ?>
-  <?define MarblePlacemarkDataGuid="27D54547-A819-435b-9A0C-13284169A9D9" ?>
-  <?define MarbleStarsDataGuid="8C5C3F32-67E6-4a4a-9B6C-6D67A6D44D67" ?>
-  <?define MarbleSvgDataGuid="03E25BCA-4C58-4571-9F17-061D52877714" ?>
+  <?define VidaliaProductGuid="9CED970A-609E-445F-92E9-4953BA719AAB" ?>
+  <?define VidaliaDocumentsGuid="C5D61CEA-E771-42C0-8927-2F8ACF1B5C81" ?>
+  <?define QtLibraryGuid="1CEE0A99-2D66-4751-AD8D-FF0DAEFCA884" ?>
+  <?define QtImageFormatPluginsGuid="1F77ADF0-3A71-43FD-BB4F-0EE5BEF2D332" ?>
+  <?define MinGWLibraryGuid="6F3AD487-30AC-41DA-8E66-709F9C338BEA" ?>
+  <?define OpenSSLLibraryGuid="38526B26-5AC9-4A87-AA8F-1424AABA750F" ?>
+  <?define MarbleWidgetLibraryGuid="7B25BC58-4FC8-4F83-BD75-33E1A7515709" ?>
+  <?define MarblePluginsGuid="92CB0A17-D454-48D0-8BBD-FDBA03297440" ?>
+  <?define MarbleLegendsDataGuid="0A7426F7-CE04-490B-B356-F319F4D0DB2C" ?>
+  <?define MarbleBlueMarbleDataGuid="155C7022-1FF4-40BE-BCD2-A29EB0D24C6E" ?>
+  <?define MarbleCityLightsDataGuid="F98A6880-DEB1-457B-9D34-DE8306BDF24A" ?>
+  <?define MarbleMwdbiiDataGuid="1E15BFA1-359E-408E-8E1F-86358A623048" ?>
+  <?define MarbleSrtmDataGuid="FDC19ED3-0BB5-4A26-9F46-ECA30FDFC091" ?>
+  <?define MarblePlacemarkDataGuid="F5156F6D-3CFA-46CD-955A-2619C05AD5CD" ?>
+  <?define MarbleStarsDataGuid="0A69C6D9-B8A1-4729-9960-4A8719A9A595" ?>
+  <?define MarbleSvgDataGuid="292FA084-F847-4A65-A415-8E9712CBDC3D" ?>
   <?define UseMarble="@USE_MARBLE@"?>
+  <?define UseBreakpad="@USE_BREAKPAD@"?>
 
   <Product Name="Vidalia @VERSION@" Id="$(var.VidaliaProductGuid)"
            Language="1033" Codepage="1252"
@@ -33,7 +34,7 @@
     <Package Id="*" Keywords="Installer"
              Description="Vidalia @VERSION@ Installer"
              Manufacturer="vidalia-project.net"
-             InstallerVersion="100" Compressed="yes"
+             InstallerVersion="300" Compressed="yes"
              Languages="1033"  SummaryCodepage="1252" />
 
     <Media Id="1" Cabinet="Vidalia.cab" CompressionLevel="high"
@@ -79,7 +80,7 @@
       <!-- Main Vidalia application files -->
       <Component Id="VidaliaExecutable" Guid="*">
         <File Id="VidaliaExe" DiskId="1"
-              Name="vidalia.exe" Source="@Vidalia_BINARY_DIR@\src\vidalia\vidalia.exe" />
+              Name="vidalia.exe" Source="@VIDALIA_EXECUTABLE@" />
       </Component>
 
       <!-- Vidalia-related documents -->
@@ -120,18 +121,31 @@
         <?endif?>
       </Component>
 
-      <!-- MinGW-related library files -->
-      <Component Id="MinGWLibrary" Guid="$(var.MinGWLibraryGuid)">
-        <File Id="MinGWDll" DiskId="1"
-              Name="mingwm10.dll" Source="@MINGW_BINARY_DIR@\mingwm10.dll" />
-      </Component>
-
       <!-- OpenSSL-related library files -->
       <Component Id="OpenSSLLibrary" Guid="$(var.OpenSSLLibraryGuid)">
         <File Id="ssleay32dll" DiskId="1"
               Name="ssleay32.dll" Source="@OPENSSL_BINARY_DIR@\ssleay32.dll" />
+        <File Id="libeay32dll" DiskId="1"
+              Name="libeay32.dll" Source="@OPENSSL_BINARY_DIR@\libeay32.dll" />
       </Component>
-      
+
+      <?if $(var.UseBreakpad) = "ON"?>
+        <!-- Builds with Breakpad support must include the CRT. -->
+        <Merge Id="CRT" Language="0" DiskId="1"
+               SourceFile="C:\Program Files\Common Files\Merge Modules\microsoft_vc90_crt_x86.msm" />
+        <Component Id="CrashReporterExecutable" Guid="*">
+          <File Id="CrashReporterExe" DiskId="1"
+                Name="crashreporter.exe"
+                Source="@VIDALIA_CRASHREPORTER_EXECUTABLE@" />
+        </Component>
+      <?else?>
+        <!-- Include MinGW-related library files -->
+        <Component Id="MinGWLibrary" Guid="$(var.MinGWLibraryGuid)">
+          <File Id="MinGWDll" DiskId="1"
+                Name="mingwm10.dll" Source="@MINGW_BINARY_DIR@\mingwm10.dll" />
+        </Component>
+      <?endif?>
+
       <?if $(var.UseMarble) = "ON"?>
         <!-- Marble-related library files -->
         <Component Id="MarbleWidgetLibrary" Guid="$(var.MarbleWidgetLibraryGuid)">
@@ -303,7 +317,6 @@
         <ComponentRef Id="VidaliaExecutable" />
         <ComponentRef Id="VidaliaDocuments" />
         <ComponentRef Id="QtLibrary" />
-        <ComponentRef Id="MinGWLibrary" />
         <ComponentRef Id="OpenSSLLibrary" />
         <?if $(var.UseMarble) = "ON"?>
           <ComponentRef Id="QtImageFormatPlugins" />
@@ -311,6 +324,12 @@
           <ComponentRef Id="MarblePlugins" />
           <ComponentGroupRef Id="MarbleData"/>
         <?endif?>
+        <?if $(var.UseBreakpad) = "ON"?>
+          <MergeRef Id="CRT"/>
+          <ComponentRef Id="CrashReporterExecutable"/>
+        <?else?>
+          <ComponentRef Id="MinGWLibrary" />
+        <?endif?>
       </Feature>
       <Feature Id="Shortcuts" Title="Shortcuts"
                AllowAdvertise="no" Absent="allow" Level="1"