Skip to content

Commit

Permalink
Make compilation and stats collection FLATPACK aware
Browse files Browse the repository at this point in the history
  • Loading branch information
giox069 committed Mar 20, 2018
1 parent 140d2fe commit fa6df20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ if(SNAP_BUILD)
add_definitions(-DSNAP_BUILD)
endif()

if(FLATPACK_BUILD)
add_definitions(-DFLATPACK_BUILD)
endif()

# Uninstall support
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
Expand Down
3 changes: 2 additions & 1 deletion flatpak/org.remmina.Remmina.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@
"config-opts": [
"-DCMAKE_BUILD_TYPE:STRING=Release",
"-DWITH_MANPAGES:BOOL=OFF",
"-DWITH_TELEPATHY:BOOL=OFF"
"-DWITH_TELEPATHY:BOOL=OFF",
"-DFLATPACK_BUILD:BOOL=ON"
],
"sources": [
{
Expand Down
8 changes: 8 additions & 0 deletions remmina/src/remmina_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ JsonNode *remmina_stats_get_version()
#else
json_builder_add_int_value(b, 0);
#endif

json_builder_set_member_name(b, "flatpack_build");
#ifdef FLATPACK_BUILD
json_builder_add_int_value(b, 1);
#else
json_builder_add_int_value(b, 0);
#endif

json_builder_end_object(b);
r = json_builder_get_root(b);
g_object_unref(b);
Expand Down

5 comments on commit fa6df20

@antenore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larchunix what do you think about this if you have some minutes?

Thanks!

@larchunix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: it is spelled flatpak not flatpack

@giox069
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Warning: I rewrote history, so if you have a local copy of this branch, you should delete it.
I had to define a specific macro during compilation to detect flatpak build. Do I have other ways to detect that remmina is a flatpak? For example: a macro already defined, or a test to execute runtime (an environment variable?).

@larchunix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first sight, there is no way to get this information at compile time.

According to https://github.com/flatpak/flatpak/wiki/Sandbox, during runtime, we can check the existence of the directory /run/user/$uid/flatpak-monitor/.

@giox069
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larchunix thank you for the info you provided. I'm merging the -D solution now. We can change it in the future and check /run/user/$uid/flatpak-monitor/.

Please # to comment.