9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] drawterm: get 64-bit windows to work
@ 2022-05-07  2:13 Amavect
  2022-05-14 21:48 ` [9front] " Amavect
  0 siblings, 1 reply; 9+ messages in thread
From: Amavect @ 2022-05-07  2:13 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

Hi,

This gets drawterm to compile and not segfault under x86_64 mingw-w64.
Tested on Wine and MSYS2.

I noticed that the win32-386 and posix-386 directories are nearly the
same (some asm preprocessor metarule in the win32-386 Makefile?), so I
used posix-amd64 for libmachdep.a instead of making a new directory.
I'll leave keeping or removing win32-386/ up to discussion.

Thanks,
Amavect

[-- Attachment #2.1: Type: text/plain, Size: 337 bytes --]

from postmaster@9front:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: text/x-patch
	Content-Transfer-Encoding: 7bit
	Content-Disposition: attachment;
 filename=0001-get-64-bit-windows-to-work.patch

[-- Attachment #2.2: 0001-get-64-bit-windows-to-work.patch.suspect --]
[-- Type: application/octet-stream, Size: 2021 bytes --]

 From e96ba525c4a5ff82fabfddd8e4e42f6b675e0949 Mon Sep 17 00:00:00 2001
From: Amavect <amavect@gmail.com>
Date: Fri, 6 May 2022 20:59:22 -0500
Subject: [PATCH] get 64-bit windows to work

---
 Make.win64         | 32 ++++++++++++++++++++++++++++++++
 gui-win32/screen.c |  4 ++--
 include/9windows.h |  2 +-
 3 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 Make.win64

diff --git a/Make.win64 b/Make.win64
new file mode 100644
index 0000000..1232bc4
--- /dev/null
+++ b/Make.win64
@@ -0,0 +1,32 @@
+# Windows via mingw-w64
+# MING=mingw32- is necessary if you're cross-compiling
+# on another platform.  Otherwise the binaries are just
+# named gcc, etc.
+
+AUDIO=win32
+MING=x86_64-w64-mingw32-
+#MING=
+AR=$(MING)ar
+CC=$(MING)gcc
+AS=$(MING)as
+RANLIB=$(MING)ranlib
+WINDRES=$(MING)windres
+CFLAGS=-Wall -Wno-missing-braces -I$(ROOT)/include -I$(ROOT) -I$(ROOT)/kern -c -DWINDOWS -DUNICODE -O2
+O=o
+FS=fs-win32
+IP=win32
+OS=win32
+GUI=win32
+LDADD=-lgdi32 -lws2_32 -lwinmm -mwindows
+TARG=drawterm.exe
+XOFILES=glenda-t.$O
+
+all: default
+
+# for root
+libmachdep.a:
+	(cd posix-amd64; make)
+
+glenda-t.$O: glenda-t.rc glenda-t.ico
+	$(WINDRES) -i glenda-t.rc -o glenda-t.o
+
diff --git a/gui-win32/screen.c b/gui-win32/screen.c
index 3790417..81c9fe6 100644
--- a/gui-win32/screen.c
+++ b/gui-win32/screen.c
@@ -532,7 +532,7 @@ setcursor(void)
 	free(and);
 	free(xor);
 
-	PostMessage(window, WM_SETCURSOR, (int)window, 0);
+	PostMessage(window, WM_SETCURSOR, (WPARAM)window, 0);
 }
 
 void
@@ -543,7 +543,7 @@ cursorarrow(void)
 		hcursor = 0;
 	}
 	SetCursor(LoadCursor(0, IDC_ARROW));
-	PostMessage(window, WM_SETCURSOR, (int)window, 0);
+	PostMessage(window, WM_SETCURSOR, (WPARAM)window, 0);
 }
 
 
diff --git a/include/9windows.h b/include/9windows.h
index e779475..e65e955 100644
--- a/include/9windows.h
+++ b/include/9windows.h
@@ -18,4 +18,4 @@
 
 typedef __int64		p9_vlong;
 typedef	unsigned __int64 p9_uvlong;
-typedef unsigned uintptr;
+typedef uintptr_t uintptr;
-- 
2.36.0



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-07  2:13 [9front] [PATCH] drawterm: get 64-bit windows to work Amavect
@ 2022-05-14 21:48 ` Amavect
  2022-05-14 22:38   ` ori
  0 siblings, 1 reply; 9+ messages in thread
From: Amavect @ 2022-05-14 21:48 UTC (permalink / raw)
  To: 9front

On Fri, 6 May 2022 21:13:00 -0500
Amavect <amavect@gmail.com> wrote:

> This gets drawterm to compile and not segfault under x86_64 mingw-w64.
> Tested on Wine and MSYS2.

Pinging this again.

Thanks,
Amavect

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-14 21:48 ` [9front] " Amavect
@ 2022-05-14 22:38   ` ori
  2022-05-15  7:01     ` sirjofri
  0 siblings, 1 reply; 9+ messages in thread
From: ori @ 2022-05-14 22:38 UTC (permalink / raw)
  To: 9front

Quoth Amavect <amavect@gmail.com>:
> On Fri, 6 May 2022 21:13:00 -0500
> Amavect <amavect@gmail.com> wrote:
> 
> > This gets drawterm to compile and not segfault under x86_64 mingw-w64.
> > Tested on Wine and MSYS2.
> 
> Pinging this again.
> 
> Thanks,
> Amavect

Anyone with windows mind reporting back? if not, I'm going to commmit
on Monday.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-14 22:38   ` ori
@ 2022-05-15  7:01     ` sirjofri
  2022-05-15 14:48       ` ori
  0 siblings, 1 reply; 9+ messages in thread
From: sirjofri @ 2022-05-15  7:01 UTC (permalink / raw)
  To: 9front

If you give me a day time I can try on windows 11.

sirjofri

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-15  7:01     ` sirjofri
@ 2022-05-15 14:48       ` ori
  2022-05-15 15:44         ` sirjofri
  0 siblings, 1 reply; 9+ messages in thread
From: ori @ 2022-05-15 14:48 UTC (permalink / raw)
  To: 9front

Quoth sirjofri <sirjofri+ml-9front@sirjofri.de>:
> If you give me a day time I can try on windows 11.
> 
> sirjofri

Sounds good -- I'll commit when I hear back, thanks!


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-15 14:48       ` ori
@ 2022-05-15 15:44         ` sirjofri
  2022-05-15 15:47           ` ori
                             ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: sirjofri @ 2022-05-15 15:44 UTC (permalink / raw)
  To: 9front

Hello, reporting back!

(Irc is fine, but people can't follow that easily, so here are my 
results:)

I installed cygwin and everything gcc that made sense, including the gcc 
package and mingw-gcc. I didn't install any 32bit compilers as far as I 
can tell. The installation target was my work windows 11 PC.

Using CONF=win64 compiled without any issues. It used 
x86_64-w64-mingw32-gcc for compiling. I verified the binary is 64-bit, 
and not 32-bit. Starting works fine like I'd expect from a drawterm 
application. No issues at runtime so far.

However, Make.win64 mentions that I can set MING to nothing when not 
cross-compiling since it would just use gcc then. I tried it, but it 
failed at some #include (I think it was direct.h). It is possible that it 
uses the "other" gcc version I installed on cygwin which tries to find 
libraries that aren't installed.

In the end, mingw works fine and is also what the Readme states. I 
suggest adjusting the comment in the Make.win64 to prevent confusion and 
then publish it.

P.S. nice to have some 64-bit drawterm. I'd love to have it as a download 
at drawterm.9front.org.

sirjofri

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-15 15:44         ` sirjofri
@ 2022-05-15 15:47           ` ori
  2022-05-15 15:57           ` sirjofri
  2022-05-15 20:56           ` Amavect
  2 siblings, 0 replies; 9+ messages in thread
From: ori @ 2022-05-15 15:47 UTC (permalink / raw)
  To: 9front

Quoth sirjofri <sirjofri+ml-9front@sirjofri.de>:
> Hello, reporting back!
> 
> (Irc is fine, but people can't follow that easily, so here are my 
> results:)
> 
> I installed cygwin and everything gcc that made sense, including the gcc 
> package and mingw-gcc. I didn't install any 32bit compilers as far as I 
> can tell. The installation target was my work windows 11 PC.
> 
> Using CONF=win64 compiled without any issues. It used 
> x86_64-w64-mingw32-gcc for compiling. I verified the binary is 64-bit, 
> and not 32-bit. Starting works fine like I'd expect from a drawterm 
> application. No issues at runtime so far.
> 
> However, Make.win64 mentions that I can set MING to nothing when not 
> cross-compiling since it would just use gcc then. I tried it, but it 
> failed at some #include (I think it was direct.h). It is possible that it 
> uses the "other" gcc version I installed on cygwin which tries to find 
> libraries that aren't installed.
> 
> In the end, mingw works fine and is also what the Readme states. I 
> suggest adjusting the comment in the Make.win64 to prevent confusion and 
> then publish it.
> 
> P.S. nice to have some 64-bit drawterm. I'd love to have it as a download 
> at drawterm.9front.org.
> 
> sirjofri

pushed, thanks!


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-15 15:44         ` sirjofri
  2022-05-15 15:47           ` ori
@ 2022-05-15 15:57           ` sirjofri
  2022-05-15 20:56           ` Amavect
  2 siblings, 0 replies; 9+ messages in thread
From: sirjofri @ 2022-05-15 15:57 UTC (permalink / raw)
  To: 9front

If someone wants to have the 64-bit drawterm version before release, you 
can (temporarily) download it from my server 😉

https://sirjofri.de/oat/tmp/drawterm.exe

(It's a stripped version)

sirjofri

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] Re: [PATCH] drawterm: get 64-bit windows to work
  2022-05-15 15:44         ` sirjofri
  2022-05-15 15:47           ` ori
  2022-05-15 15:57           ` sirjofri
@ 2022-05-15 20:56           ` Amavect
  2 siblings, 0 replies; 9+ messages in thread
From: Amavect @ 2022-05-15 20:56 UTC (permalink / raw)
  To: 9front

On Sun, 15 May 2022 15:44:42 +0000 (UTC)
sirjofri <sirjofri+ml-9front@sirjofri.de> wrote:

> However, Make.win64 mentions that I can set MING to nothing when not 
> cross-compiling since it would just use gcc then. I tried it, but it 
> failed at some #include (I think it was direct.h). It is possible
> that it uses the "other" gcc version I installed on cygwin which
> tries to find libraries that aren't installed.

MSYS2's mingw64 environment requires the MING prefix to be empty
due to some programs (like windres) not having a prefix.
gcc and $(MING)gcc are aliases in that environment.
(MSYS2 is basically Cygwin but with pacman.)
Cygwin's unprefixed gcc targets its posix emulation dll,
so you'd always want to use the prefix to cross-compile.
It might also be missing parts of the win32 api.
Different gccs can have different default include directories.
It's confusing.

Thanks,
Amavect

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-15 21:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-07  2:13 [9front] [PATCH] drawterm: get 64-bit windows to work Amavect
2022-05-14 21:48 ` [9front] " Amavect
2022-05-14 22:38   ` ori
2022-05-15  7:01     ` sirjofri
2022-05-15 14:48       ` ori
2022-05-15 15:44         ` sirjofri
2022-05-15 15:47           ` ori
2022-05-15 15:57           ` sirjofri
2022-05-15 20:56           ` Amavect

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).