lua-users home
lua-l archive

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


Hi,

Luiz Henrique de Figueiredo wrote:
> > The attached patch allows Lua to be built on a Cygwin host targetting MinGW:
> > 
> > make "CC=gcc -mno-cygwin" mingw  # build MinGW version
> 
> Thanks. Shouldn't we then add a cygwin target as below?
> 
> cygwin:
> 	$(MAKE) "CC=gcc -mno-cygwin" mingw

This would be a misnomer, but you may want to do it anyway.

[ I guess this requires an explanation:

Cygwin is a complete POSIX emulation layer plus a toolchain and a
number of utilities. Cygwin is primarily intended to get *POSIX*
programs easily ported to Windows. It also provides a development
environment where POSIX developers feel at home (shell, editor).

MinGW is a set of WIN32 compatible header files plus a toolchain.
MinGW shares (most) of the toolchain with Cygwin, but is pretty
barebones. This is fine for compiling *native* Windows programs.
Cross-compilation works, too (compile on Linux, run on Windows).

The -mno-cygwin flag tells the Cygwin compiler not to use the
Cygwin libraries, but instead link to the native Windows
libraries (MSVC6 DLLs), just like MinGW does.

Since the toolchain is similar enough, the 'mingw' target works
when used under Cygwin (with the change to $CC). Lua already
supports Windows and does not need a POSIX emulation layer.

But what you get is not really a Cygwin binary. You can just use
the 'posix' target with Cygwin (i.e. no new target is needed).
The question whether this is desirable has resulted in heated
debates. I won't try to rehash this here. But see below, too.

So technically the target you mentioned would have to be named
'nocygwin'. ;-)

BTW: Linking against the Cygwin libraries means you need to
distribute them, too (they are not small). And Cygwin is under
the GPL (not LGPL). It is suggested to read the license section
of the FAQ first. These restrictions do not apply if you link to
the native libraries (i.e. -mno-cygwin or what MinGW does). See:
  http://cygwin.com/faq.html
  http://www.mingw.org/licensing.shtml
]

Bye,
     Mike