66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
--- src/my_glade.c.orig 2003-11-05 20:06:51.000000000 +0100
|
|
+++ src/my_glade.c 2003-11-06 07:42:54.000000000 +0100
|
|
@@ -70,6 +70,51 @@ static void *my_dlsym(void *handle, char
|
|
// location of the standard ogle_gui.glade file
|
|
#define OGLE_GLADE_FILE PACKAGE_PIXMAPS_DIR "/ogle_gui." GLADE_EXT
|
|
|
|
+#ifdef __OpenBSD__
|
|
+#include <string.h>
|
|
+#include <dirent.h>
|
|
+#include <libgen.h>
|
|
+/* Quick and dirty: settle for any libglade */
|
|
+static void *findlibrary(char *template)
|
|
+{
|
|
+ char *name;
|
|
+ char *sopart;
|
|
+ size_t len;
|
|
+ DIR *d;
|
|
+ struct dirent *de;
|
|
+ void *lib;
|
|
+
|
|
+ name = dirname(template);
|
|
+ if (!name)
|
|
+ return NULL;
|
|
+ template = basename(template);
|
|
+ if (!template)
|
|
+ return NULL;
|
|
+ sopart = strstr(template, ".so.");
|
|
+ if (!sopart)
|
|
+ return NULL;
|
|
+
|
|
+ len = sopart-template+4;
|
|
+
|
|
+ d = opendir(name);
|
|
+ if (!d)
|
|
+ return NULL;
|
|
+ while ((de = readdir(d)) != NULL) {
|
|
+ if (strncmp(de->d_name, template, len) == 0) {
|
|
+ lib = dlopen(de->d_name, DL_LAZY);
|
|
+ closedir(d);
|
|
+ return lib;
|
|
+ }
|
|
+ }
|
|
+ closedir(d);
|
|
+ return NULL;
|
|
+}
|
|
+#endif
|
|
+
|
|
+#ifndef RTLD_NOW
|
|
+#define RTLD_NOW 0
|
|
+#endif
|
|
+
|
|
// to be called first
|
|
void my_glade_setup ()
|
|
{
|
|
@@ -83,6 +128,10 @@ void my_glade_setup ()
|
|
// next, try without path
|
|
glade_lib = dlopen (LIBGLADE_LIB, RTLD_NOW);
|
|
}
|
|
+#ifdef __OpenBSD__
|
|
+ if (glade_lib == NULL)
|
|
+ glade_lib = findlibrary(LIBGLADE_LIBDIR "/" LIBGLADE_LIB);
|
|
+#endif
|
|
if (glade_lib == NULL) {
|
|
fprintf(stderr, "Error during dlopen: %s\n", dlerror());
|
|
gtk_exit(1);
|