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

List:       kde-commits
Subject:    icecream/client
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2012-07-08 15:22:04
Message-ID: 20120708152205.00D1BAC7A9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1304626 by lunakl:

make --build-native create env with compilers that are available



 M  +2 -1      client.h  
 M  +8 -34     local.cpp  
 M  +15 -6     main.cpp  


--- trunk/icecream/client/client.h #1304625:1304626
@@ -47,9 +47,10 @@
 
 /* In local.cpp.  */
 extern int build_local (CompileJob& job, MsgChannel *daemon, struct rusage *usage =0);
-extern std::string find_compiler( CompileJob::Language lang );
 extern std::string find_compiler( const CompileJob& job );
 extern bool compiler_is_clang( const CompileJob& job );
+extern bool compiler_only_rewrite_includes( const CompileJob& job );
+extern std::string compiler_path_lookup(const std::string& compiler);
 
 /* In remote.cpp - permill is the probability it will be compiled three times */
 extern int build_remote (CompileJob &job, MsgChannel *scheduler, const Environments &envs, int permill);
--- trunk/icecream/client/local.cpp #1304625:1304626
@@ -42,33 +42,8 @@
 
 #define CLIENT_DEBUG 0
 
-/*
- * Get the name of the compiler depedant on the
- * language of the job and the environment
- * variable set. This is useful for native cross-compilers.
- * (arm-linux-gcc for example)
- */
-
-static string get_compiler_name( CompileJob::Language lang )
+string compiler_path_lookup(const string& compiler)
 {
-    string compiler_name = "gcc";
-
-    const char* env;
-    if ( (env = getenv( "ICECC_CC" )) )
-        compiler_name = env;
-
-    if (lang == CompileJob::Lang_CXX) {
-        compiler_name = "g++";
-        if ((env = getenv ("ICECC_CXX")))
-            compiler_name = env;
-    }
-
-    return compiler_name;
-}
-
-
-static string path_lookup(const string& compiler)
-{
     if ( compiler.at( 0 ) == '/' )
         return compiler;
 
@@ -123,6 +98,12 @@
     return best_match;
 }
 
+/*
+ * Get the name of the compiler depedant on the
+ * language of the job and the environment
+ * variable set. This is useful for native cross-compilers.
+ * (arm-linux-gcc for example)
+ */
 string find_compiler( const CompileJob& job )
 {
     if (job.language() == CompileJob::Lang_C) {
@@ -133,16 +114,9 @@
         if (const char* env = getenv ("ICECC_CXX"))
             return env;
     }
-    return path_lookup(job.compilerName());
+    return compiler_path_lookup(job.compilerName());
 }
 
-string find_compiler( CompileJob::Language lang )
-{
-    string compiler = get_compiler_name( lang );
-
-    return path_lookup(compiler);
-}
-
 bool compiler_is_clang( const CompileJob& job )
 {
     return job.compilerName().find("clang") != string::npos;
--- trunk/icecream/client/main.cpp #1304625:1304626
@@ -157,7 +157,7 @@
 static int create_native()
 {
     struct stat st;
-    string gcc, gpp;
+    string gcc, gpp, clang;
 
     // perhaps we're on gentoo
     if ( !lstat("/usr/bin/gcc-config", &st) ) {
@@ -165,11 +165,19 @@
         gcc=gccpath + "gcc";
         gpp=gccpath + "g++";
     } else {
-        gcc = find_compiler( CompileJob::Lang_C );
-        gpp = find_compiler( CompileJob::Lang_CXX );
+        gcc = compiler_path_lookup( "gcc" );
+        gpp = compiler_path_lookup( "g++" );
     }
 
-    if ( gcc.empty() || gpp.empty())
+    clang = compiler_path_lookup( "clang" );
+
+    // both C and C++ compiler are required
+    if ( gcc.empty())
+        gpp.clear();
+    if ( gpp.empty())
+        gcc.clear();
+
+    if ( gcc.empty() && gpp.empty() && clang.empty())
 	return 1;
 
     if ( lstat( PLIBDIR "/icecc-create-env", &st ) ) {
@@ -177,11 +185,12 @@
         return 1;
     }
 
-    char **argv = new char*[4];
+    char **argv = new char*[5];
     argv[0] = strdup( PLIBDIR "/icecc-create-env"  );
     argv[1] = strdup( gcc.c_str() );
     argv[2] = strdup( gpp.c_str() );
-    argv[3] = NULL;
+    argv[3] = strdup( clang.c_str() );
+    argv[4] = NULL;
 
     return execv(argv[0], argv);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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