Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 32457

Summary: rpm for Darwin / Mac OS X
Product: [Retired] Red Hat Linux Reporter: Peter O'Gorman <apple>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-04-02 15:06:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to get rpm on mac os 10.0 building with shared libs none

Description Peter O'Gorman 2001-03-20 23:48:17 UTC
Hi,
Here is my patch. Note you need the glibtool and automake projects from 
Darwin <http://publicsource.apple.com> as well as bzip2 db3.1.17 and 
gettext.
INSTRUCTIONS:
Unpack and install glibtool, automake bzip2, gettext and db.
cd into rpm-4.0.2 and patch -P1 < path/to/rpmpatch
%cd popt
%glibtoolize --copy --force
%aclocal
%autoheader
%automake
%autoconf
%cd ..
%glibtoolize --copy --force
%aclocal
%autoheader
%automake
%autoconf
%./configure --disable-shared
%make
%sudo make install
Shared libraries don't compile :-(, so the only way to go is static. Maybe 
you can solve this?
Begin Patch
--- rpm-4.0.2/acconfig.h	Tue Dec 12 03:40:56 2000
+++ rpm-4.0.2.mac/acconfig.h	Tue Mar 20 23:57:18 2001
@@ -65,6 +65,9 @@
 /* Define as 1 if you have getmntinfo_r() (only osf?) */
 #undef HAVE_GETMNTINFO_R
 
+/* Define as 1 if you have getmntinfo() (only Darwin?) */
+#undef HAVE_GETMNTINFO
+
 /* Define as 1 if you have "struct mnttab" (only sco?) */
 #undef HAVE_STRUCT_MNTTAB
 
--- rpm-4.0.2/configure.in	Thu Feb 15 09:12:55 2001
+++ rpm-4.0.2.mac/configure.in	Tue Mar 20 23:56:32 2001
@@ -788,10 +788,11 @@
 
 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
   AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL),[
-    AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
-      AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; 
+    AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO),[
+      AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
+        AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; 
 					AC_DEFINE(HAVE_GETMNTINFO_R)],
-                 LIBOBJS="$LIBOBJS getmntent.o")])])])
+                 LIBOBJS="$LIBOBJS getmntent.o")])])])])
 
 AC_CHECK_FUNC(lchown,
    [__CHOWN_RHF="%{__chown} -Rhf"
--- rpm-4.0.2/lib/fs.c	Tue Jan 16 08:10:04 2001
+++ rpm-4.0.2.mac/lib/fs.c	Tue Mar 20 23:54:06 2001
@@ -138,7 +138,7 @@
 #   if GETMNTENT_ONE || GETMNTENT_TWO
     our_mntent item;
     FILE * mtab;
-#   elif HAVE_GETMNTINFO_R
+#   elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
     struct statfs * mounts = NULL;
     int mntCount = 0, bufSize = 0, flags = MNT_NOWAIT;
     int nextMount = 0;
@@ -155,6 +155,9 @@
 	}
 #   elif HAVE_GETMNTINFO_R
 	getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
+#   elif HAVE_GETMNTINFO 
+        mntCount = getmntinfo(&mounts, flags);
+        bufSize = mntCount * sizeof(struct statfs *);        
 #   endif
 
     filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems));	/* XXX 
memory leak */
@@ -175,7 +178,7 @@
 	    /* Solaris, maybe others */
 	    if (getmntent(mtab, &item)) break;
 	    mntdir = item.our_mntdir;
-#	elif HAVE_GETMNTINFO_R
+#	elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
 	    if (nextMount == mntCount) break;
 	    mntdir = mounts[nextMount++].f_mntonname;
 #	endif
@@ -202,7 +205,7 @@
 
 #   if GETMNTENT_ONE || GETMNTENT_TWO
 	fclose(mtab);
-#   elif HAVE_GETMNTINFO_R
+#   elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
 	free(mounts);
 #   endif
 
--- rpm-4.0.2/system.h	Tue Dec 12 03:40:56 2000
+++ rpm-4.0.2.mac/system.h	Tue Mar 20 23:55:16 2001
@@ -325,7 +325,7 @@
 #define lchown chown
 #endif
 
-#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
+#if HAVE_GETMNTINFO_R || HAVE_MNTCTL || HAVE_GETMNTINFO
 # define GETMNTENT_ONE 0
 # define GETMNTENT_TWO 0
 # if HAVE_SYS_MNTCTL_H

Comment 1 Jeff Johnson 2001-03-21 15:39:07 UTC
I can add the above patch, will do so soon.

You ought to look at rpmrc changes to make Darwin
a distinguished (for rpm purposes) OS in packages. There's
further work that might be done in configure.in and Makefile.am
to choose the vendor correctly and to create per-arch directories
appropriately. If you get a chance, please attach a patch for the above
as well.

Comment 2 Peter O'Gorman 2001-04-02 15:00:51 UTC
Created attachment 14443 [details]
Patch to get rpm on mac os 10.0 building with shared libs

Comment 3 Peter O'Gorman 2001-04-02 15:06:05 UTC
I know very little about rpm (or about makefiles for that matter) coming from a 
mac os background. I hope someone else will have a go at improving support for 
this and will post a message to darwin-development with a link to my patch and 
this bug number asking for assistance.


Comment 4 Jeff Johnson 2001-12-09 17:27:04 UTC
AFAIK, apple.com is porting rpm to apple platforms, so
there's little reason to keep this preliminary work around
any more.