From 92457031ee8384b93223f857ced5b555073e9de7 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Sun, 20 May 2018 21:22:38 +0300 Subject: [PATCH] Add first support for Windows and fix many other config stuff Thanks to vtorri for this patch --- .gitignore | 2 ++ Makefile.am | 1 + configure.ac | 34 +++++++++++++++++++++------------- exactness.pc.in | 1 + src/bin/Makefile.am | 11 ++++++----- src/bin/exactness.c | 5 ++++- src/bin/injector.c | 9 ++++++--- src/bin/inspect.c | 5 +++++ src/bin/player.c | 22 ++++++++++++++-------- src/bin/recorder.c | 18 ++++++++++++------ src/lib/Exactness.h | 1 + src/lib/Makefile.am | 11 ++++------- src/lib/exactness_private.h | 2 +- src/lib/legacy_file.c | 12 +++++++++--- src/lib/unit.c | 8 +++++++- 15 files changed, 94 insertions(+), 48 deletions(-) diff --git a/.gitignore b/.gitignore index 6415f40..b34ccd8 100644 --- a/.gitignore +++ b/.gitignore @@ -11,11 +11,13 @@ Makefile.in .*.sw[po] *.gcov *.gcno +*.exe /README /aclocal.m4 /autom4te.cache/ /config.cache /config.guess +config.h.in~ /config.h /config.h.in /config.log diff --git a/Makefile.am b/Makefile.am index d914ed3..00c1025 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,6 +3,7 @@ MAINTAINERCLEANFILES = \ Makefile.in \ aclocal.m4 \ config.guess \ +config.h.in~ \ config.h.in \ config.sub \ configure \ diff --git a/configure.ac b/configure.ac index bb0a4c3..cc4549d 100644 --- a/configure.ac +++ b/configure.ac @@ -4,25 +4,27 @@ AC_INIT([exactness], [0.1.0], [enlightenment-devel@lists.sourceforge.net]) AC_PREREQ([2.52]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_MACRO_DIR([m4]) -AC_CANONICAL_BUILD +AC_CONFIG_HEADERS([config.h]) +AC_USE_SYSTEM_EXTENSIONS + AC_CANONICAL_HOST -AC_CANONICAL_TARGET +case "$host_os" in + mingw*) + have_win32="yes" + ;; +esac AM_INIT_AUTOMAKE([1.6 dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AC_CONFIG_HEADERS([config.h]) -AC_ISC_POSIX AC_PROG_CC -AC_HEADER_STDC -AC_C_CONST - AM_PROG_CC_C_O +AC_C_BIGENDIAN EFL_ENABLE_BETA_API_SUPPORT PKG_PROG_PKG_CONFIG -AC_PROG_LIBTOOL +LT_INIT([win32-dll]) dnl Checking for __attribute__ support AC_MSG_CHECKING([for __attribute__]) @@ -39,18 +41,24 @@ if test "x${_cv_have___attribute__}" = "xyes" ; then fi AC_MSG_RESULT([${_cv_have___attribute__}]) +requirements_pc="elementary >= 1.14.0 emile >= 1.14.0 ecore-evas >= 1.14.0 evas >= 1.14.0 ecore-con >= 1.14.0 ecore-file >= 1.14.0 ecore >= 1.14.0 eet >= 1.14.0 eo >= 1.14.0 eina >= 1.14.0" +if test "x${have_win32}" = "xyes" ; then + requirements_pc="${requirements_pc} evil" +fi + PKG_CHECK_MODULES([EFL], - [ - elementary >= 0.7.0 - emile >= 1.14.0 - ], - [ac_elm_themes_dir=`pkg-config --variable=themes elementary`] + [${requirements_pc}], + [ac_elm_themes_dir=`$PKG_CONFIG --variable=themes elementary`] ) if test "x$ac_elm_themes_dir" = x ; then AC_MSG_ERROR([couldn't find Elementary themes path]) fi +AC_CHECK_HEADERS([sys/sysinfo.h]) + +AC_SUBST([requirements_pc]) + AC_SUBST(ELM_THEMES_DIR, $ac_elm_themes_dir) AC_OUTPUT([ diff --git a/exactness.pc.in b/exactness.pc.in index 42568bb..560ab2e 100644 --- a/exactness.pc.in +++ b/exactness.pc.in @@ -6,5 +6,6 @@ includedir=@includedir@ Name: Exactness Description: A Library to read and write Exactness units Version: @VERSION@ +Requires.private: @requirements_pc@ Libs: -L${libdir} -lexactness Cflags: -I${includedir}/exactness diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 754567a..fce0c8e 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -19,15 +19,15 @@ exactness_record_SOURCES = recorder.c exactness_inject_SOURCES = injector.c -exactness_LDADD = @EFL_LIBS@ $(top_srcdir)/src/lib/.libs/libexactness.la +exactness_LDADD = @EFL_LIBS@ $(top_builddir)/src/lib/libexactness.la -exactness_inspect_LDADD = @EFL_LIBS@ $(top_srcdir)/src/lib/.libs/libexactness.a +exactness_inspect_LDADD = @EFL_LIBS@ $(top_builddir)/src/lib/libexactness.la -exactness_play_LDADD = @EFL_LIBS@ $(top_srcdir)/src/lib/.libs/libexactness.a +exactness_play_LDADD = @EFL_LIBS@ $(top_builddir)/src/lib/libexactness.la -exactness_record_LDADD = @EFL_LIBS@ $(top_srcdir)/src/lib/.libs/libexactness.a +exactness_record_LDADD = @EFL_LIBS@ $(top_builddir)/src/lib/libexactness.la -exactness_inject_LDADD = @EFL_LIBS@ $(top_srcdir)/src/lib/.libs/libexactness.a +exactness_inject_LDADD = @EFL_LIBS@ $(top_builddir)/src/lib/libexactness.la exactness_CFLAGS = @EFL_CFLAGS@ -I$(top_srcdir)/src/lib @@ -39,3 +39,4 @@ exactness_record_CFLAGS = @EFL_CFLAGS@ -I$(top_srcdir)/src/lib exactness_inject_CFLAGS = @EFL_CFLAGS@ -I$(top_srcdir)/src/lib +CLEANFILES = $(share_DATA) diff --git a/src/bin/exactness.c b/src/bin/exactness.c index 09d0bb3..8e98122 100644 --- a/src/bin/exactness.c +++ b/src/bin/exactness.c @@ -1,4 +1,7 @@ -#include "config.h" +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include diff --git a/src/bin/injector.c b/src/bin/injector.c index 72688be..3e5ff27 100644 --- a/src/bin/injector.c +++ b/src/bin/injector.c @@ -1,10 +1,12 @@ -#define _GNU_SOURCE 1 +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include #include -#include "config.h" #ifndef EFL_EO_API_SUPPORT #define EFL_EO_API_SUPPORT #endif @@ -13,6 +15,7 @@ #include #include #include + #include #include "exactness_private.h" @@ -50,7 +53,7 @@ foo(Eina_Debug_Session *session, int srcid, void *buffer, int size) \ return EINA_TRUE; \ } -#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifndef WORDS_BIGENDIAN #define SWAP_64(x) x #define SWAP_32(x) x #define SWAP_16(x) x diff --git a/src/bin/inspect.c b/src/bin/inspect.c index 92f5027..793aac5 100644 --- a/src/bin/inspect.c +++ b/src/bin/inspect.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + #ifndef EFL_BETA_API_SUPPORT #define EFL_BETA_API_SUPPORT #endif @@ -11,6 +15,7 @@ #include #include "exactness_private.h" + #define LDIFF(x) ""#x"" #define RDIFF(x) ""#x"" diff --git a/src/bin/player.c b/src/bin/player.c index 65ba9ec..baf48f5 100644 --- a/src/bin/player.c +++ b/src/bin/player.c @@ -1,14 +1,19 @@ -#define _GNU_SOURCE 1 +#ifdef HAVE_CONFIG_H +# include +#endif + +#define _POSIX_ +#include #include #include #include #include #include -#include -#include +#ifdef HAVE_SYS_SYSINFO_H +# include +#endif -#include "config.h" #ifndef EFL_EO_API_SUPPORT #define EFL_EO_API_SUPPORT #endif @@ -24,7 +29,7 @@ #include "exactness_private.h" -#define MAX_PATH 1024 +#define PATH_ 1024 #define IMAGE_FILENAME_EXT ".png" typedef struct @@ -60,7 +65,7 @@ foo(Eina_Debug_Session *session, int srcid, void *buffer, int size) \ return EINA_TRUE; \ } -#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifndef WORDS_BIGENDIAN #define SWAP_64(x) x #define SWAP_32(x) x #define SWAP_16(x) x @@ -851,7 +856,7 @@ _prg_invoke(const char *full_path, int argc, char **argv) static Eina_Stringshare * _prg_full_path_guess(const char *prg) { - char full_path[MAX_PATH]; + char full_path[PATH_]; if (strchr(prg, '/')) return eina_stringshare_add(prg); char *paths = strdup(getenv("PATH")); Eina_Stringshare *ret = NULL; @@ -1079,7 +1084,8 @@ int main(int argc, char **argv) memcpy(argv[0], argv[opt_args], len); memset(argv[0] + len, 0, _POSIX_PATH_MAX - len); - for (int i = opt_args; i < argc; i++) + int i; + for (i = opt_args; i < argc; i++) { if (i != opt_args) { diff --git a/src/bin/recorder.c b/src/bin/recorder.c index 20d9286..7873f2e 100644 --- a/src/bin/recorder.c +++ b/src/bin/recorder.c @@ -1,14 +1,19 @@ -#define _GNU_SOURCE 1 +#ifdef HAVE_CONFIG_H +# include +#endif + +#define _POSIX_ +#include #include #include #include #include #include -#include -#include +#ifdef HAVE_SYS_SYSINFO_H +# include +#endif -#include "config.h" #ifndef EFL_EO_API_SUPPORT #define EFL_EO_API_SUPPORT #endif @@ -22,7 +27,7 @@ #include #include -#include "exactness_private.h" +#include #define MAX_PATH 1024 #define STABILIZE_KEY_STR "F1" @@ -464,7 +469,8 @@ int main(int argc, char **argv) memcpy(argv[0], argv[opt_args], len); memset(argv[0] + len, 0, _POSIX_PATH_MAX - len); - for (int i = opt_args; i < argc; i++) + int i; + for (i = opt_args; i < argc; i++) { if (i != opt_args) { diff --git a/src/lib/Exactness.h b/src/lib/Exactness.h index d31f38e..84c04b0 100644 --- a/src/lib/Exactness.h +++ b/src/lib/Exactness.h @@ -245,4 +245,5 @@ EAPI Exactness_Unit *legacy_rec_file_read(const char *filename); /** * @} */ + #endif /* _EXACTNESS_H */ diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 51d3052..52301f8 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -8,16 +8,13 @@ AM_CPPFLAGS = \ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ -@EFL_CFLAGS@ - -EXTRA_DIST = \ - exactness_private.h +@EFL_CFLAGS@ \ +-DEXACTNESS_BUILD pkgdir = $(libdir) pkg_LTLIBRARIES = libexactness.la -libexactness_la_SOURCES = unit.c legacy_file.c -libexactness_la_LDFLAGS = -fPIC -rdynamic -libexactness_la_DEPENDENCIES = $(top_builddir)/config.h +libexactness_la_SOURCES = unit.c legacy_file.c exactness_private.h +libexactness_la_LDFLAGS = -fPIC -rdynamic -no-undefined libexactness_la_LIBADD = @EFL_LIBS@ libexactness_la_CFLAGS = @EFL_CFLAGS@ diff --git a/src/lib/exactness_private.h b/src/lib/exactness_private.h index 3daea57..68bf4d8 100644 --- a/src/lib/exactness_private.h +++ b/src/lib/exactness_private.h @@ -4,7 +4,7 @@ #include /* private header */ -const char *_exactness_action_type_to_string_get(Exactness_Action_Type type); +EAPI const char *_exactness_action_type_to_string_get(Exactness_Action_Type type); #define SHOT_DELIMITER '+' #endif diff --git a/src/lib/legacy_file.c b/src/lib/legacy_file.c index 7dfc081..b40c4ed 100644 --- a/src/lib/legacy_file.c +++ b/src/lib/legacy_file.c @@ -1,12 +1,18 @@ -#include -#include +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include #include #include + +#include +#include #include -#include + +#include "Exactness.h" #define CACHE_FILE_ENTRY "cache" diff --git a/src/lib/unit.c b/src/lib/unit.c index a215222..60661c6 100644 --- a/src/lib/unit.c +++ b/src/lib/unit.c @@ -1,5 +1,11 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + #include -#include + +#include "Exactness.h" +#include "exactness_private.h" typedef struct _Dummy {