add rpath for posix lib

This commit is contained in:
jussi 2019-10-01 16:13:58 +03:00
parent 7dc955e7ac
commit 2e113fcfaf
4 changed files with 16 additions and 15 deletions

View File

@ -3,31 +3,23 @@
#include <tc_module.h>
// Local function for returning the top level paths to look for eg "/usr/lib/tuxclocker/modules/"
static char **module_search_paths(uint8_t *count) {
return NULL;
}
tc_module_t *tc_module_find(enum tc_module_category category, const char *name) {
// How do we find out where the library path is?
// Not like this, this is bad
char abs_path[128];
char abs_env_path[128];
const char *env_module_path = getenv(TC_MODULE_PATH_ENV);
// The library is configured with runpath pointing to module root on posix
char mod_abs_path[128];
// Find the folder where the module should reside
switch (category) {
case TC_CATEGORY_ASSIGNABLE:
snprintf(abs_env_path, 128, "%s/%s/%s", env_module_path, "assignable", name);
snprintf(mod_abs_path, 128, "%s/%s", "assignable", name);
break;
case TC_CATEGORY_INTERFACE:
snprintf(abs_env_path, 128, "%s/%s/%s", env_module_path, "interface", name);
snprintf(mod_abs_path, 128, "%s/%s", "interface", name);
break;
default:
return NULL;
}
void *handle = tc_dlopen(abs_env_path);
void *handle = tc_dlopen(mod_abs_path);
if (handle == NULL) {
return NULL;
}

View File

@ -1,4 +1,5 @@
executable('tuxclocker',
posix_bin = executable('tuxclocker',
'tuxclocker.c',
include_directories : incdir,
link_with : libtuxclocker)

View File

@ -4,12 +4,18 @@ libtuxclocker_posix_sources = ['lib/posix/module.c']
libtuxclocker_posix_libs = [cc.find_library('dl')]
# Posix library uses runpath for specifying module directory root
posix_rpath = get_option('libdir' ) + '/tuxclocker/modules'
libtuxclocker = shared_library('libtuxclocker',
['lib/tc_assignable.c',
'lib/tc_module.c',
libtuxclocker_posix_sources],
include_directories : incdir,
dependencies : libtuxclocker_posix_libs)
dependencies : libtuxclocker_posix_libs,
install_rpath : posix_rpath,
link_args : '-Wl,--enable-new-dtags')
subdir('modules')
subdir('main')

View File

@ -2,6 +2,7 @@
//#include <nvml.h>
#include <X11/Xlib.h>
#include <string.h>
#include <stdio.h>
#include <tc_assignable.h>
#include <tc_common.h>
@ -98,6 +99,7 @@ static int8_t generate_assignable_tree() {
// Got the name, append the item to the root item
tc_assignable_node_t *gpu_name_node = tc_assignable_node_new();
gpu_name_node->name = strdup(gpu_name);
printf("%s\n", gpu_name_node->name);
// Append to the root node
if (tc_assignable_node_add_child(root_node, gpu_name_node) != TC_SUCCESS) {