Bug 60546 - Custom project: Project/Project Options/Make Options/Environment Variables have no effect.
Summary: Custom project: Project/Project Options/Make Options/Environment Variables ha...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: Custom Makefiles (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-30 19:35 UTC by John W Eckhart
Modified: 2003-07-01 10:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
This patch is based off of of the code from similar parts of other projects. (2.00 KB, patch)
2003-06-30 21:38 UTC, John W Eckhart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John W Eckhart 2003-06-30 19:35:03 UTC
Version:           3.0 alpha 4 (using KDE KDE 3.1.2)
Installed from:    Gentoo Packages
Compiler:          gcc 3.2 
OS:          Linux

The "environment variables" option that can be specified for make options of a custom project do not have any effect. I have checked the source to verify that they are simply not read or considered and I DO have a patch. I am not sure what the process is to submit the patch, or if someone on the project team would rather patch this instead.
Comment 1 Harald Fernengel 2003-06-30 19:56:50 UTC
Looks like someone forgot to implement this :) If you have a patch, you can send it to the 
kdevelop-devel mailing-list or directly to me ( harry at kdevelop dot org ). 
 
Best regards, 
Harry 
Comment 2 John W Eckhart 2003-06-30 21:38:47 UTC
Created attachment 1914 [details]
This patch is based off of of the code from similar parts of other projects.

To apply:
  1) Copy the patch to the source dir: 
      cp ./kdevelop-3.0a4a.patch /src/kdevelop-3.0a4a/)
  2) Goto the source dir:
      cd /src/kdevelop-3.0a4a/
  3) Apply the patch
      patch -Np1 -i ./kdevelop-3.0a4a.patch
  4) Configure and make
Comment 3 Amilcar do Carmo Lucas 2003-07-01 10:41:54 UTC
Subject: kdevelop/parts/customproject

CVS commit by aclu: 

Fix Project/Project Options/Make Options/Environment Variables have no effect
Patch by: John W Eckhart < jeckhart in us.ibm.com > Thanks for the patch!!!

CCMAIL: 60546-done@bugs.kde.org


  M +26 -0     customprojectpart.cpp   1.52
  M +1 -0      customprojectpart.h   1.14


--- kdevelop/parts/customproject/customprojectpart.cpp  #1.51:1.52
@@ -332,4 +332,29 @@ QString CustomProjectPart::buildDirector
 
 
+QString CustomProjectPart::makeEnvironment()
+{
+    // Get the make environment variables pairs into the environstr string
+    // in the form of: "ENV_VARIABLE=ENV_VALUE"
+    // Note that we quote the variable value due to the possibility of
+    // embedded spaces
+    DomUtil::PairList envvars =
+        DomUtil::readPairListEntry(*projectDom(), "/kdevcustomproject/make/envvars", "envvar", "name", "value");
+
+    QString environstr;
+    DomUtil::PairList::ConstIterator it;
+    for (it = envvars.begin(); it != envvars.end(); ++it) {
+        environstr += (*it).first;
+        environstr += "=";
+#if (KDE_VERSION > 305)
+        environstr += KProcess::quote((*it).second);
+#else
+        environstr += KShellProcess::quote((*it).second);
+#endif
+        environstr += " ";
+    }
+    return environstr;
+}
+
+
 void CustomProjectPart::startMakeCommand(const QString &dir, const QString &target)
 {
@@ -374,4 +399,5 @@ void CustomProjectPart::startMakeCommand
     dircmd += " && ";
 
+    cmdline.prepend(makeEnvironment());
     makeFrontend()->queueCommand(dir, dircmd + cmdline);
 }

--- kdevelop/parts/customproject/customprojectpart.h  #1.13:1.14
@@ -70,4 +70,5 @@ private:
     void populateProject();
     void startMakeCommand(const QString &dir, const QString &target);
+    QString makeEnvironment();
 
     QString m_projectDirectory;