blob: 94c6a41b3af6d671a4e28f4089d8c3bb883928f4 [file] [log] [blame]
Index: services/job.h
===================================================================
--- services/job.h (revision 843731)
+++ services/job.h (working copy)
@@ -57,6 +57,10 @@
unsigned int argumentFlags() const;
+ const ArgumentsList getFlags() {
+ return m_flags;
+ }
+
void setFlags( const ArgumentsList &flags ) {
m_flags = flags;
}
Index: client/main.cpp
===================================================================
--- client/main.cpp (revision 843731)
+++ client/main.cpp (working copy)
@@ -218,6 +218,39 @@
local |= analyse_argv( argv, job );
+ /* honour Gentoo's ${CFLAGS_${ABI}} environment variable */
+ if (getenv("ABI") != NULL) {
+ char* envar = (char*) malloc(sizeof(char) *
+ (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1));
+
+ if (!envar)
+ return 1;
+
+ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are
+ * the same no matter which compiler we are using.
+ */
+ sprintf(envar, "CFLAGS_%s", getenv("ABI"));
+
+ if (getenv(envar)) {
+ ArgumentsList args = job.getFlags();
+
+ char* pch = strtok(getenv(envar)," \t");
+ while (pch != NULL) {
+ #if CLIENT_DEBUG
+ log_info() << "adding CFLAG '" << pch << "' as specified in environment variable ${CFLAGS_${ABI}}" << endl;
+ #endif
+ args.append(pch, Arg_Remote);
+ pch = strtok(NULL, " \t");
+ }
+
+ job.setFlags(args);
+
+ free(pch);
+ }
+
+ free(envar);
+ }
+
/* if ICECC is set to no, then run job locally */
char* icecc = getenv("ICECC");
if ( icecc && !strcasecmp(icecc, "no") )