Subject: pkg_filecheck under darwin
To: None <dillo@NetBSD.org, pkgsrc-users@NetBSD.org>
From: Antoine Reilles <Antoine.Reilles@loria.fr>
List: pkgsrc-users
Date: 02/16/2007 22:59:52
--wq9mPyueHGvFACwf
Content-Type: multipart/mixed; boundary="bp/iNruPH9dso1Pn"
Content-Disposition: inline


--bp/iNruPH9dso1Pn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

I encountered some problems when building pkgtools/pkg_filecheck under
darwin.

I get build errors with incorrect db4 uses:

pkg_filecheck.c: In function 'main':
pkg_filecheck.c:101: error: too few arguments to function '(*((struct DB **)((i) * 4u) + db))->close'

pkg_filecheck.c: In function 'check':
pkg_filecheck.c:133: warning: passing argument 2 of '(*((struct DB **)((i) * 4u) + db))->get' from incompatible pointer type

pkg_filecheck.c:133: error: too few arguments to function '(*((struct DB **)((i) * 4u) + db))->get'

Using the attached patch fixes the issues, and simply make sure the
functions are used with the signatures from:
/usr/pkg/share/doc/db4/api_c/db_close.html
/usr/pkg/share/doc/db4/api_c/db_get.html

That is, .include "../../mk/bdb.buildlink3.mk" gets the db4-4.4.20nb1
package, so pkg_filecheck should use its api.

However, pkg_filecheck builds fine under netbsd, and will fail with the
attached patch. db4 pkg is installed, but bdb.buildlink3.mk do not
require it, and pkg_filecheck uses /usr/include/db.h.

What is the correct way to fix this problem ?
One way is to force bdb.buildlink3 to pull the db4 package under netbsd
as well, but it doesn't seem right.

Best regards,
antoine

--bp/iNruPH9dso1Pn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pkg_filecheck.patch"
Content-Transfer-Encoding: quoted-printable

Index: files/pkg_filecheck.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_filecheck/files/pkg_filecheck.c,v
retrieving revision 1.4
diff -u -r1.4 pkg_filecheck.c
--- files/pkg_filecheck.c	24 Oct 2006 19:23:38 -0000	1.4
+++ files/pkg_filecheck.c	16 Feb 2007 21:35:19 -0000
@@ -98,7 +98,7 @@
     err =3D check(dir, db, ignore);
=20
     for (i=3D0; db[i]; i++)
-	db[i]->close(db[i]);
+	db[i]->close(db[i],0);
     free(dir);
     free(db);
     free(ignore);
@@ -130,7 +130,7 @@
 	   =20
 	    found =3D 0;
 	    for (i=3D0; db[i]; i++)
-		if (db[i]->get(db[i], &key, &val, 0) =3D=3D 0) {
+		if (db[i]->get(db[i], NULL, &key, &val, 0) =3D=3D 0) {
 		    found =3D 1;
 		    break;
 		}

--bp/iNruPH9dso1Pn--

--wq9mPyueHGvFACwf
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFF1ilY4VqmoGDE/mwRApBrAJsH7NwaHupPgt18OT81jYSae8v5GQCfWgtR
r6bN+KUCGliaLCUDzIWUNW0=
=HJk2
-----END PGP SIGNATURE-----

--wq9mPyueHGvFACwf--