Re: [9fans] Fwd: Drawterm problems

2008-12-09 Thread Randall Bohn
I've built drawterm successfully from the CVS sources on Ubuntu x86
and Gentoo x86. It also builds on Win32 if you install Mingw and MSYS
(in that order). I use devfs_win32.c from /n/sources/contrib/
cinap_lenrek.

rsbohn



Re: [9fans] Fwd: Drawterm problems

2008-12-09 Thread Martín Ferrari
On Tue, Dec 9, 2008 at 05:12, Russ Cox [EMAIL PROTECTED] wrote:

 If you update from the CVS repository
 it should build and run just fine.
 If not, please let me know.

I have just uploaded to Debian drawterm with all the fixes.

Thanks a lot for your help!

-- 
Martín Ferrari



[9fans] Fwd: Drawterm problems

2008-12-08 Thread Martín Ferrari
-- Forwarded message --
From: Martín Ferrari [EMAIL PROTECTED]
Date: Tue, Dec 9, 2008 at 03:13
Subject: Drawterm problems
To: Russ Cox [EMAIL PROTECTED]
Cc: Fans of the OS Plan 9 from Bell Labs 9fans@9fans.net, Thiemo
Seufer [EMAIL PROTECTED], [EMAIL PROTECTED], Marc 'HE'
Brockschmidt [EMAIL PROTECTED], [EMAIL PROTECTED],
Damián Viano [EMAIL PROTECTED]


(Copying 9fans in case somebody can lend a hand on this, copying the
Debian bug report(er)s)
Hi Russ,

I'm a Plan9 newbie and Debian Developer, and I'm currently tying to
fix bugs that showed after I uploaded drawterm to Debian. However I
have hit some problems that are being difficult to solve. I've managed
to fix most of them, and I'd like to share the patches.

First problem: it doesn't compile on mips at all, the assembly code
seems invalid. In [0] you can find a proposed patch.

Second problem: the arch handling is quite fragile, and it doesn't
work for sparc under linux [1] (uname -m is sparc64, not sun4u), for
example. But the biggest problem is that there are no provisions for
other architectures. I have prepared a big patch for this, see below.

Third: segfaults on amd64, possibly other arches that I couldn't test.
After a lot of guessing, I suspected of these constructs in lib.h:

typedef intp9_long;
#define long  int

Changing them to match longs with longs made the segfault go away, as
amd64 uses 64bits for longs and the included libX.h was botched
because of the #define long int. But then it popped many type errors
all around, since there are many inconsistencies (for example,
function prototypes that doesn't match exactly the fuction
definitions) and all the code assumes long==int. I'm trying to fix
this, but the problem is very deep: there are many places where size
specific types should be used instead of longs and ints.

I'm still trying to fix this, and would greatly appreciate any help.




I'm including the arch-related patch: it disables all the posix-*/
code (except for the x86 hashing routines, which are now conditionally
complied from libsec) and instead creates a libmachdep directory with
a tas.c file. In tas.c it tries to use the fairly new builtin atomic
operations, and falls back to assemby if it's available. Also, the
getcallerpc function is replaced with other gcc builtin, but I haven't
made provisions for fallback to assembly here as I think that the
builtin I'm using is widely available and that would have made the
patch very complex.

This change enabled drawterm to compile on these architectures: i386
amd64 sparc64 mips mipsel alpha ia64 powerpc s390. But since most of
the porter machines I can use don't have X forwarding, I cannot test
that it works correctly. sparc64 and i386 were tested and it seems to
work ok.


[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508068
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508100

--
Martín Ferrari



-- 
Martín Ferrari
Index: drawterm/include/lib.h
===
--- drawterm.orig/include/lib.h
+++ drawterm/include/lib.h
@@ -240,7 +240,12 @@ extern	int	fmtprint(Fmt*, char*, ...);
 extern	int	fmtvprint(Fmt*, char*, va_list);
 extern	void*	mallocz(ulong, int);
 
-extern	uintptr	getcallerpc(void*);
+/* Use a GCC extension that provides the same, without specifying the actual
+ * assembly code. In the code is always used to return the caller to the actual
+ * function, so I ignore the argument */
+/* extern	uintptr	getcallerpc(void*); */
+#define		getcallerpc(a) \
+		((uintptr)__builtin_return_address(0))
 extern	char*	cleanname(char*);
 extern	void	sysfatal(char*, ...);
 extern	char*	strecpy(char*, char*, char*);
Index: drawterm/Make.irix
===
--- drawterm.orig/Make.irix
+++ drawterm/Make.irix
@@ -20,5 +20,4 @@ MAKE=gmake
 
 all: default
 
-libmachdep.a:
-	(cd posix-mips  $(MAKE))
+ARCH=mips
Index: drawterm/Make.osx
===
--- drawterm.orig/Make.osx
+++ drawterm/Make.osx
@@ -15,6 +15,5 @@ AUDIO=none
 
 all: default
 
-libmachdep.a:
-	arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/'`; \
-	(cd posix-$$arch   make)
+ARCH := $(shell uname -m |\
+	sed 's/i.86/386/;s/Power Macintosh/power/;s/x86_64/amd64/' )
Index: drawterm/Make.osx-x11
===
--- drawterm.orig/Make.osx-x11
+++ drawterm/Make.osx-x11
@@ -16,6 +16,5 @@ AUDIO=none
 
 all: default
 
-libmachdep.a:
-	arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/'`; \
-	(cd posix-$$arch   make)
+ARCH := $(shell uname -m |\
+	sed 's/i.86/386/;s/Power Macintosh/power/;s/x86_64/amd64/' )
Index: drawterm/Make.sun
===
--- drawterm.orig/Make.sun
+++ drawterm/Make.sun
@@ -16,6 +16,5 @@ AUDIO=none
 
 all: default
 
-libmachdep.a:
-	arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/'`; \

Re: [9fans] Fwd: Drawterm problems

2008-12-08 Thread Michal Hajek
Hello, 
 From: Mart�n Ferrari [EMAIL PROTECTED]
 Subject: Drawterm problems

I am a user of debian an amd64 and also I succeeded to install plan9 on
another machine, although my skills in plan9 are less than mediocre.

However, I am ready to test drawterm and hopefuly be helpful.

Also, I have already downloaded source of drawterm and tried to compile
it (few days ago as a matter of coincidence). Unfortunately, on my
system the source did not compile.  From what has been said in the two
previous emails I understood that just downloading a source and trying
to compile as is was almost hopeless anyway.  But if somebody is
interested in details, I can send them.
 
Best regards
Michal 



Re: [9fans] Fwd: Drawterm problems

2008-12-08 Thread Russ Cox
  I am a user of debian an amd64 and also I succeeded to install plan9 on
  another machine, although my skills in plan9 are less than mediocre.

  However, I am ready to test drawterm and hopefuly be helpful.

  Also, I have already downloaded source of drawterm and tried to compile
  it (few days ago as a matter of coincidence). Unfortunately, on my
  system the source did not compile.  From what has been said in the two
  previous emails I understood that just downloading a source and trying
  to compile as is was almost hopeless anyway.  But if somebody is
  interested in details, I can send them.

If you update from the CVS repository
it should build and run just fine.
If not, please let me know.

Thanks.
Russ