forked from enlightenment/efl
efl runtime dynamic lib loading - make errors consistent and useful
so drop trying to appease the openbsd packages and stick to "upstream so major versions" and let users fix their systems with symlinks. also report what we are looking for so they have a chance to symlink to make efl happy. at some point we should make a single simple runtime lib linker subsystem in efl so all these errors are reported in the same way, input libray names are listed in a simple consistent way etc. etc. for now we have 3 locations in efl that do this and they are roughly similar. we can unify it later.
This commit is contained in:
parent
dd1d3f0d2d
commit
879d93377b
|
@ -99,7 +99,7 @@ ecore_audio_pulse_lib_load(void)
|
||||||
{
|
{
|
||||||
if (!ecore_audio_pulse_lib->mod)
|
if (!ecore_audio_pulse_lib->mod)
|
||||||
{
|
{
|
||||||
ERR("Cannot find libpulse!");
|
ERR("Cannot find libpulse at runtime!");
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -120,19 +120,25 @@ ecore_audio_pulse_lib_load(void)
|
||||||
LOAD("libpulse-0.dll");
|
LOAD("libpulse-0.dll");
|
||||||
LOAD("libpulse.dll");
|
LOAD("libpulse.dll");
|
||||||
LOAD("pulse.dll");
|
LOAD("pulse.dll");
|
||||||
|
if (!ecore_audio_pulse_lib->mod)
|
||||||
|
ERR("Could not find libpulse-0.dll, libpulse.dll, pulse.dll");
|
||||||
# elif defined(__APPLE__) && defined(__MACH__)
|
# elif defined(__APPLE__) && defined(__MACH__)
|
||||||
LOAD("libpulse.0.dylib");
|
LOAD("libpulse.0.dylib");
|
||||||
LOAD("libpulse.0.so");
|
LOAD("libpulse.0.so");
|
||||||
LOAD("libpulse.so.0");
|
LOAD("libpulse.so.0");
|
||||||
|
if (!ecore_audio_pulse_lib->mod)
|
||||||
|
ERR("Could not find libpulse.0.dylib, libpulse.0.so, libpulse.so.0");
|
||||||
# else
|
# else
|
||||||
LOAD("libpulse.so.0");
|
LOAD("libpulse.so.0");
|
||||||
|
if (!ecore_audio_pulse_lib->mod)
|
||||||
|
ERR("Could not find libpulse.so.0");
|
||||||
# endif
|
# endif
|
||||||
# undef LOAD
|
# undef LOAD
|
||||||
if (!ecore_audio_pulse_lib->mod) return EINA_FALSE;
|
if (!ecore_audio_pulse_lib->mod) return EINA_FALSE;
|
||||||
|
|
||||||
#define SYM(x) \
|
#define SYM(x) \
|
||||||
if (!(ecore_audio_pulse_lib->x = eina_module_symbol_get(ecore_audio_pulse_lib->mod, #x))) { \
|
if (!(ecore_audio_pulse_lib->x = eina_module_symbol_get(ecore_audio_pulse_lib->mod, #x))) { \
|
||||||
ERR("libpulse - cannot find %s", #x); \
|
ERR("Cannot find symbol '%s' in'%s", #x, eina_module_file_get(ecore_audio_pulse_lib->mod)); \
|
||||||
goto err; \
|
goto err; \
|
||||||
}
|
}
|
||||||
SYM(pa_context_new);
|
SYM(pa_context_new);
|
||||||
|
@ -186,7 +192,7 @@ ecore_audio_sndfile_lib_load(void)
|
||||||
{
|
{
|
||||||
if (!ecore_audio_sndfile_lib->mod)
|
if (!ecore_audio_sndfile_lib->mod)
|
||||||
{
|
{
|
||||||
ERR("Cannot find libsndfile!");
|
ERR("Cannot find libsndfile at runtime!");
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -219,7 +225,7 @@ ecore_audio_sndfile_lib_load(void)
|
||||||
|
|
||||||
#define SYM(x) \
|
#define SYM(x) \
|
||||||
if (!(ecore_audio_sndfile_lib->x = eina_module_symbol_get(ecore_audio_sndfile_lib->mod, #x))) { \
|
if (!(ecore_audio_sndfile_lib->x = eina_module_symbol_get(ecore_audio_sndfile_lib->mod, #x))) { \
|
||||||
ERR("libsndfile - cannot find %s", #x); \
|
ERR("Cannot find symbol '%s' in'%s", #x, eina_module_file_get(ecore_audio_pulse_lib->mod)); \
|
||||||
goto err; \
|
goto err; \
|
||||||
}
|
}
|
||||||
SYM(sf_open);
|
SYM(sf_open);
|
||||||
|
|
|
@ -32,7 +32,11 @@ _c_init(void)
|
||||||
long ms = 0;
|
long ms = 0;
|
||||||
|
|
||||||
if (_c) return EINA_TRUE;
|
if (_c) return EINA_TRUE;
|
||||||
if (_c_fail) return EINA_FALSE;
|
if (_c_fail)
|
||||||
|
{
|
||||||
|
ERR("Cannot find libcurl at runtime!");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
_c = calloc(1, sizeof(Ecore_Con_Curl));
|
_c = calloc(1, sizeof(Ecore_Con_Curl));
|
||||||
if (!_c) goto error;
|
if (!_c) goto error;
|
||||||
|
|
||||||
|
@ -50,32 +54,28 @@ _c_init(void)
|
||||||
LOAD("libcurl-4.dll"); // try correct dll first
|
LOAD("libcurl-4.dll"); // try correct dll first
|
||||||
LOAD("libcurl.dll"); // try 1
|
LOAD("libcurl.dll"); // try 1
|
||||||
LOAD("curllib.dll"); // if fail try 2
|
LOAD("curllib.dll"); // if fail try 2
|
||||||
|
if (!_c->mod)
|
||||||
|
ERR("Could not find libcurl-5.dll, libcurl-4.dll, libcurl.dll, curllib.dll");
|
||||||
#elif defined(__APPLE__) && defined(__MACH__)
|
#elif defined(__APPLE__) && defined(__MACH__)
|
||||||
LOAD("libcurl.5.dylib"); // try 1
|
LOAD("libcurl.5.dylib"); // try 1
|
||||||
LOAD("libcurl.4.dylib"); // try 1
|
LOAD("libcurl.4.dylib"); // try 1
|
||||||
LOAD("libcurl.so.5"); // if fail try 2
|
LOAD("libcurl.so.5"); // if fail try 2
|
||||||
LOAD("libcurl.so.4"); // if fail try 2
|
LOAD("libcurl.so.4"); // if fail try 2
|
||||||
#elif defined(__OpenBSD__)
|
if (!_c->mod)
|
||||||
{
|
ERR("Could not find libcurl.5.dylib, libcurl.4.dylib, libcurl.so.5, libcurl.so.4");
|
||||||
char buf[64];
|
|
||||||
int min;
|
|
||||||
int maj = 25;
|
|
||||||
|
|
||||||
for (min = 0; min < 10; min++)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof (buf), "libcurl.so.%d.%d", maj, min);
|
|
||||||
LOAD(buf);
|
|
||||||
if (_c->mod) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
LOAD("libcurl.so.5"); // try only
|
LOAD("libcurl.so.5"); // try only
|
||||||
LOAD("libcurl.so.4"); // try only
|
LOAD("libcurl.so.4"); // try only
|
||||||
|
if (!_c->mod)
|
||||||
|
ERR("Could not find libcurl.so.5, libcurl.so.4");
|
||||||
#endif
|
#endif
|
||||||
if (!_c->mod) goto error;
|
if (!_c->mod) goto error;
|
||||||
|
|
||||||
#define SYM(x) if (!(_c->x = eina_module_symbol_get(_c->mod, #x))) \
|
#define SYM(x) \
|
||||||
goto error
|
if (!(_c->x = eina_module_symbol_get(_c->mod, #x))) { \
|
||||||
|
ERR("Cannot find symbol '%s' in'%s", #x, eina_module_file_get(_c->mod)); \
|
||||||
|
goto error; \
|
||||||
|
}
|
||||||
SYM(curl_global_init);
|
SYM(curl_global_init);
|
||||||
SYM(curl_global_cleanup);
|
SYM(curl_global_cleanup);
|
||||||
SYM(curl_multi_init);
|
SYM(curl_multi_init);
|
||||||
|
|
|
@ -334,12 +334,11 @@ _edje_ephysics_load(void)
|
||||||
{
|
{
|
||||||
if (!_edje_ephysics->mod)
|
if (!_edje_ephysics->mod)
|
||||||
{
|
{
|
||||||
ERR("Cannot find libpulse!");
|
ERR("Cannot find libephysics at runtime!");
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
ERR("PHYYYYYYYYYYYYYYZIKS");
|
|
||||||
_edje_ephysics = calloc(1, sizeof(Edje_Ephysics));
|
_edje_ephysics = calloc(1, sizeof(Edje_Ephysics));
|
||||||
if (!_edje_ephysics) return EINA_FALSE;
|
if (!_edje_ephysics) return EINA_FALSE;
|
||||||
# define LOAD(x) \
|
# define LOAD(x) \
|
||||||
|
@ -353,19 +352,26 @@ _edje_ephysics_load(void)
|
||||||
}
|
}
|
||||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
LOAD("libephysics-1.dll");
|
LOAD("libephysics-1.dll");
|
||||||
|
LOAD("libephysics1.dll");
|
||||||
LOAD("libephysics.dll");
|
LOAD("libephysics.dll");
|
||||||
|
if (!_edje_ephysics->mod)
|
||||||
|
ERR("Could not find libephysics-1.dll, libephysics1.dll, libephysics.dll");
|
||||||
# elif defined(__APPLE__) && defined(__MACH__)
|
# elif defined(__APPLE__) && defined(__MACH__)
|
||||||
LOAD("libephysics.1.dylib");
|
LOAD("libephysics.1.dylib");
|
||||||
LOAD("libephysics.1.so");
|
LOAD("libephysics.1.so");
|
||||||
LOAD("libephysics.so.1");
|
LOAD("libephysics.so.1");
|
||||||
|
if (!_edje_ephysics->mod)
|
||||||
|
ERR("Could not find libephysics.1.dylib, libephysics.1.so, libephysics.so.1");
|
||||||
# else
|
# else
|
||||||
LOAD("libephysics.so.1");
|
LOAD("libephysics.so.1");
|
||||||
|
if (!_edje_ephysics->mod)
|
||||||
|
ERR("Could not find libephysics.so.1");
|
||||||
# endif
|
# endif
|
||||||
# undef LOAD
|
# undef LOAD
|
||||||
if (!_edje_ephysics->mod) return EINA_FALSE;
|
if (!_edje_ephysics->mod) return EINA_FALSE;
|
||||||
# define SYM(x) \
|
# define SYM(x) \
|
||||||
if (!(_edje_ephysics->x = eina_module_symbol_get(_edje_ephysics->mod, #x))) { \
|
if (!(_edje_ephysics->x = eina_module_symbol_get(_edje_ephysics->mod, #x))) { \
|
||||||
ERR("libpulse - cannot find %s", #x); \
|
ERR("Cannot find symbol '%s' in'%s", #x, eina_module_file_get(_edje_ephysics->mod)); \
|
||||||
goto err; \
|
goto err; \
|
||||||
}
|
}
|
||||||
SYM(ephysics_init);
|
SYM(ephysics_init);
|
||||||
|
|
Loading…
Reference in New Issue