Skip to content

Commit

Permalink
Allow customized runtime paths in cmake.
Browse files Browse the repository at this point in the history
This patch allow runtime paths to be different from
install paths. This allows relative runtime paths
for AppImage builds.
  • Loading branch information
giox069 committed Sep 7, 2017
1 parent 8f13dff commit 185abca
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 22 deletions.
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,33 @@ endif()

if(NOT REMMINA_DATADIR)
set(REMMINA_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
if(NOT REMMINA_RUNTIME_DATADIR)
set(REMMINA_RUNTIME_DATADIR "${REMMINA_DATADIR}")
endif()
endif()
if(NOT REMMINA_LOCALEDIR)
set(REMMINA_LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
if(NOT REMMINA_RUNTIME_LOCALEDIR)
set(REMMINA_RUNTIME_LOCALEDIR "${REMMINA_LOCALEDIR}")
endif()
endif()
if(NOT REMMINA_PLUGINDIR)
set(REMMINA_PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/remmina/plugins")
if(NOT REMMINA_RUNTIME_PLUGINDIR)
set(REMMINA_RUNTIME_PLUGINDIR "${REMMINA_PLUGINDIR}")
endif()
endif()
if(NOT REMMINA_UIDIR)
set(REMMINA_UIDIR "${REMMINA_DATADIR}/remmina/ui")
if(NOT REMMINA_RUNTIME_UIDIR)
set(REMMINA_RUNTIME_UIDIR "${REMMINA_UIDIR}")
endif()
endif()
if(NOT REMMINA_EXTERNAL_TOOLS_DIR)
set(REMMINA_EXTERNAL_TOOLS_DIR "${REMMINA_DATADIR}/remmina/external_tools")
if(NOT REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR)
set(REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR "${REMMINA_EXTERNAL_TOOLS_DIR}")
endif()
endif()

# Snap package generation support
Expand Down
9 changes: 5 additions & 4 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

#define GETTEXT_PACKAGE remmina

#define REMMINA_DATADIR "${REMMINA_DATADIR}"
#define REMMINA_LOCALEDIR "${REMMINA_LOCALEDIR}"
#define REMMINA_PLUGINDIR "${REMMINA_PLUGINDIR}"
#define REMMINA_UIDIR "${REMMINA_UIDIR}"
#define REMMINA_RUNTIME_DATADIR "${REMMINA_RUNTIME_DATADIR}"
#define REMMINA_RUNTIME_LOCALEDIR "${REMMINA_RUNTIME_LOCALEDIR}"
#define REMMINA_RUNTIME_PLUGINDIR "${REMMINA_RUNTIME_PLUGINDIR}"
#define REMMINA_RUNTIME_UIDIR "${REMMINA_RUNTIME_UIDIR}"
#define REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR "${REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR}"

#endif
2 changes: 1 addition & 1 deletion remmina-plugins/nx/nx_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ remmina_plugin_entry(RemminaPluginService *service)

remmina_plugin_nx_service = service;

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if ((dpy = XkbOpenDisplay(NULL, NULL, NULL, NULL, NULL, NULL)) != NULL)
Expand Down
2 changes: 1 addition & 1 deletion remmina-plugins/rdp/rdp_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService* service)
return FALSE;
}

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if (! service->register_plugin((RemminaPlugin*) &remmina_rdp))
Expand Down
2 changes: 1 addition & 1 deletion remmina-plugins/spice/spice_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ remmina_plugin_entry(RemminaPluginService *service)
TRACE_CALL(__func__);
remmina_plugin_service = service;

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if (!service->register_plugin((RemminaPlugin *) &remmina_plugin_spice))
Expand Down
2 changes: 1 addition & 1 deletion remmina-plugins/telepathy/telepathy_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ remmina_plugin_entry(RemminaPluginService *service)
TRACE_CALL("remmina_plugin_entry");
remmina_plugin_telepathy_service = service;

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if (!service->register_plugin((RemminaPlugin *) &remmina_plugin_telepathy))
Expand Down
2 changes: 1 addition & 1 deletion remmina-plugins/tool_hello_world/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService *service)
TRACE_CALL("remmina_plugin_entry");
remmina_plugin_service = service;

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if (!service->register_plugin((RemminaPlugin *) &remmina_plugin))
Expand Down
2 changes: 1 addition & 1 deletion remmina-plugins/vnc/vnc_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ remmina_plugin_entry(RemminaPluginService *service)
TRACE_CALL("remmina_plugin_entry");
remmina_plugin_service = service;

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if (!service->register_plugin((RemminaPlugin *) &remmina_plugin_vnc))
Expand Down
2 changes: 1 addition & 1 deletion remmina-plugins/xdmcp/xdmcp_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ remmina_plugin_entry(RemminaPluginService *service)
TRACE_CALL("remmina_plugin_entry");
remmina_plugin_service = service;

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

if (!service->register_plugin((RemminaPlugin *) &remmina_plugin_xdmcp))
Expand Down
3 changes: 0 additions & 3 deletions remmina/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ if(WITH_TRANSLATIONS)
add_subdirectory(po)
endif()

set(REMMINA_EXTERNAL_TOOLS_DIR "${CMAKE_INSTALL_FULL_DATADIR}/remmina/external_tools")
add_definitions( -DREMMINA_EXTERNAL_TOOLS_DIR="${REMMINA_EXTERNAL_TOOLS_DIR}" )

add_subdirectory(icons)
add_subdirectory(desktop)
add_subdirectory(external_tools)
Expand Down
4 changes: 2 additions & 2 deletions remmina/src/remmina.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static void remmina_on_startup(GApplication *app)
gtk_window_set_default_icon_name("remmina");

gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
REMMINA_DATADIR G_DIR_SEPARATOR_S "icons");
REMMINA_RUNTIME_DATADIR G_DIR_SEPARATOR_S "icons");
g_application_hold(app);
}

Expand All @@ -239,7 +239,7 @@ int main(int argc, char* argv[])

remmina_masterthread_exec_save_main_thread_id();

bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);

Expand Down
4 changes: 2 additions & 2 deletions remmina/src/remmina_external_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ gboolean remmina_external_tools_from_filename(RemminaMain *remminamain, gchar* r
GDir* dir;
const gchar* name;

strcpy(dirname, REMMINA_EXTERNAL_TOOLS_DIR);
strcpy(dirname, REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR);
dir = g_dir_open(dirname, 0, NULL);

if (dir == NULL)
Expand Down Expand Up @@ -104,7 +104,7 @@ static gboolean remmina_external_tools_launcher(const gchar* filename, const gch
size_t envstrlen;
gchar launcher[MAX_PATH_LEN];

g_snprintf(launcher, MAX_PATH_LEN, "%s/launcher.sh", REMMINA_EXTERNAL_TOOLS_DIR);
g_snprintf(launcher, MAX_PATH_LEN, "%s/launcher.sh", REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR);

remminafile = remmina_file_load(filename);
GHashTableIter iter;
Expand Down
2 changes: 1 addition & 1 deletion remmina/src/remmina_icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void remmina_icon_init(void)
{
#ifdef HAVE_LIBAPPINDICATOR
remmina_icon.icon = app_indicator_new ("remmina-icon", remmina_panel, APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
app_indicator_set_icon_theme_path (remmina_icon.icon, REMMINA_DATADIR G_DIR_SEPARATOR_S "icons");
app_indicator_set_icon_theme_path (remmina_icon.icon, REMMINA_RUNTIME_DATADIR G_DIR_SEPARATOR_S "icons");

app_indicator_set_status (remmina_icon.icon, APP_INDICATOR_STATUS_ACTIVE);
app_indicator_set_title (remmina_icon.icon, "Remmina");
Expand Down
4 changes: 2 additions & 2 deletions remmina/src/remmina_plugin_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void remmina_plugin_manager_init(void)
return;
}

dir = g_dir_open(REMMINA_PLUGINDIR, 0, NULL);
dir = g_dir_open(REMMINA_RUNTIME_PLUGINDIR, 0, NULL);
if (dir == NULL)
return;
while ((name = g_dir_read_name(dir)) != NULL)
Expand All @@ -242,7 +242,7 @@ void remmina_plugin_manager_init(void)
ptr++;
if (g_strcmp0(ptr, G_MODULE_SUFFIX) != 0)
continue;
fullpath = g_strdup_printf(REMMINA_PLUGINDIR "/%s", name);
fullpath = g_strdup_printf(REMMINA_RUNTIME_PLUGINDIR "/%s", name);
remmina_plugin_manager_load_plugin(fullpath);
g_free(fullpath);
}
Expand Down
2 changes: 1 addition & 1 deletion remmina/src/remmina_public.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ gboolean remmina_public_get_modifier_for_keycode(GdkKeymap *keymap, guint16 keyc
GtkBuilder* remmina_public_gtk_builder_new_from_file(gchar *filename)
{
TRACE_CALL("remmina_public_gtk_builder_new_from_file")
gchar *ui_path = g_strconcat(REMMINA_UIDIR, G_DIR_SEPARATOR_S, filename, NULL);
gchar *ui_path = g_strconcat(REMMINA_RUNTIME_UIDIR, G_DIR_SEPARATOR_S, filename, NULL);
#if GTK_CHECK_VERSION(3, 10, 0)
GtkBuilder *builder = gtk_builder_new_from_file(ui_path);
#else
Expand Down

0 comments on commit 185abca

Please sign in to comment.