Subject: Re: different plists on other OSes
To: grant beattie <grant@NetBSD.org>
From: Eric Haszlakiewicz <erh@jodi.nimenees.com>
List: tech-pkg
Date: 11/21/2003 12:50:26
--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Nov 21, 2003 at 01:15:58PM +1100, grant beattie wrote:
> On Thu, Nov 20, 2003 at 07:00:24PM -0600, Eric Haszlakiewicz wrote:
> 
> > 	almost.  I had to play around a bit with setenv/unsetenv in libnbcompat,
> > and with ar_io.c in pax.  I got it to build, but I have no way to test the
> > pax stuff.  For that I had to create a bunch of defines to map from the
> > mtio.h defines to the tape.h ones, but I don't have a tape drive to see
> > if it works.  (nor do I have access to use it if there was one. (yet))
> 
> cool, as long as the defines are right, that's a good start.
> 
> can you pls send me your diffs to bootstrap-pkgsrc so they can be
> incorporated?
attached.  tape_h_fixup.h goes in bootstrap-pkgsrc/pax

eric

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="diff.out"

diff -cr orig/bootstrap-pkgsrc/bootstrap bootstrap-pkgsrc/bootstrap
*** orig/bootstrap-pkgsrc/bootstrap	Sat Oct 18 04:56:52 2003
--- bootstrap-pkgsrc/bootstrap	Fri Nov 21 12:34:00 2003
***************
*** 233,238 ****
--- 233,246 ----
  	set_opsys=no
  	whoamiprog=/usr/ucb/whoami
  	;;
+ AIX)
+ 	root_group=system
+ 	need_pax=yes
+ 	need_mtree=yes
+ 	need_bsd_install=yes
+ 	need_sed=yes
+ 	set_opsys=no
+ 	;;
  *)
  	echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc"
  	root_group=wheel
diff -cr orig/bootstrap-pkgsrc/libnbcompat/configure bootstrap-pkgsrc/libnbcompat/configure
*** orig/bootstrap-pkgsrc/libnbcompat/configure	Tue Sep 16 11:58:09 2003
--- bootstrap-pkgsrc/libnbcompat/configure	Fri Nov 21 12:42:03 2003
***************
*** 6322,6331 ****
  
  
  
- 
  for ac_func in err fgetln fparseln fseeko getenv glob inet_ntop \
  	inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
! 	poll setenv setprogname snprintf strdup strerror strlcat strlcpy \
  	strmode strptime strsep strtoll timegm usleep
  do
  as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
--- 6322,6330 ----
  
  
  
  for ac_func in err fgetln fparseln fseeko getenv glob inet_ntop \
  	inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
! 	poll setprogname snprintf strdup strerror strlcat strlcpy \
  	strmode strptime strsep strtoll timegm usleep
  do
  as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
***************
*** 6760,6768 ****
--- 6759,6858 ----
  fi
  done
  
+ pkg_use_nbcompat_setenv=no
  
+ 
+ for ac_func in setenv unsetenv
+ do
+ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ echo "$as_me:$LINENO: checking for $ac_func" >&5
+ echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+ if eval "test \"\${$as_ac_var+set}\" = set"; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ /* confdefs.h.  */
+ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func (); below.
+     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+     <limits.h> exists even on freestanding compilers.  */
+ #ifdef __STDC__
+ # include <limits.h>
+ #else
+ # include <assert.h>
+ #endif
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ #ifdef __cplusplus
+ extern "C"
+ {
+ #endif
+ /* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+ char $ac_func ();
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ char (*f) () = $ac_func;
+ #endif
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ int
+ main ()
+ {
+ return f != $ac_func;
+   ;
+   return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+   (eval $ac_link) 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } &&
+          { ac_try='test -s conftest$ac_exeext'
+   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+   (eval $ac_try) 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; }; then
+   eval "$as_ac_var=yes"
+ else
+   echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+ 
+ eval "$as_ac_var=no"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+ echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ if test `eval echo '${'$as_ac_var'}'` = yes; then
+   cat >>confdefs.h <<_ACEOF
+ #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+ _ACEOF
+ 
+ else
+   pkg_use_nbcompat_setenv=yes
+ fi
+ done
+ 
+ 
  if test $pkg_use_nbcompat_setmode = yes; then
  	LIBOBJS="$LIBOBJS setmode.$ac_objext"
+ fi
+ if test $pkg_use_nbcompat_setenv = yes; then
+ 	LIBOBJS="$LIBOBJS setenv.$ac_objext"
  fi
  
  
diff -cr orig/bootstrap-pkgsrc/libnbcompat/configure.ac bootstrap-pkgsrc/libnbcompat/configure.ac
*** orig/bootstrap-pkgsrc/libnbcompat/configure.ac	Tue Sep 16 11:58:09 2003
--- bootstrap-pkgsrc/libnbcompat/configure.ac	Fri Nov 21 11:57:04 2003
***************
*** 119,125 ****
  
  AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv glob inet_ntop \
  	inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
! 	poll setenv setprogname snprintf strdup strerror strlcat strlcpy \
  	strmode strptime strsep strtoll timegm usleep])
  
  AC_CHECK_FUNCS([setgroupent setgrent setpassent setpwent])
--- 119,125 ----
  
  AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv glob inet_ntop \
  	inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
! 	poll setprogname snprintf strdup strerror strlcat strlcpy \
  	strmode strptime strsep strtoll timegm usleep])
  
  AC_CHECK_FUNCS([setgroupent setgrent setpassent setpwent])
***************
*** 128,136 ****
--- 128,142 ----
  AC_CHECK_FUNCS([getmode setmode],
  	[pkg_use_nbcompat_setmode=no],
  	[pkg_use_nbcompat_setmode=yes; break])
+ pkg_use_nbcompat_setenv=no
+ AC_CHECK_FUNCS([setenv unsetenv], ,
+ 	[pkg_use_nbcompat_setenv=yes])
  
  if test $pkg_use_nbcompat_setmode = yes; then
  	AC_LIBOBJ(setmode)
+ fi
+ if test $pkg_use_nbcompat_setenv = yes; then
+ 	AC_LIBOBJ(setenv)
  fi
  
  AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \
diff -cr orig/bootstrap-pkgsrc/libnbcompat/nbcompat.h bootstrap-pkgsrc/libnbcompat/nbcompat.h
*** orig/bootstrap-pkgsrc/libnbcompat/nbcompat.h	Sat Oct 18 04:56:53 2003
--- bootstrap-pkgsrc/libnbcompat/nbcompat.h	Thu Nov 20 11:29:16 2003
***************
*** 381,387 ****
--- 381,389 ----
  #endif
  
  #if !HAVE_H_ERRNO_D
+ #ifndef _AIX
  extern int	h_errno;
+ #endif
  #endif
  #define HAVE_H_ERRNO	1		/* XXX: an assumption for now... */
  
diff -cr orig/bootstrap-pkgsrc/libnbcompat/setenv.c bootstrap-pkgsrc/libnbcompat/setenv.c
*** orig/bootstrap-pkgsrc/libnbcompat/setenv.c	Sun Sep 14 02:37:54 2003
--- bootstrap-pkgsrc/libnbcompat/setenv.c	Fri Nov 21 11:57:39 2003
***************
*** 74,79 ****
--- 74,80 ----
  	return(NULL);
  }
  
+ #if !HAVE_SETENV
  /*
   * setenv --
   *	Set the value of the environmental variable "name" to be
***************
*** 134,140 ****
--- 135,143 ----
  		;
  	return (0);
  }
+ #endif /* !HAVE_SETENV */
  
+ #if !HAVE_UNSETENV
  /*
   * unsetenv(name) --
   *	Delete environmental variable "name".
***************
*** 153,155 ****
--- 156,159 ----
  			if (!(*P = *(P + 1)))
  				break;
  }
+ #endif /* !HAVE_UNSETENV */
diff -cr orig/bootstrap-pkgsrc/libnbcompat/nbcompat/config.h.in bootstrap-pkgsrc/libnbcompat/nbcompat/config.h.in
*** orig/bootstrap-pkgsrc/libnbcompat/nbcompat/config.h.in	Tue Sep 16 11:58:35 2003
--- bootstrap-pkgsrc/libnbcompat/nbcompat/config.h.in	Fri Nov 21 11:45:50 2003
***************
*** 384,389 ****
--- 384,392 ----
  /* Define to 1 if you have the <unistd.h> header file. */
  #undef HAVE_UNISTD_H
  
+ /* Define to 1 if you have the `unsetenv' function. */
+ #undef HAVE_UNSETENV
+ 
  /* Define to 1 if you have the `user_from_uid' function. */
  #undef HAVE_USER_FROM_UID
  
diff -cr orig/bootstrap-pkgsrc/libnbcompat/nbcompat/getopt.h bootstrap-pkgsrc/libnbcompat/nbcompat/getopt.h
*** orig/bootstrap-pkgsrc/libnbcompat/nbcompat/getopt.h	Sun Sep 14 02:38:01 2003
--- bootstrap-pkgsrc/libnbcompat/nbcompat/getopt.h	Thu Nov 20 11:28:40 2003
***************
*** 50,56 ****
  /*
   * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
   */
! #if (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(__linux__)
  #define no_argument        0
  #define required_argument  1
  #define optional_argument  2
--- 50,56 ----
  /*
   * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
   */
! #if (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(__linux__) || defined(_AIX)
  #define no_argument        0
  #define required_argument  1
  #define optional_argument  2
diff -cr orig/bootstrap-pkgsrc/pax/ar_io.c bootstrap-pkgsrc/pax/ar_io.c
*** orig/bootstrap-pkgsrc/pax/ar_io.c	Tue Sep 23 09:48:46 2003
--- bootstrap-pkgsrc/pax/ar_io.c	Fri Nov 21 09:42:52 2003
***************
*** 94,99 ****
--- 94,103 ----
  #if HAVE_SYS_IOCTL_H
  #include <sys/ioctl.h>
  #endif
+ #if HAVE_SYS_TAPE_H
+ #include <sys/tape.h>
+ #include "tape_h_fixup.h"
+ #endif
  #if HAVE_SYS_MTIO_H
  #include <sys/mtio.h>
  #endif
diff -cr orig/bootstrap-pkgsrc/pax/config.h.in bootstrap-pkgsrc/pax/config.h.in
*** orig/bootstrap-pkgsrc/pax/config.h.in	Sun Sep 14 23:44:53 2003
--- bootstrap-pkgsrc/pax/config.h.in	Fri Nov 21 09:44:49 2003
***************
*** 48,53 ****
--- 48,56 ----
  /* Define to 1 if you have the <sys/ioctl.h> header file. */
  #undef HAVE_SYS_IOCTL_H
  
+ /* Define to 1 if you have the <sys/tape.h> header file. */
+ #undef HAVE_SYS_TAPE_H
+ 
  /* Define to 1 if you have the <sys/mtio.h> header file. */
  #undef HAVE_SYS_MTIO_H
  
diff -cr orig/bootstrap-pkgsrc/pax/configure bootstrap-pkgsrc/pax/configure
*** orig/bootstrap-pkgsrc/pax/configure	Sun Sep 14 23:44:53 2003
--- bootstrap-pkgsrc/pax/configure	Fri Nov 21 09:42:59 2003
***************
*** 2946,2952 ****
  
  
  
! for ac_header in sys/ioctl.h sys/mtio.h sys/resource.h sys/uio.h sys/wait.h
  do
  as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  if eval "test \"\${$as_ac_Header+set}\" = set"; then
--- 2946,2952 ----
  
  
  
! for ac_header in sys/ioctl.h sys/tape.h sys/mtio.h sys/resource.h sys/uio.h sys/wait.h
  do
  as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  if eval "test \"\${$as_ac_Header+set}\" = set"; then
diff -cr orig/bootstrap-pkgsrc/pax/configure.ac bootstrap-pkgsrc/pax/configure.ac
*** orig/bootstrap-pkgsrc/pax/configure.ac	Sun Sep 14 23:44:53 2003
--- bootstrap-pkgsrc/pax/configure.ac	Fri Nov 21 09:43:03 2003
***************
*** 15,21 ****
  # Checks for header files.
  AC_HEADER_STDC
  AC_CHECK_HEADERS([ctype.h grp.h regex.h regexp.h rmt.h stdarg.h])
! AC_CHECK_HEADERS([sys/ioctl.h sys/mtio.h sys/resource.h sys/uio.h sys/wait.h])
  
  # Checks for library functions.
  AC_CHECK_FUNCS([getrlimit setrlimit])
--- 15,21 ----
  # Checks for header files.
  AC_HEADER_STDC
  AC_CHECK_HEADERS([ctype.h grp.h regex.h regexp.h rmt.h stdarg.h])
! AC_CHECK_HEADERS([sys/ioctl.h sys/tape.h sys/mtio.h sys/resource.h sys/uio.h sys/wait.h])
  
  # Checks for library functions.
  AC_CHECK_FUNCS([getrlimit setrlimit])
diff -cr orig/bootstrap-pkgsrc/pax/options.c bootstrap-pkgsrc/pax/options.c
*** orig/bootstrap-pkgsrc/pax/options.c	Sun Sep 14 23:44:54 2003
--- bootstrap-pkgsrc/pax/options.c	Fri Nov 21 09:01:02 2003
***************
*** 1739,1745 ****
  		 */
  		maxflt = 0;
  		while ((str = getline(stdin)) != NULL) {
! 			ftree_add(str, NULL);
  		}
  		if (getline_error) {
  			tty_warn(1, "Problem while reading stdin");
--- 1739,1745 ----
  		 */
  		maxflt = 0;
  		while ((str = getline(stdin)) != NULL) {
! 			ftree_add(str, 0);
  		}
  		if (getline_error) {
  			tty_warn(1, "Problem while reading stdin");
Only in bootstrap-pkgsrc/pax: tape_h_fixup.h

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tape_h_fixup.h"

/*	$NetBSD: $ */

/*
 * Mapping from the mtio.h defines and structures to
 * the tape.h ones.
 */

#ifndef _TAPE_H_FIXUP
#define _TAPE_H_FIXUP

#define MTIOCTOP   STIOCTOP
#define MTIOCMD    STIOCMD
#define MTIOCHGP   STIOCHGP
#define mtop stop
#define mt_op st_op
#define mt_count st_count

#define MTOFFL     STOFFL
#define MTREW      STREW
#define MTERASE    STERASE
#define MTRETEN    STRETEN
#define MTWEOF     STWEOF
#define MTFSF      STFSF
#define MTBSF      STRSF
#define MTFSR      STFSR
#define MTBSR      STRSR
#define MTINSRT    STINSRT
#define MTEJECT    STEJECT
#define MTDEOF     STDEOF

/* mtget and MTIOCGET aren't anywhere that I could find. */
struct	mtget
{
	short	mt_type;
	short	mt_dsreg;
	short	mt_erreg;
	daddr_t	mt_resid;
	daddr_t	mt_fileno;
	daddr_t	mt_blkno;
};

#define MTIOCGET _IOR('m', 2, struct mtget)

#endif

--PNTmBPCT7hxwcZjr--