1. Volker Braun
  2. compilerwrapper

Commits

Volker Braun  committed 1746d07

add PATH support, bugfix (from jpflori)

  • Participants
  • Parent commits 979f1ad
  • Branches master

Comments (0)

Files changed (2)

File spkg/make_spkg.sh

View file
 hg commit -m "Updated to compilerwrapper-$VERSION"
 
 cd "$TOPDIR/spkg"
-sage -pkg "compilerwrapper-$VERSION"
+tar cjf "compilerwrapper-$VERSION.spkg" "compilerwrapper-$VERSION"

File src/wrapper.cc

View file
     new_path = getenv(COMPILERWRAPPER_LD_LIBRARY_PATH.c_str());
 
 #ifdef WITH_SAGE
-  const string SAGE_OLD_LD_LIBRARY_PATH = 
-    string("SAGE_OLD_") + LD_LIBRARY_PATH;
+  const string SAGE_ORIG_LD_LIBRARY_PATH = 
+    string("SAGE_ORIG_") + LD_LIBRARY_PATH;
   if (new_path == NULL)
-    new_path = getenv(SAGE_OLD_LD_LIBRARY_PATH.c_str());
+    new_path = getenv(SAGE_ORIG_LD_LIBRARY_PATH.c_str());
 #endif
 
   if (new_path == NULL)
 }
 
 
+void modify_path()
+{
+  using std::string;
+  char * new_path = NULL;
+
+  const static string PATH = string("PATH");
+  
+  const string COMPILERWRAPPER_PATH = 
+    string("COMPILERWRAPPER_") + PATH;
+  if (new_path == NULL)
+    new_path = getenv(COMPILERWRAPPER_PATH.c_str());
+
+#ifdef WITH_SAGE
+  const string SAGE_ORIG_PATH = 
+    string("SAGE_ORIG_") + PATH;
+  if (new_path == NULL)
+      new_path = getenv(SAGE_ORIG_PATH.c_str());
+#endif
+
+  if (new_path == NULL)
+    return;
+  setenv(PATH.c_str(), new_path, true);
+
+  if (getenv("COMPILERWRAPPER_DEBUG") != NULL) 
+    std::cerr << "------- Changed path --------------------" << endl
+	      << PATH << " now is " << new_path << endl;
+}
+
+
 int main(int argc, char *argv[])
 {
   assert(argc > 0);
   Arguments args(argc, argv);
   const wrapped_program prog = identify_wrapped_program(argv[0]);
+  modify_path();
   modify_library_path();
 
   //std::cerr << "------- executing --------------------" << endl