* move header files in efree_provate.h to the source files
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 20 Apr 2009 23:20:40 +0000 (23:20 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 20 Apr 2009 23:20:40 +0000 (23:20 +0000)
 * fix compilation on Windows XP (not sure that Windows CE port is needed...)

note that, as ecore_exe is not available on Windows, some code have
been disables for that platform in src/lib/efreet_desktop.c. Also, a new Evil
version should be used (not in svn yet)

The compilation on Windows is needed for Ewl (icon and mime)

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/efreet@40257 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

24 files changed:
configure.ac
src/lib/Efreet.h
src/lib/Efreet_Mime.h
src/lib/Efreet_Trash.h
src/lib/Makefile.am
src/lib/efreet.c
src/lib/efreet_base.c
src/lib/efreet_base.h
src/lib/efreet_cache.c
src/lib/efreet_desktop.c
src/lib/efreet_desktop.h
src/lib/efreet_icon.c
src/lib/efreet_icon.h
src/lib/efreet_ini.c
src/lib/efreet_menu.c
src/lib/efreet_menu.h
src/lib/efreet_mime.c
src/lib/efreet_private.h
src/lib/efreet_trash.c
src/lib/efreet_uri.c
src/lib/efreet_uri.h
src/lib/efreet_utils.c
src/lib/efreet_utils.h
src/lib/efreet_xml.c

index e521974..ba7632c 100644 (file)
@@ -35,8 +35,31 @@ AC_SUBST(efreet_release_info)
 AC_SUBST(efreet_mime_release_info)
 AC_SUBST(efreet_trash_release_info)
 
+PKG_PROG_PKG_CONFIG
+
+EFL_EFREET_BUILD=""
+EFL_EFREET_MIME_BUILD=""
+EFL_EFREET_TRASH_BUILD=""
+win32_libs=""
+case "$host_os" in
+   mingw* | cegcc*)
+      PKG_CHECK_MODULES([EVIL], [evil])
+      AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
+      EFL_EFREET_BUILD="-DEFL_EFREET_BUILD"
+      EFL_EFREET_MIME_BUILD="-DEFL_EFREET_MIME_BUILD"
+      EFL_EFREET_TRASH_BUILD="-DEFL_EFREET_TRASH_BUILD"
+      win32_libs="-lws2_32"
+   ;;
+esac
+AC_SUBST(EFL_EFREET_BUILD)
+AC_SUBST(EFL_EFREET_MIME_BUILD)
+AC_SUBST(EFL_EFREET_TRASH_BUILD)
+AC_SUBST(win32_libs)
+
 AC_FUNC_ALLOCA
 
+AC_CHECK_HEADERS([arpa/inet.h])
+
 PKG_CHECK_MODULES(EFREET, [eina-0 ecore >= 0.9.9 ecore-file >= 0.9.9])
 PKG_CHECK_MODULES(EINA, [eina-0])
 
index db13044..ce939ea 100644 (file)
  * @li Trash Specification
  */
 
+#include <Eina.h>
+
 #ifdef EAPI
-#undef EAPI
+# undef EAPI
 #endif
-#ifdef _MSC_VER
-# ifdef BUILDING_DLL
-#  define EAPI __declspec(dllexport)
+
+#ifdef _WIN32
+# ifdef EFL_EFREET_BUILD
+#  ifdef DLL_EXPORT
+#   define EAPI __declspec(dllexport)
+#  else
+#   define EAPI
+#  endif /* ! DLL_EXPORT */
 # else
 #  define EAPI __declspec(dllimport)
-# endif
+# endif /* ! EFL_EFREET_BUILD */
 #else
 # ifdef __GNUC__
 #  if __GNUC__ >= 4
index 8578f5b..1e0e2aa 100644 (file)
  * @{
  */
 
-
 #ifdef EAPI
-#undef EAPI
+# undef EAPI
 #endif
-#ifdef _MSC_VER
-# ifdef BUILDING_DLL
-#  define EAPI __declspec(dllexport)
+
+#ifdef _WIN32
+# ifdef EFL_EFREET_MIME_BUILD
+#  ifdef DLL_EXPORT
+#   define EAPI __declspec(dllexport)
+#  else
+#   define EAPI
+#  endif /* ! DLL_EXPORT */
 # else
 #  define EAPI __declspec(dllimport)
-# endif
+# endif /* ! EFL_EFREET_MIME_BUILD */
 #else
 # ifdef __GNUC__
 #  if __GNUC__ >= 4
index 897f646..ea59964 100644 (file)
@@ -3,14 +3,19 @@
 #define EFREET_TRASH_H
 
 #ifdef EAPI
-#undef EAPI
+# undef EAPI
 #endif
-#ifdef _MSC_VER
-# ifdef BUILDING_DLL
-#  define EAPI __declspec(dllexport)
+
+#ifdef _WIN32
+# ifdef EFL_EFREET_TRASH_BUILD
+#  ifdef DLL_EXPORT
+#   define EAPI __declspec(dllexport)
+#  else
+#   define EAPI
+#  endif /* ! DLL_EXPORT */
 # else
 #  define EAPI __declspec(dllimport)
-# endif
+# endif /* ! EFL_EFREET_TRASH_BUILD */
 #else
 # ifdef __GNUC__
 #  if __GNUC__ >= 4
index aa9d4f9..fd97876 100644 (file)
@@ -1,11 +1,6 @@
 
 MAINTAINERCLEANFILES = Makefile.in
 
-AM_CPPFLAGS = \
--I$(top_builddir) \
--I$(top_srcdir) \
-@EFREET_CFLAGS@
-
 lib_LTLIBRARIES = libefreet.la libefreet_mime.la libefreet_trash.la
 
 EFREETHEADERS = \
@@ -35,6 +30,13 @@ $(EFREETHEADERS)
 
 libefreet_la_SOURCES = \
        $(EFREETSOURCES)
+libefreet_la_CPPFLAGS =  \
+-I$(top_builddir) \
+-I$(top_srcdir) \
+@EFL_EFREET_BUILD@ \
+@EFREET_CFLAGS@
+libefreet_la_LIBADD = @EFREET_LIBS@ @win32_libs@
+libefreet_la_LDFLAGS = -no-undefined -version-info @version_info@ @efreet_release_info@
 
 EFREETMIMEHEADERS = \
 Efreet_Mime.h
@@ -45,6 +47,11 @@ $(EFREETMIMEHEADERS)
 
 libefreet_mime_la_SOURCES = \
 $(EFREETMIMESOURCES)
+libefreet_mime_la_CPPFLAGS = \
+-I$(top_builddir) \
+-I$(top_srcdir) \
+@EFL_EFREET_MIME_BUILD@ \
+@EFREET_CFLAGS@
 
 
 EFREETTRASHHEADERS = \
@@ -56,16 +63,18 @@ $(EFREETTRASHHEADERS)
 
 libefreet_trash_la_SOURCES = \
 $(EFREETTRASHSOURCES)
+libefreet_trash_la_CPPFLAGS = \
+-I$(top_builddir) \
+-I$(top_srcdir) \
+@EFL_EFREET_TRASH_BUILD@ \
+@EFREET_CFLAGS@
 
 
 installed_headersdir = $(prefix)/include/efreet
 installed_headers_DATA = $(EFREETHEADERS) $(EFREETMIMEHEADERS) $(EFREETTRASHHEADERS)
 
-libefreet_la_LIBADD = @EFREET_LIBS@
-libefreet_la_LDFLAGS = -version-info @version_info@ @efreet_release_info@
-
-libefreet_mime_la_LDFLAGS = -version-info @version_info@ @efreet_mime_release_info@
-libefreet_trash_la_LDFLAGS = -version-info @version_info@ @efreet_trash_release_info@
+libefreet_mime_la_LDFLAGS = -no-undefined -version-info @version_info@ @efreet_mime_release_info@
+libefreet_trash_la_LDFLAGS = -no-undefined -version-info @version_info@ @efreet_trash_release_info@
 
-libefreet_mime_la_LIBADD = @EFREET_LIBS@ libefreet.la
+libefreet_mime_la_LIBADD = @EFREET_LIBS@ libefreet.la @win32_libs@
 libefreet_trash_la_LIBADD = @EFREET_LIBS@ libefreet.la
index 32a53c4..df69879 100644 (file)
@@ -1,6 +1,16 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#include <Ecore_Str.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
+#include "efreet_xml.h"
 
 static int init = 0;
 static int efreet_parsed_locale = 0;
index 679d645..9d2af85 100644 (file)
@@ -1,4 +1,12 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
index d273fe2..113fb6d 100644 (file)
@@ -12,8 +12,6 @@
  * @{
  */
 
-#include <Eina.h>
-
 EAPI const char *efreet_data_home_get(void);
 EAPI Eina_List *efreet_data_dirs_get(void);
 
index fedc19b..9710b51 100644 (file)
@@ -1,4 +1,10 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
index 2983983..9aa8fb4 100644 (file)
@@ -1,4 +1,22 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifdef _WIN32
+# include <winsock2.h>
+#endif
+
+#include <Ecore_Str.h>
+#include <Ecore_File.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
@@ -549,8 +567,10 @@ static void *
 efreet_desktop_exec_cb(void *data, Efreet_Desktop *desktop __UNUSED__,
                                 char *exec, int remaining __UNUSED__)
 {
+#ifndef _WIN32
     ecore_exe_run(exec, data);
     free(exec);
+#endif
     return NULL;
 }
 
index a579d42..f301463 100644 (file)
@@ -12,8 +12,6 @@
  * @{
  */
 
-#include <Eina.h>
-
 EAPI extern int EFREET_DESKTOP_TYPE_APPLICATION;
 EAPI extern int EFREET_DESKTOP_TYPE_LINK;
 EAPI extern int EFREET_DESKTOP_TYPE_DIRECTORY;
index 02c3fac..af8fdfa 100644 (file)
@@ -1,4 +1,21 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <limits.h>
+
+#include <Ecore.h>
+#include <Ecore_Str.h>
+#include <Ecore_File.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
index 26d35e6..18ce0dd 100644 (file)
@@ -12,8 +12,6 @@
  * @{
  */
 
-#include <Eina.h>
-
 /**
  * The possible contexts for an icon directory
  */
index 7c14efd..4e00104 100644 (file)
@@ -1,4 +1,34 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#elif defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#else
+# include <stddef.h>
+# ifdef  __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
index 3b395f1..c4b632b 100644 (file)
@@ -1,6 +1,20 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+#include <Ecore_Str.h>
+#include <Ecore_File.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
+#include "efreet_xml.h"
 
 /**
  * Efreet_Menu_Move
index 9218139..a6643d3 100644 (file)
@@ -12,8 +12,6 @@
  * @{
  */
 
-#include <Eina.h>
-
 /**
  * The type of entry
  */
index b758f65..502e356 100644 (file)
@@ -1,11 +1,52 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
-#include <Efreet.h>
-#include <Efreet_Mime.h>
-#include "efreet_private.h"
-#include <arpa/inet.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/time.h>
+#include <sys/mman.h>
+#include <unistd.h>
 #include <time.h>
+#include <fcntl.h>
+#include <fnmatch.h>
+
+#ifdef _WIN32
+# include <winsock2.h>
+#endif
+
+#ifdef HAVE_ARPA_INET
+# include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#elif defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#else
+# include <stddef.h>
+# ifdef  __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
+
+#include <Ecore.h>
+#include <Ecore_File.h>
+
+#include <Efreet.h>
+#include <Efreet_Mime.h>
+#include "efreet_private.h"
 
 static Eina_List *globs = NULL;     /* contains Efreet_Mime_Glob structs */
 static Eina_List *magics = NULL;    /* contains Efreet_Mime_Magic structs */
@@ -635,8 +676,10 @@ efreet_mime_special_check(const char *file)
         if (S_ISREG(s.st_mode))
             return NULL;
 
+#ifndef _WIN32
         if (S_ISLNK(s.st_mode))
             return "inode/symlink";
+#endif
 
         if (S_ISFIFO(s.st_mode))
             return "inode/fifo";
@@ -647,8 +690,10 @@ efreet_mime_special_check(const char *file)
         if (S_ISBLK(s.st_mode))
             return "inode/blockdevice";
 
+#ifndef _WIN32
         if (S_ISSOCK(s.st_mode))
             return "inode/socket";
+#endif
 
         if (S_ISDIR(s.st_mode))
         {
index a566670..18849a3 100644 (file)
  * @{
  */
 
-#include "config.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fnmatch.h>
-#include <limits.h>
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#include <Eina.h>
-#include <Ecore.h>
-#include <Ecore_File.h>
-#include <Ecore_Str.h>
-
-#include "efreet_xml.h"
-#include "efreet_ini.h"
-
 /**
  * @def NEW(x, c)
  * Allocate and zero out c structures of type x
index 3fd279f..3cf919f 100644 (file)
@@ -1,6 +1,15 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
 #include <errno.h>
 #include <time.h>
+
+#include <Ecore_File.h>
+
 #include "Efreet.h"
 #include "Efreet_Trash.h"
 #include "efreet_private.h"
index 0904b08..1ba0416 100644 (file)
@@ -1,4 +1,18 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
index c7d4070..7f5d14a 100644 (file)
@@ -9,8 +9,6 @@
  * @{
  */
 
-#include <Ecore.h>
-
 
 /**
  * Efreet_Uri
index 9146e8d..3509607 100644 (file)
@@ -1,4 +1,18 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <fnmatch.h>
+
+#include <Ecore.h>
+#include <Ecore_File.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
 
index eb3f901..eb21b5f 100644 (file)
@@ -2,8 +2,6 @@
 #ifndef EFREET_UTILS_H
 #define EFREET_UTILS_H
 
-#include <Eina.h>
-
 typedef enum _Efreet_Desktop_Change Efreet_Desktop_Change;
 
 enum _Efreet_Desktop_Change
index b2b32a1..1d60a26 100644 (file)
@@ -1,6 +1,27 @@
 /* vim: set sw=4 ts=4 sts=4 et: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
+#include <Ecore_File.h>
+
 #include "Efreet.h"
 #include "efreet_private.h"
+#include "efreet_xml.h"
 
 #if 0
 static void efreet_xml_dump(Efreet_Xml *xml, int level);
@@ -64,23 +85,23 @@ efreet_xml_new(const char *file)
     if (!file) return NULL;
 
     size = ecore_file_size(file);
-    if (size <= 0) goto ERROR;
+    if (size <= 0) goto efreet_error;
 
     fd = open(file, O_RDONLY);
-    if (fd == -1) goto ERROR;
+    if (fd == -1) goto efreet_error;
 
     data = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
-    if (data == (void *)-1) goto ERROR;
+    if (data == (void *)-1) goto efreet_error;
 
     error = 0;
     xml = efreet_xml_parse(&data, &size);
-    if (error) goto ERROR;
+    if (error) goto efreet_error;
 
     munmap(data, size);
     close(fd);
     return xml;
 
-ERROR:
+efreet_error:
     fprintf(stderr, "[efreet]: could not parse xml file\n");
     if (data != (void *)-1) munmap(data, size);
     if (fd != -1) close(fd);
@@ -335,7 +356,7 @@ efreet_xml_attributes_parse(char **data, int *size,
             if (buf_size <= 1)
             {
                 fprintf(stderr, "[efreet]: zero length key\n");
-                goto ERROR;
+                goto efreet_error;
             }
 
             if (buf_size > 256) buf_size = 256;
@@ -359,7 +380,7 @@ efreet_xml_attributes_parse(char **data, int *size,
             if (!start)
             {
                 fprintf(stderr, "[efreet]: missing value for attribute!\n");
-                goto ERROR;
+                goto efreet_error;
             }
 
             /* search for '"', beginning of value */
@@ -378,7 +399,7 @@ efreet_xml_attributes_parse(char **data, int *size,
             if (!start)
             {
                 fprintf(stderr, "[efreet]: erroneous value for attribute!\n");
-                goto ERROR;
+                goto efreet_error;
             }
 
             /* skip '"' */
@@ -402,14 +423,14 @@ efreet_xml_attributes_parse(char **data, int *size,
             if (!end)
             {
                 fprintf(stderr, "[efreet]: erroneous value for attribute!\n");
-                goto ERROR;
+                goto efreet_error;
             }
 
             buf_size = end - start + 1;
             if (buf_size <= 1)
             {
                 fprintf(stderr, "[efreet]: zero length value\n");
-                goto ERROR;
+                goto efreet_error;
             }
 
             if (buf_size > 256) buf_size = 256;
@@ -433,7 +454,7 @@ efreet_xml_attributes_parse(char **data, int *size,
     }
     return;
 
-ERROR:
+efreet_error:
     while (count >= 0)
     {
         if (attr[count].key) eina_stringshare_del(attr[count].key);