SCUMMVM ported to CYGWIN

Discussion about other and unofficial ports of ScummVM

Moderator: ScummVM Team

Post Reply
carlo_bramini
Posts: 13
Joined: Sat Aug 08, 2015 3:27 pm

SCUMMVM ported to CYGWIN

Post by carlo_bramini » Sun Jan 03, 2016 4:38 pm

I tried to compile SCUMMVM in CYGWIN and at first try the configure script said:

ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW.

Surprised by this message, I made few fixes in the configure:

Code: Select all

diff --git a/configure b/configure
index abc38fe..b9069cb 100755
--- a/configure
+++ b/configure
@@ -2217,8 +2217,9 @@ case $_host_os in
 		_seq_midi=no
 		;;
 	cygwin*)
-		echo ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW.
-		exit 1
+		# Cygwin has more strict set c++0x/c++11: the function
+		# vsnprintf is defined in the GNU variant (gnu++0x/gnu++11)
+		append_var CXXFLAGS "-std=gnu++0x"
 		;;
 	darwin*)
 		# Pass -mlongcall to gcc so that it emits long calls
@@ -3202,10 +3203,10 @@ esac
 #
 echo_n "Checking if host is POSIX compliant... "
 case $_host_os in
-	amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | ps3 | psp | wii | wince)
+	amigaos* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | ps3 | psp | wii | wince)
 		_posix=no
 		;;
-	android | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sunos* | uclinux* | webos)
+	android | beos* | bsd* | cygwin* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sunos* | uclinux* | webos)
 		_posix=yes
 		;;
 	os2-emx*)
@@ -4173,7 +4174,7 @@ if test "$_have_x86" = yes ; then
 				darwin*)
 					append_var NASMFLAGS "-f macho"
 				;;
-				mingw*)
+				mingw* | cygwin*)
 					append_var NASMFLAGS "-f win32"
 				;;
 				os2-emx*)
and I got SCUMMVM compiled an working.
Optionally, I did these fixes in the sources for enabling optimized scalers compiled with NASM:

Code: Select all

diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp
index 745988c..6bb9b7b 100644
--- a/graphics/scaler.cpp
+++ b/graphics/scaler.cpp
@@ -36,7 +36,7 @@ extern "C" {
 // NOTE: if your compiler uses different mangled names, add another
 //       condition here
 
-#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__) && !defined(__CYGWIN__)
 #define RGBtoYUV _RGBtoYUV
 #define hqx_highbits _hqx_highbits
 #define hqx_lowbits _hqx_lowbits
diff --git a/graphics/scaler/hq2x.cpp b/graphics/scaler/hq2x.cpp
index 74ceebd..03e1d2f 100644
--- a/graphics/scaler/hq2x.cpp
+++ b/graphics/scaler/hq2x.cpp
@@ -27,7 +27,7 @@
 
 extern "C" {
 
-#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__) && !defined(__CYGWIN__)
 #define hq2x_16 _hq2x_16
 #endif
 
diff --git a/graphics/scaler/hq3x.cpp b/graphics/scaler/hq3x.cpp
index f6c86b3..3d0592d 100644
--- a/graphics/scaler/hq3x.cpp
+++ b/graphics/scaler/hq3x.cpp
@@ -27,7 +27,7 @@
 
 extern "C" {
 
-#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__) && !defined(__CYGWIN__)
 #define hq3x_16 _hq3x_16
 #endif
and nothing else is required.
I'm wondering if the above fixes could be imported in the main sources
I did two screenshots of this build in action.

Image
Image

Sincerely,

Carlo Bramini.

User avatar
md5
ScummVM Developer
Posts: 2258
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 » Sun Jan 03, 2016 7:23 pm

Good question

Support for Cygwin was dropped 6 years ago (in 2009), in this commit:

https://github.com/scummvm/scummvm/comm ... 3ce4c12035

The rationale was that the -mno-cygwin switch has been removed, so the resulting executables will need the cygwin DLL to work.

If the changes are this minimal, it would be trivial to add support for Cygwin builds once more. Please, add a pull request.

Kirben
ScummVM Developer
Posts: 416
Joined: Wed Sep 21, 2005 12:15 pm
Location: Melbourne, Victoria, Australia

Post by Kirben » Sun Jan 03, 2016 11:11 pm

Cygwin support was dropped, when the option for a mingw cross build was no longer available.

A native Cygwin build will never be officially supported, as that would be a unix build through emulation under Windows.

carlo_bramini
Posts: 13
Joined: Sat Aug 08, 2015 3:27 pm

Post by carlo_bramini » Mon Jan 04, 2016 11:46 am

md5 wrote:Good question

Support for Cygwin was dropped 6 years ago (in 2009), in this commit:

https://github.com/scummvm/scummvm/comm ... 3ce4c12035

The rationale was that the -mno-cygwin switch has been removed, so the resulting executables will need the cygwin DLL to work.
Kirben wrote:Cygwin support was dropped, when the option for a mingw cross build was no longer available.
I was imaging something similar... hopefully, since then, CYGWIN is evolved a lot and nowadays the "-mno-cygwin" is like a distant memory.
md5 wrote:If the changes are this minimal, it would be trivial to add support for Cygwin builds once more. Please, add a pull request.
I followed your suggestion and I posted the above patch in the patch tracker:
https://sourceforge.net/p/scummvm/patches/1619/
Kirben wrote:A native Cygwin build will never be officially supported, as that would be a unix build through emulation under Windows.
Well... It is not my intention to ask to release a CYGWIN build of SCUMMVM near all official builds but, if we are able to compile it with CYGWIN, this will open the road to someone else to compile and make available SCUMMVM as a package in future.
As I wrote, CYGWIN is evolved a lot in these years, much stuff has been made available as you can see by looking the list of available software, you are even able to run a full desktop environment and it's available for 32bit and 64bit platforms. Since SCUMMVM can be already compiled for POSIX compliant systems, adding support for CYGWIN requires very few changes, as you can see. So, the few fixes in my patch have a different target, for Windows users the native MINGW build is what they need.
I hope you will find this useful.

Sincerely,

Carlo Bramini.

Kirben
ScummVM Developer
Posts: 416
Joined: Wed Sep 21, 2005 12:15 pm
Location: Melbourne, Victoria, Australia

Post by Kirben » Mon Jan 04, 2016 12:00 pm

Cygwin is meant for programs without Windows native code, and only offers the disadvantage of an addition emulation layer for ScummVM under Windows.

I definitely don't want to see a ScummVM package for Cygwin, as we would end up with any support requests, when the unexpected happens. That fact that ScummVM compiles under Cygwin, doesn't mean there aren't any issues, especially when relying on an emulation layer for unix support.

carlo_bramini
Posts: 13
Joined: Sat Aug 08, 2015 3:27 pm

Post by carlo_bramini » Mon Jan 04, 2016 1:29 pm

I see. No problem.

If I could say my opinion about the "don't want to see a ScummVM package for Cygwin", probably nobody could stop such thing, as long as the terms of the GPL license are respected... so, at the end, even if those lines would be added or not, this build would follow the same fate of the various abandoned ports or unofficial builds, so I do not see a big problem about what to do with the support requests (but I doubt there will be any) but, as I wrote, it's just my opinion.

Thank you very much for your time. :wink:

Post Reply