Re: [E-devel] IMLIB2 ported to mingw+msys

2008-11-01 Thread carlo.bramix
Hello,

I tried to analize my changes more in detail.

The mmap() problem with TGA file loader: I could do it natively on Windows too 
(with CreateFileMapping(), MapViewOfFile(), etc) but I do not think this is 
what you really want...
So, this is a good reason for adding the dependency with Evil if mmap() is 
supported.
As alternative, we can do a simple wrapper to another specific library like 
LibTGA, which just handle TGA images as you can probably imagine by its name.
BTW, I improved libTGA a lot because I wanted to use it in my Windows image 
viewer clone, but it seems I received no replies from the author... (sigh!).

LibJPEG is normally used with setjmp/longjmp under Windows.
I admit that I do not know if this will corrupt something with IMLIB2.

Into IMLIB2 there are already some #ifdef on EMX.
The coding solution for EMX is good for Windows too.
There is only one wrong thing here and it is the inclusion of pwd.h which do 
not exists under Windows.
So I simply added the check on pwd.h into configure script.

The -no-undefined flag is required for mingw and cygwin, otherwise libtool 
will never create a shared library.
There are no much work-arounds here.

I added macro IMLIB2_IS_COMPILING to distinguish the compilation of IMLIB2 from 
the applications. There was already BUILDING_DLL with a similar purpose, but if 
a library depends from IMLIB2 and it uses BUILDING_DLL too, it will happen an 
error because an import/export confict (I already encountered such problems in 
the past).
If I can give a suggestion, I would use a different name here.

Some functions are missing, (mkstemp, dlopen, etc) but doing a replacement is 
very easy even for me ;)
For the functions into dlfcn.h, it would be perfect to use dlfcn-win32 package 
but since it is not compiled with libtool (in other words, there is no libdl.la 
file) the linking fails to build a shared library because it cannot know the 
dependencies of -ldl (perhaps a fix to dlfcn-win32 will be appreciated).
In conclusion, these functions too may be provided by Evil.

I hope this will help.

Sincerely,

Carlo Bramini.


-- Initial Header ---

From  : Vincent Torri [EMAIL PROTECTED]
To  : Kim Woelders [EMAIL PROTECTED]
Cc  : enlightenment-devel enlightenment-devel@lists.sourceforge.net
Date  : Sat, 1 Nov 2008 08:23:50 +0100 (CET)
Subject : Re: [E-devel] IMLIB2 ported to mingw+msys

 On Thu, 30 Oct 2008, Kim Woelders wrote:
 
  On Tue, 28 Oct 2008 17:45:10 +0100, carlo.bramix [EMAIL PROTECTED] 
  wrote:
 
  Hello,
  I got the sources of your newly released Imlib2 1.4.2 and I did again the 
  fixes for Mingw+Msys.
  I think I also fixed my bugs with:
  1) bad mmap() detection
  2) wrong use of HAVE_SIGJMP_BUF instead of HAVE_SIGSETJMP.
  3) all my files are in unix format.
  I tested Imlib2 with:
  - Mingw+Msys
  - Cygwin
  - Linux Debian 4.0r3
  and everything seems to be working.
  Attached patch includes all those fixes.
  
 
  dlfcn-win32.c/h are missing from this patch. I assume they were meant to 
  the 
  same as in the original patch.
 
  Vincent - Do you still want to evilify imlib2? Otherwise I'm fine with this 
  patch (except a few nitpicks I'll fix if/when committed).
 
 I can try to integrate Evil. Right now, i'm trying to make the efl working 
 natively on Windows CE. If you can wait a bit (around 1 week), I'll try to 
 do it next week end
 
 Vincent
 
 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 Build the coolest Linux based applications with Moblin SDK  win great prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 enlightenment-devel mailing list
 enlightenment-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
 


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] IMLIB2 ported to mingw+msys

2008-10-28 Thread carlo.bramix
Hello,
I got the sources of your newly released Imlib2 1.4.2 and I did again the fixes 
for Mingw+Msys.
I think I also fixed my bugs with:
1) bad mmap() detection
2) wrong use of HAVE_SIGJMP_BUF instead of HAVE_SIGSETJMP.
3) all my files are in unix format.
I tested Imlib2 with:
- Mingw+Msys
- Cygwin
- Linux Debian 4.0r3
and everything seems to be working.
Attached patch includes all those fixes.

Sincerely,

Carlo Bramini.


-- Initial Header ---

From  : Kim Woelders [EMAIL PROTECTED]
To  : Vincent Torri [EMAIL PROTECTED],carlo\.bramix [EMAIL 
PROTECTED]
Cc  : enlightenment-devel enlightenment-devel@lists.sourceforge.net
Date  : Thu, 16 Oct 2008 17:38:41 +0200
Subject : Re: [E-devel] IMLIB2 ported to mingw+msys

 On Wed, 15 Oct 2008 13:29:10 +0200, Vincent Torri [EMAIL PROTECTED]
 wrote:

 
 
  On Wed, 15 Oct 2008, carlo\.bramix wrote:
 
  Hello,
 
  I have already implemented some of the functions you need in a lib 
  called
  'Evil' (mmap, dlfcn, pwd.h, mkstemp,...). I use it for the EFL Windows
  (XP
  or Ce) port. Maybe you could look at my code, improve it if you think
  it's
  needed, and make imlib2 Windows port depending on Evil
 
 If all that's needed is included in the patch I think it's a bit much to
 have to depend on another (unreleased) library.

  Otherwise, i would say that you need to add AC_LIBTOOL_WIN32_DLL in
  configure.ac too so that libtool is aware that you have a Windows port.
 
  Sorry, my fault, I forgot to tell you that I also upgraded to a newer
  version these files:
 
  config.guess
  config.sub
  depcomp
  install-sh
  ltmain.sh
  missing
 
 These should all be generated when running ./autogen.sh.

  AC_LIBTOOL_WIN32_DLL seems deprecated and I think this could be the 
  reason because it works fine here on my PC.
  It's not a problem to add it anyways.
 
  it's deprecated but the new way to do it requires a recent version of
  libtool (= 1.9b, more precisely). You can say that that version was
  released in 2004 and we are in 2008. I have absolutely no problem in 
  using
  the new way to do that, but as it is Kim who uses really imlib2 in e16, I
  would wait for his opinion about using or not a recent version of
  libtool.
 
 I don't think imlib2 should depend on a libtool version  1.5.x.

  I also forgot to add $LT_LDFLAGS into src/modules/filters/Makefile.am
  (my mistake): it is not possible to create shared libs without that
  flag, I discovered it only when I checked the content of /lib directory
  after I did the make install, if I must provide a new patch with this
  little fix, just let me know.
 
 Yes, please.

  that should be the new way of doing things with libtool.
 
  Please also excuse my ignorance, but I have not found a package called
  EFL into download page at sourceforge...
 
  EFL means Enlightenment fundation libraries. It is a set of libraries
  that
  e17 uses (eet, evas, ...).
 
  actually I was just trying to
  build IMLIB2 because libcaca checked if it was available. I tried to do
  it in the simplest manner (especially because I'm a developer for
  Windows and not very expert with unix stuff)
 
  You interest me ! I am searching some help for the Windows port of the
  EFL, especially because I'm not a Windows developper. If you want to join
  the task force (and if you have time, of course), I would be glad to have
  someone more on that port :)
 
  Anyway, I think that this port should be done in the same way than the
  other EFL. Using Evil means that the Windows code it located at one place
  only. Less things to fix. And I would be happy if you have time to review
  the code in Evil :)
 
  regards
 
  Vincent
 
 Basically I'm fine with these changes. However:

 - We should make a 1.4.2 release of current svn before doing this.

 - tga support wasn't built when I tested (no configure arguments), I think
 the HAVE_MMAP test is wrong.

 - In configure.in (which has been renamed to configure.ac) you set
 HAVE_SIGSETJMP but in loader_jpeg.c you use HAVE_SIGJMP_BUF.

 - Some dos style CRLF line endings have crept in (e.g. loader_gif.c).

 /Kim

diff -r -u imlib2-1.4.2-old/config.h.in imlib2-1.4.2-new/config.h.in
--- imlib2-1.4.2-old/config.h.in2008-10-21 03:02:04 +
+++ imlib2-1.4.2-new/config.h.in2008-10-27 21:03:34 +
@@ -18,6 +18,18 @@
 /* Define to 1 if you have the memory.h header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the pwd.h header file. */
+#undef HAVE_PWD_H
+
+/* Define if sigsetjmp is available. */
+#undef HAVE_SIGSETJMP
+
 /* Define to 1 if you have the stdint.h header file. */
 #undef HAVE_STDINT_H
 
@@ -39,6 +51,12 @@
 /* Define to 1 if you have the unistd.h header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the windows.h header file. */
+#undef HAVE_WINDOWS_H
+
+/* Always 

Re: [E-devel] IMLIB2 ported to mingw+msys

2008-10-15 Thread carlo.bramix
Hello,

 I have already implemented some of the functions you need in a lib called 
 'Evil' (mmap, dlfcn, pwd.h, mkstemp,...). I use it for the EFL Windows (XP 
 or Ce) port. Maybe you could look at my code, improve it if you think it's 
 needed, and make imlib2 Windows port depending on Evil
 
 Otherwise, i would say that you need to add AC_LIBTOOL_WIN32_DLL in 
 configure.ac too so that libtool is aware that you have a Windows port.

Sorry, my fault, I forgot to tell you that I also upgraded to a newer version 
these files:

config.guess
config.sub
depcomp
install-sh
ltmain.sh
missing

AC_LIBTOOL_WIN32_DLL seems deprecated and I think this could be the reason 
because it works fine here on my PC.
It's not a problem to add it anyways.
I also forgot to add $LT_LDFLAGS into src/modules/filters/Makefile.am (my 
mistake): it is not possible to create shared libs without that flag, I 
discovered it only when I checked the content of /lib directory after I did the 
make install, if I must provide a new patch with this little fix, just let me 
know.

Please also excuse my ignorance, but I have not found a package called EFL into 
download page at sourceforge... actually I was just trying to build IMLIB2 
because libcaca checked if it was available. I tried to do it in the simplest 
manner (especially because I'm a developer for Windows and not very expert with 
unix stuff) but I'm sure I'm missing lot of knownledge about your developed 
libraries and their work philosophy...

Sincerely,

Carlo Bramini.



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] IMLIB2 ported to mingw+msys

2008-10-14 Thread carlo.bramix
Hello,
I ported IMLIB2 to Mingw+msys and I also included some fixes for Cygwin.
List of Changes:
1) Added test for mmap support. This test is required because TGA needs it (but 
why???). By conseguence, the TGA support becomes configurable.

2) Added test for sigjmp_buf support. If it is not supported, it will fall to 
usual jmp_buf support (libjpeg for win32/win64 is compiled in that manner).

3) Added the ability to configure the flags to libtool with LT_LDFLAGS 
variable. For generating a DLL with --enable-shared option it is required to 
add -no-undefined to the link stage.

4) Added symbol IMLIB2_IS_COMPILING: if it's declared, it means that we are 
compiling the sources of IMLIB2 (used into Imlib2.h).

5) ImLib2.H has also been fixed because dllimport/dllexport stuff was wrong.

6) Added dlfcn-win32.c and dlfcn-win32.h for supporting shared modules support. 
Unfortunately the usual dlfcn package does not work... libtool complains with a 
message like libtool has no real life with library -ldl.

7) Added test if mkstemp() exists; if it does not, now there is the chance to 
describe a replacement into common.h

8) Added test if pwd.h exists and file.h has been fixed with HAVE_PWD_H.

9) If S_IRGRP or S_IROTH do not exists, they will fall to S_IRUSR.

10) Some OS2 fixes are good for WIN32 too, so I added support for it too into 
file.c and loader_gif.c

11) If ELOOP do not exist, the compilation is fixes by an #ifdef...#endif.

12) Since support for the dlfcn.h was already tested, I added the checks on 
HAVE_DLFCN_H into image.h and script.h. In the future it will be possible to 
add support for other dynamic loaders in the same manner I did for Win32.

I hope you will find it useful.

Sincerely,

Carlo Bramini.



diff -r -u imlib2-1.4.1-old/configure.in imlib2-1.4.1-new/configure.in
--- imlib2-1.4.1-old/configure.in   2008-06-06 03:43:19 +
+++ imlib2-1.4.1-new/configure.in   2008-10-14 17:28:02 +
@@ -86,6 +86,9 @@
   ]
 )
 
+dnl Used for DLL import/export stuff.
+AC_DEFINE(IMLIB2_IS_COMPILING, 1, [Always defined])
+
 AC_MSG_CHECKING(whether to enable x86 mmx support)
 if test x$mmx = xyes; then
   AC_DEFINE(DO_MMX_ASM, 1, [enabling MMX Assembly])
@@ -510,10 +513,62 @@
 AM_CONDITIONAL(BUILD_ID3_LOADER, test $id3_ok = yes)
 AC_SUBST(ID3LIBS)
 
+dnl Test if mmap is supported
+AC_FUNC_MMAP
+
+AC_MSG_CHECKING(whether to enable tga support)
+AC_ARG_WITH([tga],
+  [AC_HELP_STRING([--without-tga], [Disable TGA loader])],
+  [
+   if test $withval = no ; then
+ tga_loader=no
+   else
+ tga_loader=yes
+   fi
+  ],
+  [ tga_loader=auto ]
+)
+AC_MSG_RESULT($tga_loader)
+
+if test $tga_loader != no ; then
+  if test x$HAVE_MMAP = xyes ; then
+tga_ok=yes
+  else
+tga_ok=no
+  fi
+fi
+AM_CONDITIONAL(BUILD_TGA_LOADER, test $tga_ok = yes)
+
 if test x$enable_visibility_hiding = xyes ; then
   CPPFLAGS=$CPPFLAGS -fvisibility=hidden
 fi
 
+dnl Check which jump code is supported
+AC_TRY_COMPILE(
+[#include setjmp.h],
+[sigjmp_buf env;
+ while (! sigsetjmp (env, 1))
+   siglongjmp (env, 1);
+],
+[AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.])])
+
+dnl Check some standard(?) functions
+AC_CHECK_FUNCS([mkstemp])
+
+dnl Check some standard header files
+AC_CHECK_HEADERS([pwd.h windows.h])
+
+dnl Check for platform dependant flags for libtool
+case $host_os in
+*mingw* | *cygwin*)
+LT_LDFLAGS=-no-undefined
+;;
+*)
+LT_LDFLAGS=
+;;
+esac
+AC_SUBST(LT_LDFLAGS)
+
 AC_OUTPUT([
 Makefile
 imlib2.pc
@@ -556,6 +611,7 @@
 echo   ZLIB: $zlib_ok
 echo   BZIP2...: $bz2_ok
 echo   ID3.: $id3_ok
+echo   TGA.: $tga_ok
 echo   X...: $have_x
 echo
 echo
diff -r -u imlib2-1.4.1-old/src/lib/Imlib2.h imlib2-1.4.1-new/src/lib/Imlib2.h
--- imlib2-1.4.1-old/src/lib/Imlib2.h   2007-11-05 08:02:28 +
+++ imlib2-1.4.1-new/src/lib/Imlib2.h   2008-10-14 17:49:30 +
@@ -5,8 +5,12 @@
 # undef EAPI
 # endif
 # ifdef WIN32
-#  ifdef BUILDING_DLL
-#   define EAPI __declspec(dllexport)
+#  ifdef IMLIB2_IS_COMPILING
+#   ifdef DLL_EXPORT
+#define EAPI __declspec(dllexport)
+#   else
+#define EAPI
+#   endif
 #  else
 #   define EAPI __declspec(dllimport)
 #  endif
diff -r -u imlib2-1.4.1-old/src/lib/Makefile.am 
imlib2-1.4.1-new/src/lib/Makefile.am
--- imlib2-1.4.1-old/src/lib/Makefile.am2008-06-06 03:42:29 +
+++ imlib2-1.4.1-new/src/lib/Makefile.am2008-10-14 17:29:58 +
@@ -18,6 +18,7 @@
 common.h \
 context.c \
 context.h \
+dlfcn-win32.c \
 draw.c \
 draw.h \
 dynamic_filters.c \
@@ -98,5 +99,5 @@
 libImlib2_la_DEPENDENCIES = $(top_builddir)/config.h
 endif
 endif
-libImlib2_la_LDFLAGS  = -version-info @lt_version@
+libImlib2_la_LDFLAGS  = -version-info @lt_version@ $(LT_LDFLAGS)
 
diff -r -u imlib2-1.4.1-old/src/lib/common.h imlib2-1.4.1-new/src/lib/common.h
--- imlib2-1.4.1-old/src/lib/common.h