Selaa lähdekoodia

Support OpenBSD.

Adam Heath 23 vuotta sitten
vanhempi
commit
842f828dd9
10 muutettua tiedostoa jossa 68 lisäystä ja 12 poistoa
  1. 6 0
      ChangeLog
  2. 2 0
      Makefile.conf.in
  3. 2 1
      archtable
  4. 41 6
      configure.in
  5. 2 0
      debian/changelog
  6. 1 1
      dselect/Makefile.in
  7. 4 0
      lib/varbuf.c
  8. 5 3
      scripts/dpkg-architecture.pl
  9. 4 0
      scripts/dpkg-shlibdeps.pl
  10. 1 1
      utils/start-stop-daemon.c

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+Sat Sep 13 18:42:27 CDT 2003 Adam Heath <doogie@debian.org>
+
+  * Makefile.conf.in, archtable, configure.in, dselect/Makefile.in,
+    lib/varbuf.c, scripts/dpkg-{architecture,shlibdeps}.pl,
+    utils/start-stop-daemon.c: Support OpenBSD.
+
 Sat Sep 13 18:39:41 CDT 2003 Adam Heath <doogie@debian.org>
 
   * archtable: Added alphaev68-linux-gnu to archtable.

+ 2 - 0
Makefile.conf.in

@@ -73,6 +73,8 @@ NLS_LIBS		= @INTLLIBS@
 
 SSD_LIBS		= @SSD_LIBS@
 
+CURSES_LIBS		= @CURSES_LIBS@
+
 ZLIB_CFLAGS		= @ZLIB_CFLAGS@
 ZLIB_LIBS		= @ZLIB_LIBS@
 ZLIB_LIBS_ALSO_STATIC	= @ZLIB_LIBS_ALSO_STATIC@

+ 2 - 1
archtable

@@ -53,7 +53,8 @@ i386-netbsdelf-gnu	netbsd-i386	netbsd-i386
 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
 s390x-linux-gnu		s390x		s390x

+ 41 - 6
configure.in

@@ -93,13 +93,36 @@ AC_MSG_RESULT($VERSION)
 
 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
@@ -141,6 +164,14 @@ AC_CHECK_LIB(shouldbeinlibc, fmt_past_time, SSD_LIBS="-lshouldbeinlibc $SSD_LIBS
 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=
@@ -175,13 +206,17 @@ AC_TRY_COMPILE(,[
 } 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>

+ 2 - 0
debian/changelog

@@ -46,6 +46,8 @@ dpkg (1.10.11) unstable; urgency=low
     Closes: #169359
   * Falk Hueffner <falk@debian.org>:
     Added alphaev68-linux-gnu to archtable.  Closes: #199360
+  * Elie Rosenblum <fnord@debian.org>:
+    Apply patch to support OpenBSD.  Closes: #154277
 
  -- Wichert Akkerman <debian@extern.wiggy.net>  UNRELEASED
 

+ 1 - 1
dselect/Makefile.in

@@ -48,7 +48,7 @@ install-doc:
 	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

+ 4 - 0
lib/varbuf.c

@@ -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;

+ 5 - 3
scripts/dpkg-architecture.pl

@@ -95,11 +95,13 @@ Known GNU System Types are ".join(", ",map ($archtable{$_},keys %archtable))."
 ";
 }
 
-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 $_;
 }
 
@@ -108,7 +110,7 @@ sub gnu_to_debian {
 	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;
@@ -171,7 +173,7 @@ while (@ARGV) {
     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/^-//;

+ 4 - 0
scripts/dpkg-shlibdeps.pl

@@ -82,6 +82,10 @@ sub isbin {
     }
     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

+ 1 - 1
utils/start-stop-daemon.c

@@ -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