summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@free.fr>2014-03-03 08:39:53 -0300
committerCedric Bail <cedric.bail@free.fr>2014-03-03 08:39:53 -0300
commit92a24dea79bc2ffe215bbc8f3d2ad467bb7e6f62 (patch)
treeb309390c1a10d1281c4a817dc18d7f2d4f99f29d /src/bin
parentf3ba81f7c18d787eb6bcf4737f14144c08145e9c (diff)
edje: @feature to include license in edje file.
This will close T1027.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/edje/edje_cc.c8
-rw-r--r--src/bin/edje/edje_cc.h1
-rw-r--r--src/bin/edje/edje_cc_out.c53
3 files changed, 59 insertions, 3 deletions
diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c
index d714355677..5c62fb61f0 100644
--- a/src/bin/edje/edje_cc.c
+++ b/src/bin/edje/edje_cc.c
@@ -21,6 +21,7 @@ char *file_in = NULL;
21char *tmp_dir = NULL; 21char *tmp_dir = NULL;
22char *file_out = NULL; 22char *file_out = NULL;
23char *watchfile = NULL; 23char *watchfile = NULL;
24char *license = NULL;
24 25
25static const char *progname = NULL; 26static const char *progname = NULL;
26 27
@@ -90,6 +91,7 @@ main_help(void)
90 "-sd sound/directory Add a directory to look in for relative path sounds samples\n" 91 "-sd sound/directory Add a directory to look in for relative path sounds samples\n"
91 "-dd data/directory Add a directory to look in for relative path data.file entries\n" 92 "-dd data/directory Add a directory to look in for relative path data.file entries\n"
92 "-td temp/directory Directory to store temporary files\n" 93 "-td temp/directory Directory to store temporary files\n"
94 "-l license Specify the license of a theme\n"
93 "-v Verbose output\n" 95 "-v Verbose output\n"
94 "-no-lossy Do NOT allow images to be lossy\n" 96 "-no-lossy Do NOT allow images to be lossy\n"
95 "-no-comp Do NOT allow images to be stored with lossless compression\n" 97 "-no-comp Do NOT allow images to be stored with lossless compression\n"
@@ -194,6 +196,12 @@ main(int argc, char **argv)
194 if (!tmp_dir) 196 if (!tmp_dir)
195 tmp_dir = argv[i]; 197 tmp_dir = argv[i];
196 } 198 }
199 else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1)))
200 {
201 i++;
202 if (!license)
203 license = argv[i];
204 }
197 else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1))) 205 else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
198 { 206 {
199 i++; 207 i++;
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 3d9973d9a9..10d2a4ba25 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -227,6 +227,7 @@ extern char *file_in;
227extern char *tmp_dir; 227extern char *tmp_dir;
228extern char *file_out; 228extern char *file_out;
229extern char *watchfile; 229extern char *watchfile;
230extern char *license;
230extern int no_lossy; 231extern int no_lossy;
231extern int no_comp; 232extern int no_comp;
232extern int no_raw; 233extern int no_raw;
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index e30b5965cc..e269eccc9b 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -1345,16 +1345,13 @@ data_scripts_exe_del_cb(void *data EINA_UNUSED, int evtype EINA_UNUSED, void *ev
1345 } 1345 }
1346 if (threads) 1346 if (threads)
1347 { 1347 {
1348 pending_threads++;
1349 ecore_thread_run(data_thread_script, data_thread_script_end, NULL, sc); 1348 ecore_thread_run(data_thread_script, data_thread_script_end, NULL, sc);
1350 } 1349 }
1351 else 1350 else
1352 { 1351 {
1353 pending_threads++;
1354 data_thread_script(sc, NULL); 1352 data_thread_script(sc, NULL);
1355 data_thread_script_end(sc, NULL); 1353 data_thread_script_end(sc, NULL);
1356 } 1354 }
1357 pending_threads--;
1358 if (pending_threads <= 0) ecore_main_loop_quit(); 1355 if (pending_threads <= 0) ecore_main_loop_quit();
1359 return ECORE_CALLBACK_CANCEL; 1356 return ECORE_CALLBACK_CANCEL;
1360} 1357}
@@ -1644,6 +1641,45 @@ data_thread_source_end(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
1644} 1641}
1645 1642
1646static void 1643static void
1644data_thread_license(void *data, Ecore_Thread *thread EINA_UNUSED)
1645{
1646 Eet_File *ef = data;
1647 Eina_File *f;
1648 void *m;
1649 int bytes;
1650
1651 f = eina_file_open(license, 0);
1652 if (!f) return ;
1653
1654 m = eina_file_map_all(f, EINA_FILE_WILLNEED);
1655 if (!m) goto on_error;
1656
1657 bytes = eet_write(ef, "edje/license", m, eina_file_size_get(f), compress_mode);
1658 if ((bytes <= 0) || eina_file_map_faulted(f, m))
1659 {
1660 ERR("Unable to write license part \"%s\".", license);
1661 }
1662 else
1663 {
1664 INF("Wrote %9i bytes (%4iKb) for \"%s\" license entry compress: [real: %2.1f%%]",
1665 bytes, (bytes + 512) / 1024, license,
1666 100 - (100 * (double)bytes) / ((double)(eina_file_size_get(f))));
1667 }
1668
1669 eina_file_map_free(f, m);
1670
1671 on_error:
1672 eina_file_close(f);
1673}
1674
1675static void
1676data_thread_license_end(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
1677{
1678 pending_threads--;
1679 if (pending_threads <= 0) ecore_main_loop_quit();
1680}
1681
1682static void
1647data_thread_fontmap(void *data, Ecore_Thread *thread EINA_UNUSED) 1683data_thread_fontmap(void *data, Ecore_Thread *thread EINA_UNUSED)
1648{ 1684{
1649 Eet_File *ef = data; 1685 Eet_File *ef = data;
@@ -1721,6 +1757,17 @@ data_write(void)
1721 INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); 1757 INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get();
1722 data_write_sounds(ef, &sound_num); 1758 data_write_sounds(ef, &sound_num);
1723 INF("sounds: %3.5f", ecore_time_get() - t); t = ecore_time_get(); 1759 INF("sounds: %3.5f", ecore_time_get() - t); t = ecore_time_get();
1760 if (license)
1761 {
1762 pending_threads++;
1763 if (threads)
1764 ecore_thread_run(data_thread_license, data_thread_license_end, NULL, ef);
1765 else
1766 {
1767 data_thread_license(ef, NULL);
1768 data_thread_license_end(ef, NULL);
1769 }
1770 }
1724 pending_threads--; 1771 pending_threads--;
1725 if (pending_threads > 0) ecore_main_loop_begin(); 1772 if (pending_threads > 0) ecore_main_loop_begin();
1726 INF("THREADS: %3.5f", ecore_time_get() - t); 1773 INF("THREADS: %3.5f", ecore_time_get() - t);