From c7c66a652a1f700df0780c36cfb321d79928f951 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 17 Dec 2009 00:50:43 +0000 Subject: [PATCH] add Sun Studio support when parsing edc files. Technically, it means that e17 can run on OpenSolaris using Sun Studio or gcc. It actually runs if temperature and battery modules are disabled as they don't compile yet. Also, the problem on Mac OS X problem with C++ comments can be fixed (I think). See FIXME in that patch SVN revision: 44519 --- legacy/edje/src/bin/edje_cc_parse.c | 40 ++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/legacy/edje/src/bin/edje_cc_parse.c b/legacy/edje/src/bin/edje_cc_parse.c index bb5971ce83..71d6f987b0 100644 --- a/legacy/edje/src/bin/edje_cc_parse.c +++ b/legacy/edje/src/bin/edje_cc_parse.c @@ -687,7 +687,34 @@ compile(void) /* * Run the input through the C pre-processor. + */ + + /* + * On OpenSolaris, the default cpp is located in different places. + * Alan Coppersmith told me to do what xorg does: using /usr/ccs/lib/cpp * + * Also, that preprocessor is not managing C++ comments, so pass the + * sun cc preprocessor just after. + */ + snprintf(buf, sizeof(buf), "/usr/ccs/lib/cpp -I%s %s %s %s", + inc, def, file_in, tmpn); + ret = system(buf); + if (ret == 0) + { + static char tmpn2[4096]; + + snprintf (tmpn2, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir); + fd = mkstemp(tmpn2); + if (fd >= 0) + { + close(fd); + snprintf (buf, 4096, "cc -E -I%s %s -o %s %s", + inc, def, tmpn2, tmpn); + ret = system(buf); + snprintf(tmpn, 4096, "%s", tmpn2); + } + } + /* * On some BSD based systems (MacOS, OpenBSD), the default cpp * in the path is a wrapper script that chokes on the -o option. * If the preprocessor is invoked via gcc -E, it will treat @@ -696,10 +723,17 @@ compile(void) * * Redirecting the output is required for MacOS 10.3, and works fine * on other systems. + * + * FIXME: if C++ comments are still there, maybe doing like on + * OpenSolaris: using gcc -E to remove them after using cpp. + * */ - snprintf(buf, sizeof(buf), "cat %s | cpp -I%s %s > %s", - file_in, inc, def, tmpn); - ret = system(buf); + if (ret < 0) + { + snprintf(buf, sizeof(buf), "cat %s | cpp -I%s %s > %s", + file_in, inc, def, tmpn); + ret = system(buf); + } if (ret < 0) { snprintf(buf, sizeof(buf), "gcc -I%s %s -E -o %s %s",