azpainter icon indicating copy to clipboard operation
azpainter copied to clipboard

Porting to Windows

Open Symbian9 opened this issue 8 years ago • 5 comments

Using Cygwin/X

  • http://x.cygwin.com
    • https://github.com/czvtools/cygwinxp
    • https://github.com/x3193/cygwinxp
  • https://github.com/cygwinports/cygport
  • https://github.com/cygwinports-extras

Using Xming

  • https://sourceforge.net/projects/xming/
  • https://github.com/niloufar/xmingw32

Symbian9 avatar Oct 13 '17 01:10 Symbian9

Found that there is FontForge MinGW-64 build scripts:

  • https://github.com/jtanx/fontforgebuilds

@jtanx, could you help me create similar build scripts for AzPainter?

Symbian9 avatar Jun 03 '19 01:06 Symbian9

Sure, I'll take a look this evening.

Just note I've actually just removed all the x11 stuff from FontForge builds, because we can now build the gui without it. But there's some useful stuff there if you have a hard dependency on x11.

jtanx avatar Jun 03 '19 02:06 jtanx

Sure, I'll take a look this evening.

Thanks!

Symbian9 avatar Jun 03 '19 02:06 Symbian9

I had a bit of a play around with this. It can start, but it doesn't run (it crashes on doing anything nontrivial).

image

See this branch: https://github.com/Symbian9/azpainter/compare/master...jtanx:win32

CFLAGS="-g -O0 -DMLIB_NO_THREAD=1" ./configure  --with-freetype-dir=/mingw32/include/freetype2 
  • Must open files in binary mode (O_BINARY)
  • You need to write a strndup replacement, I wrote a quick hack
  • Symlinks don't exist (well they sort of do, but I won't go there)
  • mkdir syntax is different (no permissions field)
  • sys/select.h doesn't exist
  • For some reason XInternAtom was segfaulting. I was using my precompiled X11 binaries, since I haven't compiled it from scratch in a long time. These are missing the debugging symbols. So I've left this for now, but really you need to compile libx11 from scratch, and run it under gdb to figure out why it's segfaulting
  • No unsetenv
  • Linking flags are different
  • No fcntl on Windows - I'm not sure how important this is, but this fcntl code here https://github.com/Symbian9/azpainter/blob/master/mlib/src/x11/x11_main.c#L183 requires some equivalent Winapi/winsock rewrite - the alternative, which I did, was to define the MLIB_NO_THREAD variable. For reference, we can get pthreads just fine, just not fcntl
  • I had to uninstall libxext - I can get this installed, but it doesn't support the shm stuff that mlib does.

Other notes - the configure script isn't very flexible, e.g. it doesn't use pkg-config, so the makefile just assumes it can link to a bunch of libs, even though it can't.

This repo is also missing a .gitignore file, and there's a bunch of files committed which shouldn't be (I removed them in the branch).

To be honest, unless there's a strong push for a native Windows build this would probably all just work on Cygwin (which I don't have). Having to run an X server (VcXsrv/Xming) to run this is always going to be a bit clunky, and it's hitting other edge cases running X on Windows, that I never saw for FontForge.

jtanx avatar Jun 03 '19 09:06 jtanx

Thank you for try, @jtanx!

To be honest, unless there's a strong push for a native Windows build this would probably all just work on Cygwin (which I don't have).

I will try find someone who can help with Cygwin build.

Symbian9 avatar Jun 03 '19 15:06 Symbian9