make edje binaries compile and allow the creation of the edje shared lib on windows. Remove some trailing spaces

SVN revision: 31517
This commit is contained in:
doursse 2007-08-26 12:54:51 +00:00 committed by doursse
parent 50432552c8
commit 2e7692e45e
10 changed files with 281 additions and 191 deletions

View File

@ -12,3 +12,8 @@ To install (run this as root, or the user who handles installs):
make install
NOTE: You MUST make install Edje for it to run properly.
NOTE: for compilation with MinGW, fnmatch.h is probably missing.
That file can be found here:
http://www.koders.com/c/fid2B518462CB1EED3D4E31E271DB83CD1582F6EEBE.aspx
It should be installed in the mingw include directory.

View File

@ -12,23 +12,37 @@ AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_HEADER_STDC
AC_C_CONST
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
AC_FUNC_ALLOCA
create_shared_lib=""
case "$host_os" in
mingw|mingw32)
create_shared_lib="-no-undefined "
;;
esac
AC_SUBST(create_shared_lib)
AC_CHECK_FUNCS(realpath)
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file MinGW users: see the INSTALL file]))
fnmatch_libs=""
AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
if test "x$res" = "xno"; then
AC_CHECK_LIB(fnmatch, fnmatch, res=yes, res=no)
AC_CHECK_LIB(fnmatch, fnmatch, res=yes fnmatch_libs="-lfnmatch", res=no)
dnl Test for compilation with MinGW.
dnl fnmatch function is in the libiberty library
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch])
else
fnmatch_libs="-lfnmatch"
AC_CHECK_LIB(iberty, fnmatch, res=yes fnmatch_libs="-liberty", res=no)
fi
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty])
fi
fi

View File

@ -16,8 +16,8 @@ EXTRA_DIST = @EDJE_RECC_PRG@
EXTRA_SCRIPTS = edje_recc
bin_PROGRAMS = \
@EDJE_CC_PRG@ \
@EDJE_DECC_PRG@
edje_cc \
edje_decc
EXTRA_PROGRAMS = \
edje_cc \

View File

@ -2,6 +2,11 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef _WIN32
# include <windows.h>
#endif /* _WIN32 */
#include "edje_cc.h"
typedef struct _Part_Lookup Part_Lookup;
@ -583,10 +588,27 @@ data_write(void)
if ((cd->shared) || (cd->programs))
{
int fd;
#ifdef _WIN32
int ret;
char path[4096];
#endif /* _WIN32 */
char tmpn[4096];
#ifdef _WIN32
ret = GetTempPath(_MAX_PATH, path);
if ((ret > _MAX_PATH) || (ret == 0))
fd = -1;
else
{
if (!GetTempFileName(path, "edj", 0, tmpn))
fd = -1;
else
fd = open(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
}
#else
strcpy(tmpn, "/tmp/edje_cc.sma-tmp-XXXXXX");
fd = mkstemp(tmpn);
#endif /* _WIN32 */
if (fd >= 0)
{
FILE *f;
@ -667,8 +689,21 @@ data_write(void)
fclose(f);
}
close(fd);
#ifdef _WIN32
ret = GetTempPath(_MAX_PATH, path);
if ((ret > _MAX_PATH) || (ret == 0))
fd = -1;
else
{
if (!GetTempFileName(path, "edj", 0, tmpo))
fd = -1;
else
fd = open(tmpo, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
}
#else
strcpy(tmpo, "/tmp/edje_cc.amx-tmp-XXXXXX");
fd = mkstemp(tmpo);
#endif /* _WIN32 */
if (fd >= 0)
{
snprintf(buf, sizeof(buf),

View File

@ -2,6 +2,10 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef _WIN32
# include <windows.h>
#endif /* _WIN32 */
#include "edje_cc.h"
static void new_object(void);
@ -608,17 +612,33 @@ compile(void)
int fd;
off_t size;
char *data, *p;
#ifdef _WIN32
int ret;
#endif /* _WIN32 */
char buf[4096];
char inc[4096];
static char tmpn[4096];
strcpy(tmpn, "/tmp/edje_cc.edc-tmp-XXXXXX");
strncpy(inc, file_in, 4000);
inc[4001] = 0;
p = strrchr(inc, '/');
if (!p) strcpy(inc, "./");
else *p = 0;
#ifdef _WIN32
ret = GetTempPath(4096, buf);
if ((ret > 4096) || (ret == 0))
fd = -1;
else
{
if (!GetTempFileName(buf, "edj", 0, tmpn))
fd = -1;
else
fd = open(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
}
#else
strcpy(tmpn, "/tmp/edje_cc.edc-tmp-XXXXXX");
fd = mkstemp(tmpn);
#endif /* _WIN32 */
if (fd >= 0)
{
int ret;

View File

@ -8,6 +8,9 @@
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef _WIN32
# include <windows.h>
#endif /* _WIN32 */
char *progname = NULL;
char *file_in = NULL;
@ -298,12 +301,16 @@ output(void)
if (file_out)
{
snprintf(out, sizeof(out), "%s/%s", outdir, file_out);
#ifdef _WIN32
CopyFile(sf->name, out, TRUE);
#else
symlink(sf->name, out);
#endif /* _WIN32 */
}
#ifndef WIN32
#ifndef _WIN32
chmod(out, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP);
#endif
#endif /* _WIN32 */
printf("\n*** CAUTION ***\n"
"Please check the build script for anything malicious "
@ -325,13 +332,13 @@ e_file_is_dir(char *file)
int
e_file_mkdir(char *dir)
{
#ifndef WIN32
#ifndef _WIN32
static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
if (mkdir(dir, default_mode) < 0) return 0;
#else
if (mkdir(dir) < 0) return 0;
#endif
#endif /* _WIN32 */
return 1;
}

View File

@ -11,16 +11,13 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/param.h>
#include <dlfcn.h>
#include <math.h>
#include <fnmatch.h>
#include <limits.h>
#include <ctype.h>
#include <time.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <glob.h>
#include "edje_prefix.h"
/* local subsystem functions */
@ -377,7 +374,11 @@ _e_prefix_try_argv(char *argv0)
if (getcwd(buf3, sizeof(buf3)))
{
snprintf(buf2, sizeof(buf2), "%s/%s", buf3, argv0);
#ifdef _WIN32
if (_fullpath(buf2, buf, _MAX_PATH))
#else
if (realpath(buf2, buf))
#endif /* _WIN32 */
{
_exe_path = strdup(buf);
if (access(_exe_path, X_OK) == 0) return 1;
@ -401,7 +402,11 @@ _e_prefix_try_argv(char *argv0)
strncpy(s, cp, len);
s[len] = '/';
strcpy(s + len + 1, argv0);
#ifdef _WIN32
if (_fullpath(s, buf, _MAX_PATH))
#else
if (realpath(s, buf))
#endif /* _WIN32 */
{
if (access(buf, X_OK) == 0)
{
@ -421,7 +426,11 @@ _e_prefix_try_argv(char *argv0)
strncpy(s, cp, len);
s[len] = '/';
strcpy(s + len + 1, argv0);
#ifdef _WIN32
if (_fullpath(s, buf, _MAX_PATH))
#else
if (realpath(s, buf))
#endif /* _WIN32 */
{
if (access(buf, X_OK) == 0)
{

View File

@ -6,7 +6,7 @@
#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else

View File

@ -39,5 +39,5 @@ edje_textblock_styles.c
libedje_la_LIBADD = -lm @EDJE_LIBS@ @fnmatch_libs@
libedje_la_CPPFLAGS =
libedje_la_DEPENDENCIES = $(top_builddir)/config.h
libedje_la_LDFLAGS = -version-info 5:0:5
libedje_la_LDFLAGS = @create_shared_lib@ -version-info 5:0:5

View File

@ -35,7 +35,7 @@
#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else