summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-11-27 20:28:27 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-11-27 20:28:27 +0900
commit9ca7239be7fe35f3d3dd6baa541838f52d08a2e2 (patch)
treeaf44210416c19c3190fcd186fa99eb4385887be0
parent5c9969797415b534f86be59bc4bfeca56c031358 (diff)
more mrk work
-rw-r--r--mrklib.h1
-rw-r--r--mrklib_buildfile.c77
-rw-r--r--mrklib_package.c2
-rw-r--r--mrklib_priv.h10
-rw-r--r--mrklib_serv.c30
5 files changed, 85 insertions, 35 deletions
diff --git a/mrklib.h b/mrklib.h
index e167020..570ae58 100644
--- a/mrklib.h
+++ b/mrklib.h
@@ -107,6 +107,7 @@ struct _Mrk_Build
107{ 107{
108 const char *name; 108 const char *name;
109 const char *icon; 109 const char *icon;
110 const char *splash;
110 const char *brief; 111 const char *brief;
111 const char *version; 112 const char *version;
112 const char *license; 113 const char *license;
diff --git a/mrklib_buildfile.c b/mrklib_buildfile.c
index 17d3977..2894d99 100644
--- a/mrklib_buildfile.c
+++ b/mrklib_buildfile.c
@@ -18,28 +18,29 @@ typedef struct
18 18
19static const Tag_Type tags[] = 19static const Tag_Type tags[] =
20{ 20{
21 {"PROJ:", TMODE_EOL}, 21 {"PROJ:", TMODE_EOL},
22 {"PROJICON:", TMODE_PATH}, 22 {"PROJICON:", TMODE_PATH},
23 {"BRIEF:", TMODE_TEXT}, 23 {"PROJSPLASH", TMODE_PATH},
24 {"VERSION:", TMODE_EOL}, 24 {"BRIEF:", TMODE_TEXT},
25 {"LICENSE:", TMODE_EOL}, 25 {"VERSION:", TMODE_EOL},
26 {"COPYING:", TMODE_PATH_LIST}, 26 {"LICENSE:", TMODE_EOL},
27 {"NEEDS:", TMODE_EOL}, 27 {"COPYING:", TMODE_PATH_LIST},
28 {"DOMAIN:", TMODE_PATH}, 28 {"NEEDS:", TMODE_EOL},
29 {"REPO:", TMODE_EOL}, 29 {"DOMAIN:", TMODE_PATH},
30 {"DEVREPO:", TMODE_EOL}, 30 {"REPO:", TMODE_EOL},
31 {"CONTACT:", TMODE_TEXT}, 31 {"DEVREPO:", TMODE_EOL},
32 {"CATEGORY:", TMODE_PATH_LIST}, 32 {"CONTACT:", TMODE_TEXT},
33 {"TAGS:", TMODE_PATH_LIST}, 33 {"CATEGORY:", TMODE_PATH_LIST},
34 {"BIN:", TMODE_PATH}, 34 {"TAGS:", TMODE_PATH_LIST},
35 {"SRC:", TMODE_PATH_LIST}, 35 {"BIN:", TMODE_PATH},
36 {"DEPS:", TMODE_PATH_LIST}, 36 {"SRC:", TMODE_PATH_LIST},
37 {"INC:", TMODE_PATH_LIST}, 37 {"DEPS:", TMODE_PATH_LIST},
38 {"DATA:", TMODE_PATH_CP_LIST}, 38 {"INC:", TMODE_PATH_LIST},
39 {"DESKTOP:", TMODE_PATH_LIST}, 39 {"DATA:", TMODE_PATH_CP_LIST},
40 {"ICON:", TMODE_PATH_LIST}, 40 {"DESKTOP:", TMODE_PATH_LIST},
41 {"PODOMAIN:", TMODE_PATH}, 41 {"ICON:", TMODE_PATH_LIST},
42 {"PO:", TMODE_PATH_LIST}, 42 {"PODOMAIN:", TMODE_PATH},
43 {"PO:", TMODE_PATH_LIST},
43 {NULL, 0} // END OF LIST 44 {NULL, 0} // END OF LIST
44}; 45};
45 46
@@ -90,10 +91,17 @@ token:
90static char * 91static char *
91path_check(char *tok) 92path_check(char *tok)
92{ 93{
93 // XXX: check me 94 if (!_mrk_util_plain_path_check(tok)) return NULL;
94 return strdup(tok); 95 return strdup(tok);
95} 96}
96 97
98static Eina_List *
99path_matches_append(Eina_List *list, const char *path)
100{
101 list = eina_list_append(list, eina_stringshare_add(path));
102 return list;
103}
104
97static Mrk_Build * 105static Mrk_Build *
98parse_content(char *mem, size_t size) 106parse_content(char *mem, size_t size)
99{ 107{
@@ -191,6 +199,11 @@ not_tag:
191 eina_stringshare_del(bld->icon); 199 eina_stringshare_del(bld->icon);
192 bld->icon = eina_stringshare_add(data1); 200 bld->icon = eina_stringshare_add(data1);
193 } 201 }
202 else if (!strcmp(seg, "PROJSPLASH:"))
203 {
204 eina_stringshare_del(bld->splash);
205 bld->splash = eina_stringshare_add(data1);
206 }
194 else if (!strcmp(seg, "BRIEF:")) 207 else if (!strcmp(seg, "BRIEF:"))
195 { 208 {
196 if (!bld->brief) bld->brief = eina_stringshare_add(data1); 209 if (!bld->brief) bld->brief = eina_stringshare_add(data1);
@@ -282,10 +295,7 @@ not_tag:
282 { 295 {
283 Mrk_Build_Bin *build_bin = eina_list_data_get(eina_list_last(bld->bins)); 296 Mrk_Build_Bin *build_bin = eina_list_data_get(eina_list_last(bld->bins));
284 if (build_bin) 297 if (build_bin)
285 { 298 build_bin->srcs = path_matches_append(build_bin->srcs, data1);
286 build_bin->srcs = eina_list_append(build_bin->srcs,
287 eina_stringshare_add(data1));
288 }
289 } 299 }
290 else if (!strcmp(seg, "DEPS:")) 300 else if (!strcmp(seg, "DEPS:"))
291 { 301 {
@@ -300,10 +310,7 @@ not_tag:
300 { 310 {
301 Mrk_Build_Bin *build_bin = eina_list_data_get(eina_list_last(bld->bins)); 311 Mrk_Build_Bin *build_bin = eina_list_data_get(eina_list_last(bld->bins));
302 if (build_bin) 312 if (build_bin)
303 { 313 build_bin->incs = path_matches_append(build_bin->incs, data1);
304 build_bin->incs = eina_list_append(build_bin->incs,
305 eina_stringshare_add(data1));
306 }
307 } 314 }
308 else if (!strcmp(seg, "DATA:")) 315 else if (!strcmp(seg, "DATA:"))
309 { 316 {
@@ -318,13 +325,11 @@ not_tag:
318 } 325 }
319 else if (!strcmp(seg, "DESKTOP:")) 326 else if (!strcmp(seg, "DESKTOP:"))
320 { 327 {
321 bld->desktops = eina_list_append(bld->desktops, 328 bld->desktops = path_matches_append(bld->desktops, data1);
322 eina_stringshare_add(data1));
323 } 329 }
324 else if (!strcmp(seg, "ICON:")) 330 else if (!strcmp(seg, "ICON:"))
325 { 331 {
326 bld->icons = eina_list_append(bld->icons, 332 bld->icons = path_matches_append(bld->icons, data1);
327 eina_stringshare_add(data1));
328 } 333 }
329 else if (!strcmp(seg, "PO:")) 334 else if (!strcmp(seg, "PO:"))
330 { 335 {
@@ -387,6 +392,7 @@ mrk_build_free(Mrk_Build *bld)
387 if (!bld) return; 392 if (!bld) return;
388 eina_stringshare_del(bld->name); 393 eina_stringshare_del(bld->name);
389 eina_stringshare_del(bld->icon); 394 eina_stringshare_del(bld->icon);
395 eina_stringshare_del(bld->splash);
390 eina_stringshare_del(bld->brief); 396 eina_stringshare_del(bld->brief);
391 eina_stringshare_del(bld->version); 397 eina_stringshare_del(bld->version);
392 eina_stringshare_del(bld->license); 398 eina_stringshare_del(bld->license);
@@ -765,6 +771,7 @@ mrk_build_package_bin(Mrk_Build *bld, const char *file, const char *tmpd, const
765 if (var) eet_write(ef, key, var, strlen(var), EET_COMPRESSION_VERYFAST) 771 if (var) eet_write(ef, key, var, strlen(var), EET_COMPRESSION_VERYFAST)
766 WRTS("name", bld->name); 772 WRTS("name", bld->name);
767 if (bld->icon) package_file(ef, bld->icon, "icon"); 773 if (bld->icon) package_file(ef, bld->icon, "icon");
774 if (bld->splash) package_file(ef, bld->splash, "splash");
768 WRTS("brief", bld->brief); 775 WRTS("brief", bld->brief);
769 WRTS("version", bld->version); 776 WRTS("version", bld->version);
770 WRTS("license", bld->license); 777 WRTS("license", bld->license);
diff --git a/mrklib_package.c b/mrklib_package.c
index 25154d4..00a4a28 100644
--- a/mrklib_package.c
+++ b/mrklib_package.c
@@ -247,6 +247,8 @@ mrk_package_bin_install(const char *file, const char *os, const char *arch)
247 } 247 }
248 snprintf(tmp, sizeof(tmp), "%s/Applications/%s/.icon.png", get_home(), name); 248 snprintf(tmp, sizeof(tmp), "%s/Applications/%s/.icon.png", get_home(), name);
249 write_file(ef, "icon", tmp); 249 write_file(ef, "icon", tmp);
250 snprintf(tmp, sizeof(tmp), "%s/Applications/%s/.splash.png", get_home(), name);
251 write_file(ef, "splash", tmp);
250 snprintf(tmp, sizeof(tmp), "%s/Applications/%s/.info.mki", get_home(), name); 252 snprintf(tmp, sizeof(tmp), "%s/Applications/%s/.info.mki", get_home(), name);
251 ef2 = eet_open(tmp, EET_FILE_MODE_WRITE); 253 ef2 = eet_open(tmp, EET_FILE_MODE_WRITE);
252 free(name); 254 free(name);
diff --git a/mrklib_priv.h b/mrklib_priv.h
index 8903e29..7c0095c 100644
--- a/mrklib_priv.h
+++ b/mrklib_priv.h
@@ -66,6 +66,16 @@ extern int _mrk_uuid_len;
66#define M_ID_VERSION 52 66#define M_ID_VERSION 52
67#define M_ID_ARCH 53 67#define M_ID_ARCH 53
68 68
69#define M_INF_B 60
70#define M_INF_E 70
71#define M_INF_START 61
72#define M_INF_DATA 62
73#define M_INF_END 63
74#define M_INF_GET_IC 64
75#define M_INF_GET_SP 65
76#define M_INF_GET_IN 66
77
78
69#if defined(__x86_64__) 79#if defined(__x86_64__)
70# define ARCH "x86_64" 80# define ARCH "x86_64"
71#elif defined(__i386__) 81#elif defined(__i386__)
diff --git a/mrklib_serv.c b/mrklib_serv.c
index 99c62ae..69e191c 100644
--- a/mrklib_serv.c
+++ b/mrklib_serv.c
@@ -286,6 +286,34 @@ _mrk_query_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e)
286} 286}
287 287
288static Eina_Bool 288static Eina_Bool
289_mrk_inf_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e)
290{
291 if ((!c->uuid) || (!c->version) || (!c->arch)) return EINA_FALSE;
292 if (e->minor == M_INF_GET_IC)
293 {
294 char *str = _mrk_util_proto_cli_string(e);
295 if (str)
296 {
297 if (_mrk_util_plain_file_check(str))
298 {
299 char *str2 = malloc(strlen(str) + 1 + 8);
300 if (str2)
301 {
302 strcpy(str2, str);
303 strcat(str2, ".icn.png");
304 client_send(c, "src", str2,
305 M_INF_START, M_INF_DATA, M_INF_END);
306 free(str2);
307 }
308 }
309 free(str);
310 }
311 return EINA_TRUE;
312 }
313 return EINA_FALSE;
314}
315
316static Eina_Bool
289_mrk_data_handle(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) 317_mrk_data_handle(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e)
290{ 318{
291 if ((e->minor > M_UP_B) && (e->minor < M_UP_E)) 319 if ((e->minor > M_UP_B) && (e->minor < M_UP_E))
@@ -294,6 +322,8 @@ _mrk_data_handle(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e)
294 return _mrk_query_data(server, c, e); 322 return _mrk_query_data(server, c, e);
295 else if ((e->minor > M_ID_B) && (e->minor < M_ID_E)) 323 else if ((e->minor > M_ID_B) && (e->minor < M_ID_E))
296 return _mrk_id_data(server, c, e); 324 return _mrk_id_data(server, c, e);
325 else if ((e->minor > M_INF_B) && (e->minor < M_INF_E))
326 return _mrk_inf_data(server, c, e);
297 return EINA_FALSE; 327 return EINA_FALSE;
298} 328}
299 329