dc7d30b0ed
variable was set, it was prefixed to ''all'' values in the wrapper compiler data text files. For example, if OPAL_DESTDIR was set to /tmp/bogus and a wrapper compiler data file contained the line: preprocessor_flags=-pthread The value would be exanded to: /tmp/bogus/-pthread Which is clearly wrong. After some back-and-forth with Ralph and Brian, Brian submitted this patch that fixes the problem. Now we handle three cases properly (assume that configure was invoked with --prefix=/opt/openmpi and no other directory specifications, and $OPAL_DESTDIR is set to /tmp/buildroot): 1. Individual directories, such as libdir. These need to be prepended with DESTDIR. I.e., return /tmp/buildroot/opt/openmpi/lib. 2. Compiler flags that have ${FIELD} values embedded in them. For example, consider if a wrapper compiler data file contains the line: preprocessor_flags=-DMYFLAG="${prefix}/share/randomthingy/" The value we should return is: -DMYFLAG="/tmp/buildroot/opt/openmpi/share/randomthingy/" 3. Compiler flags that do not have any ${FIELD} values. For example, consider if a wrapper compiler data file contains the line: preprocessor_flags=-pthread The value we should return is: -pthread Note, too, that this OPAL_DESTDIR futzing only needs to occur during opal_init(). By the time opal_init() has completed, all values should be substituted in that need substituting. Hence, we take an extra parameter (is_setup) to know whether we should do this futzing or not. This commit was SVN r23402.
192 строки
8.1 KiB
C
192 строки
8.1 KiB
C
/*
|
|
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
|
|
* reserved.
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
|
* Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*
|
|
*/
|
|
|
|
#include "opal_config.h"
|
|
|
|
#include "opal/constants.h"
|
|
#include "opal/mca/mca.h"
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
#include "opal/mca/installdirs/base/base.h"
|
|
#include "opal/mca/installdirs/base/static-components.h"
|
|
|
|
int opal_installdirs_base_output;
|
|
opal_install_dirs_t opal_install_dirs;
|
|
opal_list_t opal_installdirs_components;
|
|
|
|
#define CONDITIONAL_COPY(target, origin, field) \
|
|
do { \
|
|
if (origin.field != NULL && target.field == NULL) { \
|
|
target.field = origin.field; \
|
|
} \
|
|
} while (0)
|
|
|
|
int
|
|
opal_installdirs_base_open(void)
|
|
{
|
|
int i, ret;
|
|
mca_base_component_list_item_t *cli;
|
|
|
|
OBJ_CONSTRUCT(&opal_installdirs_components, opal_list_t);
|
|
for (i = 0 ; mca_installdirs_base_static_components[i] != NULL ; ++i) {
|
|
opal_installdirs_base_component_t *component =
|
|
(opal_installdirs_base_component_t*)
|
|
mca_installdirs_base_static_components[i];
|
|
|
|
/* Save it in a global list for ompi_info */
|
|
cli = OBJ_NEW(mca_base_component_list_item_t);
|
|
cli->cli_component = mca_installdirs_base_static_components[i];
|
|
opal_list_append(&opal_installdirs_components,
|
|
&cli->super);
|
|
|
|
if (NULL != component->component.mca_open_component) {
|
|
ret = component->component.mca_open_component();
|
|
if (OPAL_SUCCESS != ret) continue;
|
|
}
|
|
|
|
/* copy over the data, if something isn't already there */
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
prefix);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
exec_prefix);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
bindir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
sbindir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
libexecdir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
datarootdir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
datadir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
sysconfdir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
sharedstatedir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
localstatedir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
libdir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
includedir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
infodir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
mandir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
pkgdatadir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
pkglibdir);
|
|
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
|
|
pkgincludedir);
|
|
}
|
|
|
|
/* expand out all the fields */
|
|
opal_install_dirs.prefix =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.prefix);
|
|
opal_install_dirs.exec_prefix =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.exec_prefix);
|
|
opal_install_dirs.bindir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.bindir);
|
|
opal_install_dirs.sbindir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.sbindir);
|
|
opal_install_dirs.libexecdir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.libexecdir);
|
|
opal_install_dirs.datarootdir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.datarootdir);
|
|
opal_install_dirs.datadir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.datadir);
|
|
opal_install_dirs.sysconfdir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.sysconfdir);
|
|
opal_install_dirs.sharedstatedir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.sharedstatedir);
|
|
opal_install_dirs.localstatedir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.localstatedir);
|
|
opal_install_dirs.libdir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.libdir);
|
|
opal_install_dirs.includedir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.includedir);
|
|
opal_install_dirs.infodir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.infodir);
|
|
opal_install_dirs.mandir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.mandir);
|
|
opal_install_dirs.pkgdatadir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.pkgdatadir);
|
|
opal_install_dirs.pkglibdir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.pkglibdir);
|
|
opal_install_dirs.pkgincludedir =
|
|
opal_install_dirs_expand_setup(opal_install_dirs.pkgincludedir);
|
|
|
|
#if 0
|
|
fprintf(stderr, "prefix: %s\n", opal_install_dirs.prefix);
|
|
fprintf(stderr, "exec_prefix: %s\n", opal_install_dirs.exec_prefix);
|
|
fprintf(stderr, "bindir: %s\n", opal_install_dirs.bindir);
|
|
fprintf(stderr, "sbindir: %s\n", opal_install_dirs.sbindir);
|
|
fprintf(stderr, "libexecdir: %s\n", opal_install_dirs.libexecdir);
|
|
fprintf(stderr, "datarootdir: %s\n", opal_install_dirs.datarootdir);
|
|
fprintf(stderr, "datadir: %s\n", opal_install_dirs.datadir);
|
|
fprintf(stderr, "sysconfdir: %s\n", opal_install_dirs.sysconfdir);
|
|
fprintf(stderr, "sharedstatedir: %s\n", opal_install_dirs.sharedstatedir);
|
|
fprintf(stderr, "localstatedir: %s\n", opal_install_dirs.localstatedir);
|
|
fprintf(stderr, "libdir: %s\n", opal_install_dirs.libdir);
|
|
fprintf(stderr, "includedir: %s\n", opal_install_dirs.includedir);
|
|
fprintf(stderr, "infodir: %s\n", opal_install_dirs.infodir);
|
|
fprintf(stderr, "mandir: %s\n", opal_install_dirs.mandir);
|
|
fprintf(stderr, "pkgdatadir: %s\n", opal_install_dirs.pkgdatadir);
|
|
fprintf(stderr, "pkglibdir: %s\n", opal_install_dirs.pkglibdir);
|
|
fprintf(stderr, "pkgincludedir: %s\n", opal_install_dirs.pkgincludedir);
|
|
#endif
|
|
|
|
for (i = 0 ; mca_installdirs_base_static_components[i] != NULL ; ++i) {
|
|
if (NULL != mca_installdirs_base_static_components[i]->mca_close_component) {
|
|
mca_installdirs_base_static_components[i]->mca_close_component();
|
|
}
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
int
|
|
opal_installdirs_base_close(void)
|
|
{
|
|
opal_list_item_t *item;
|
|
|
|
free(opal_install_dirs.prefix);
|
|
free(opal_install_dirs.exec_prefix);
|
|
free(opal_install_dirs.bindir);
|
|
free(opal_install_dirs.sbindir);
|
|
free(opal_install_dirs.libexecdir);
|
|
free(opal_install_dirs.datarootdir);
|
|
free(opal_install_dirs.datadir);
|
|
free(opal_install_dirs.sysconfdir);
|
|
free(opal_install_dirs.sharedstatedir);
|
|
free(opal_install_dirs.localstatedir);
|
|
free(opal_install_dirs.libdir);
|
|
free(opal_install_dirs.includedir);
|
|
free(opal_install_dirs.infodir);
|
|
free(opal_install_dirs.mandir);
|
|
free(opal_install_dirs.pkgdatadir);
|
|
free(opal_install_dirs.pkglibdir);
|
|
free(opal_install_dirs.pkgincludedir);
|
|
|
|
for (item = opal_list_remove_first(&opal_installdirs_components);
|
|
NULL != item;
|
|
item = opal_list_remove_first(&opal_installdirs_components)) {
|
|
OBJ_RELEASE(item);
|
|
}
|
|
OBJ_DESTRUCT(&opal_installdirs_components);
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|