forked from enlightenment/efl
edje: add AUTHORS and more than one license file to Edje.
@feature
This commit is contained in:
parent
c3e0f5c4ef
commit
dea550eba1
|
@ -21,7 +21,9 @@ char *file_in = NULL;
|
||||||
char *tmp_dir = NULL;
|
char *tmp_dir = NULL;
|
||||||
char *file_out = NULL;
|
char *file_out = NULL;
|
||||||
char *watchfile = NULL;
|
char *watchfile = NULL;
|
||||||
|
char *authors = NULL;
|
||||||
char *license = NULL;
|
char *license = NULL;
|
||||||
|
Eina_List *licenses = NULL;
|
||||||
|
|
||||||
static const char *progname = NULL;
|
static const char *progname = NULL;
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ main_help(void)
|
||||||
"-dd data/directory Add a directory to look in for relative path data.file entries\n"
|
"-dd data/directory Add a directory to look in for relative path data.file entries\n"
|
||||||
"-td temp/directory Directory to store temporary files\n"
|
"-td temp/directory Directory to store temporary files\n"
|
||||||
"-l license Specify the license of a theme\n"
|
"-l license Specify the license of a theme\n"
|
||||||
|
"-a authors Specify AUTHORS\n"
|
||||||
"-v Verbose output\n"
|
"-v Verbose output\n"
|
||||||
"-no-lossy Do NOT allow images to be lossy\n"
|
"-no-lossy Do NOT allow images to be lossy\n"
|
||||||
"-no-comp Do NOT allow images to be stored with lossless compression\n"
|
"-no-comp Do NOT allow images to be stored with lossless compression\n"
|
||||||
|
@ -201,6 +204,14 @@ main(int argc, char **argv)
|
||||||
i++;
|
i++;
|
||||||
if (!license)
|
if (!license)
|
||||||
license = argv[i];
|
license = argv[i];
|
||||||
|
else
|
||||||
|
licenses = eina_list_append(licenses, argv[i]);
|
||||||
|
}
|
||||||
|
else if ((!strcmp(argv[i], "-a") || !strcmp(argv[i], "--authors")) && (i < (argc - 1)))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (!authors)
|
||||||
|
authors = argv[i];
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -228,6 +228,8 @@ extern char *tmp_dir;
|
||||||
extern char *file_out;
|
extern char *file_out;
|
||||||
extern char *watchfile;
|
extern char *watchfile;
|
||||||
extern char *license;
|
extern char *license;
|
||||||
|
extern char *authors;
|
||||||
|
extern Eina_List *licenses;
|
||||||
extern int no_lossy;
|
extern int no_lossy;
|
||||||
extern int no_comp;
|
extern int no_comp;
|
||||||
extern int no_raw;
|
extern int no_raw;
|
||||||
|
|
|
@ -123,6 +123,7 @@ typedef struct _Fonts_Write Fonts_Write;
|
||||||
typedef struct _Image_Write Image_Write;
|
typedef struct _Image_Write Image_Write;
|
||||||
typedef struct _Sound_Write Sound_Write;
|
typedef struct _Sound_Write Sound_Write;
|
||||||
typedef struct _Group_Write Group_Write;
|
typedef struct _Group_Write Group_Write;
|
||||||
|
typedef struct _License_Write License_Write;
|
||||||
|
|
||||||
struct _Script_Write
|
struct _Script_Write
|
||||||
{
|
{
|
||||||
|
@ -175,6 +176,13 @@ struct _Group_Write
|
||||||
char *errstr;
|
char *errstr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _License_Write
|
||||||
|
{
|
||||||
|
Eet_File *ef;
|
||||||
|
const char *file;
|
||||||
|
Eina_Bool master;
|
||||||
|
};
|
||||||
|
|
||||||
struct _Image_Unused_Ids
|
struct _Image_Unused_Ids
|
||||||
{
|
{
|
||||||
int old_id;
|
int old_id;
|
||||||
|
@ -1643,21 +1651,35 @@ data_thread_source_end(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
|
||||||
static void
|
static void
|
||||||
data_thread_license(void *data, Ecore_Thread *thread EINA_UNUSED)
|
data_thread_license(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Eet_File *ef = data;
|
License_Write *lw = data;
|
||||||
|
Eet_File *ef = lw->ef;
|
||||||
Eina_File *f;
|
Eina_File *f;
|
||||||
void *m;
|
void *m;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
f = eina_file_open(license, 0);
|
f = eina_file_open(lw->file, 0);
|
||||||
if (!f) return ;
|
if (!f) return ;
|
||||||
|
|
||||||
m = eina_file_map_all(f, EINA_FILE_WILLNEED);
|
m = eina_file_map_all(f, EINA_FILE_WILLNEED);
|
||||||
if (!m) goto on_error;
|
if (!m) goto on_error;
|
||||||
|
|
||||||
bytes = eet_write(ef, "edje/license", m, eina_file_size_get(f), compress_mode);
|
if (lw->master)
|
||||||
|
{
|
||||||
|
bytes = eet_write(ef, "edje/license", m, eina_file_size_get(f), compress_mode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *s = alloca(strlen(lw->file) + 1 + 13);
|
||||||
|
|
||||||
|
strcpy(s, lw->file);
|
||||||
|
sprintf(s, "edje/license/%s", basename(s));
|
||||||
|
|
||||||
|
bytes = eet_write(ef, s, m, eina_file_size_get(f), compress_mode);
|
||||||
|
}
|
||||||
|
|
||||||
if ((bytes <= 0) || eina_file_map_faulted(f, m))
|
if ((bytes <= 0) || eina_file_map_faulted(f, m))
|
||||||
{
|
{
|
||||||
ERR("Unable to write license part \"%s\".", license);
|
ERR("Unable to write license part \"%s\".", lw->file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1673,7 +1695,92 @@ data_thread_license(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
data_thread_license_end(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
|
data_thread_license_end(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
|
{
|
||||||
|
pending_threads--;
|
||||||
|
if (pending_threads <= 0) ecore_main_loop_quit();
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
data_write_license(Eet_File *ef)
|
||||||
|
{
|
||||||
|
License_Write *lw;
|
||||||
|
Eina_List *l;
|
||||||
|
const char *file;
|
||||||
|
|
||||||
|
if (!license) return ;
|
||||||
|
|
||||||
|
lw = calloc(1, sizeof (License_Write));
|
||||||
|
if (!lw) return ;
|
||||||
|
|
||||||
|
lw->ef = ef;
|
||||||
|
lw->file = license;
|
||||||
|
lw->master = EINA_TRUE;
|
||||||
|
|
||||||
|
pending_threads++;
|
||||||
|
if (threads)
|
||||||
|
ecore_thread_run(data_thread_license, data_thread_license_end, NULL, lw);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data_thread_license(lw, NULL);
|
||||||
|
data_thread_license_end(lw, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(licenses, l, file)
|
||||||
|
{
|
||||||
|
lw = calloc(1, sizeof (License_Write));
|
||||||
|
if (!lw) return ;
|
||||||
|
|
||||||
|
lw->ef = ef;
|
||||||
|
lw->file = file;
|
||||||
|
lw->master = EINA_FALSE;
|
||||||
|
|
||||||
|
pending_threads++;
|
||||||
|
if (threads)
|
||||||
|
ecore_thread_run(data_thread_license, data_thread_license_end, NULL, lw);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data_thread_license(lw, NULL);
|
||||||
|
data_thread_license_end(lw, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
data_thread_authors(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Eet_File *ef = data;
|
||||||
|
Eina_File *f;
|
||||||
|
void *m;
|
||||||
|
int bytes;
|
||||||
|
|
||||||
|
f = eina_file_open(authors, 0);
|
||||||
|
if (!f) return ;
|
||||||
|
|
||||||
|
m = eina_file_map_all(f, EINA_FILE_WILLNEED);
|
||||||
|
if (!m) goto on_error;
|
||||||
|
|
||||||
|
bytes = eet_write(ef, "edje/authors", m, eina_file_size_get(f), compress_mode);
|
||||||
|
if ((bytes <= 0) || eina_file_map_faulted(f, m))
|
||||||
|
{
|
||||||
|
ERR("Unable to write license part \"%s\".", authors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INF("Wrote %9i bytes (%4iKb) for \"%s\" license entry compress: [real: %2.1f%%]",
|
||||||
|
bytes, (bytes + 512) / 1024, license,
|
||||||
|
100 - (100 * (double)bytes) / ((double)(eina_file_size_get(f))));
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_file_map_free(f, m);
|
||||||
|
|
||||||
|
on_error:
|
||||||
|
eina_file_close(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
data_thread_authors_end(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
|
||||||
{
|
{
|
||||||
pending_threads--;
|
pending_threads--;
|
||||||
if (pending_threads <= 0) ecore_main_loop_quit();
|
if (pending_threads <= 0) ecore_main_loop_quit();
|
||||||
|
@ -1757,15 +1864,17 @@ data_write(void)
|
||||||
INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get();
|
INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get();
|
||||||
data_write_sounds(ef, &sound_num);
|
data_write_sounds(ef, &sound_num);
|
||||||
INF("sounds: %3.5f", ecore_time_get() - t); t = ecore_time_get();
|
INF("sounds: %3.5f", ecore_time_get() - t); t = ecore_time_get();
|
||||||
if (license)
|
data_write_license(ef);
|
||||||
|
INF("license: %3.5f", ecore_time_get() - t); t = ecore_time_get();
|
||||||
|
if (authors)
|
||||||
{
|
{
|
||||||
pending_threads++;
|
pending_threads++;
|
||||||
if (threads)
|
if (threads)
|
||||||
ecore_thread_run(data_thread_license, data_thread_license_end, NULL, ef);
|
ecore_thread_run(data_thread_authors, data_thread_authors_end, NULL, ef);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data_thread_license(ef, NULL);
|
data_thread_authors(ef, NULL);
|
||||||
data_thread_license_end(ef, NULL);
|
data_thread_authors_end(ef, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pending_threads--;
|
pending_threads--;
|
||||||
|
|
Loading…
Reference in New Issue