[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    icecream/client
From:       Stephan Kulow <coolo () kde ! org>
Date:       2010-02-01 9:11:19
Message-ID: 1265015479.727063.2181.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1083357 by coolo:

commiting Lubos's support for an "icerun" symlink


 M  +1 -7      Makefile.am  
 M  +9 -2      arg.cpp  
 M  +1 -1      client.h  
 M  +41 -1     main.cpp  


--- trunk/icecream/client/Makefile.am #1083356:1083357
@@ -7,16 +7,10 @@
 noinst_HEADERS = client.h md5.h util.h
 
 EXTRA_DIST = icecc-create-env
-CLEANFILES = icecc++
 
-all-local: icecc++
-
-icecc++:
-	-rm -f icecc++
-	$(LN_S) icecc icecc++
-
 install-exec-local:
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	(cd $(DESTDIR)$(bindir) && $(LN_S) icecc icerun)
 	for link in g++ gcc c++ cc; do \
 	  rm -f $(DESTDIR)$(bindir)/$$link ;\
 	  $(LN_S) icecc $(DESTDIR)$(bindir)/$$link ;\
--- trunk/icecream/client/arg.cpp #1083356:1083357
@@ -82,6 +82,7 @@
         job.setLanguage (CompileJob::Lang_C);
     else {
         job.setLanguage( CompileJob::Lang_Custom );
+        job.setCompilerName( name ); // keep path
         return true;
     }
 
@@ -89,7 +90,7 @@
 }
 
 bool analyse_argv( const char * const *argv,
-                   CompileJob &job )
+                   CompileJob &job, bool icerun )
 {
     ArgumentsList args;
     string ofile;
@@ -105,11 +106,17 @@
     bool always_local = analyze_program(had_cc ? job.compilerName().c_str() : \
argv[0], job);  bool seen_c = false;
     bool seen_s = false;
+    if( icerun ) {
+        always_local = true;
+        job.setLanguage( CompileJob::Lang_Custom );
+    }
 
     for (int i = had_cc ? 2 : 1; argv[i]; i++) {
         const char *a = argv[i];
 
-        if (a[0] == '-') {
+        if (icerun) {
+            args.append(a, Arg_Local);
+        } else if (a[0] == '-') {
             if (!strcmp(a, "-E") || !strncmp(a, "-fdump", 6) || !strcmp(a, \
"-combine")) {  always_local = true;
                 args.append(a, Arg_Local);
--- trunk/icecream/client/client.h #1083356:1083357
@@ -40,7 +40,7 @@
 extern std::string get_absfilename( const std::string &_file );
 
 /* In arg.cpp.  */
-extern bool analyse_argv (const char * const *argv, CompileJob &job);
+extern bool analyse_argv (const char * const *argv, CompileJob &job, bool icerun);
 
 /* In cpp.cpp.  */
 extern pid_t call_cpp (CompileJob &job, int fdwrite, int fdread = -1);
--- trunk/icecream/client/main.cpp #1083356:1083357
@@ -91,6 +91,23 @@
 "\n");
 }
 
+static void icerun_show_usage(void)
+{
+    printf(
+"Usage:\n"
+"   icerun [compile options] -o OBJECT -c SOURCE\n"
+"   icerun --help\n"
+"\n"
+"Options:\n"
+"   --help                     explain usage and exit\n"
+"   --version                  show version and exit\n"
+"Environment Variables:\n"
+"   ICECC                      if set to \"no\", just exec the real gcc\n"
+"   ICECC_DEBUG                [info | warnings | debug]\n"
+"                              sets verboseness of icecream client.\n"
+"   ICECC_LOGFILE              if set, additional debug information is logged to the \
specified file\n" +"\n");
+}
 
 volatile bool local = false;
 
@@ -189,6 +206,7 @@
     setup_debug(debug_level, logfile, "ICECC");
 
     CompileJob job;
+    bool icerun = false;
 
     string compiler_name = argv[0];
     dcc_client_catch_signals();
@@ -209,6 +227,28 @@
             if ( arg.size() > 0 && arg.at(0) == '/' )
                 job.setCompilerName(arg);
         }
+    } else if ( find_basename( compiler_name ) == "icerun") {
+        icerun = true;
+        if ( argc > 1 ) {
+            string arg = argv[1];
+            if ( arg == "--help" ) {
+                icerun_show_usage();
+                return 0;
+            }
+            if ( arg == "--version" ) {
+                printf( "ICERUN " VERSION "\n" );
+                return 0;
+            }
+            if ( arg.size() > 0 )
+                job.setCompilerName(arg);
+        }
+    } else {
+        char buf[ PATH_MAX ];
+        buf[ PATH_MAX - 1 ] = '\0';
+        // check if it's a symlink to icerun
+        if( readlink( compiler_name.c_str(), buf, PATH_MAX - 1 ) >= 0 && \
find_basename( buf ) == "icerun" ) { +            icerun = true;
+        }
     }
 
     int sg_level = dcc_recursion_safeguard();
@@ -222,7 +262,7 @@
      * see the EPIPE. */
     dcc_ignore_sigpipe(1);
 
-    local |= analyse_argv( argv, job );
+    local |= analyse_argv( argv, job, icerun );
 
     /* if ICECC is set to no, then run job locally */
     char* icecc = getenv("ICECC");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic