Changeset 394d507 in git


Ignore:
Timestamp:
Oct 31, 2013, 3:33:58 PM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
763c4ddb0c6304b684b9b52b91d2713df4bbb4ee
Parents:
b71c90b0435ff0a26e3081e93b19ece9c2262807
Message:
chg: use LIBEXEC_DIR/PREFIX for resources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/mod_raw.cc

    rb71c90 r394d507  
    1717#include <sys/stat.h>
    1818#include <errno.h>
     19#include <unistd.h>
    1920
    2021
     
    6162  void* handle = NULL;
    6263  char* binary_name_so=NULL;
    63 
    64   // try %b/MOD first
    65   {
    66     const char* bin_dir = feGetResource('b');
    67     const int binary_name_so_length = 6 + strlen(DL_TAIL)
    68                + strlen(binary_name)
    69                +strlen(DIR_SEPP)*2
    70                +strlen(bin_dir);
     64  BOOLEAN found=FALSE;
     65
     66  // try P_PROCS_DIR (%P)
     67  char* proc_path = feGetResource('P');
     68  if (proc_path != NULL)
     69  {
     70    char *p;
     71    char *q;
     72    p=proc_path;
     73    int binary_name_so_length = 3 + strlen(DL_TAIL) + strlen(binary_name) + strlen(DIR_SEPP) + strlen(proc_path);
    7174    binary_name_so = (char *)omAlloc0( binary_name_so_length * sizeof(char) );
    72     snprintf(binary_name_so, binary_name_so_length, "%s%s%s%s%s%s", bin_dir, DIR_SEPP,"MOD",DIR_SEPP,binary_name, DL_TAIL);
    73     handle = dynl_open(binary_name_so);
    74 
    75   }
    76 
    77   // try P_PROCS_DIR (%P)
    78   if (handle == NULL)
    79   {
    80     const char* proc_dir = feGetResource('P');
    81     if (proc_dir != NULL)
     75    while((p!=NULL)&&(*p!='\0'))
    8276    {
    83       if (binary_name_so!=NULL) omFree(binary_name_so);
    84       const int binary_name_so_length = 3 + strlen(DL_TAIL) + strlen(binary_name) + strlen(DIR_SEPP) + strlen(proc_dir);
    85       binary_name_so = (char *)omAlloc0( binary_name_so_length * sizeof(char) );
    86       snprintf(binary_name_so, binary_name_so_length, "%s%s%s%s", proc_dir, DIR_SEPP, binary_name, DL_TAIL);
    87       handle = dynl_open(binary_name_so);
     77      q=strchr(p,fePathSep);
     78      if (q!=NULL) *q='\0';
     79      strcpy(binary_name_so,p);
     80      if (q!=NULL) *q=fePathSep;
     81      strcat(binary_name_so,DIR_SEPP);
     82      strcat(binary_name_so,binary_name);
     83      strcat(binary_name_so,DL_TAIL);
     84      if(!access(binary_name_so, R_OK)) { found=TRUE; break; }
     85      if (q!=NULL) p=q+1; else p=NULL;
    8886    }
     87    if (found) handle = dynl_open(binary_name_so);
    8988  }
    9089
    9190  if (handle == NULL && ! warn_handle)
    9291  {
    93       Warn("Could not find dynamic library: %s%s (tried %s)",
    94               binary_name, DL_TAIL,binary_name_so);
    95       Warn("Error message from system: %s", dynl_error());
    96       if (msg != NULL) Warn("%s", msg);
    97       Warn("See the INSTALL section in the Singular manual for details.");
    98       warn_handle = TRUE;
     92    Warn("Could not find dynamic library: %s%s (path %s)",
     93            binary_name, DL_TAIL,proc_path);
     94    if (found) Warn("Error message from system: %s", dynl_error());
     95    if (msg != NULL) Warn("%s", msg);
     96    Warn("See the INSTALL section in the Singular manual for details.");
     97    warn_handle = TRUE;
    9998  }
    10099  omfree((ADDRESS)binary_name_so );
  • resources/feResource.cc

    rb71c90 r394d507  
    4242// #define RESOURCE_DEBUG
    4343
    44 #define SINGULAR_DEFAULT_DIR "/usr/local/Singular/"
     44#define SINGULAR_DEFAULT_DIR PREFIX
    4545
    4646/*****************************************************************
     
    6363   "%r/share/singular/LIB;"
    6464   "%b/../share/singular/LIB;"
     65   // gftables:
    6566   "%D/factory;"
    6667   "%r/share/factory;"
    67    "%b/../share/factory;"
    68    "%r/libexec/singular/MOD;"
    69    "%b/../libexec/singular/MOD;"
    7068   "%b/LIB;"
    71    "%r/LIB;"
    72    "%d/LIB;"
     69   "%b/../factory;"
     70   // path for dynamic modules, should match ProcDir:
    7371   "%b/MOD;"
    74    "%r/MOD;"
    75    "%d/MOD;"
    76    "%b;"
    77    "%b/../factory;"
    78    "%b/../../factory",
    79    ""},
     72   LIBEXEC_DIR "/singular/MOD;"
     73   "%b",
     74   (char *)""},
    8075  {"Singular",  'S',    feResBinary,"SINGULAR_EXECUTABLE",  "%d/Singular",          (char *)""},
    8176  {"BinDir",    'b',    feResDir,   "SINGULAR_BIN_DIR",     "",                  (char *)""},
    82   // should be changed to %b/../libexec/singular/pProcs/:
    83   {"ProcDir",   'P',    feResDir,   "SINGULAR_PROCS_DIR",   "%r/libexec/singular/MOD/",                  (char *)""},
     77  // should be changed to %b/../lib/singular/pProcs/:
     78  {"ProcDir",   'P',    feResPath,  "SINGULAR_PROCS_DIR",
     79     "%b/MOD;"
     80     LIBEXEC_DIR "/singular/MOD;"
     81     "%r/libexec/singular/MOD",                  (char *)""},
    8482  {"RootDir",   'r',    feResDir,   "SINGULAR_ROOT_DIR",    "%b/..",                (char *)""},
    8583  {"DataDir",   'D',    feResDir,   "SINGULAR_DATA_DIR",    "%b/../share/",          (char *)""},
     
    188186  // don't complain about stuff when initializing SingularPath
    189187  feResource('s',0);
     188  feResource('P');
    190189
    191190#if defined(HAVE_SETENV) || defined(HAVE_PUTENV)
Note: See TracChangeset for help on using the changeset viewer.