diff -uNr rpm-4.0.2.orig/Makefile.in rpm-4.0.2/Makefile.in
--- rpm-4.0.2.orig/Makefile.in	Mon Jan 22 09:17:37 2001
+++ rpm-4.0.2/Makefile.in	Tue Mar 27 20:40:22 2001
@@ -213,23 +213,23 @@
 
 rpmb_SOURCES = build.c
 rpmb_LDFLAGS = $(myLDFLAGS)
-rpmb_LDADD = rpmb.o $(myLDADD)
+rpmb_LDADD = rpmb.o $(myLDADD) @LIBMISC@
 
 rpmdb_SOURCES = 
 rpmdb_LDFLAGS = $(myLDFLAGS)
-rpmdb_LDADD = rpmdb.o $(myLDADD)
+rpmdb_LDADD = rpmdb.o $(myLDADD) @LIBMISC@
 
 rpmi_SOURCES = 
 rpmi_LDFLAGS = $(myLDFLAGS)
-rpmi_LDADD = rpmi.o $(myLDADD)
+rpmi_LDADD = rpmi.o $(myLDADD) @LIBMISC@
 
 rpmk_SOURCES = 
 rpmk_LDFLAGS = $(myLDFLAGS)
-rpmk_LDADD = rpmk.o $(myLDADD)
+rpmk_LDADD = rpmk.o $(myLDADD) @LIBMISC@
 
 rpmq_SOURCES = 
 rpmq_LDFLAGS = $(myLDFLAGS)
-rpmq_LDADD = rpmq.o $(myLDADD)
+rpmq_LDADD = rpmq.o $(myLDADD) @LIBMISC@
 
 rpm2cpio_SOURCES = rpm2cpio.c
 rpm2cpio_LDFLAGS = $(myLDFLAGS)
diff -uNr rpm-4.0.2.orig/autodeps/darwin.prov rpm-4.0.2/autodeps/darwin.prov
--- rpm-4.0.2.orig/autodeps/darwin.prov	Tue Mar 27 15:33:23 2001
+++ rpm-4.0.2/autodeps/darwin.prov	Tue Mar 27 15:34:35 2001
@@ -0,0 +1,12 @@
+#!/bin/bash
+# ----------------------------------------------------------
+#       find-provides for Darwin/MacOSX
+# ----------------------------------------------------------
+# This script reads filenames from STDIN and outputs any relevant provides
+# information that needs to be included in the package.
+
+filelist=$(sed -n -e '/\.dylib/p' -e '/\.so/p' -e '/\.bundle/p' | uniq | xargs file 2>/dev/null | grep "Mach-O.*ppc" | cut -d: -f1)
+
+for f in $filelist; do
+	echo ${f##*/}
+done | sort -u
diff -uNr rpm-4.0.2.orig/autodeps/darwin.req rpm-4.0.2/autodeps/darwin.req
--- rpm-4.0.2.orig/autodeps/darwin.req	Tue Mar 27 15:33:27 2001
+++ rpm-4.0.2/autodeps/darwin.req	Tue Mar 27 16:43:22 2001
@@ -0,0 +1,27 @@
+#!/bin/sh
+# ----------------------------------------------------------------
+#	find-requires for Darwin/MacOSX
+# ----------------------------------------------------------------
+ulimit -c 0
+
+filelist=`sed "s/['\"]/\\\&/g"`
+exelist=`echo $filelist | xargs file | fgrep executable | cut -d: -f1 `
+scriptlist=`echo $filelist | xargs file | egrep ":.* (commands|script) " | cut -d: -f1 `
+
+for f in $exelist; do
+    if [ -x $f ]; then
+        otool -L $f  \
+	| gawk '/^\t/ { print }' \
+	| sed -n -e '/ (compatibility version .* current version .*)/p' \
+	| sed -e 's/ (compatibility version .* current version .*)//' \
+	| sed -n -e '/\/System\/Library/!p'
+    fi
+done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u
+
+for f in $scriptlist; do
+    if [ -x $f ]; then
+        head -1 $f | sed -e 's/^\#\![   ]*//' \
+	| sed -n -e '/^\/bin/!p' | sed -n -e '/^\/usr\/bin/!p' | uniq \
+	| cut -d" " -f1
+    fi
+done | sort -u
diff -uNr rpm-4.0.2.orig/build/parseScript.c rpm-4.0.2/build/parseScript.c
--- rpm-4.0.2.orig/build/parseScript.c	Tue Jan 16 08:10:04 2001
+++ rpm-4.0.2/build/parseScript.c	Tue Mar 27 22:23:50 2001
@@ -89,7 +89,7 @@
     poptContext optCon = NULL;
     
     name = NULL;
-    prog = "/bin/sh";
+    prog = "/bin/bash";
     file = NULL;
     
     switch (parsePart) {
diff -uNr rpm-4.0.2.orig/lib/rpmrc.c rpm-4.0.2/lib/rpmrc.c
--- rpm-4.0.2.orig/lib/rpmrc.c	Tue Jan 16 08:10:04 2001
+++ rpm-4.0.2/lib/rpmrc.c	Tue Mar 27 21:57:07 2001
@@ -859,6 +859,9 @@
 	    if (!strncmp(un.machine, "RM", 2))
 		sprintf(un.machine, "mips");
 	}
+	else if (!strncmp(un.machine, "Power Macintosh", 15)) {
+			sprintf(un.machine, "ppc");
+	}
 	else if ((!strncmp(un.machine, "34", 2) ||
 		!strncmp(un.machine, "33", 2)) && \
 		!strncmp(un.release, "4.0", 3))
diff -uNr rpm-4.0.2.orig/macros.in rpm-4.0.2/macros.in
--- rpm-4.0.2.orig/macros.in	Tue Dec 12 03:40:56 2000
+++ rpm-4.0.2/macros.in	Tue Mar 27 22:27:51 2001
@@ -86,7 +86,7 @@
 #	(e.g. per-platform, per-system, per-packager, per-package) macros.
 #
 %_builddir		%{_topdir}/BUILD
-%_buildshell		/bin/sh
+%_buildshell		/bin/bash
 %_bzip2bin		@BZIP2BIN@
 %_dbpath		%{_var}/lib/rpm
 %_dbpath_rebuild	%{_dbpath}
@@ -118,7 +118,7 @@
 %_specdir		%{_topdir}/SPECS
 %_srcrpmdir		%{_topdir}/SRPMS
 %_tmppath		%{_var}/tmp
-%_topdir		%{_usrsrc}/redhat
+%_topdir		%{_usrsrc}/%{_vendor}
 %_unzipbin		@UNZIPBIN@
 
 #==============================================================================
@@ -308,7 +308,7 @@
 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
 export RPM_BUILD_ROOT}
 
-%___build_shell		%{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
+%___build_shell		%{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/bash}
 %___build_args		-e
 %___build_cmd		%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
 %___build_pre	\
diff -uNr rpm-4.0.2.orig/rpmrc.in rpm-4.0.2/rpmrc.in
--- rpm-4.0.2.orig/rpmrc.in	Tue Dec 12 03:40:56 2000
+++ rpm-4.0.2/rpmrc.in	Tue Mar 27 14:57:16 2001
@@ -122,6 +122,8 @@
 os_canon:       VM/ESA: VM/ESA	19
 os_canon:    Linux/390: OS/390	20
 os_canon:    Linux/ESA: VM/ESA	20
+os_canon:       Darwin: darwin	21
+os_canon:       MacOSX: macosx	21
 
 #############################################################
 # For a given uname().machine, the default build arch
@@ -246,6 +248,8 @@
 os_compat: MiNT: FreeMiNT mint TOS
 os_compat: mint: FreeMiNT MiNT TOS
 os_compat: TOS: FreeMiNT MiNT mint
+
+os_compat: Darwin: MacOSX
 
 buildarch_compat: ia64: noarch
 
diff -uNr rpm-4.0.2.orig/tools/Makefile.in rpm-4.0.2/tools/Makefile.in
--- rpm-4.0.2.orig/tools/Makefile.in	Mon Jan 22 09:17:52 2001
+++ rpm-4.0.2/tools/Makefile.in	Tue Mar 27 20:30:53 2001
@@ -183,7 +183,7 @@
 #myLDFLAGS= -L$(top_builddir)/build -L$(top_builddir)/lib \
 #	-L$(top_builddir)/rpmio -L$(top_builddir)/popt
 
-myLDADD = $(top_builddir)/build/librpmbuild.la 	$(top_builddir)/lib/librpm.la 	$(top_builddir)/rpmio/librpmio.la 	$(top_builddir)/popt/libpopt.la 	@INTLLIBS@
+myLDADD = $(top_builddir)/build/librpmbuild.la 	$(top_builddir)/lib/librpm.la 	$(top_builddir)/rpmio/librpmio.la 	$(top_builddir)/popt/libpopt.la 	@INTLLIBS@ @LIBMISC@
 
 
 LIBS = 
