--- Config.kmk.orig	2012-06-20 08:07:42.000000000 -0500
+++ Config.kmk	2012-08-19 05:22:48.000000000 -0500
@@ -1147,7 +1147,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
@@ -1873,7 +1873,11 @@
   endif
   VBOX_PATH_MACOSX_SDK ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk
  else
-  VBOX_PATH_MACOSX_SDK ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
+  ifneq ($(wildcard /Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk),)
+   VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
+  else
+   VBOX_PATH_MACOSX_SDK = $(shell xcode-select -print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
+  endif
  endif
 
  ## The Xcode version.
@@ -1967,6 +1971,13 @@
  endif
 
  if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5 10.6)
+  ifndef VBOX_PATH_MACOSX_SDK_10_6
+   ifneq ($(wildcard $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.6.sdk),)
+    VBOX_PATH_MACOSX_SDK_10_6           = $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.6.sdk
+   else
+    VBOX_PATH_MACOSX_SDK_10_6           = $(shell xcode-select -print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
+   endif
+  endif
   VBOX_PATH_MACOSX_SDK_10_6            ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.6.sdk
   VBOX_DARWIN_DEF_SDK_10_6_DEFS        := MAC_OS_X_VERSION_MIN_REQUIRED=1060 MAC_OS_X_VERSION_MAX_ALLOWED=1060
   VBOX_DARWIN_DEF_SDK_10_6_CFLAGS      := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
@@ -1985,7 +1996,7 @@
    ifneq ($(wildcard $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk),)
     VBOX_PATH_MACOSX_SDK_10_7           = $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk
    else
-    VBOX_PATH_MACOSX_SDK_10_7           = $(PATH_DEVTOOLS)/darwin.x86/SDKs/MacOSX10.7.sdk
+    VBOX_PATH_MACOSX_SDK_10_7           = $(shell xcode-select -print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
    endif
   endif
   VBOX_DARWIN_DEF_SDK_10_7_DEFS        := MAC_OS_X_VERSION_MIN_REQUIRED=1070 MAC_OS_X_VERSION_MAX_ALLOWED=1070
@@ -2165,22 +2176,22 @@
 VBOX_GCC32_CHECK_CXX = $(2)
 else
 VBOX_GCC_CHECK_CC = $(shell \
-   if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(subst -Wno-,-W,$(1)) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
+   if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(subst -Wno-,-W,$(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) $(subst -Wno-,-W,$(1)) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
+   if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(subst -Wno-,-W,$(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
@@ -4218,25 +4229,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 $(filter %-$(tolower $(VBOX_VCC_TOOL_STEM)),$(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*))))
-  else if1of ($(KBUILD_TARGET), linux 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,11 @@
+VBOX_DEF_MACOSX_VERSION_MIN = @MACOSX_DEPLOYMENT_TARGET@
+VBOX_DARWIN_NO_COMPACT_LINKEDIT =
+VBOX_MACOS_10_5_WORKAROUND =
+VBOX_PATH_APP_DOCS = "@APPLICATIONS_DIR@/VirtualBox.app/Contents/MacOS"
+VBOX_PATH_APP_PRIVATE = "@APPLICATIONS_DIR@/VirtualBox.app/Contents/MacOS"
+VBOX_PATH_APP_PRIVATE_ARCH = "@APPLICATIONS_DIR@/VirtualBox.app/Contents/MacOS"
+VBOX_PATH_SHARED_LIBS = "@APPLICATIONS_DIR@/VirtualBox.app/Contents/MacOS"
+VBOX_WITH_MULTIVERSION_PYTHON = 1
+VBOX_WITH_TESTSUITE =
+VBOX_WITH_TESTCASES =
+kBuildGlobalDefaults_LD_DEBUG =
--- Makefile.kmk.orig	2011-08-15 19:38:16.000000000 -0500
+++ Makefile.kmk	2011-08-15 19:38:16.000000000 -0500
@@ -111,53 +111,6 @@
 endif
 
 #
-# 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
- if defined(VBOX_WITH_QT4_SUN) || defined(VBOX_WITH_QT4_PAYLOAD)
-  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
-
-
-#
 # For building the combined package, just get the additions .ISO
 # once for amd64 to prevent version inconsistences. In all other
 # cases we get the .ISO per target architecture.
--- configure.orig	2011-08-15 19:38:16.000000000 -0500
+++ configure	2011-08-15 19:38:16.000000000 -0500
@@ -1068,21 +1068,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"`
@@ -1091,7 +1076,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
@@ -1439,53 +1423,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=$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=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
               pkg-config QtCore --cflags`
           INCQT4=`strip_I "$FLGQT4"`
           LIBQT4=`\
-              PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
               PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
               pkg-config QtCore --libs`
           foundqt4=1
@@ -1527,7 +1478,6 @@
         fi
       done
     fi
-  fi
   if [ -n "$foundqt4" ]; then
     cat > $ODIR.tmp_src.cc << EOF
 #include <cstdio>
@@ -1547,21 +1497,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
@@ -1607,7 +1542,6 @@
               fi
             fi
           done
-        fi
       fi
     else
       log_failure "qt4 not working"
@@ -2066,19 +2000,55 @@
   test_header "Darwin version"
   darwin_ver=`uname -r`
   case "$darwin_ver" in
+    12\.*)
+      darwin_ver="10.8" # Mountain Lion
+
+      if { test -d "`xcode-select -print-path`/SDKs/MacOSX10.7.sdk"; } then
+          sdk="`xcode-select -print-path`/SDKs/MacOSX10.7.sdk"
+      else
+          sdk="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
+      fi
+
+      CXX_FLAGS="-mmacosx-version-min=10.7 -isysroot $sdk -Wl,-syslibroot,$sdk"
+      ;;
     11\.*)
       darwin_ver="10.7" # Lion
-      sdk=/Developer/SDKs/MacOSX10.6.sdk
-      CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
+
+      if { test -d "`xcode-select -print-path`/SDKs/MacOSX10.6.sdk"; } then
+          # Developer tools are not bundled in Xcode.app.
+          sdk="`xcode-select -print-path`/SDKs/MacOSX10.6.sdk"
+          CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
+      elif { test -d "`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; } then
+          # Developer tools are bundled in Xcode.app.
+          sdk="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"
+          CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
+      else
+          # Developer tools are bundled in Xcode.app and there's no 10.6 SDK; default to 10.7.
+          sdk="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
+          CXX_FLAGS="-mmacosx-version-min=10.7 -isysroot $sdk -Wl,-syslibroot,$sdk"
+      fi
       ;;
     10\.*)
       darwin_ver="10.6" # Snow Leopard
+
       if [ "$BUILD_MACHINE" = "x86" ]; then
-          sdk=/Developer/SDKs/MacOSX10.5.sdk
+
+          if { test -d "`xcode-select -print-path`/SDKs/MacOSX10.5.sdk"; } then
+              sdk="`xcode-select -print-path`/SDKs/MacOSX10.5.sdk"
+          else
+              sdk="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk"
+          fi
+
           CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
           cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
       else
-          sdk=/Developer/SDKs/MacOSX10.6.sdk
+
+          if { test -d "/Developer/SDKs/MacOSX10.6.sdk"; } then
+              sdk="/Developer/SDKs/MacOSX10.6.sdk"
+          else
+              sdk="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"
+          fi
+
           CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
       fi
 #      test "$CC" = "gcc" && CC="gcc-4.0"
@@ -2275,7 +2245,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-ow-dir=*)
       WATCOM=`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 \
@@ -169,7 +162,6 @@
      endif
 
     endif
-   endif # Unices
   endif
   # Found it?
   ifeq ($(PATH_SDK_QT4),)
@@ -184,18 +176,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)
@@ -959,23 +941,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/libs/xpcom18a4/Config.kmk.orig  2013-01-21 13:27:34.000000000 -0500
+++ src/libs/xpcom18a4/Config.kmk   2013-01-21 13:27:34.000000000 -0500
@@ -228,6 +228,7 @@
  TEMPLATE_XPCOMOSX104_INCS.darwin        = $(VBOX_PATH_MACOSX_SDK_10_4)/Developer/Headers/FlatCarbon
 endif
 
+ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.5)
 #
 # Template for building VBoxPython against the Mac OS X 10.5 SDK.
 # ASSUMES that the SDK bits are in the .darwin properties we're overriding below.
@@ -239,7 +240,9 @@
 TEMPLATE_XPCOMOSX105_LDFLAGS.darwin     = $(filter-out $(VBOX_DARWIN_DEF_SDK_LDFLAGS),$(TEMPLATE_XPCOM_LDFLAGS.darwin)) $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS)
 TEMPLATE_XPCOMOSX105_DEFS.darwin        = $(filter-out $(VBOX_DARWIN_DEF_SDK_DEFS),$(TEMPLATE_XPCOM_DEFS.darwin)) $(VBOX_DARWIN_DEF_SDK_10_5_DEFS)
 TEMPLATE_XPCOMOSX105_INCS.darwin        = $(VBOX_PATH_MACOSX_SDK_10_5)/Developer/Headers/FlatCarbon
+endif
 
+ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.6)
 #
 # Template for building VBoxPhython against the Mac OS X 10.6 SDK.
 # ASSUMES that the SDK bits are in the .darwin properties we're overriding below.
@@ -251,7 +254,9 @@
 TEMPLATE_XPCOMOSX106_LDFLAGS.darwin     = $(filter-out $(VBOX_DARWIN_DEF_SDK_LDFLAGS),$(TEMPLATE_XPCOM_LDFLAGS.darwin)) $(VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS)
 TEMPLATE_XPCOMOSX106_DEFS.darwin        = $(filter-out $(VBOX_DARWIN_DEF_SDK_DEFS),$(TEMPLATE_XPCOM_DEFS.darwin)) $(VBOX_DARWIN_DEF_SDK_10_6_DEFS)
 TEMPLATE_XPCOMOSX106_INCS.darwin        = $(VBOX_PATH_MACOSX_SDK_10_6)/Developer/Headers/FlatCarbon
+endif
 
+ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.7)
 #
 # Template for building VBoxPhython against the Mac OS X 10.7 SDK.
 # ASSUMES that the SDK bits are in the .darwin properties we're overriding below.
@@ -264,6 +269,7 @@
 TEMPLATE_XPCOMOSX107_LDFLAGS.darwin     = $(filter-out $(VBOX_DARWIN_DEF_SDK_LDFLAGS),$(TEMPLATE_XPCOM_LDFLAGS.darwin)) $(VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS)
 TEMPLATE_XPCOMOSX107_DEFS.darwin        = $(filter-out $(VBOX_DARWIN_DEF_SDK_DEFS),$(TEMPLATE_XPCOM_DEFS.darwin)) $(VBOX_DARWIN_DEF_SDK_10_7_DEFS)
 TEMPLATE_XPCOMOSX107_INCS.darwin        = $(VBOX_PATH_MACOSX_SDK_10_7)/Developer/Headers/FlatCarbon
+endif
 
 
 #
--- src/libs/xpcom18a4/python/Makefile.kmk.orig	2012-08-21 20:52:14.000000000 -0400
+++ src/libs/xpcom18a4/python/Makefile.kmk	2012-08-21 20:53:59.000000000 -0400
@@ -34,14 +34,14 @@
   VBOX_PYTHON25_LIB = $(VBOX_PATH_MACOSX_SDK)/usr/lib/libpython2.5.dylib
  endif
  if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) \
-  && (   !defined(VBOX_OSE) \
-      || "$(wildcard $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib)" != "")
+  && defined(VBOX_PATH_MACOSX_SDK_10_6)
+  && ("$(wildcard $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib)" != "")
   VBOX_PYTHON26_INC = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/include/python2.6
   VBOX_PYTHON26_LIB = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib
  endif
  if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7) \
-  && (   defined(VBOX_NOT_OSE_LATER_SOMETIME) \
-      || "$(wildcard $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib)" != "")
+  && defined(VBOX_PATH_MACOSX_SDK_10_7)
+  && ("$(wildcard $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib)" != "")
   VBOX_PYTHON27_INC = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/include/python2.7
   VBOX_PYTHON27_LIB = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib
  endif
