summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING1
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac58
-rw-r--r--pc/.gitignore1
-rw-r--r--pc/emile.pc.in12
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile_Emile.am48
-rw-r--r--src/lib/emile/Emile.h111
-rw-r--r--src/lib/emile/emile_main.c56
-rw-r--r--src/tests/emile/emile_suite.c102
10 files changed, 388 insertions, 3 deletions
diff --git a/COPYING b/COPYING
index 80f87c3c6d..d4294500de 100644
--- a/COPYING
+++ b/COPYING
@@ -14,6 +14,7 @@ use them and is not more restrictive).
14evil: licenses/COPYING.BSD 14evil: licenses/COPYING.BSD
15escape: licenses/COPYING.GPL (used in PlayStation native) 15escape: licenses/COPYING.GPL (used in PlayStation native)
16eina: licenses/COPYING.LGPL 16eina: licenses/COPYING.LGPL
17emile: licenses/COPYING.LGPL
17eet: licenses/COPYING.BSD 18eet: licenses/COPYING.BSD
18eo: licenses/COPYING.BSD 19eo: licenses/COPYING.BSD
19evas: licenses/COPYING.BSD 20evas: licenses/COPYING.BSD
diff --git a/Makefile.am b/Makefile.am
index b1b7ea130c..af334fed22 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -128,6 +128,7 @@ pc/eo.pc \
128pc/eolian.pc \ 128pc/eolian.pc \
129pc/efl.pc \ 129pc/efl.pc \
130pc/efl-cxx.pc \ 130pc/efl-cxx.pc \
131pc/emile.pc \
131pc/eet.pc \ 132pc/eet.pc \
132pc/evas.pc \ 133pc/evas.pc \
133pc/ecore.pc \ 134pc/ecore.pc \
diff --git a/configure.ac b/configure.ac
index c12968b4da..e4e2ab33ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1034,6 +1034,54 @@ EFL_EVAL_PKGS([EET_CXX])
1034EFL_LIB_END([Eet_Cxx]) 1034EFL_LIB_END([Eet_Cxx])
1035#### End of Eet CXX 1035#### End of Eet CXX
1036 1036
1037#### Emile
1038
1039EFL_LIB_START([Emile])
1040
1041### Default values
1042
1043### Additional options to configure
1044
1045### Checks for programs
1046
1047### Checks for libraries
1048
1049## Compatibility layers
1050EFL_PLATFORM_DEPEND([EMILE], [evil])
1051
1052EFL_ADD_LIBS([EMILE], [-lm])
1053
1054# Cryptography support
1055if test "$build_crypto" != "none" ; then
1056 AC_DEFINE([HAVE_CIPHER], [1], [Have cipher support built in emile])
1057 AC_DEFINE([HAVE_SIGNATURE], [1], [Have signature support in emile])
1058 EFL_CRYPTO_DEPEND([EMILE])
1059fi
1060
1061EFL_CHECK_LIBS([EMILE], [zlib])
1062
1063EFL_INTERNAL_DEPEND_PKG([EMILE], [eina])
1064
1065EFL_EVAL_PKGS([EMILE])
1066
1067### Checks for header files
1068
1069### Checks for types
1070
1071### Checks for structures
1072
1073### Checks for compiler characteristics
1074
1075### Checks for linker characteristics
1076
1077### Checks for library functions
1078
1079### Check availability
1080
1081EFL_LIB_END([Emile])
1082#### End of Emile
1083
1084
1037#### Eet 1085#### Eet
1038 1086
1039EFL_LIB_START([Eet]) 1087EFL_LIB_START([Eet])
@@ -1061,6 +1109,7 @@ fi
1061EFL_CHECK_LIBS([EET], [libjpeg zlib]) 1109EFL_CHECK_LIBS([EET], [libjpeg zlib])
1062 1110
1063EFL_INTERNAL_DEPEND_PKG([EET], [eina]) 1111EFL_INTERNAL_DEPEND_PKG([EET], [eina])
1112EFL_INTERNAL_DEPEND_PKG([EET], [emile])
1064 1113
1065EFL_EVAL_PKGS([EET]) 1114EFL_EVAL_PKGS([EET])
1066 1115
@@ -4413,6 +4462,7 @@ pc/evil.pc
4413pc/escape.pc 4462pc/escape.pc
4414pc/eina.pc 4463pc/eina.pc
4415pc/eina-cxx.pc 4464pc/eina-cxx.pc
4465pc/emile.pc
4416pc/eet.pc 4466pc/eet.pc
4417pc/eet-cxx.pc 4467pc/eet-cxx.pc
4418pc/eo.pc 4468pc/eo.pc
@@ -4591,15 +4641,17 @@ echo " Cryptography..: ${build_crypto}"
4591echo " X11...........: ${with_x11}" 4641echo " X11...........: ${with_x11}"
4592echo " OpenGL........: ${with_opengl}" 4642echo " OpenGL........: ${with_opengl}"
4593echo " C++11.........: ${have_cxx11}" 4643echo " C++11.........: ${have_cxx11}"
4644echo "Eina............: yes (${features_eina})"
4645echo "Eo..............: yes (${features_eo})"
4646echo "Eolian..........: yes (${features_eolian})"
4647echo "Emile...........: yes"
4648echo "Eet.............: yes"
4594echo "Evas............: yes (${features_evas})" 4649echo "Evas............: yes (${features_evas})"
4595echo " Engines.......: ${features_evas_engine}" 4650echo " Engines.......: ${features_evas_engine}"
4596echo " Image Loaders.: ${features_evas_loader}" 4651echo " Image Loaders.: ${features_evas_loader}"
4597if test "x${have_pixman}" = "xyes" ; then 4652if test "x${have_pixman}" = "xyes" ; then
4598echo " Pixman........: ${features_evas_pixman}" 4653echo " Pixman........: ${features_evas_pixman}"
4599fi 4654fi
4600echo "Eo..............: yes (${features_eo})"
4601echo "Eolian..........: yes (${features_eolian})"
4602echo "Eina............: yes (${features_eina})"
4603echo "Ecore...........: yes (${features_ecore})" 4655echo "Ecore...........: yes (${features_ecore})"
4604echo "Ecore_Con.......: yes (${features_ecore_con})" 4656echo "Ecore_Con.......: yes (${features_ecore_con})"
4605echo "Ecore_File......: yes" 4657echo "Ecore_File......: yes"
diff --git a/pc/.gitignore b/pc/.gitignore
index db9bc3f3cc..4aaaa1359c 100644
--- a/pc/.gitignore
+++ b/pc/.gitignore
@@ -61,3 +61,4 @@
61/efl.pc 61/efl.pc
62/efl-cxx.pc 62/efl-cxx.pc
63/elua.pc 63/elua.pc
64/emile.pc
diff --git a/pc/emile.pc.in b/pc/emile.pc.in
new file mode 100644
index 0000000000..a933808bf8
--- /dev/null
+++ b/pc/emile.pc.in
@@ -0,0 +1,12 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: emile
7Description: Library for simplified serialization, compression and ciphering.
8Version: @VERSION@
9Requires.private: @requirements_pc_emile@
10Libs: -L${libdir} -lemile
11Libs.private: @requirements_libs_emile@
12Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/emile-@VMAJ@
diff --git a/src/Makefile.am b/src/Makefile.am
index 4c9c95e9ce..580911a31a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,6 +31,7 @@ include Makefile_Escape.am
31include Makefile_Eina.am 31include Makefile_Eina.am
32include Makefile_Eo.am 32include Makefile_Eo.am
33include Makefile_Efl.am 33include Makefile_Efl.am
34include Makefile_Emile.am
34include Makefile_Eet.am 35include Makefile_Eet.am
35include Makefile_Eolian.am 36include Makefile_Eolian.am
36include Makefile_Evas.am 37include Makefile_Evas.am
diff --git a/src/Makefile_Emile.am b/src/Makefile_Emile.am
new file mode 100644
index 0000000000..227be05736
--- /dev/null
+++ b/src/Makefile_Emile.am
@@ -0,0 +1,48 @@
1
2### Library
3
4lib_LTLIBRARIES += lib/emile/libemile.la
5
6installed_emilemainheadersdir = $(includedir)/emile-@VMAJ@
7dist_installed_emilemainheaders_DATA = lib/emile/Emile.h
8
9lib_emile_libemile_la_SOURCES = \
10lib/emile/emile_main.c
11
12lib_emile_libemile_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
13-I$(top_srcdir)/src/static_libs/lz4 \
14-DPACKAGE_BIN_DIR=\"$(bindir)\" \
15-DPACKAGE_LIB_DIR=\"$(libdir)\" \
16-DPACKAGE_DATA_DIR=\"$(datadir)/emile\" \
17@EMILE_CFLAGS@
18lib_emile_libemile_la_LIBADD = @EMILE_LIBS@
19lib_emile_libemile_la_DEPENDENCIES = @EMILE_INTERNAL_LIBS@
20lib_emile_libemile_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
21
22EXTRA_DIST += static_libs/lz4/README
23
24### Binary
25
26# None yet, maybe a tool to manually use cypher/compression ?
27
28### Unit tests
29
30if EFL_ENABLE_TESTS
31
32check_PROGRAMS += tests/emile/emile_suite
33TESTS += tests/emile/emile_suite
34
35tests_emile_emile_suite_SOURCES = \
36tests/emile/emile_suite.c
37
38tests_emile_emile_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
39-DTESTS_WD=\"`pwd`\" \
40-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/emile\" \
41-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/emile\" \
42@CHECK_CFLAGS@ \
43@EMILE_CFLAGS@
44
45tests_emile_emile_suite_LDADD = @CHECK_LIBS@ @USE_EMILE_LIBS@
46tests_emile_emile_suite_DEPENDENCIES = @USE_EMILE_INTERNAL_LIBS@
47
48endif
diff --git a/src/lib/emile/Emile.h b/src/lib/emile/Emile.h
new file mode 100644
index 0000000000..b0ab0efa64
--- /dev/null
+++ b/src/lib/emile/Emile.h
@@ -0,0 +1,111 @@
1/* EMILE - EFL serialization, compression and crypto library.
2 * Copyright (C) 2013 Enlightenment Developers:
3 * Cedric Bail <cedric.bail@samsung.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library;
17 * if not, see <http://www.gnu.org/licenses/>.
18 */
19
20/**
21 * @brief Emile serialization, compression and ciphering public API calls.
22 *
23 * These routines are used for Emile Library interaction
24 *
25 * @date 2013 (created)
26 */
27#ifndef EMILE_H_
28#define EMILE_H_
29
30#ifdef EAPI
31# undef EAPI
32#endif /* ifdef EAPI */
33
34#ifdef _WIN32
35# ifdef EFL_EMILE_BUILD
36# ifdef DLL_EXPORT
37# define EAPI __declspec(dllexport)
38# else /* ifdef DLL_EXPORT */
39# define EAPI
40# endif /* ! DLL_EXPORT */
41# else /* ifdef EFL_EET_BUILD */
42# define EAPI __declspec(dllimport)
43# endif /* ! EFL_EET_BUILD */
44#else /* ifdef _WIN32 */
45# ifdef __GNUC__
46# if __GNUC__ >= 4
47# define EAPI __attribute__ ((visibility("default")))
48# else /* if __GNUC__ >= 4 */
49# define EAPI
50# endif /* if __GNUC__ >= 4 */
51# else /* ifdef __GNUC__ */
52# define EAPI
53# endif /* ifdef __GNUC__ */
54#endif /* ! _WIN32 */
55
56#ifdef __cplusplus
57extern "C" {
58#endif /* ifdef __cplusplus */
59
60/**
61 * @file Emile.h
62 * @brief The file that provide the Emile function
63 *
64 * This header provides the Emile management functions.
65 */
66
67/**
68 * @defgroup Emile_Group Top level functions
69 * @ingroup Emile
70 * Function that affect Emile as a whole.
71 *
72 * @{
73 */
74
75/**
76 * Initialize the Emile library
77 *
78 * The first time this function is called, it will perform all the internal
79 * initialization required for the library to function properly and
80 * increment the initialization counter. Any subsequent call only
81 * increment this counter and return its new value, so it's safe to call
82 * this function more than once.
83 *
84 * @return The new init count. Will be 0 if initialization failed.
85 *
86 * @since 1.9.0
87 */
88EAPI int emile_init(void);
89
90/**
91 * Shut down the Emile library
92 *
93 * If emile_init() was called more than once for the running application,
94 * emile_shutdown() will decrement the initialization counter and return its
95 * new value, without doing anything else. When the counter reaches 0, all
96 * of the internal elements will be shutdown and any memory used freed.
97 *
98 * @return The new init count.
99 * @since 1.9.0
100 */
101EAPI int emile_shutdown(void);
102
103/**
104 * @}
105 */
106
107#ifdef __cplusplus
108}
109#endif /* ifdef __cplusplus */
110
111#endif /* ifndef _EET_H */
diff --git a/src/lib/emile/emile_main.c b/src/lib/emile/emile_main.c
new file mode 100644
index 0000000000..389f66022b
--- /dev/null
+++ b/src/lib/emile/emile_main.c
@@ -0,0 +1,56 @@
1#include <Eina.h>
2
3#include "Emile.h"
4
5static unsigned int _emile_init_count = 0;
6int _emile_log_dom_global = -1;
7
8EAPI int
9emile_init(void)
10{
11 if (++_emile_init_count != 1)
12 return _emile_init_count;
13
14 if (!eina_init())
15 return --_emile_init_count;
16
17 _emile_log_dom_global = eina_log_domain_register("emile", EINA_COLOR_CYAN);
18 if (_emile_log_dom_global < 0)
19 {
20 EINA_LOG_ERR("Emile can not create a general log domain.");
21 goto shutdown_eina;
22 }
23
24 // FIXME: Init the rest here.
25
26 eina_log_timing(_emile_log_dom_global,
27 EINA_LOG_STATE_STOP,
28 EINA_LOG_STATE_INIT);
29
30 return _emile_init_count;
31
32 shutdown_eina:
33 eina_shutdown();
34
35 return --_emile_init_count;
36}
37
38EAPI int
39emile_shutdown(void)
40{
41 if (--_emile_init_count != 0)
42 return _emile_init_count;
43
44 eina_log_timing(_emile_log_dom_global,
45 EINA_LOG_STATE_START,
46 EINA_LOG_STATE_SHUTDOWN);
47
48 // FIXME: Shutdown the rest here.
49
50 eina_log_domain_unregister(_emile_log_dom_global);
51 _emile_log_dom_global = -1;
52
53 eina_shutdown();
54
55 return _emile_init_count;
56}
diff --git a/src/tests/emile/emile_suite.c b/src/tests/emile/emile_suite.c
new file mode 100644
index 0000000000..2663bceaff
--- /dev/null
+++ b/src/tests/emile/emile_suite.c
@@ -0,0 +1,102 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include <check.h>
9
10#include <Eina.h>
11#include <Emile.h>
12
13START_TEST(emile_test_init)
14{
15 fail_if(emile_init() <= 0);
16 fail_if(emile_shutdown() != 0);
17}
18END_TEST
19
20static void
21emile_base_test(TCase *tc)
22{
23 tcase_add_test(tc, emile_test_init);
24}
25
26static const struct {
27 const char *name;
28 void (*build)(TCase *tc);
29} tests[] = {
30 { "Emile_Base", emile_base_test }
31};
32
33static void
34_list_tests(void)
35{
36 unsigned int i;
37
38 fputs("Available tests cases :\n", stderr);
39 for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
40 fprintf(stderr, "\t%s\n", tests[i].name);
41}
42
43static Eina_Bool
44_use_test(const char *name, int argc, char *argv[])
45{
46 argc--; argv--;
47
48 if (argc < 1) return EINA_TRUE;
49
50 for (; argc > 1; argc--, argv++)
51 if (strcmp(name, *argv) == 0)
52 return EINA_TRUE;
53 return EINA_FALSE;
54}
55
56int
57main(int argc, char *argv[])
58{
59 SRunner *sr;
60 Suite *s;
61 unsigned int i;
62 int failed_count;
63 int j;
64
65 for (j = 1; j < argc; j++)
66 if ((strcmp(argv[j], "-h") == 0) ||
67 (strcmp(argv[j], "--help") == 0))
68 {
69 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
70 argv[0]);
71 _list_tests();
72 return 0;
73 }
74 else if ((strcmp(argv[j], "-l") == 0) ||
75 (strcmp(argv[j], "--list") == 0))
76 {
77 _list_tests();
78 return 0;
79 }
80
81 s = suite_create("Emile");
82
83 for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
84 {
85 TCase *tc;
86
87 if (!_use_test(tests[i].name, argc, argv)) continue ;
88
89 tc = tcase_create(tests[i].name);
90 tests[i].build(tc);
91 suite_add_tcase(s, tc);
92 tcase_set_timeout(tc, 0);
93 }
94
95 sr = srunner_create(s);
96 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
97 srunner_run_all(sr, CK_ENV);
98 failed_count = srunner_ntests_failed(sr);
99 srunner_free(sr);
100
101 return (failed_count == 0) ? 0 : 255;
102}