[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#154277: OpenBSD patch



On Thu, Jul 25, 2002 at 07:55:05PM +0200, Wichert Akkerman wrote:
> Previously Elie Rosenblum wrote:
> > +DSEL_LIBS		= @DSEL_LIBS@
> 
> DSEL_LIBS seems to be only used to determine the name of the curses
> library on the system, so please rename that to CURSESLIB or so.

Certainly.

> > +# check for ncurses. In OpenBSD ncurses is there, but it is
> > +# called curses. We need to check for either one.
> 
> That isn't OpenBSD specific, so please reword that text :)

No prob.

> > diff -ru3 dpkg-1.10.4.orig/scripts/dpkg-architecture.pl dpkg-1.10.4/scripts/dpkg-architecture.pl
> > --- dpkg-1.10.4.orig/scripts/dpkg-architecture.pl	Fri May 24 22:10:15 2002
> > +++ dpkg-1.10.4/scripts/dpkg-architecture.pl	Wed Jul 24 16:38:33 2002
> > @@ -93,11 +93,13 @@
> >  ";
> >  }
> >  
> > -sub rewrite_gnu_cpu {
> > +sub rewrite_gnu {
> 
> Why rename that function?

It's no longer just rewriting the CPU, it potentially rewrites other
parts of the string. I can change it back if you prefer though, or
move the other rewrites into a second function.

> The rest of the patch looks fine.

Excellent. Here's the patch with everything but rewrite_gnu changed.
I'll resubmit with that if you decide you want a different way of
handling the rewrite.


diff -ru3 dpkg-1.10.4.orig/Makefile.conf.in dpkg-1.10.4/Makefile.conf.in
--- dpkg-1.10.4.orig/Makefile.conf.in	Sun Jul 14 16:15:06 2002
+++ dpkg-1.10.4/Makefile.conf.in	Thu Jul 25 06:23:16 2002
@@ -73,6 +73,8 @@
 
 SSD_LIBS		= @SSD_LIBS@
 
+CURSES_LIBS		= @CURSES_LIBS@
+
 ZLIB_CFLAGS		= @ZLIB_CFLAGS@
 ZLIB_LIBS		= @ZLIB_LIBS@
 ZLIB_LIBS_ALSO_STATIC	= @ZLIB_LIBS_ALSO_STATIC@
diff -ru3 dpkg-1.10.4.orig/archtable dpkg-1.10.4/archtable
--- dpkg-1.10.4.orig/archtable	Tue Jan  1 08:16:37 2002
+++ dpkg-1.10.4/archtable	Wed Jul 24 15:37:53 2002
@@ -47,6 +47,7 @@
 s390-linux-gnu		s390		s390
 s390-ibm-linux-gnu	s390		s390
 s390-unknown-linux-gnu	s390		s390
-i386-openbsd2.8		openbsd-i386	i386
+i386-openbsd		openbsd-i386	openbsd-i386
+i386-unknown-openbsd	openbsd-i386	openbsd-i386
 powerpc-darwin		darwin-powerpc	darwin-powerpc
 i386-darwin		darwin-i386	darwin-i386
diff -ru3 dpkg-1.10.4.orig/configure.in dpkg-1.10.4/configure.in
--- dpkg-1.10.4.orig/configure.in	Sun Jul 14 16:08:11 2002
+++ dpkg-1.10.4/configure.in	Thu Jul 25 06:22:46 2002
@@ -93,13 +93,36 @@
 
 AC_PREFIX_DEFAULT(/usr)
 
+# OpenBSD has decided to be odd and includ a version number
+# in the final field of the GNU system type.
+# This code strips it out in a generic way.
+os_type=''
+AC_MSG_CHECKING(Operating system type)
+case $target_os in 
+        *linux* )
+          os_type="linux";;
+        *openbsd* )
+          os_type="openbsd";;
+        *netbsd* )
+          os_type="netbsd";;
+        *freebsd* )
+          os_type="freebsd";;
+        gnu )
+          os_type="hurd";;
+esac
+if test "x$os_type" = "x"; then
+ os_type=$target_os 
+fi
+AC_MSG_RESULT([$os_type])
+AC_SUBST(os_type)
+
 dpkg_archset=''
 AC_MSG_CHECKING(Debian architecture)
-dpkg_archset="`awk '$1 == "'$target_cpu-$target_os'" { print $2 }' $srcdir/archtable`"
+dpkg_archset="`awk '$1 == "'$target_cpu-$os_type'" { print $2 }' $srcdir/archtable`"
 # Finish off
 if test "x$dpkg_archset" = "x"; then
- AC_MSG_RESULT([$target_cpu-$target_os, but not found in archtable])
- dpkg_archset=$target_cpu-$target_os
+ AC_MSG_RESULT([$target_cpu-$os_type, but not found in archtable])
+ dpkg_archset=$target_cpu-$os_type
  else
  AC_MSG_RESULT($dpkg_archset)
 fi
@@ -140,6 +163,14 @@
 AC_CHECK_LIB(kvm, kvm_openfiles, SSD_LIBS="-lkvm $SSD_LIBS")
 AC_SUBST(SSD_LIBS)
 
+# check for the proper curses library. This can be either
+# -lcurses or -lncurses, we need to check for either one.
+AC_CHECK_LIB(ncurses,initscr, CURSES_LIBS="-lncurses $CURSES_LIBS", AC_CHECK_LIB(curses,initscr, CURSES_LIBS="-lcurses $CURSES_LIBS"))
+if test "x$CURSES_LIBS" = "x"; then
+ AC_MSG_WARN(no curses library found)
+fi
+AC_SUBST(CURSES_LIBS)
+
 DPKG_CHECK_DEFINE(TIOCNOTTY,sys/ioctl.h)
 
 ZLIB_CFLAGS=
@@ -174,13 +205,17 @@
 } inline int foo (int x) {], AC_DEFINE(HAVE_INLINE,,[Define if inline functions a la GCC are available.]))
 
 AC_MSG_CHECKING([for __va_copy])
-AC_TRY_COMPILE([
+# OpenBSD passes AC_TRY_COMPILE for __va_copy even though 
+# it doesn't seem to exist, which is odd. We need to use
+# AC_TRY_RUN.
+AC_TRY_RUN([
 #include <stdarg.h>
-],[
+main(){
 va_list v1,v2;
 __va_copy(v1, v2);
+exit(0);}
 ], [AC_MSG_RESULT(yes)
-AC_DEFINE(HAVE_VA_COPY,,[Define if you have the __va_copy macro])],[AC_MSG_RESULT(no)
+AC_DEFINE(HAVE_VA_COPY)],[AC_MSG_RESULT(no)
 AC_MSG_CHECKING([for va_list assignment copy])
 AC_TRY_COMPILE([
 #include <stdarg.h>
diff -ru3 dpkg-1.10.4.orig/dselect/Makefile.in dpkg-1.10.4/dselect/Makefile.in
--- dpkg-1.10.4.orig/dselect/Makefile.in	Mon May 20 00:40:26 2002
+++ dpkg-1.10.4/dselect/Makefile.in	Thu Jul 25 06:23:42 2002
@@ -48,7 +48,7 @@
 	done
 
 dselect: $(OBJECTS) ../lib/libdpkg.a
-	$(CXX) $(LDFLAGS) -o $@ $(OBJECTS) -lncurses $(LIBS) $(NLS_LIBS)
+	$(CXX) $(LDFLAGS) -o $@ $(OBJECTS) $(CURSES_LIBS) $(LIBS) $(NLS_LIBS)
 
 basecmds.o: helpmsgs.h
 curkeys.o: curkeys.h
diff -ru3 dpkg-1.10.4.orig/lib/varbuf.c dpkg-1.10.4/lib/varbuf.c
--- dpkg-1.10.4.orig/lib/varbuf.c	Mon May  6 12:18:15 2002
+++ dpkg-1.10.4/lib/varbuf.c	Wed Jul 24 15:39:38 2002
@@ -27,6 +27,10 @@
 #include <dpkg.h>
 #include <dpkg-db.h>
 
+#ifndef HAVE_VA_COPY
+#define __va_copy(dest,src)     (dest) = (src)
+#endif
+
 inline void varbufaddc(struct varbuf *v, int c) {
   if (v->used >= v->size) varbufextend(v);
   v->buf[v->used++]= c;
diff -ru3 dpkg-1.10.4.orig/scripts/dpkg-architecture.pl dpkg-1.10.4/scripts/dpkg-architecture.pl
--- dpkg-1.10.4.orig/scripts/dpkg-architecture.pl	Fri May 24 22:10:15 2002
+++ dpkg-1.10.4/scripts/dpkg-architecture.pl	Wed Jul 24 16:38:33 2002
@@ -93,11 +93,13 @@
 ";
 }
 
-sub rewrite_gnu_cpu {
+sub rewrite_gnu {
 	local ($_) = @_;
 
 	s/(?:i386|i486|i586|i686|pentium)(.*linux)/i386$1/;
 	s/ppc/powerpc/;
+	s/openbsd([\d\.]+$)/openbsd/;
+	s/-unknown-/-/;
 	return $_;
 }
 
@@ -106,7 +108,7 @@
 	local (@list);
 	local ($a);
 
-	$gnu = &rewrite_gnu_cpu($gnu);
+	$gnu = &rewrite_gnu($gnu);
 
 	foreach $a (keys %archtable) {
 		push @list, $a if $archtable{$a} eq $gnu;
@@ -175,7 +177,7 @@
     if (m/^-a/) {
 	$req_host_arch = $';
     } elsif (m/^-t/) {
-	$req_host_gnu_type = &rewrite_gnu_cpu($');
+	$req_host_gnu_type = &rewrite_gnu($');
     } elsif (m/^-[lsu]$/) {
 	$action = $_;
 	$action =~ s/^-//;
diff -ru3 dpkg-1.10.4.orig/scripts/dpkg-shlibdeps.pl dpkg-1.10.4/scripts/dpkg-shlibdeps.pl
--- dpkg-1.10.4.orig/scripts/dpkg-shlibdeps.pl	Wed Jun 20 12:30:15 2001
+++ dpkg-1.10.4/scripts/dpkg-shlibdeps.pl	Wed Jul 24 15:47:34 2002
@@ -82,6 +82,10 @@
     }
     if ($d =~ /^\177ELF$/) { # ELF binary
        return 1;
+    } elsif (unpack ('N', $d) == 2156265739) { # obsd dyn bin
+       return 1;
+    } elsif (unpack ('N', $d) == 8782091) { # obsd stat bin
+       return 1;
     } elsif ($d =~ /^\#\!..$/) { # shell script
        return 0;
     } elsif (unpack ('N', $d) == 0xcafebabe) { # JAVA binary
diff -ru3 dpkg-1.10.4.orig/utils/start-stop-daemon.c dpkg-1.10.4/utils/start-stop-daemon.c
--- dpkg-1.10.4.orig/utils/start-stop-daemon.c	Thu Jul 11 23:32:00 2002
+++ dpkg-1.10.4/utils/start-stop-daemon.c	Wed Jul 24 15:43:43 2002
@@ -28,7 +28,7 @@
 #  define OSHURD
 #elif defined(__sparc__)
 #  define OSsunos
-#elif defined(OPENBSD)
+#elif defined(OPENBSD) || defined(__OpenBSD__)
 #  define OSOpenBSD
 #elif defined(hpux)
 #  define OShpux


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: