imtui icon indicating copy to clipboard operation
imtui copied to clipboard

Packaging imtui for Linux distributions

Open jubalh opened this issue 4 years ago • 18 comments

I would like to build a package for this.

  • It would be great if you could tag and create releases in GitHub.
  • if there would be a make install to install the library.
  • if there could be a single tarball which doesn't need git to build.
  • Would be nice to have a pkgconfig (pc) file too.

jubalh avatar Dec 15 '20 16:12 jubalh

Sounds great!

1, 2 and 3 will do very soon. 4 will probably take some time.

ggerganov avatar Dec 15 '20 17:12 ggerganov

Should the tar contain just a copy of the source + the submodules?

ggerganov avatar Dec 15 '20 18:12 ggerganov

Should the tar contain just a copy of the source + the submodules?

Yep, if that is what is needed to build it. Many Linux distros have a build environment that doesn't allow network connections for their package building.

Being curious: what submodules are used?

jubalh avatar Dec 15 '20 19:12 jubalh

It uses the Dear ImGui library.

I think I was able to modify the CMake configuration to properly install targets. You can try with this release:

https://github.com/ggerganov/imtui/releases/tag/v1.0.2

To build shared libs, use cmake -DBUILD_SHARED_LIBS=1. By default it builds static.

  • The release exports 2 C++ libraries: libimtui and libimtui-ncurses.
  • libimtui-ncurses depends on libncurses.

Let me know if something else is needed.

ggerganov avatar Dec 15 '20 19:12 ggerganov

The release exports 2 C++ libraries: libimtui and libimtui-ncurses.

What's the difference? (I'm not yet familiar with the codebase. Only found the project today)

jubalh avatar Dec 15 '20 21:12 jubalh

'libimtui' just renders the ImGui draw data into a memory buffer.

You now need a way display this buffer on the screen and also provide input from the keyboard and/or mouse. This is what 'libimtui-ncurses' does.

In theory, one can use some other lib X instead of ncurses and then ImTui would provide 'libimtui-X' or the user can directly use 'libimtui' with their I/O.

Hope that makes sense. This library separation is very similar to what Dear ImGui does - I'm simply following their example.

ggerganov avatar Dec 16 '20 06:12 ggerganov

Hey, I'd be happy to help on this one.. ! We've been using this library for some months, building from a cmake Add_ExternalProject, but we'd like to treat it as a system dependency (so a deb package would be great!)

I recently synced our fork at master to test the install feature... but I wasn't able to build directly. I had to do a couple of not-so-elegant tweaks in the cmake to build my dependant projects as before, namely:

  1. Install ImGUI related files: https://github.com/beta-robots/imtui/commit/94a43adc7c34c53fa4c3c4b78ba5b67040970866
  2. Install ImTUI headers into a imtui folder, so they can find each other: https://github.com/beta-robots/imtui/commit/c71e1e9aa4dd4842b01819251173d51b3d73b1ed

Let me know if you need more user-side testing. And thanks for the library!

carlosjoserg avatar Mar 25 '21 16:03 carlosjoserg

Hi @carlosjoserg . Thanks for the info.

I recently synced our fork at master to test the install feature... but I wasn't able to build directly.

Yes, I think I somehow messed up the CMake install commands at some point. I'll take a look at your suggested changes and push proper CMakeLists to master.

Regarding the package: I am not familiar with the process of publishing the package and making it available to various distros. Do I need to make my own PPA? Or do I apply somewhere? Any help/info on that would be much appreciated.

ggerganov avatar Mar 26 '21 08:03 ggerganov

I am not familiar with the process of publishing the package and making it available to various distros. Do I need to make my own PPA? Or do I apply somewhere?

No you don't. Packagers do this. What you basically need to do is what I mentioned in my first request: https://github.com/ggerganov/imtui/issues/17#issue-767751669

From there packagers will pick up your package if they are interested. One can also file requests for packaging in various distributions.

jubalh avatar Mar 26 '21 09:03 jubalh

@carlosjoserg

I made a PR that should fix the CMake install targets: #26 Let me know if that works for you.

@jubalh

After we merge #26 I will make a new release that should satisfy the first 3 points in your comment. Will post an update here when this is ready. Thanks!

ggerganov avatar Mar 26 '21 09:03 ggerganov

@ggerganov that's great. I'll package imtui then for openSUSE.

jubalh avatar Mar 26 '21 10:03 jubalh

@jubalh Just made the v1.0.4 release:

https://github.com/ggerganov/imtui/releases/tag/v1.0.4

There is also a tarball attached.

To build, use:

tar -zxvf imtui-1.0.4.tar.gz
cd imtui-1.0.4
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/some/path/to/install ..
make install

ggerganov avatar Apr 03 '21 12:04 ggerganov

@carlosjoserg

I made a PR that should fix the CMake install targets: #26 Let me know if that works for you.

Yes, that worked. Thanks!

carlosjoserg avatar Apr 05 '21 08:04 carlosjoserg

I made a test package at https://build.opensuse.org/package/show/home:jubalh/imtui now. It seems imtui also installs imgui header files. We have an imgui test package too: https://build.opensuse.org/package/show/devel:libraries:c_c++/imgui So I would like to rather depend on that one. So that not two packages install the same files.

Could you add an option so that we don't install the imgui files when building/installing imtui?

jubalh avatar Apr 07 '21 14:04 jubalh

I added the option and made release v1.0.5:

https://github.com/ggerganov/imtui/releases/tag/v1.0.5

Use like this:

cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/some/path/to/install -DIMTUI_INSTALL_IMGUI_HEADERS=OFF ..

I am wondering if it would be better if I moved the imgui headers that imtui provides into a folder called imgui-for-imtui. This way, imtui can continue to distribute it's imgui headers and we will avoid the name clash.

ggerganov avatar Apr 08 '21 17:04 ggerganov

@ggerganov thanks for this. I now have the package moved to an official devel repo for openSUSE: https://build.opensuse.org/package/show/devel:libraries:c_c++/imtui

It would be really great if you could use library versioning: https://autotools.io/libtool/version.html And a .pc file would also be nice but is not as important.

After adding library versioning I could push this into official repositories.

jubalh avatar Apr 13 '21 10:04 jubalh

@jubalh Regarding the library versioning: I also find this page and I think I now understand how it works: https://www.sourceware.org/autobook/autobook/autobook_61.html

I should make a new release with version 0.0.0 and increment the numbers as explained.

Before I make the release: do I need to change my CMake to generate the .so files with the version number at the end? For example:

  • libimtui.so -> libimtui.so.0.0.0
  • libimtui-ncurses.so -> libimtui-ncurses.so.0.0.0

ggerganov avatar Apr 15 '21 11:04 ggerganov

It looks like you do, but I haven't been in the C++ space for ages: https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html

endgame avatar Nov 18 '21 10:11 endgame