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

Bug#602766: libsbuf-dev for non-kfreebsd systems



Package: libsbuf-dev
Version: 8.1-5
Severity: wishlist
Tags: patch

This patch makes libsbuf buildable (and usable) on kernels other
than kFreeBSD.

Note: this requires moving a header off kfreebsd-kernel-headers,
and adjusting the Replaces: kfreebsd-kernel-headers (<< 0~fixme)
afterwards.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libsbuf-dev depends on:
ii  libc6-dev [libc-dev]          2.11.2-6   Embedded GNU C Library: Developmen
ii  libsbuf0                      8.1-5      FreeBSD string buffer library

libsbuf-dev recommends no packages.

libsbuf-dev suggests no packages.

-- no debconf information
diff -Nur -x sbuf.h freebsd-libs-8.1/debian/control freebsd-libs-8.1.new/debian/control
--- freebsd-libs-8.1/debian/control	2010-11-07 18:22:58.000000000 +0100
+++ freebsd-libs-8.1.new/debian/control	2010-11-07 22:16:29.000000000 +0100
@@ -3,15 +3,19 @@
 Priority: optional
 Maintainer: GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>
 Uploaders: Aurelien Jarno <aurel32@debian.org>
-Build-Depends: debhelper (>= 7), quilt, freebsd-buildutils, libbsd-dev (>= 0.1.4),
- libc0.1-dev (>= 2.10), libgdbm-dev, kfreebsd-kernel-headers (>= 0.51), libexpat-dev
+Build-Depends: debhelper (>= 7), quilt, freebsd-buildutils,
+ libbsd-dev (>= 0.1.4) [kfreebsd-any],
+ libc0.1-dev (>= 2.10) [kfreebsd-any],
+ libgdbm-dev [kfreebsd-any],
+ kfreebsd-kernel-headers (>= 0.51) [kfreebsd-any],
+ libexpat-dev [kfreebsd-any]
 # libexpat-dev: aka bsdxml. needed by libgeom
 Vcs-Browser: http://svn.debian.org/wsvn/glibc-bsd/trunk/freebsd-libs/
 Vcs-Svn: svn://svn.debian.org/glibc-bsd/trunk/freebsd-libs/
 Standards-Version: 3.9.1
 
 Package: libsbuf0
-Architecture: kfreebsd-any
+Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: FreeBSD string buffer library
  This library provide a way to handle string buffers. It contains
@@ -32,8 +36,9 @@
 
 Package: libsbuf-dev
 Section: libdevel
-Architecture: kfreebsd-any
+Architecture: any
 Depends: libsbuf0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
+Replaces: kfreebsd-kernel-headers (<< 0~fixme)
 Description: Development files for libsbuf
  This package contains the header files and static library needed to
  compile applications that use libsbuf.
diff -Nur -x sbuf.h freebsd-libs-8.1/debian/libsbuf-dev.install freebsd-libs-8.1.new/debian/libsbuf-dev.install
--- freebsd-libs-8.1/debian/libsbuf-dev.install	2010-11-07 18:22:58.000000000 +0100
+++ freebsd-libs-8.1.new/debian/libsbuf-dev.install	2010-11-07 22:19:01.000000000 +0100
@@ -1,2 +1,3 @@
 usr/lib/libsbuf.a
 usr/lib/libsbuf*.so
+sys/sys/sbuf.h		usr/include
diff -Nur -x sbuf.h freebsd-libs-8.1/debian/patches/03_sbuf.diff freebsd-libs-8.1.new/debian/patches/03_sbuf.diff
--- freebsd-libs-8.1/debian/patches/03_sbuf.diff	1970-01-01 01:00:00.000000000 +0100
+++ freebsd-libs-8.1.new/debian/patches/03_sbuf.diff	2010-11-07 22:14:43.000000000 +0100
@@ -0,0 +1,44 @@
+--- a/lib/libsbuf/Makefile
++++ b/lib/libsbuf/Makefile
+@@ -4,6 +4,7 @@
+ SHLIBDIR?= /lib
+ SRCS=	subr_sbuf.c 
+ WARNS?= 2
++CFLAGS+= -I${.CURDIR}/../../sys
+ 
+ .PATH:	${.CURDIR}/../../sys/kern
+ 
+--- a/sys/kern/subr_sbuf.c
++++ b/sys/kern/subr_sbuf.c
+@@ -44,6 +44,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/user.h> /* PAGE_SIZE */
+ #endif /* _KERNEL */
+ 
+ #include <sys/sbuf.h>
+--- a/sys/sys/sbuf.h
++++ b/sys/sys/sbuf.h
+@@ -31,8 +31,6 @@
+ #ifndef _SYS_SBUF_H_
+ #define	_SYS_SBUF_H_
+ 
+-#include <sys/_types.h>
+-
+ /*
+  * Structure definition
+  */
+@@ -64,10 +62,8 @@
+ int		 sbuf_bcpy(struct sbuf *, const void *, size_t);
+ int		 sbuf_cat(struct sbuf *, const char *);
+ int		 sbuf_cpy(struct sbuf *, const char *);
+-int		 sbuf_printf(struct sbuf *, const char *, ...)
+-	__printflike(2, 3);
+-int		 sbuf_vprintf(struct sbuf *, const char *, __va_list)
+-	__printflike(2, 0);
++int		 sbuf_printf(struct sbuf *, const char *, ...);
++int		 sbuf_vprintf(struct sbuf *, const char *, __va_list);
+ int		 sbuf_putc(struct sbuf *, int);
+ int		 sbuf_trim(struct sbuf *);
+ int		 sbuf_overflowed(struct sbuf *);
diff -Nur -x sbuf.h freebsd-libs-8.1/debian/rules freebsd-libs-8.1.new/debian/rules
--- freebsd-libs-8.1/debian/rules	2010-11-07 18:22:58.000000000 +0100
+++ freebsd-libs-8.1.new/debian/rules	2010-11-07 22:18:52.000000000 +0100
@@ -9,7 +9,7 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
-CFLAGS = -Wall -g -pipe -fPIC -I. -D_GNU_SOURCE -D'__FBSDID(string)='
+CFLAGS = -Wall -g -pipe -fPIC -I. -D_GNU_SOURCE -D'__FBSDID(string)=' -D__va_list=__builtin_va_list
 
 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -O0
@@ -25,6 +25,7 @@
 DESTDIR=$(CURDIR)/debian/tmp
 PMAKE=COPTS="$(CFLAGS)" CFLAGS="$(CFLAGS)" NO_WERROR=1 NOGCCERROR=1 NOSHARED=NO NO_SHARED=NO DESTDIR=$(DESTDIR) make
 export SHLIB_MAJOR=0
+kernel=$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 
 get-orig-source:
 	rm -rf $(ORIGDIR)
@@ -37,6 +38,8 @@
 	svn cat $(SVN)/share/misc/usb_hid_usages > $(ORIGDIR)/lib/libusbhid/usb_hid_usages
 	mkdir -p $(ORIGDIR)/sys/kern && \
 	    svn cat $(SVN)/sys/kern/subr_sbuf.c > $(ORIGDIR)/sys/kern/subr_sbuf.c
+	mkdir -p $(ORIGDIR)/sys/sys && \
+	    svn cat $(SVN)/sys/sys/sbuf.h > $(ORIGDIR)/sys/sys/sbuf.h
 	# Remove unused files with non GPL compatible license (eg BSD 4 clauses)
 	rm -f $(ORIGDIR)/sys/cam/scsi/scsi_ch.*
 	rm -f $(ORIGDIR)/lib/libkvm/kvm_ia64.c
@@ -49,7 +52,11 @@
 	QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
 	touch $@
 
+ifeq ($(kernel), kfreebsd)
 build: build-cam build-geom build-sbuf build-ipx build-kiconv build-kvm build-usbhid build-usb build-devstat build-memstat build-netgraph
+else
+build: build-sbuf
+endif
 
 build-cam: build-cam-stamp
 build-cam-stamp: patch build-sbuf
@@ -109,6 +116,8 @@
 clean:
 	dh_testdir
 	dh_testroot
+	$(PMAKE) -C $(CURDIR)/lib/libsbuf clean
+ifeq ($(kernel), kfreebsd)
 	$(PMAKE) -C $(CURDIR)/lib/libcam clean
 	$(PMAKE) -C $(CURDIR)/lib/libnetgraph clean
 	$(PMAKE) -C $(CURDIR)/lib/libdevstat clean
@@ -117,9 +126,9 @@
 	$(PMAKE) -C $(CURDIR)/lib/libipx clean
 	$(PMAKE) -C $(CURDIR)/lib/libkiconv clean
 	$(PMAKE) -C $(CURDIR)/lib/libkvm clean
-	$(PMAKE) -C $(CURDIR)/lib/libsbuf clean
 	$(PMAKE) -C $(CURDIR)/lib/libusbhid clean
 	$(PMAKE) -C $(CURDIR)/lib/libusb clean
+endif
 	QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2
 	rm -rf .pc
 	rm -f *stamp
@@ -133,6 +142,7 @@
 
 	mkdir -p $(DESTDIR)/lib $(DESTDIR)/usr/lib $(DESTDIR)/usr/include $(DESTDIR)/usr/share/man/man3
 	$(PMAKE) -C $(CURDIR)/lib/libsbuf install SHLIBDIR=/usr/lib
+ifeq ($(kernel), kfreebsd)
 	$(PMAKE) -C $(CURDIR)/lib/libcam install SHLIBDIR=/usr/lib
 	$(PMAKE) -C $(CURDIR)/lib/libgeom install SHLIBDIR=/lib
 	$(PMAKE) -C $(CURDIR)/lib/libipx install SHLIBDIR=/usr/lib
@@ -148,6 +158,7 @@
 	install -m644 debian/libusb*.pc $(CURDIR)/debian/tmp/usr/lib/pkgconfig
 	mkdir -p $(CURDIR)/debian/tmp/usr/bin
 	install -m755 debian/libusb-config $(CURDIR)/debian/tmp/usr/bin
+endif
 
 	dh_install --list-missing
 
@@ -183,10 +194,12 @@
 #	dh_perl
 #	dh_python
 	dh_makeshlibs -a
+ifeq ($(kernel), kfreebsd)
 	dh_makeshlibs -plibgeom0 --add-udeb=libgeom0-udeb
 	dh_makeshlibs -plibipx2 --add-udeb=libipx2-udeb
 	dh_makeshlibs -plibsbuf0 --add-udeb=libsbuf0-udeb
 	dh_makeshlibs -plibusb2 --add-udeb=libusb2-udeb
+endif
 	dh_installdeb -a
 	dh_shlibdeps -a
 	dh_gencontrol -a

Reply to: