Skip to content

Commit

Permalink
fix library paths. The build now progresses through all the parts tha…
Browse files Browse the repository at this point in the history
…t require the parrot executable and we now need to fix all the ancillary utility programs to also work
  • Loading branch information
Whiteknight committed Nov 23, 2010
1 parent 291f4c3 commit 5c2c3d4
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 51 deletions.
6 changes: 6 additions & 0 deletions include/parrot/library.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ STRING* Parrot_locate_runtime_file_str(PARROT_INTERP,
void parrot_init_library_paths(PARROT_INTERP) void parrot_init_library_paths(PARROT_INTERP)
__attribute__nonnull__(1); __attribute__nonnull__(1);


void Parrot_lib_update_paths_from_config_hash(PARROT_INTERP)
__attribute__nonnull__(1);

PARROT_IGNORABLE_RESULT PARROT_IGNORABLE_RESULT
PARROT_CANNOT_RETURN_NULL PARROT_CANNOT_RETURN_NULL
STRING * parrot_split_path_ext(PARROT_INTERP, STRING * parrot_split_path_ext(PARROT_INTERP,
Expand Down Expand Up @@ -112,6 +115,9 @@ STRING * parrot_split_path_ext(PARROT_INTERP,
, PARROT_ASSERT_ARG(file)) , PARROT_ASSERT_ARG(file))
#define ASSERT_ARGS_parrot_init_library_paths __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ #define ASSERT_ARGS_parrot_init_library_paths __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp)) 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 = (\ #define ASSERT_ARGS_parrot_split_path_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \ PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(in) \ , PARROT_ASSERT_ARG(in) \
Expand Down
1 change: 1 addition & 0 deletions src/embed/api.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
{ {
EMBED_API_CALLIN(interp_pmc, interp); EMBED_API_CALLIN(interp_pmc, interp);
Parrot_set_config_hash_pmc(interp, confighash); Parrot_set_config_hash_pmc(interp, confighash);
Parrot_lib_update_paths_from_config_hash(interp);
EMBED_API_CALLOUT(interp_pmc, interp); EMBED_API_CALLOUT(interp_pmc, interp);
} }


Expand Down
122 changes: 71 additions & 51 deletions src/library.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ parrot_init_library_paths(PARROT_INTERP)
ASSERT_ARGS(parrot_init_library_paths) ASSERT_ARGS(parrot_init_library_paths)
PMC *paths; PMC *paths;
STRING *entry; STRING *entry;
STRING *versionlib = NULL;
STRING *builddir = NULL;
PMC * const iglobals = interp->iglobals; PMC * const iglobals = interp->iglobals;
PMC * const config_hash = VTABLE_get_pmc_keyed_int(interp, iglobals, PMC * const config_hash = VTABLE_get_pmc_keyed_int(interp, iglobals,
(INTVAL)IGLOBALS_CONFIG_HASH); (INTVAL)IGLOBALS_CONFIG_HASH);
Expand All @@ -172,21 +170,6 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_set_pmc_keyed_int(interp, iglobals, VTABLE_set_pmc_keyed_int(interp, iglobals,
IGLOBALS_LIB_PATHS, lib_paths); 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 */ /* each is an array of strings */
/* define include paths */ /* define include paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
Expand All @@ -200,18 +183,8 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_push_string(interp, paths, entry); 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, "./"); entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry); 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 */ /* define library paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
Expand All @@ -225,46 +198,22 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_push_string(interp, paths, entry); 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, "./"); entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry); 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 */ /* define languages paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
VTABLE_set_pmc_keyed_int(interp, lib_paths, VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_LANG, 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, "./"); entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry); 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 */ /* define dynext paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
VTABLE_set_pmc_keyed_int(interp, lib_paths, VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_DYNEXT, 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/"); entry = CONST_STRING(interp, "dynext/");
VTABLE_push_string(interp, paths, entry); 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 */ /* shared exts */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
Expand All @@ -284,6 +233,77 @@ parrot_init_library_paths(PARROT_INTERP)
#endif #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)> =item C<static PMC* get_search_paths(PARROT_INTERP, enum_lib_paths which)>
Expand Down

0 comments on commit 5c2c3d4

Please sign in to comment.