[Pkg-electronics-commits] [gnucap] 08/43: move PLUGPATH configurability to main.cc
felix salfelder
felix-guest at moszumanska.debian.org
Wed Oct 4 03:21:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
felix-guest pushed a commit to branch master
in repository gnucap.
commit e08f5ce7e789b17b3bae58ddd6d297da88c58b22
Author: Felix Salfelder <felix at salfelder.org>
Date: Sun Mar 12 21:55:04 2017 +0000
move PLUGPATH configurability to main.cc
main sets proper environment, c_attach just acts accordingly.
---
include/l_lib.h | 4 ++++
include/patchlev.h | 2 +-
lib/c_attach.cc | 13 +++----------
lib/configure | 4 +---
main/configure | 4 +++-
main/main.cc | 12 ++++++++++++
6 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/include/l_lib.h b/include/l_lib.h
index 109f963..ce8cd9f 100644
--- a/include/l_lib.h
+++ b/include/l_lib.h
@@ -76,6 +76,10 @@ namespace OS {
return "";
}
}
+
+ inline void setenv(const std::string& s, const std::string& v, bool overwrite=true) {
+ ::setenv(s.c_str(), v.c_str(), overwrite);
+ }
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
diff --git a/include/patchlev.h b/include/patchlev.h
index 119aeaa..1476db8 100644
--- a/include/patchlev.h
+++ b/include/patchlev.h
@@ -1 +1 @@
-#define PATCHLEVEL "plugpath-3b 2017.03.12"
+#define PATCHLEVEL "plugpath-3c 2017.03.12"
diff --git a/lib/c_attach.cc b/lib/c_attach.cc
index 1e3caaf..b570ea7 100644
--- a/lib/c_attach.cc
+++ b/lib/c_attach.cc
@@ -25,26 +25,19 @@
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
-#define STRINGIZE(x) #x
-#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
-/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
-// DTAGS substitute
-const std::string plugpath("PLUGPATH=" STRINGIZE_VALUE_OF(GNUCAP_PLUGPATH)
- "\0 (reserved space) ");
-/*--------------------------------------------------------------------------*/
std::map<const std::string, void*> attach_list;
/*--------------------------------------------------------------------------*/
std::string plug_path()
{ untested();
std::string path = OS::getenv("GNUCAP_PLUGPATH");
- if(path==""){ untested();
- path = plugpath.substr(9);
+ if(path==""){ unreachable();
}else{ untested();
+ path += ':';
}
- path += ':' + OS::getenv("LD_LIBRARY_PATH") + ':';
+ path += OS::getenv("LD_LIBRARY_PATH") + ':';
return path;
}
diff --git a/lib/configure b/lib/configure
index a013351..b027a5f 100755
--- a/lib/configure
+++ b/lib/configure
@@ -53,9 +53,7 @@ LDFLAGS = -shared
.SUFFIXES:
.SUFFIXES: .o .cc
-.cc.o:; \$(CCC) \$(CXXFLAGS) \$(CONF_CPPFLAGS) \$(CPPFLAGS) \$(CCFLAGS) -c \$<
-#------------------------------------------------------------------------
-c_attach.o: CONF_CPPFLAGS=-DGNUCAP_PLUGPATH="\$(PREFIX)/lib/gnucap"
+.cc.o:; \$(CCC) \$(CXXFLAGS) \$(CPPFLAGS) \$(CCFLAGS) -c \$<
#------------------------------------------------------------------------
\$(TARGET)\$(TARGET_EXT): \$(TARGET_DEPENDS)
rm -f \$@
diff --git a/main/configure b/main/configure
index 22fc417..d98988b 100755
--- a/main/configure
+++ b/main/configure
@@ -58,8 +58,10 @@ TARGET_EXT =
LDFLAGS = -rdynamic \
-L../../lib/O
+CONF_CPPFLAGS=-DGNUCAP_PLUGPATH="\$(PREFIX)/lib/gnucap"
+
.SUFFIXES : .o .cc
-.cc.o:; \$(CCC) \$(CXXFLAGS) \$(CPPFLAGS) \$(CCFLAGS) -c \$<
+.cc.o:; \$(CCC) \$(CXXFLAGS) \$(CONF_CPPFLAGS) \$(CPPFLAGS) \$(CCFLAGS) -c \$<
#------------------------------------------------------------------------
\$(TARGET): \$(OBJS)
rm -f \$@
diff --git a/main/main.cc b/main/main.cc
index 741f4d4..82532e1 100644
--- a/main/main.cc
+++ b/main/main.cc
@@ -33,6 +33,9 @@
#include "c_comand.h"
#include "declare.h" /* plclose */
/*--------------------------------------------------------------------------*/
+#define STRINGIZE(x) #x
+#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
+/*--------------------------------------------------------------------------*/
struct JMP_BUF{
sigjmp_buf p;
} env;
@@ -52,6 +55,14 @@ static void sign_on(void)
"core-lib version: " << lib_version() << "\n";
}
/*--------------------------------------------------------------------------*/
+static void prepare_env()
+{
+ static std::string plugpath("PLUGPATH=" STRINGIZE_VALUE_OF(GNUCAP_PLUGPATH)
+ "\0 (reserved space) ");
+
+ OS::setenv("GNUCAP_PLUGPATH", plugpath.substr(9), false);
+}
+/*--------------------------------------------------------------------------*/
static void read_startup_files(void)
{
{
@@ -211,6 +222,7 @@ static void process_cmd_line(int argc, const char *argv[])
/*--------------------------------------------------------------------------*/
int main(int argc, const char *argv[])
{
+ prepare_env();
CKT_BASE::_sim = new SIM_DATA;
CKT_BASE::_probe_lists = new PROBE_LISTS;
try {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git
More information about the Pkg-electronics-commits
mailing list