diff --git a/meson.build b/meson.build index 847059c..ad0eaa0 100644 --- a/meson.build +++ b/meson.build @@ -58,6 +58,11 @@ if with_libintercept == true cdata.set('HAVE_LIBINTERCEPT', '1') endif +with_libredirect = get_option('with-libredirect') +if with_libredirect == true + cdata.set('HAVE_LIBREDIRECT', '1') +endif + with_frontend = get_option('with-frontend') if get_option('with-new-libcxx-abi') == true diff --git a/meson_options.txt b/meson_options.txt index f4096dc..7cd9c7e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,4 +5,5 @@ option('with-frontend', type: 'boolean', description: 'Build the LSI Settings UI option('with-preload-libs', type: 'string', description: 'Colon separated list of libraries required to launch Steam games', value: '/usr/\$LIB/libxcb.so.1:/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6') option('with-libintercept', type: 'boolean', description: 'Enable libintercept library for controlling Steam linking', value: true) +option('with-libredirect', type: 'boolean', description: 'Enable libredirect library for fine-tuning Steam games', value: true) option('with-new-libcxx-abi', type: 'boolean', description: 'Enable when using the new libstdc++ ABI', value: false) diff --git a/src/meson.build b/src/meson.build index e6cbd65..81ee23f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -19,4 +19,5 @@ nica_includes = [ subdir('lsi') subdir('frontend') subdir('intercept') +subdir('redirect') subdir('shim') diff --git a/src/redirect/main.c b/src/redirect/main.c new file mode 100644 index 0000000..39aaffe --- /dev/null +++ b/src/redirect/main.c @@ -0,0 +1,38 @@ +/* + * This file is part of linux-steam-integration. + * + * Copyright © 2017 Ikey Doherty + * + * linux-steam-integration is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + */ + +#define _GNU_SOURCE + +#include +#include + +__attribute__((constructor)) static void lsi_redirect_init(void) +{ + fprintf(stderr, "Loading lsi_redirect\n"); +} + +__attribute__((destructor)) static void lsi_redirect_unload(void) +{ + fprintf(stderr, "Unloading lsi_redirect\n"); +} + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=8 tabstop=8 expandtab: + * :indentSize=8:tabSize=8:noTabs=true: + */ diff --git a/src/redirect/meson.build b/src/redirect/meson.build new file mode 100644 index 0000000..89b1f08 --- /dev/null +++ b/src/redirect/meson.build @@ -0,0 +1,15 @@ +# Only build libintercept if told to! + +if with_libredirect == true + + redirect_sources = [ + 'main.c', + ] + + main_redirect = shared_library( + 'lsi-redirect', + sources: redirect_sources, + c_args: ['-fvisibility=hidden'], + install: true, + ) +endif