Subject: pkg/21451: pkgsrc partial patch for HURD
To: None <gnats-bugs@gnats.netbsd.org>
From: None <pancake@phreaker.net>
List: netbsd-bugs
Date: 05/05/2003 00:14:42
>Number: 21451
>Category: pkg
>Synopsis: pkgsrc is not compilable under GNU/Hurd
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 04 22:09:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.6R
>Organization:
>Environment:
System: NetBSD panser 1.6R NetBSD 1.6R (GENERIC) #0: Tue Mar 25 09:42:17 UTC 2003 autobuild@tgm.daemon.org:/autobuild/HEAD/i386/OBJ/autobuild/HEAD/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
pkgsrc package system is not compilable under Hurd with this patch
you will be able to compile tha main apps of pkgsrc on Hurd (is a fast
patch (just for testing)). Soon I will write the rest of patches and I
will begin porting apps to hurd using pkgsrc system.
With this patch is possible to compile all the main programs of pkgsrc
(pkg_*,bmake and mtree), but not lukemftp and pax (openbsd pax is ported
to hurd but netbsd pax not :/...well I will patch them soon.
>How-To-Repeat:
Just run hurd and try to build pkgsrc ;)
>Fix:
Apply this patch:
diff -ru bootstrap-pkgsrc/bmake/arch.c bootstrap-pkgsrc_new/bmake/arch.c
--- bootstrap-pkgsrc/bmake/arch.c 2002-09-19 12:40:05.000000000 +0200
+++ bootstrap-pkgsrc_new/bmake/arch.c 2003-04-20 18:33:36.000000000 +0200
@@ -55,6 +55,11 @@
__IDSTRING(rcs_id,"$Id: arch.c,v 1.1.1.1 2002/09/19 10:40:05 agc Exp $");
#endif
+#ifndef MAXPATHLEN
+#warning MAXPATHLEN fixed - This is an ugly patch.
+#define MAXPATHLEN 300
+#endif
+
/*-
* arch.c --
* Functions to manipulate libraries, archives and their members.
diff -ru bootstrap-pkgsrc/bmake/mk/bsd.lib.mk bootstrap-pkgsrc_new/bmake/mk/bsd.lib.mk
--- bootstrap-pkgsrc/bmake/mk/bsd.lib.mk 2003-03-23 18:07:04.000000000 +0100
+++ bootstrap-pkgsrc_new/bmake/mk/bsd.lib.mk 2003-04-21 17:24:09.000000000 +0200
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lib.mk,v 1.2 2003/03/23 17:07:04 jschauma Exp $
+# $NetBSD: Linux.bsd.lib.mk,v 1.1 2002/09/23 14:37:49 abs Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
@@ -346,7 +346,7 @@
__archivebuild: .USE
@rm -f ${.TARGET}
- ${AR} -c -q ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
+ ${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
${RANLIB} ${.TARGET}
__archiveinstall: .USE
@@ -379,7 +379,7 @@
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} \
--no-whole-archive ${LDADD} \
- -L${DESTDIR}${LIBDIR} ${RPATH_FLAG}${LIBDIR} \
+ -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
diff -ru bootstrap-pkgsrc/bootstrap bootstrap-pkgsrc_new/bootstrap
--- bootstrap-pkgsrc/bootstrap 2003-04-01 07:07:53.000000000 +0200
+++ bootstrap-pkgsrc_new/bootstrap 2003-04-21 17:20:03.000000000 +0200
@@ -149,6 +149,13 @@
need_bsd_install=no
set_opsys=no
;;
+GNU)
+ root_group=root
+ need_pax=no
+ need_mtree=yes
+ need_bsd_install=no
+ set_opsys=no
+ ;;
*)
echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc"
root_group=wheel
diff -ru bootstrap-pkgsrc/lukemftp/libedit/tty.h bootstrap-pkgsrc_new/lukemftp/libedit/tty.h
--- bootstrap-pkgsrc/lukemftp/libedit/tty.h 2002-09-19 12:41:54.000000000 +0200
+++ bootstrap-pkgsrc_new/lukemftp/libedit/tty.h 2003-04-21 13:35:19.000000000 +0200
@@ -41,6 +41,10 @@
/*
* el.tty.h: Local terminal header
*/
+#if __GNU__
+#include <termios.h>
+#endif
+
#ifndef _h_el_tty
#define _h_el_tty
diff -ru bootstrap-pkgsrc/lukemftp/libukem/glob.c bootstrap-pkgsrc_new/lukemftp/libukem/glob.c
--- bootstrap-pkgsrc/lukemftp/libukem/glob.c 2002-09-19 12:41:55.000000000 +0200
+++ bootstrap-pkgsrc_new/lukemftp/libukem/glob.c 2003-04-20 20:41:27.000000000 +0200
@@ -723,6 +723,9 @@
}
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+ #ifndef ARG_MAX
+ #define ARG_MAX 4096
+ #endif
if ((pglob->gl_flags & GLOB_LIMIT) && (newsize + *limit) >= ARG_MAX) {
errno = 0;
return(GLOB_NOSPACE);
diff -ru bootstrap-pkgsrc/lukemftp/lukemftp.h bootstrap-pkgsrc_new/lukemftp/lukemftp.h
--- bootstrap-pkgsrc/lukemftp/lukemftp.h 2002-12-19 23:38:02.000000000 +0100
+++ bootstrap-pkgsrc_new/lukemftp/lukemftp.h 2003-04-20 20:15:36.000000000 +0200
@@ -35,6 +35,15 @@
#include <termios.h>
#include <unistd.h>
+#ifndef MAXPATHLEN
+#warning MAXPATHLEN uses an ugly patch.
+#define MAXPATHLEN 300
+#endif
+
+#ifndef MAXHOSTNAMELEN
+char *xgethostname( void );
+#endif
+
#if HAVE_POLL
# if HAVE_POLL_H
# include <poll.h>
diff -ru bootstrap-pkgsrc/lukemftp/src/cmds.c bootstrap-pkgsrc_new/lukemftp/src/cmds.c
--- bootstrap-pkgsrc/lukemftp/src/cmds.c 2002-09-19 12:41:56.000000000 +0200
+++ bootstrap-pkgsrc_new/lukemftp/src/cmds.c 2003-04-20 20:03:56.000000000 +0200
@@ -992,7 +992,11 @@
void
setgate(int argc, char *argv[])
{
+ #ifdef MAXHOSTNAMELEN
static char gsbuf[MAXHOSTNAMELEN];
+ #else
+ char *gsbuf;
+ #endif
if (argc == 0 || argc > 3) {
fprintf(ttyout,
diff -ru bootstrap-pkgsrc/lukemftp/src/ftp.c bootstrap-pkgsrc_new/lukemftp/src/ftp.c
--- bootstrap-pkgsrc/lukemftp/src/ftp.c 2002-09-19 12:41:58.000000000 +0200
+++ bootstrap-pkgsrc_new/lukemftp/src/ftp.c 2003-04-21 01:20:23.000000000 +0200
@@ -140,8 +140,13 @@
{
int s = -1, len, error, portnum;
struct addrinfo hints, *res, *res0;
+ #ifdef MAXHOSTNAMELEN
char hbuf[MAXHOSTNAMELEN];
static char hostnamebuf[MAXHOSTNAMELEN];
+ #else
+ char *hbuf;
+ char *hostnamebuf;
+ #endif
char *cause = "unknown";
memset((char *)&hisctladdr, 0, sizeof (hisctladdr));
@@ -1724,7 +1729,11 @@
sigfunc oldintr;
static struct comvars {
int connect;
+ #ifdef MAXHOSTNAMELEN
char name[MAXHOSTNAMELEN];
+ #else
+ char *name;
+ #endif
struct sockinet mctl;
struct sockinet hctl;
FILE *in;
diff -ru bootstrap-pkgsrc/lukemftp/src/ruserpass.c bootstrap-pkgsrc_new/lukemftp/src/ruserpass.c
--- bootstrap-pkgsrc/lukemftp/src/ruserpass.c 2002-09-19 12:41:59.000000000 +0200
+++ bootstrap-pkgsrc_new/lukemftp/src/ruserpass.c 2003-04-20 20:33:13.000000000 +0200
@@ -69,7 +69,12 @@
const char **aacct)
{
char *tmp;
- char myname[MAXHOSTNAMELEN + 1], *mydomain;
+ #ifdef MAXHOSTNAMELEN
+ char myname[MAXHOSTNAMELEN + 1];
+ #else
+ char *myname;
+ #endif
+ char *mydomain;
int t, i, c, usedefault = 0;
struct stat stb;
@@ -81,7 +86,11 @@
warn("%s", netrc);
return (0);
}
+ #ifdef MAXHOSTNAMELEN
if (gethostname(myname, sizeof(myname)) < 0)
+ #else
+ if (xgethostname() < 0)
+ #endif
myname[0] = '\0';
myname[sizeof(myname) - 1] = '\0';
if ((mydomain = strchr(myname, '.')) == NULL)
diff -ru bootstrap-pkgsrc/mtree/compare.c bootstrap-pkgsrc_new/mtree/compare.c
--- bootstrap-pkgsrc/mtree/compare.c 2003-02-21 12:19:19.000000000 +0100
+++ bootstrap-pkgsrc_new/mtree/compare.c 2003-04-21 14:38:01.000000000 +0200
@@ -341,6 +341,7 @@
time_t smtime = s->st_mtimespec.tv_sec;
#ifdef BSD4_4
+#ifndef __GNU__
time_t pmtime = ps->st_mtimespec.tv_sec;
TIMESPEC_TO_TIMEVAL(&tv[0], &s->st_mtimespec);
@@ -353,7 +354,7 @@
tv[1].tv_sec = pmtime;
tv[1].tv_usec = 0;
#endif
-
+#endif
if (tv[0].tv_sec != tv[1].tv_sec ||
tv[0].tv_usec != tv[1].tv_usec) {
LABEL;
diff -ru bootstrap-pkgsrc/mtree/create.c bootstrap-pkgsrc_new/mtree/create.c
--- bootstrap-pkgsrc/mtree/create.c 2002-12-17 13:44:56.000000000 +0100
+++ bootstrap-pkgsrc_new/mtree/create.c 2003-04-21 14:38:20.000000000 +0200
@@ -202,6 +202,7 @@
if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode))
output(&indent, "size=%lld", (long long)p->fts_statp->st_size);
#ifdef BSD4_4
+#ifndef __GNU__
if (keys & F_TIME)
output(&indent, "time=%ld.%ld",
(long)p->fts_statp->st_mtimespec.tv_sec,
@@ -210,6 +211,7 @@
output(&indent, "time=%ld.%ld",
p->fts_statp->st_mtime, (long int)0);
#endif
+#endif
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
crc(fd, &val, &len))
diff -ru bootstrap-pkgsrc/pax/file_subs.c bootstrap-pkgsrc_new/pax/file_subs.c
--- bootstrap-pkgsrc/pax/file_subs.c 2003-03-03 12:50:51.000000000 +0100
+++ bootstrap-pkgsrc_new/pax/file_subs.c 2003-04-21 17:17:19.000000000 +0200
@@ -706,6 +706,7 @@
*/
if (lstat(fnm, &sb) == 0) {
#ifdef BSD4_4
+#ifndef __GNU__
if (!patime)
TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
if (!pmtime)
@@ -716,6 +717,7 @@
if (!pmtime)
tv[1].tv_sec = sb.st_mtime;
#endif
+#endif
} else
syswarn(0, errno, "Cannot obtain file stats %s", fnm);
}
diff -ru bootstrap-pkgsrc/pax/ftree.c bootstrap-pkgsrc_new/pax/ftree.c
--- bootstrap-pkgsrc/pax/ftree.c 2002-10-31 13:16:55.000000000 +0100
+++ bootstrap-pkgsrc_new/pax/ftree.c 2003-04-21 17:17:19.000000000 +0200
@@ -517,10 +517,12 @@
#endif
if (ftnode->flags & F_TIME)
#ifdef BSD4_4
+#ifndef __GNU__
statbuf.st_mtimespec = ftnode->st_mtimespec;
#else
statbuf.st_mtime = ftnode->st_mtimespec.tv_sec;
#endif
+#endif
if (ftnode->flags & F_DEV)
statbuf.st_rdev = ftnode->st_rdev;
if (ftnode->flags & F_SLINK)
diff -ru bootstrap-pkgsrc/pax/getoldopt.c bootstrap-pkgsrc_new/pax/getoldopt.c
--- bootstrap-pkgsrc/pax/getoldopt.c 2003-02-26 04:10:23.000000000 +0100
+++ bootstrap-pkgsrc_new/pax/getoldopt.c 2003-04-21 17:17:20.000000000 +0200
@@ -26,7 +26,7 @@
#include "pax.h"
#include "extern.h"
-#if defined(sgi) || defined(__linux__)
+#if defined(sgi) || defined(__linux__) || defined(__GNU__)
extern char *optarg;
extern int optind;
#endif
diff -ru bootstrap-pkgsrc/pax/pax.h bootstrap-pkgsrc_new/pax/pax.h
--- bootstrap-pkgsrc/pax/pax.h 2003-03-03 12:50:52.000000000 +0100
+++ bootstrap-pkgsrc_new/pax/pax.h 2003-04-21 17:17:19.000000000 +0200
@@ -57,6 +57,9 @@
/* Don't even think of changing this */
#define DEVBLK 8192 /* default read blksize for devices */
#define FILEBLK 10240 /* default read blksize for files */
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
#define PAXPATHLEN 3072 /* maximum path length for pax. MUST be */
/* longer than the system MAXPATHLEN */
diff -ru bootstrap-pkgsrc/pkg_install/lib/pen.c bootstrap-pkgsrc_new/pkg_install/lib/pen.c
--- bootstrap-pkgsrc/pkg_install/lib/pen.c 2003-04-11 23:30:52.000000000 +0200
+++ bootstrap-pkgsrc_new/pkg_install/lib/pen.c 2003-04-21 14:31:22.000000000 +0200
@@ -227,7 +227,7 @@
* We do this autoconf dance here to get around the old interface (it's
* in libc on 2.7 and 2.8, but not in 2.9)
*/
-#if !defined(HAVE_STATFS) || (defined(HAVE_STATFS) && defined(HAVE_STATVFS) && !defined(__linux__) && !defined(__FreeBSD__))
+#if !defined(HAVE_STATFS) || (defined(HAVE_STATFS) && defined(HAVE_STATVFS) && !defined(__linux__) && !defined(__FreeBSD__)) && !defined(__GNU__)
/* $NetBSD: pen.c,v 1.12 2003/04/11 21:25:58 grant Exp $ */
/*-
@@ -268,7 +268,9 @@
#include <string.h>
#include <sys/types.h>
+#ifdef HAVE_MOUNT_H
#include <sys/mount.h>
+#endif
#include <sys/statvfs.h>
#define MFSNAMELEN 16 /* length of fs type name, including nul */
diff -ru bootstrap-pkgsrc/pkg_install/lib/str.c bootstrap-pkgsrc_new/pkg_install/lib/str.c
--- bootstrap-pkgsrc/pkg_install/lib/str.c 2003-01-06 05:36:37.000000000 +0100
+++ bootstrap-pkgsrc_new/pkg_install/lib/str.c 2003-04-21 14:32:13.000000000 +0200
@@ -82,6 +82,10 @@
{
size_t cc;
char *s;
+ #ifdef __GNU__
+ #warning Ugly PATH_MAX patch
+ #define PATH_MAX 1024
+ #endif
static char buf[PATH_MAX];
if ((s = strrchr(path, '/')) == NULL) {
>Release-Note:
>Audit-Trail:
>Unformatted: