Attached is a patch to fix most of the compilation problems for
util-vserver. Steve Langasek tested this on sparc and it worked. Builds
still fail on at least hppa, powerpc, and mipsel, since the dietlibc
linking fails. See #300926 for some discussion about this.

I didn't try giving the -Os option to the diet command at the linking
stage, since I didn't see an easy way to do it from util-vserver's
debian/rules.

I have so far failed to debug the linking problem to any successful
degree. Gerrit, perhaps you could give Ola a helping hand with the
linking issue?

diff -ru util-vserver-0.30.204/debian/changelog util-vserver-0.30.204.patched/debian/changelog
--- util-vserver-0.30.204/debian/changelog	2005-03-25 12:51:53.008715504 +0200
+++ util-vserver-0.30.204.patched/debian/changelog	2005-03-24 12:34:34.000000000 +0200
@@ -1,3 +1,13 @@
+util-vserver (0.30.204-1.1) unstable; urgency=low
+
+  * debian/rules: Added stuff to put architecture specific macros to CFLAGS
+    to work around problems in dietlibc's header files.
+  * src/vshelper-sync.c: Test for __linux__ (which is defined always when
+    compiling for Linux) instead of __linux (which is not defined when
+    compiling with gcc --std=c99).
+
+ -- Lars Wirzenius <[EMAIL PROTECTED]>  Thu, 24 Mar 2005 12:30:00 +0200
+
 util-vserver (0.30.204-1) unstable; urgency=low
 
   * New upstream release.
diff -ru util-vserver-0.30.204/debian/rules util-vserver-0.30.204.patched/debian/rules
--- util-vserver-0.30.204/debian/rules	2005-03-25 12:51:53.007715656 +0200
+++ util-vserver-0.30.204.patched/debian/rules	2005-03-24 13:41:18.000000000 +0200
@@ -11,6 +11,7 @@
 # from having to guess our platform (since we know it already)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
 
 # (Most of) the files this concerns belong to /usr/lib/util-vserver.
 # To keep referencing simple, and because we're not even sure there
@@ -18,7 +19,27 @@
 # so far.
 #MAKE_OPTS =  pkglibdir=/var/lib/util-vserver PKGLIBDIR=/var/lib/util-vserver
 
-CFLAGS = -Wall -g
+CFLAGS = -Wall -g 
+
+ifeq ($(DEB_HOST_ARCH),powerpc)
+    # dietlibc's sys/types.h tests for "powerpc", not "__powerpc__"
+    CFLAGS += -Dpowerpc
+endif
+
+ifeq ($(DEB_HOST_ARCH),sparc)
+    # Targetting at older sparc's causes compilation errors. Steve Langasek
+    # says this works and it is anyway the oldest sparc generation we
+    # support in Debian (or kernel/glibc).
+    CFLAGS += -mv8
+endif
+
+ifeq ($(DEB_HOST_ARCH),hppa)
+    # dietlibc fails to define O_NOFOLLOW and O_LARGEFILE. These values
+    # have been copied from glibc's bits/fcntl.h.
+    CFLAGS += -DO_NOFOLLOW=00000200 -DO_LARGEFILE=00004000
+endif
+
+
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -O0
diff -ru util-vserver-0.30.204/src/vshelper-sync.c util-vserver-0.30.204.patched/src/vshelper-sync.c
--- util-vserver-0.30.204/src/vshelper-sync.c	2004-04-21 12:44:05.000000000 +0300
+++ util-vserver-0.30.204.patched/src/vshelper-sync.c	2005-03-24 12:24:01.000000000 +0200
@@ -85,7 +85,7 @@
     FD_ZERO(&fds);
     FD_SET(fd, &fds);
 
-#ifndef __linux
+#ifndef __linux__
 #  error vshelper relies on the Linux select() behavior (timeout holds remaining time)
 #endif
 

Reply via email to