From 6934d9e75fde9c880b39faa19237b041495c8531 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 30 Jun 2011 16:07:17 +0200 Subject: fix generation of auto-compiled file names on mingw systems * libguile/load.c (canonical_to_suffix, scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): * module/system/base/compile.scm (compiled-file-name): If the canonical path of a file is a DOS-style path with a drive letter, turn it into a path suffix it by removing the colon and prefixing a "/". Inspired by a patch from Jan Nieuwenhuizen. --- libguile/load.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'libguile/load.c') diff --git a/libguile/load.c b/libguile/load.c index 3b6ba2b38..91309bb1e 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -793,6 +793,22 @@ scm_try_auto_compile (SCM source) NULL, NULL); } +/* See also (system base compile):compiled-file-name. */ +static SCM +canonical_to_suffix (SCM canon) +{ + size_t len = scm_c_string_length (canon); + + if (len > 1 && scm_is_eq (scm_c_string_ref (canon, 0), SCM_MAKE_CHAR ('/'))) + return canon; + else if (len > 2 && scm_is_eq (scm_c_string_ref (canon, 1), SCM_MAKE_CHAR (':'))) + return scm_string_append (scm_list_3 (scm_from_latin1_string ("/"), + scm_c_substring (canon, 0, 1), + scm_c_substring (canon, 2, len))); + else + return canon; +} + SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, (SCM args), "Search @var{%load-path} for the file named @var{filename} and\n" @@ -857,7 +873,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, { SCM fallback = scm_string_append (scm_list_3 (*scm_loc_compile_fallback_path, - full_filename, + canonical_to_suffix (full_filename), scm_car (*scm_loc_load_compiled_extensions))); if (scm_is_true (scm_stat (fallback, SCM_BOOL_F))) { @@ -895,7 +911,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, { SCM fallback = scm_string_append (scm_list_3 (*scm_loc_compile_fallback_path, - full_filename, + canonical_to_suffix (full_filename), scm_car (*scm_loc_load_compiled_extensions))); if (scm_is_true (scm_stat (fallback, SCM_BOOL_F)) && compiled_is_fresh (full_filename, fallback)) -- cgit v1.2.3 From 9957641b603f79b070fc2be0bf511235fa764229 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 21 Jul 2011 10:36:13 +0200 Subject: add a site dir to %load-compiled-path * libguile/Makefile.am (libpath.h): Define SCM_SITE_CCACHE_DIR. Defined as site-ccache/ instead of site/ccache/ to indicate that we don't expect further subdirectories, and also to avoid confusion about whether extensions/ is a site-specific or not. * libguile/load.c (scm_init_load_path): Add SCM_SITE_CCACHE_DIR to the default load-compiled path. --- libguile/Makefile.am | 1 + libguile/load.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'libguile/load.c') diff --git a/libguile/Makefile.am b/libguile/Makefile.am index e69a1551e..1817100fd 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -647,6 +647,7 @@ libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp @echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp @echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp + @echo '#define SCM_SITE_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache"' >> libpath.tmp @echo '#define SCM_EFFECTIVE_VERSION "$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp diff --git a/libguile/load.c b/libguile/load.c index 91309bb1e..de6bf7c60 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -270,7 +270,10 @@ scm_init_load_path () else if (env) cpath = scm_parse_path (scm_from_locale_string (env), cpath); else - cpath = scm_cons (scm_from_locale_string (SCM_CCACHE_DIR), cpath); + { + cpath = scm_list_2 (scm_from_locale_string (SCM_CCACHE_DIR), + scm_from_locale_string (SCM_SITE_CCACHE_DIR)); + } #endif /* SCM_LIBRARY_DIR */ -- cgit v1.2.3