Permalink
Browse files

fix library paths. The build now progresses through all the parts tha…

…t require the parrot executable and we now need to fix all the ancillary utility programs to also work
  • Loading branch information...
1 parent 291f4c3 commit 5c2c3d483763ce5b996b3d18818612c0312862f5 @Whiteknight Whiteknight committed Nov 23, 2010
Showing with 78 additions and 51 deletions.
  1. +6 −0 include/parrot/library.h
  2. +1 −0 src/embed/api.c
  3. +71 −51 src/library.c
View
@@ -80,6 +80,9 @@ STRING* Parrot_locate_runtime_file_str(PARROT_INTERP,
void parrot_init_library_paths(PARROT_INTERP)
__attribute__nonnull__(1);
+void Parrot_lib_update_paths_from_config_hash(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
PARROT_IGNORABLE_RESULT
PARROT_CANNOT_RETURN_NULL
STRING * parrot_split_path_ext(PARROT_INTERP,
@@ -112,6 +115,9 @@ STRING * parrot_split_path_ext(PARROT_INTERP,
, PARROT_ASSERT_ARG(file))
#define ASSERT_ARGS_parrot_init_library_paths __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_lib_update_paths_from_config_hash \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_parrot_split_path_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(in) \
View
@@ -310,6 +310,7 @@ Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
{
EMBED_API_CALLIN(interp_pmc, interp);
Parrot_set_config_hash_pmc(interp, confighash);
+ Parrot_lib_update_paths_from_config_hash(interp);
EMBED_API_CALLOUT(interp_pmc, interp);
}
View
@@ -160,8 +160,6 @@ parrot_init_library_paths(PARROT_INTERP)
ASSERT_ARGS(parrot_init_library_paths)
PMC *paths;
STRING *entry;
- STRING *versionlib = NULL;
- STRING *builddir = NULL;
PMC * const iglobals = interp->iglobals;
PMC * const config_hash = VTABLE_get_pmc_keyed_int(interp, iglobals,
(INTVAL)IGLOBALS_CONFIG_HASH);
@@ -172,21 +170,6 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_set_pmc_keyed_int(interp, iglobals,
IGLOBALS_LIB_PATHS, lib_paths);
- if (VTABLE_elements(interp, config_hash)) {
- STRING * const libkey = CONST_STRING(interp, "libdir");
- STRING * const verkey = CONST_STRING(interp, "versiondir");
- STRING * const builddirkey = CONST_STRING(interp, "build_dir");
- STRING * const installed = CONST_STRING(interp, "installed");
-
- versionlib = VTABLE_get_string_keyed_str(interp, config_hash, libkey);
- entry = VTABLE_get_string_keyed_str(interp, config_hash, verkey);
- versionlib = Parrot_str_concat(interp, versionlib, entry);
-
- if (!VTABLE_get_integer_keyed_str(interp, config_hash, installed))
- builddir = VTABLE_get_string_keyed_str(interp,
- config_hash, builddirkey);
- }
-
/* each is an array of strings */
/* define include paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
@@ -200,18 +183,8 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_push_string(interp, paths, entry);
}
}
- if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/"));
- VTABLE_push_string(interp, paths, entry);
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/include/"));
- VTABLE_push_string(interp, paths, entry);
- }
entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry);
- if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/include/"));
- VTABLE_push_string(interp, paths, entry);
- }
/* define library paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
@@ -225,46 +198,22 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_push_string(interp, paths, entry);
}
}
- if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/library/"));
- VTABLE_push_string(interp, paths, entry);
- }
entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry);
- if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/library/"));
- VTABLE_push_string(interp, paths, entry);
- }
/* define languages paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_LANG, paths);
- if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/languages/"));
- VTABLE_push_string(interp, paths, entry);
- }
entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry);
- if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/languages/"));
- VTABLE_push_string(interp, paths, entry);
- }
/* define dynext paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_DYNEXT, paths);
- if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/dynext/"));
- VTABLE_push_string(interp, paths, entry);
- }
entry = CONST_STRING(interp, "dynext/");
VTABLE_push_string(interp, paths, entry);
- if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/dynext/"));
- VTABLE_push_string(interp, paths, entry);
- }
/* shared exts */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
@@ -284,6 +233,77 @@ parrot_init_library_paths(PARROT_INTERP)
#endif
}
+PARROT_EXPORT
+void
+Parrot_lib_update_paths_from_config_hash(PARROT_INTERP)
+{
+ ASSERT_ARGS(Parrot_lib_update_paths_from_config_hash)
+ STRING * versionlib = NULL;
+ STRING * entry = NULL;
+ STRING * builddir = NULL;
+ PMC * const lib_paths = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_LIB_PATHS);
+ PMC * const config_hash = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_CONFIG_HASH);
+ PMC * paths;
+
+ if (VTABLE_elements(interp, config_hash)) {
+ STRING * const libkey = CONST_STRING(interp, "libdir");
+ STRING * const verkey = CONST_STRING(interp, "versiondir");
+ STRING * const builddirkey = CONST_STRING(interp, "build_dir");
+ STRING * const installed = CONST_STRING(interp, "installed");
+
+ versionlib = VTABLE_get_string_keyed_str(interp, config_hash, libkey);
+ entry = VTABLE_get_string_keyed_str(interp, config_hash, verkey);
+ versionlib = Parrot_str_concat(interp, versionlib, entry);
+
+ if (!VTABLE_get_integer_keyed_str(interp, config_hash, installed))
+ builddir = VTABLE_get_string_keyed_str(interp,
+ config_hash, builddirkey);
+ }
+
+ paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, PARROT_LIB_PATH_INCLUDE);
+ if (!STRING_IS_NULL(builddir)) {
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/"));
+ VTABLE_push_string(interp, paths, entry);
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/include/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+ if (!STRING_IS_NULL(versionlib)) {
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/include/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+
+ paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, PARROT_LIB_PATH_LIBRARY);
+ if (!STRING_IS_NULL(builddir)) {
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/library/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+ if (!STRING_IS_NULL(versionlib)) {
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/library/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+
+ paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, PARROT_LIB_PATH_LANG);
+ if (!STRING_IS_NULL(builddir)) {
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/languages/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+ if (!STRING_IS_NULL(versionlib)) {
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/languages/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+
+ paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, PARROT_LIB_PATH_DYNEXT);
+ if (!STRING_IS_NULL(builddir)) {
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/dynext/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+ if (!STRING_IS_NULL(versionlib)) {
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/dynext/"));
+ VTABLE_push_string(interp, paths, entry);
+ }
+}
+
+
/*
=item C<static PMC* get_search_paths(PARROT_INTERP, enum_lib_paths which)>

0 comments on commit 5c2c3d4

Please sign in to comment.