diff options
author | dos-reis <gdr@axiomatics.org> | 2010-11-30 00:35:51 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-11-30 00:35:51 +0000 |
commit | cadd6f77df5ad2f93d1c494525db8a192bed87b5 (patch) | |
tree | 1662ed293232382d988bac5e9c2fea089ea80b07 /src | |
parent | eadaa332441dbb0bbc710e4803cd73970859cc1f (diff) | |
download | open-axiom-cadd6f77df5ad2f93d1c494525db8a192bed87b5.tar.gz |
* etc/Makefile.in: Use the driver.
* driver/utils.c (get_suffix): New.
(option_value): Likewise.
(preprocess_arguments): Handle --translate and --build-databases.
* driver/main.c (upgrade_environment): Change argument type to
Command. Upgrade LD_LIBRARY_PATH too.
* boot/translator.boot (loadSystemRuntimeCore): Don't prefix the
shared library file name with the system path.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 11 | ||||
-rw-r--r-- | src/boot/translator.boot | 3 | ||||
-rw-r--r-- | src/driver/main.c | 11 | ||||
-rw-r--r-- | src/driver/utils.c | 26 | ||||
-rw-r--r-- | src/driver/utils.h | 3 | ||||
-rw-r--r-- | src/etc/Makefile.in | 5 |
6 files changed, 51 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index db11d90f..b106343c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-11-29 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * etc/Makefile.in: Use the driver. + * driver/utils.c (get_suffix): New. + (option_value): Likewise. + (preprocess_arguments): Handle --translate and --build-databases. + * driver/main.c (upgrade_environment): Change argument type to + Command. Upgrade LD_LIBRARY_PATH too. + * boot/translator.boot (loadSystemRuntimeCore): Don't prefix the + shared library file name with the system path. + 2010-11-28 Gabriel Dos Reis <gdr@cs.tamu.edu> * clef/: Add using directive at toplevel. diff --git a/src/boot/translator.boot b/src/boot/translator.boot index 191d958b..046b1f43 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -783,5 +783,4 @@ loadNativeModule m == loadSystemRuntimeCore() == %hasFeature KEYWORD::ECL or %hasFeature KEYWORD::GCL => nil - loadNativeModule strconc(systemLibraryDirectory(), - '"libopen-axiom-core",$NativeModuleExt) + loadNativeModule strconc('"libopen-axiom-core",$NativeModuleExt) diff --git a/src/driver/main.c b/src/driver/main.c index 3dd06ebe..1436d42c 100644 --- a/src/driver/main.c +++ b/src/driver/main.c @@ -79,13 +79,16 @@ namespace OpenAxiom { } static void - upgrade_environment(const char* sysdir) { + upgrade_environment(const Command* command) { + const char* sysdir = command->root_dir; augment_variable("TEXINPUTS", oa_concatenate_string(sysdir, OPENAXIOM_TEXINPUTS_PATH)); augment_variable("BIBINPUTS", oa_concatenate_string(sysdir, OPENAXIOM_BIBINPUTS_PATH)); - augment_variable("LD_LIBRARY_PATH", - oa_concatenate_string(sysdir, "/lib")); + const char* ldd_path = option_value(command, "--syslib"); + if (ldd_path == 0) + ldd_path = oa_concatenate_string(sysdir, "/lib"); + augment_variable("LD_LIBRARY_PATH", ldd_path); publish_systemdir(sysdir); } @@ -115,7 +118,7 @@ main(int argc, char* argv[]) using namespace OpenAxiom; Command command; Driver driver = preprocess_arguments(&command, argc, argv); - upgrade_environment(command.root_dir); + upgrade_environment(&command); switch (driver) { case null_driver: diff --git a/src/driver/utils.c b/src/driver/utils.c index 42b0183d..89e1ad4c 100644 --- a/src/driver/utils.c +++ b/src/driver/utils.c @@ -86,6 +86,14 @@ namespace OpenAxiom { exec_path() { } + static const char* + get_suffix(const char* first, const char* last, const char* seq) { + for (; first < last; ++first, ++seq) + if (*first != *seq) + return 0; + return seq; + } + // -- Return non-null if `lhs' is a prefix of `rhs'. When non-null // -- the pointer points to the '=' character that starts of the // -- value supplied to the argument. @@ -97,6 +105,21 @@ namespace OpenAxiom { return rhs + N - 1; } + const char* + option_value(const Command* command, const char* opt) { + const int n = strlen(opt); + for (int i = 1; i < command->core.argc; ++i) { + const char* arg = command->core.argv[i]; + if (strlen(arg) < n) + continue; + if(const char* val = get_suffix(opt, opt + n, arg)) { + if (*val++ == '=') + return val; + break; + } + } + return 0; + } /* Return a path to the running system, either as specified on command line through --system=, or as specified at configuration time. */ @@ -311,7 +334,8 @@ preprocess_arguments(Command* command, int argc, char** argv) if (strcmp(argv[i], "--script") == 0) driver = script_driver; else if(strcmp(argv[i], "--compile") == 0 - or strcmp(argv[i], "--translate") == 0) + or strcmp(argv[i], "--translate") == 0 + or strcmp(argv[i], "--build-databases") == 0) driver = compiler_driver; else if (strcmp(argv[i], "--make") == 0) driver = linker_driver; diff --git a/src/driver/utils.h b/src/driver/utils.h index 10f47f79..6c55f1c0 100644 --- a/src/driver/utils.h +++ b/src/driver/utils.h @@ -93,6 +93,9 @@ namespace OpenAxiom { const char* get_systemdir(int argc, char*[]); const char* make_path_for(const char*, Driver); + // Return a pointer the string value associated with an option. + const char* option_value(const Command*, const char*); + int execute_core(const Command*, Driver); void build_rts_options(Command*, Driver); diff --git a/src/etc/Makefile.in b/src/etc/Makefile.in index 6052ffb7..1d2c05a5 100644 --- a/src/etc/Makefile.in +++ b/src/etc/Makefile.in @@ -29,8 +29,11 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +DRIVER = ../driver/open-axiom$(EXEEX) -INTERPSYS = ../interp/interpsys$(EXEEXT) -- --system="$(AXIOM)" \ +INTERPSYS = \ + $(DRIVER) --execpath=../interp/interpsys$(EXEEXT) \ + --system="$(AXIOM)" \ --sysalg="$(axiom_src_datadir)/algebra/" openaxiom_databases = \ |