--- Makefile.am.orig	2009-09-08 23:11:08.000000000 -0400
+++ Makefile.am	2009-09-12 13:32:39.000000000 -0400
@@ -1,20 +1,20 @@
 OPENJDK_VERSION = b66
 
-OPENJDK_CHANGESET = e7eeeda332ec
-CORBA_CHANGESET = 1741ea5cb854
-JAXP_CHANGESET = b3d2bf4c255d
-JAXWS_CHANGESET = c37936a72332
-JDK_CHANGESET = 51fcc41d8b24
-LANGTOOLS_CHANGESET = 634f519d6f9a
-HOTSPOT_CHANGESET = 945fcffdbcab
-
-OPENJDK_MD5SUM = 8f63dbb0dcd83d905e243c58d0135174
-CORBA_MD5SUM = 06ac898f583fc9eec179fc2d1dcb5c71
-JAXP_MD5SUM = 01118a1882ea1ac5205e232bd7c847f7
-JAXWS_MD5SUM = 8c53573f9f072bb273435ee75c7aaaa3
-JDK_MD5SUM = 5ca832939f80db7c2e836141a9cac98a
-LANGTOOLS_MD5SUM = cd1389112baa1b2b24da95555345c1b9
-HOTSPOT_MD5SUM = ce3ab877df030cf4842001918898244e
+OPENJDK_CHANGESET = 428565383a55
+CORBA_CHANGESET = d78d74f54632
+JAXP_CHANGESET = 25b32432ad4c
+JAXWS_CHANGESET = d2b6b2d2581d
+JDK_CHANGESET = ac301b6fdfad
+LANGTOOLS_CHANGESET = 41a366b862a2
+HOTSPOT_CHANGESET = 4256b1662add
+
+OPENJDK_MD5SUM = 4b21f32c4b61a31a59ddce92b7641c7c
+CORBA_MD5SUM = ee1aefb1f2371011e30eedf5166d13ff
+JAXP_MD5SUM = f47e800c83813ec7bf5bf37235f71ae9
+JAXWS_MD5SUM = 4a199b6dba3906ebd17af77b02c9794e
+JDK_MD5SUM = 077b359417c0e3643e81354e6c6efaf8
+LANGTOOLS_MD5SUM = 5e6dedf7204ab5aeaeb08ddaf145589c
+HOTSPOT_MD5SUM = b6740f515b71e1edf22dc433f1f13e24
 
 CACAO_VERSION = 0.99.4
 CACAO_MD5SUM = 63220327925ace13756ae334c55a3baa
@@ -1703,16 +1703,17 @@
 CVMI_HG_URL = http://hg.openjdk.java.net/cvmi/cvmi/
 CLOSURES_HG_URL = http://hg.openjdk.java.net/closures/closures/
 CACIOCAVALLO_HG_URL = http://hg.openjdk.java.net/caciocavallo/jdk7/
+#BSD_HG_URL = /Volumes/Data/Users/mfranz/developer/openjdk-bsd/repos/bsd-port-b66
 BSD_HG_URL = http://hg.openjdk.java.net/bsd-port/bsd-port
 NIO2_HG_URL = http://hg.openjdk.java.net/nio/nio/
 
-OPENJDK_URL = $(ICEDTEA_HG_URL)
-CORBA_URL = $(ICEDTEA_HG_URL)/corba
-JAXP_URL = $(ICEDTEA_HG_URL)/jaxp
-JAXWS_URL = $(ICEDTEA_HG_URL)/jaxws
-JDK_URL = $(ICEDTEA_HG_URL)/jdk
-LANGTOOLS_URL = $(ICEDTEA_HG_URL)/langtools
-HOTSPOT_URL = $(ICEDTEA_HG_URL)/hotspot
+OPENJDK_URL = $(BSD_HG_URL)
+CORBA_URL = $(BSD_HG_URL)/corba
+JAXP_URL = $(BSD_HG_URL)/jaxp
+JAXWS_URL = $(BSD_HG_URL)/jaxws
+JDK_URL = $(BSD_HG_URL)/jdk
+LANGTOOLS_URL = $(BSD_HG_URL)/langtools
+HOTSPOT_URL = $(BSD_HG_URL)/hotspot
 
 if USE_HG
   OPENJDK_SRC_ZIP = 
@@ -1792,14 +1793,11 @@
 if USE_CACIOCAVALLO
 	$(HG) fclone $(CACIOCAVALLO_HG_URL) openjdk;
 else
-if USE_BSD
-	$(HG) fclone $(BSD_HG_URL) openjdk;
-else
 if USE_NIO2
 	hg fclone $(NIO2_HG_URL) openjdk;
 else
 if USE_JDK7
-	hg fclone $(OPENJDK_HG_URL) openjdk;
+        hg fclone $(OPENJDK_HG_URL) openjdk;
 else
 if USE_HG
 if WITH_HGREV
@@ -1808,6 +1806,7 @@
 	$(HG) fclone $(ICEDTEA_HG_URL) openjdk;
 endif
 else
+if USE_BSD
 	if ! echo "$(OPENJDK_MD5SUM)  $(OPENJDK_SRC_ZIP)" \
 	  | $(MD5SUM) --check ; \
 	then \
@@ -1975,7 +1974,7 @@
 	for target in $(abs_top_srcdir)/ports/hotspot/make/*/makefiles/* \
 		      $(abs_top_srcdir)/ports/hotspot/src/cpu/zero/vm/* \
 		      $(abs_top_srcdir)/ports/hotspot/src/share/vm/*; do \
-	  link=$$(dirname $$target | sed 's/^.*ports/openjdk/'|sed "s#hotspot/build#hotspot/make#"); \
+	  link=$$(dirname $$target | $(SED) 's/^.*ports/openjdk/'|sed "s#hotspot/build#hotspot/make#"); \
 	  ln -sfv $$target $$link; \
 	done
 	if ! test "x$(ICEDTEA_CORE_BUILD)$(ICEDTEA_SHARK_BUILD)$(WITH_CACAO)" \
@@ -2018,7 +2017,6 @@
 	patches/icedtea-float-double-trailing-zeros.patch \
 	patches/hotspot/$(HSBUILD)/icedtea-memory-limits.patch \
 	patches/icedtea-sunsrc.patch \
-	patches/icedtea-libraries.patch \
 	patches/icedtea-core-build.patch \
 	patches/icedtea-zero-build.patch \
 	patches/icedtea-print-lsb-release.patch \
@@ -2030,21 +2028,17 @@
 	patches/hotspot/$(HSBUILD)/icedtea-sparc-ptracefix.patch \
 	patches/hotspot/$(HSBUILD)/icedtea-sparc-trapsfix.patch \
 	patches/icedtea-override-redirect-metacity.patch \
-	patches/icedtea-shark-build.patch \
-	patches/hotspot/$(HSBUILD)/icedtea-shark-build.patch \
 	patches/icedtea-security-updates.patch \
 	patches/icedtea-jdk-docs-target.patch \
 	patches/icedtea-mbeanintrospector.patch \
 	patches/icedtea-hotspot-gcc-pr36917.patch \
 	patches/icedtea-alpha-fixes.patch \
 	patches/icedtea-alt-jar.patch \
-	patches/icedtea-jdk-use-ssize_t.patch \
 	patches/hotspot/$(HSBUILD)/icedtea-use-idx_t.patch \
 	patches/hotspot/$(HSBUILD)/icedtea-params-cast-size_t.patch \
 	patches/icedtea-clean-crypto.patch \
 	patches/hotspot/$(HSBUILD)/icedtea-shark.patch \
 	$(GCC_PATCH) \
-	patches/cacao/arch.patch \
 	patches/icedtea-signed-types.patch \
 	patches/icedtea-lc_ctype.patch \
 	patches/icedtea-xjc.patch \
@@ -2052,7 +2046,6 @@
 	patches/icedtea-tests-jdk.patch \
 	patches/icedtea-stroker-finish.patch \
 	patches/icedtea-alsa-default-device.patch \
-	patches/icedtea-linker-libs-order.patch \
 	patches/icedtea-testenv.patch \
 	patches/icedtea-samejvm-safe.patch \
 	patches/icedtea-pr261.patch \
@@ -2132,7 +2125,7 @@
 
 stamps/extract.stamp: stamps/download.stamp
 if OPENJDK_SRC_DIR_FOUND
-	cp -a $(OPENJDK_SRC_DIR) openjdk
+	${CP) -a $(OPENJDK_SRC_DIR) openjdk
 else
 	if ! test -d openjdk ; then \
 	  if [ ! -z $(OPENJDK_SRC_ZIP) ] ; then \
@@ -2140,7 +2133,7 @@
 	      *.zip) $(UNZIP) -q $(OPENJDK_SRC_ZIP) ;; \
 	      *.tar.*) $(TAR) xf $(OPENJDK_SRC_ZIP) ;; \
 	    esac; \
-	    mv jdk7-$(OPENJDK_CHANGESET) openjdk ; \
+	    mv bsd-port-$(OPENJDK_CHANGESET) openjdk ; \
 	    if test "x${HSBUILD}" != "xdefault"; then \
 	      rm -rf openjdk/hotspot ; \
 	    fi ; \
@@ -2231,7 +2224,7 @@
 	chmod -R ug+w openjdk 
 	sh $(srcdir)/fsg.sh ; 
 	find openjdk -name '*.java' \
-	  -exec sed -i 's/^[[:space:]]*@Override//' {} + ; \
+	  -exec $(SED) -i 's/^[[:space:]]*@Override//' {} + ; \
 	mkdir -p stamps 
 	touch stamps/extract.stamp
 
@@ -2253,7 +2246,7 @@
 
 stamps/generated.stamp: stamps/extract-cacao.stamp
 	if [ ! -e $(abs_top_builddir)/generated ]; then \
-	  cp -a $(abs_top_srcdir)/generated $(abs_top_builddir); \
+	  $(CP) -a $(abs_top_srcdir)/generated $(abs_top_builddir); \
 	  find $(abs_top_builddir)/generated -type f -exec chmod 640 '{}' ';' \
 	    -o -type d -exec chmod 750 '{}' ';'; \
 	fi
@@ -2269,7 +2262,7 @@
 	do \
 	  if test x$${all_patches_ok} == "xyes" \
 	     && echo Checking $$p \
-	     && $(PATCH) -l -p1 --dry-run -s -t -f -F 0 < $(abs_top_srcdir)/$$p ; \
+	     && $(PATCH) -l -p1 --dry-run -s -t -f -F 3 < $(abs_top_srcdir)/$$p ; \
 	  then \
 	    echo Applying $$p ; \
 	    $(PATCH) -l -p1 < $(abs_top_srcdir)/$$p ; \
@@ -2283,7 +2276,7 @@
 	  if test x$${all_patches_ok} = "xyes" \
 	    && echo Checking $$p \
 	    && $(PATCH) -l -p0 --dry-run -s -t -f \
-	      -F 0 < $(abs_top_srcdir)/$$p ; \
+	      -F 3 < $(abs_top_srcdir)/$$p ; \
 	  then \
 	    echo Applying $$p ; \
 	    $(PATCH) -l -p0 < $(abs_top_srcdir)/$$p ; \
@@ -2305,14 +2298,14 @@
 	mv stamps/patch.stamp.tmp stamps/patch.stamp 
 
 if ENABLE_NPPLUGIN
-	cp -a $(abs_top_srcdir)/plugin/icedteanp/java/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
+	$(CP) -a $(abs_top_srcdir)/plugin/icedteanp/java/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
 	mkdir -p rt
-	cp -a $(abs_top_srcdir)/plugin/icedteanp/java/netscape rt/
+	$(CP) -a $(abs_top_srcdir)/plugin/icedteanp/java/netscape rt/
 else
 if ENABLE_PLUGIN
-	cp -a $(abs_top_srcdir)/plugin/icedtea/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
+	$(CP) -a $(abs_top_srcdir)/plugin/icedtea/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
 	mkdir -p rt
-	cp -a $(abs_top_srcdir)/plugin/icedtea/netscape rt/
+	$(CP) -a $(abs_top_srcdir)/plugin/icedtea/netscape rt/
 	chmod -R ug+w rt 
 endif
 endif
@@ -2363,7 +2356,7 @@
 	  if test x$${all_patches_ok} = "xyes" \
 	    && echo Checking $$p \
 	    && $(PATCH) -l -p0 --dry-run -s -t -f \
-	      -F 0 < $(abs_top_srcdir)/$$p ; \
+	      -F 3 < $(abs_top_srcdir)/$$p ; \
 	  then \
 	    echo Applying $$p ; \
 	    $(PATCH) -l -p0 < $(abs_top_srcdir)/$$p ; \
@@ -2427,7 +2420,7 @@
 	if test x"$(VERSION_SUFFIX)" != "x"; then \
 	  ver_suffix="-$(VERSION_SUFFIX)"; \
 	fi ; \
-	sed -i "s#BUILD_VARIANT_RELEASE)#BUILD_VARIANT_RELEASE)$${proj_suffix}$${ver_suffix}#" \
+	$(SED) -i "s#BUILD_VARIANT_RELEASE)#BUILD_VARIANT_RELEASE)$${proj_suffix}$${ver_suffix}#" \
 	  openjdk/jdk/make/common/shared/Defs.gmk; \
 	cp -r $(abs_top_srcdir)/overlays/openjdk/* openjdk/
 	chmod -R ug+w openjdk 
@@ -2439,7 +2432,7 @@
 # Copy over OpenJDK sources for ecj.
 stamps/clone-ecj.stamp: stamps/overlay.stamp
 	if ! test -d openjdk-ecj ; then \
-	    cp -pPRl openjdk openjdk-ecj ; \
+	    $(CP) -pPRl openjdk openjdk-ecj ; \
 	fi
 	mkdir -p stamps
 	touch stamps/clone-ecj.stamp
@@ -2492,7 +2485,7 @@
 	  if test x$${all_patches_ok} = "xyes" \
 	    && echo Checking $$p \
 	    && $(PATCH) -l -p0 --dry-run -s -t -f \
-	      -F 0 < $(abs_top_srcdir)/$$p ; \
+	      -F 3 < $(abs_top_srcdir)/$$p ; \
 	  then \
 	    echo Applying $$p ; \
 	    $(PATCH) -l -p0 < $(abs_top_srcdir)/$$p ; \
@@ -2740,7 +2733,7 @@
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset ; \
 	grep "client IGNORE" $(BUILD_JRE_ARCH_DIR)/jvm.cfg; \
 	if test $$? -eq 0; then \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
 	else \
@@ -2826,7 +2819,7 @@
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset ; \
 	grep "client IGNORE" $(BUILD_JRE_ARCH_DIR)/jvm.cfg; \
 	if test $$? -eq 0; then \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
 	else \
@@ -3159,7 +3152,7 @@
 	(cd $(abs_top_builddir)/netx.build ; \
 	 mkdir -p lib ; \
 	 $(ICEDTEA_BOOT_DIR)/bin/jar cf lib/classes.jar javax/jnlp net ; \
-	 cp -a $(abs_top_srcdir)/netx src; \
+	 $(CP) -a $(abs_top_srcdir)/netx src; \
 	 find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
 	 cd src ; \
 	 $(ICEDTEA_BOOT_DIR)/bin/jar uf $(abs_top_builddir)/netx.build/lib/classes.jar \
@@ -3185,7 +3178,7 @@
 	ln -s $(JIBX_DIR)/jibx-run.jar $(JIBX_DEPS_DIR)
 else
 	mkdir -p $(BUILD_OUTPUT_DIR)/gensrc/javax/swing/plaf
-	cp -a $(abs_top_builddir)/generated/javax/swing/plaf/nimbus \
+	$(CP) -a $(abs_top_builddir)/generated/javax/swing/plaf/nimbus \
 	  $(BUILD_OUTPUT_DIR)/gensrc/javax/swing/plaf
 endif
 endif
@@ -3459,7 +3452,7 @@
 		$(ARCH_PREFIX) $(MAKE) -C zerovm $(ICEDTEA_BUILD_TARGET)
 
 	mkdir -p $(BUILD_JRE_ARCH_DIR)/zero
-	cp -a zerovm/openjdk/build/$(OS_DIR)/hotspot/import/jre/lib/$(INSTALL_ARCH_DIR)/server/* \
+	$(CP) -a zerovm/openjdk/build/$(OS_DIR)/hotspot/import/jre/lib/$(INSTALL_ARCH_DIR)/server/* \
 		$(BUILD_JRE_ARCH_DIR)/zero/
 	printf -- '-zero KNOWN\n' >> $(BUILD_JRE_ARCH_DIR)/jvm.cfg
 else
@@ -3479,7 +3472,7 @@
 		$(ARCH_PREFIX) $(MAKE) -C zerovm $(ICEDTEA_DEBUG_BUILD_TARGET)
 
 	mkdir -p $(BUILD_DEBUG_JRE_ARCH_DIR)/zero
-	cp -a zerovm/openjdk/build/$(OS_DIR)/hotspot/import/jre/lib/$(INSTALL_ARCH_DIR)/server/* \
+	$(CP) -a zerovm/openjdk/build/$(OS_DIR)/hotspot/import/jre/lib/$(INSTALL_ARCH_DIR)/server/* \
 		$(BUILD_DEBUG_JRE_ARCH_DIR)/zero/
 	printf -- '-zero KNOWN\n' >> $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg
 else
@@ -3549,7 +3542,7 @@
 # FIXME: this might need some adjustment for other OS than Linux
 jtreg_processes = ps x -ww -o pid,ppid,args \
 	| awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,/scratch)/' \
-	| sed 's,$(CURDIR)/$(sdkimg),<sdkimg>,g;s,$(CURDIR),<pwd>,g'
+	| $(SED) 's,$(CURDIR)/$(sdkimg),<sdkimg>,g;s,$(CURDIR),<pwd>,g'
 jtreg_pids = ps x --no-headers -ww -o pid,ppid,args \
 	| awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,$(CURDIR)/$(sdkimg))/ {print $$1}'
 
