From: Adam Heath Date: Sat, 13 Sep 2003 23:43:49 +0000 (+0000) Subject: Support OpenBSD. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=842f828dd9ca788ac123a68ccaabf512d5e82e36;p=dpkg Support OpenBSD. --- diff --git a/ChangeLog b/ChangeLog index 01c2bbd0..23a58c80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Sep 13 18:42:27 CDT 2003 Adam Heath + + * 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 * archtable: Added alphaev68-linux-gnu to archtable. diff --git a/Makefile.conf.in b/Makefile.conf.in index 54e14959..b8627b7a 100644 --- a/Makefile.conf.in +++ b/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@ diff --git a/archtable b/archtable index 1de57ac4..7c1e7e78 100644 --- a/archtable +++ b/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 diff --git a/configure.in b/configure.in index cd1c9ff3..ec2b47c3 100644 --- a/configure.in +++ b/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 -],[ +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 diff --git a/debian/changelog b/debian/changelog index 83859802..ef24b6a2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -46,6 +46,8 @@ dpkg (1.10.11) unstable; urgency=low Closes: #169359 * Falk Hueffner : Added alphaev68-linux-gnu to archtable. Closes: #199360 + * Elie Rosenblum : + Apply patch to support OpenBSD. Closes: #154277 -- Wichert Akkerman UNRELEASED diff --git a/dselect/Makefile.in b/dselect/Makefile.in index f50b349d..7ce734e0 100644 --- a/dselect/Makefile.in +++ b/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 diff --git a/lib/varbuf.c b/lib/varbuf.c index f7185e29..41fbb0d4 100644 --- a/lib/varbuf.c +++ b/lib/varbuf.c @@ -27,6 +27,10 @@ #include #include +#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 --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl index 0e478fb0..3a1e9f52 100755 --- a/scripts/dpkg-architecture.pl +++ b/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/^-//; diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index f53406fa..64fa30f9 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/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 diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index 5ee282b7..0559f46c 100644 --- a/utils/start-stop-daemon.c +++ b/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