GLX implementation and *nix-specific file handling implementation

I added gl-x11 which allows compatibility with X11 (Xlib-based) and GLX.
I also added various functions to handle file finding based on FHS.
Various changes to autotools to both install files correctly and to configure correctly.
This commit is contained in:
Zachary Lund
2013-12-27 20:43:28 -06:00
parent 1c91e0d0e0
commit 80b8176e29
11 changed files with 402 additions and 21 deletions

View File

@@ -414,9 +414,8 @@ struct gs_window {
void *hwnd;
#elif defined(__APPLE__)
__unsafe_unretained id view;
#elif defined(__posix__)
int bla;
/* TODO */
#elif defined(__linux__)
uint32_t id;
#endif
};

View File

@@ -16,17 +16,52 @@
******************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "util/dstr.h"
#include "obs.h"
static inline bool check_path(const char* data, const char *path, struct dstr * output)
{
dstr_copy(output, path);
dstr_cat(output, data);
blog(LOG_INFO, "Attempting path: %s\n", output->array);
return access(output->array, R_OK) == 0;
}
static inline bool check_lib_path(const char* data, const char *path, struct dstr *output)
{
bool result = false;
struct dstr tmp;
dstr_init_copy(&tmp, "lib");
dstr_cat(&tmp, data);
dstr_cat(&tmp, ".so");
result = check_path(tmp.array, path, output);
dstr_free(&tmp);
return result;
}
/*
* /usr/local/lib/obs-plugins
* /usr/lib/obs-plugins
*/
char *find_plugin(const char *plugin)
{
/* TODO */
{
struct dstr output;
dstr_init(&output);
if (check_lib_path(plugin, "/usr/local/lib/obs-plugins/", &output))
return output.array;
if (check_lib_path(plugin, "/usr/lib/obs-plugins/", &output))
return output.array;
dstr_free(&output);
return NULL;
}
@@ -36,7 +71,16 @@ char *find_plugin(const char *plugin)
*/
char *find_libobs_data_file(const char *file)
{
/* TODO */
struct dstr output;
dstr_init(&output);
if (check_path(file, "/usr/local/share/libobs/", &output))
return output.array;
if (check_path(file, "/usr/share/libobs/", &output))
return output.array;
dstr_free(&output);
return NULL;
}
@@ -45,7 +89,16 @@ char *find_libobs_data_file(const char *file)
* /usr/share/obs-plugins
*/
char *obs_find_plugin_file(const char *file)
{
/* TODO */
return NULL;
{
struct dstr output;
dstr_init(&output);
if (check_path(file, "/usr/local/share/obs-plugins/", &output))
return output.array;
if (check_path(file, "/usr/share/obs-plugins", &output))
return output.array;
dstr_free(&output);
return NULL;
}