--- Config.kmk.orig	2011-08-15 19:38:16.000000000 -0500
+++ Config.kmk	2011-08-15 19:38:16.000000000 -0500
@@ -1094,7 +1094,7 @@
 # of VirtualBox binaries.  We request though that you always use something that
 # clearly identifies your build and makes it clear that it is not one done by
 # the VirtualBox team.
- VBOX_BUILD_PUBLISHER = _OSE
+ VBOX_BUILD_PUBLISHER = _MacPorts
 endif
 
 # Keep in sync with G_virtualBoxPackage in glue-jaxws.xsl and glue-java.xsl
@@ -2065,22 +2065,22 @@
 VBOX_GCC32_CHECK_CXX = $(2)
 else
 VBOX_GCC_CHECK_CC = $(shell \
-   if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
+   if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -xc /dev/null > /dev/null 2>&1; \
    then echo "$(1)"; \
    else echo "$(2)"; fi; )
 
 VBOX_GCC_CHECK_CXX = $(shell \
-   if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
+   if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -xc++ /dev/null > /dev/null 2>&1; \
    then echo "$(1)"; \
    else echo "$(2)"; fi; )
 
 VBOX_GCC_CHECK_LD = $(shell \
-   if $(TOOL_$(VBOX_GCC_TOOL)_LD) -Wl,$(1) $(if $(eq $(KBUILD_HOST),darwin),-Wl$(COMMA)-u$(COMMA)start -Wl$(COMMA)-undefined$(COMMA)dynamic_lookup,) -nostdlib -o /dev/null -xc /dev/null > /dev/null 2>&1 ;\
+   if $(TOOL_$(VBOX_GCC_TOOL)_LD) -Wl,$(1) $(if $(eq $(KBUILD_HOST),darwin),-Wl$(COMMA)-u$(COMMA)start -Wl$(COMMA)-undefined$(COMMA)dynamic_lookup,) -nostdlib -xc /dev/null > /dev/null 2>&1 ;\
    then echo "-Wl,$(1)"; \
    else echo "$(2)"; fi; )
 
 VBOX_GCC32_CHECK_CXX = $(shell \
-   if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
+   if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -xc++ /dev/null > /dev/null 2>&1; \
    then echo "$(1)"; \
    else echo "$(2)"; fi; )
 endif
@@ -3945,25 +3945,6 @@
  # be cleaned up properly later some time (not important now).
  #
  ifeq ($(VBOX_PATH_QT4),)
-  ifeq ($(KBUILD_TARGET),darwin)
-   VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
-   ifeq ($(VBOX_PATH_QT4),)
-    ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
-     # Using the global installation (for OSE).
-     VBOX_PATH_QT4 ?= /usr
-     VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
-    endif
-   endif
-  else if1of ($(KBUILD_TARGET), win)
-   VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
-  else if1of ($(KBUILD_TARGET), solaris)
-   VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
-   ifneq ($(VBOX_PATH_QT4),)
-    VBOX_WITH_QT4_SUN = 1
-   endif
-  endif
- endif
- ifeq ($(VBOX_PATH_QT4),)
   if1of ($(USERNAME), bird)
    # gentoo (64-bit)
    VBOX_PATH_QT4          ?= /usr
--- /dev/null	2011-08-15 19:38:06.000000000 -0500
+++ LocalConfig.kmk	2011-08-15 19:38:17.000000000 -0500
@@ -0,0 +1,3 @@
+VBOX_DEF_MACOSX_VERSION_MIN = 10.6
+VBOX_DARWIN_NO_COMPACT_LINKEDIT =
+VBOX_MACOS_10_5_WORKAROUND =
--- Makefile.kmk.orig	2011-08-15 19:38:16.000000000 -0500
+++ Makefile.kmk	2011-08-15 19:38:16.000000000 -0500
@@ -182,47 +182,6 @@
 # Install our Qt DLLs / Shared Objects / Frameworks.
 # Note: The installer fixes the darwin .dylibs when hardening is enabled.
 #
-ifeq ($(KBUILD_TARGET),darwin)
- INSTALLS += qt4-bin
- qt4-bin_MODE = 755
- qt4-bin_INST = $(INST_VIRTUALBOX)Contents/
- qt4-bin_SOURCES = $(foreach qtmod,$(VBOX_QT4_MOD_NAMES) \
-  	,$(PATH_SDK_QT4_LIB)/$(qtmod).framework/Versions/4/$(qtmod)=>Frameworks/$(qtmod).framework/Versions/4/$(qtmod))
- ifdef VBOX_WITH_COCOA_QT
-  qt4-bin_SOURCES += \
-  	$(PATH_SDK_QT4_LIB)/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/classes.nib=>Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/classes.nib \
-  	$(PATH_SDK_QT4_LIB)/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/info.nib=>Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/info.nib \
-  	$(PATH_SDK_QT4_LIB)/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/keyedobjects.nib=>Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/keyedobjects.nib
- endif
- ifneq ($(wildcard $(VBOX_PATH_QT4)/plugins/accessible/libqtaccessiblewidgets.dylib),)
-  qt4-bin_SOURCES += \
-  	$(VBOX_PATH_QT4)/plugins/accessible/libqtaccessiblewidgets.dylib=>MacOS/accessible/libqtaccessiblewidgets.dylib
- endif
- qt4-bin_SYMLINKS = $(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
- 		,Frameworks/$(qtmod).framework/$(qtmod)=>Versions/4/$(qtmod))
- ifdef VBOX_WITH_COCOA_QT
-  qt4-bin_SYMLINKS += \
-  	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Resources=>Versions/4/Resources/
- endif
-else
- ifdef VBOX_WITH_QT4_SUN
-  ifeq ($(KBUILD_TARGET),win)
-   INSTALLS += qt4-bin
-   qt4-bin_MODE = 755
-   qt4-bin_INST = $(INST_BIN)
-   qt4-bin_SOURCES = \
-	$(foreach qtmod,$(VBOX_QT4_MOD_NAMES),$(VBOX_PATH_QT4_LIB)/$(qtmod)4$(SUFF_DLL)) \
- 	$(VBOX_PATH_QT4)/plugins/accessible/qtaccessiblewidgets4$(SUFF_DLL)=>accessible/qtaccessiblewidgets4$(SUFF_DLL)
-  else
-   INSTALLS += qt4-bin
-   qt4-bin_MODE = 755
-   qt4-bin_INST = $(INST_BIN)
-   qt4-bin_SOURCES = \
-	$(foreach qtmod,$(VBOX_QT4_MOD_NAMES),$(VBOX_PATH_QT4_LIB)/lib$(qtmod)$(SUFF_DLL).4) \
- 	$(VBOX_PATH_QT4)/plugins/accessible/libqtaccessiblewidgets$(SUFF_DLL)=>accessible/libqtaccessiblewidgets$(SUFF_DLL)
-  endif
- endif # VBOX_WITH_QT4_SUN
-endif
 
 
 #
--- configure.orig	2011-08-15 19:38:16.000000000 -0500
+++ configure	2011-08-15 19:38:16.000000000 -0500
@@ -96,10 +96,10 @@
 BUILD_LIBCURL=
 BUILD_LIBSSL=
 PASSIVE_MESA=0
-CC="gcc"
+CC="@CONFIGURE.CC@"
 CC32=""
 CC64=""
-CXX="g++"
+CXX="@CONFIGURE.CXX@"
 CXX32=""
 CXX64=""
 BCC="bcc"
@@ -1100,21 +1100,6 @@
 check_sdl()
 {
   test_header SDL
-  if [ "$OS" = "darwin" ]; then
-    if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
-      PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
-    elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
-      PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
-    fi
-    if [ -n "$PATH_SDK_LIBSDL" ]; then
-      foundsdl=1
-      INCSDL="$PATH_SDK_LIBSDL/Headers"
-      FLDSDL="-framework SDL"
-    else
-      log_failure "SDL framework not found"
-      fail
-    fi
-  else
     if which_wrapper sdl-config > /dev/null; then
       FLGSDL=`sdl-config --cflags`
       INCSDL=`strip_I "$FLGSDL"`
@@ -1123,7 +1108,6 @@
       FLDSDL=
       foundsdl=1
     fi
-  fi
   [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
   if [ -n "$foundsdl" ]; then
     cat > $ODIR.tmp_src.cc << EOF
@@ -1471,53 +1455,20 @@
 {
   foundqt4=
   test_header Qt4
-  if [ "$OS" = "darwin" ]; then
-    # First check if there is the internal version of Qt. If yes nothing else
-    # has to be done.
-    QT_INTERNAL=`/bin/ls -rd1 $PWD/tools/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
-    for t in $QT_INTERNAL; do
-        if [ -f "$t/Frameworks/QtCoreVBox.framework/QtCoreVBox" ]; then
-          cnf_append "VBOX_WITH_QT4_SUN" "1"
-          log_success "use internal version"
-          return
-        fi
-    done
-    # Now try the user provided directory and some of the standard directories.
-    QT_TRIES="$QT4DIR /System/Library /Library"
-    for t in $QT_TRIES; do
-        if [ -f "$t/Frameworks/QtCore.framework/QtCore" ]; then
-          PATH_SDK_QT4="$t"
-          break
-        fi
-    done
-    # Add the necessary params for building the test application
-    if [ -n "$PATH_SDK_QT4" ]; then
-      foundqt4=1
-      INCQT4=-I$PATH_SDK_QT4/Frameworks/QtCore.framework/Headers
-      LIBQT4=-F$PATH_SDK_QT4/Frameworks
-      FLGQT4="-framework QtCore"
-    else
-      log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
-      fail
-    fi
-  else
     if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
       # default is to use pkg-config
       if which_wrapper pkg-config > /dev/null; then
         # this braindead path is necessary for mdv2008.1
         qt4_ver=`\
-            PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
             pkg-config QtCore --modversion 2>> $LOG`
         if [ $? -ne 0 ]; then
           log_failure "QtCore not found"
           fail
         else
           FLGQT4=`\
-              PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
               pkg-config QtCore --cflags`
           INCQT4=`strip_I "$FLGQT4"`
           LIBQT4=`\
-              PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
               PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
               pkg-config QtCore --libs`
           foundqt4=1
@@ -1559,7 +1510,6 @@
         fi
       done
     fi
-  fi
   if [ -n "$foundqt4" ]; then
     cat > $ODIR.tmp_src.cc << EOF
 #include <cstdio>
@@ -1579,21 +1529,6 @@
     [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
     if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
       if test_execute_path "`strip_L "$LIBQT4"`"; then
-        if [ "$OS" = "darwin" ]; then
-          # Successful build & run the test application so add the necessary
-          # params to AutoConfig.kmk
-          cnf_append "PATH_SDK_QT4_INC" "$PATH_SDK_QT4/Frameworks"
-          cnf_append "PATH_SDK_QT4_LIB" "$PATH_SDK_QT4/Frameworks"
-          cnf_append "PATH_SDK_QT4" "$PATH_SDK_QT4/Frameworks"
-          # Check for the moc tool in the Qt directory found & some standard
-          # directories.
-          for q in $PATH_SDK_QT4 /usr /Developer/Tools/Qt; do
-            if which_wrapper "$q/bin/moc" > /dev/null; then
-              cnf_append "PATH_TOOL_QT4" "$q"
-              cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
-            fi
-          done
-        else
           # strip .../QtCore as we add components ourself
           INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
           # store only the first path, remove all other pathes
@@ -1639,7 +1574,6 @@
               fi
             fi
           done
-        fi
       fi
     else
       log_failure "qt4 not working"
@@ -2242,8 +2176,6 @@
   WITH_PULSE=0
   WITH_DBUS=0
   WITH_KMODS=0
-  BUILD_LIBXSLT=1
-  BUILD_LIBXML2=1
   [ $OSE -eq 1 ] || BUILD_LIBCURL=1
   [ $OSE -eq 1 ] || BUILD_LIBSSL=1
 fi
@@ -2281,7 +2213,7 @@
     --with-openssl-dir=*)
       OPENSSLDIR=`echo $option | cut -d'=' -f2`
       INCCRYPTO="-I${OPENSSLDIR}/include"
-      LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
+      LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.dylib ${OPENSSLDIR}/lib/libssl.dylib"
       ;;
     --with-gsoap-dir=*)
       GSOAP=`echo $option | cut -d'=' -f2`
--- kBuild/units/qt4.kmk.orig	2011-08-15 19:38:16.000000000 -0500
+++ kBuild/units/qt4.kmk	2011-08-15 19:38:16.000000000 -0500
@@ -70,13 +70,6 @@
  ifeq ($(PATH_SDK_QT4),)
   # If target == host, try look for Qt in the various platform specific places.
   ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
-   ifeq ($(KBUILD_TARGET),darwin)
-    PATH_SDK_QT4 := $(patsubst %/Frameworks/QtCore.framework/Versions/4,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/4)))
-   else ifeq ($(KBUILD_TARGET),win)
-    # No idea here yet...
-   else ifeq ($(KBUILD_TARGET),ose)
-    # No port...
-   else
     # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT4_LIB* stuff if it doesn't work.
     # Try find the general root of thing by looking for the qt3to4 program, if not found, then look for rcc.
     PATH_SDK_QT4 := $(patsubst %/bin/qt3to4,%,$(firstword $(wildcard \
@@ -163,7 +156,6 @@
      endif
 
     endif
-   endif # Unices
   endif
   # Found it?
   ifeq ($(PATH_SDK_QT4),)
@@ -178,18 +170,8 @@
 
 # Libraries can be in either Frameworks or lib depending on how you
 # build it on the mac. The .dmg installs into Frameworks but builds into lib.
-ifeq ($(KBUILD_TARGET),darwin)
- ifndef PATH_SDK_QT4_LIB
-  ifneq ($(wildcard $(PATH_SDK_QT4)/Frameworks),)
-   PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/Frameworks
-  else
-   PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
-  endif
- endif
-else
- PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
- PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
-endif
+PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
+PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
 
 # The bits that kBuild picks up.
 #  (nothing here)
@@ -953,23 +935,8 @@
  	$($(target)_QT_INFIX.$(bld_trg_cpu)) \
  	$($(target)_QT_INFIX.$(bld_type)) \
  	$($(target)_QT_INFIX))
-ifeq ($(bld_trg),darwin)
- # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
- $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
- $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
- $(eval $(target)_LDFLAGS  += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
- $(eval $(target)_INCS     += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
-else
- ifeq ($(bld_trg),win)
-  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
-  ifeq ($(tool_do),LINK_PROGRAM)
-   $(eval $(target)_LIBS   += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
-  endif
- else
-  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
- endif
- $(eval $(target)_INCS     += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
-endif
+$(eval $(target)_LIBS      += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
+$(eval $(target)_INCS      += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
 $(eval $(target)_DEFS      += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
 
 
--- src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp.orig	2011-08-15 19:38:17.000000000 -0500
+++ src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	2011-08-15 19:38:17.000000000 -0500
@@ -1454,7 +1454,7 @@
 
     /* Check for the already registered image */
     CVirtualBox vbox = vboxGlobal().virtualBox();
-    QString name = QString("VBoxGuestAdditions_%1.iso").arg(vbox.GetVersion().remove("_OSE"));
+    QString name = QString("VBoxGuestAdditions_%1.iso").arg(vbox.GetVersion().remove("_MacPorts"));
 
     CMediumVector vec = vbox.GetDVDImages();
     for (CMediumVector::ConstIterator it = vec.begin(); it != vec.end(); ++ it)
@@ -1470,7 +1470,7 @@
     int result = msgCenter().cannotFindGuestAdditions(QDir::toNativeSeparators(strSrc1), QDir::toNativeSeparators(strSrc2));
     if (result == QIMessageBox::Yes)
     {
-        QString source = QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_OSE")) + name;
+        QString source = QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_MacPorts")) + name;
         QString target = QDir(vboxGlobal().virtualBox().GetHomeFolder()).absoluteFilePath(name);
 
         UIDownloaderAdditions *pDl = UIDownloaderAdditions::create();
--- src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp.orig	2011-08-15 19:38:17.000000000 -0500
+++ src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	2011-08-15 19:38:17.000000000 -0500
@@ -2833,7 +2833,7 @@
         UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();
         /* Configure User Manual downloader: */
         CVirtualBox vbox = vboxGlobal().virtualBox();
-        pDl->addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_OSE")) + strShortFileName);
+        pDl->addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_MacPorts")) + strShortFileName);
         pDl->addSource(QString("http://download.virtualbox.org/virtualbox/") + strShortFileName);
         pDl->setTarget(strUserManualFileName2);
         pDl->setParentWidget(mainWindowShown());
