Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use glib as base library #237

Open
mgautierfr opened this issue Jul 23, 2019 · 6 comments
Open

Use glib as base library #237

mgautierfr opened this issue Jul 23, 2019 · 6 comments

Comments

@mgautierfr
Copy link
Member

This is a open question. I wonder if ... I'm not sure we have to do it. But I open the issue to discuss about this.
This issue is related to almost all our projects but I have to open the issue somewhere.

glib (https://developer.gnome.org/glib/stable/) is the low level library of the gnome project.
While it is in the gnome project, it is not related at all with graphic/ui (handle by gdk, gtk, clutter, ...).

The thing is that glib provide a lot of functionality we use/need (in parenthesis, the library or code we have) :

The compilation system of glib is meson. We already have everything we need on our side to compile it. glib depends on few other libraries:

  • iconv. Present on gnu libc since 1999 so not a problem on linux. On windows we can use gnu's libiconv)
  • gettext. The de facto standard internationalization tool. We will need it anyway.
  • a thread library. pthread on unix or win32 threads (but we don't need pthread on windows)

By using glib, we could remove the use of other dependencies (icu and all the icu data file manipulation, e2fsprogs, gtest) and almost all our "tools" code.
We would also be (more) platform independent using well established library instead of our (probably buggy) code.

@kelson42
Copy link
Collaborator

@mgautierfr I agree with the principle idea to rely on a well established base lib.

I have a few questions:

  • I hardly understand how glib would avoid using libicu. Does glib for example provide function to remove accents?
  • What is the complete list of glib dependences?
  • How much work would be needed to get all of this compiles properly in CI?
  • Where is the list of supported architectures? Does it works fine on all our supported systems?
  • glib is C, why not using a baselib in C++ like Boost?
  • How much bigger would become our static binaries?

@mgautierfr
Copy link
Member Author

hardly understand how glib would avoid using libicu. Does glib for example provide function to remove accents?

Not directly, but the algorithm is pretty simple: Normalize using a decomposed form, remove accent chars.
This is explain here (https://sigquit.wordpress.com/tag/unaccenting/) with an implantation here (https://mail.gnome.org/archives/commits-list/2010-June/msg04595.html)
It already has functions to upper or lower case a unicode string.

What is the complete list of glib dependences?

The ones I've listed. (See https://developer.gnome.org/glib/stable/glib-building.html)
From the meson.build file (https://gitlab.gnome.org/GNOME/glib/blob/master/meson.build) the mandatory dependencies are :

  • libffi
  • some function from gettext
  • threading support
  • iconv

How much work would be needed to get all of this compiles properly in CI?

Hopefully not so much (if everything is good with next question). We can start to compile glib on the CI and slowly move our code base to glib.

Where is the list of supported architectures? Does it works fine on all our supported systems?

I don't know. Linux, Windows and mac platform should be ok. As the different archs.
There is this blog post to cross-compile for android (https://zwyuan.github.io/2016/07/17/cross-compile-glib-for-android/) this is pretty old (still use the autotools build system) but it should be better now than before :)

glib is C, why not using a baselib in C++ like Boost?

Because I've not investigate boost :)
But boost is also a solution yes.

But C has an advantage : C abi is standardize, it allows us to link to the lib whatever the compiler used to compile the lib and the binary (as opposite to c++ which need that the same compile is used)

How much bigger would become our static binaries?

No clue at all. We need to test.

@stale
Copy link

stale bot commented Nov 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Nov 21, 2019
@kelson42
Copy link
Collaborator

kelson42 commented Dec 3, 2019

One thing we need as well is something to parse HTTP header properly, see kiwix/kiwix-tools#148. Boost provides one, but not glib AFAIK.

@stale stale bot removed the stale label Dec 3, 2019
@stale
Copy link

stale bot commented Feb 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Feb 1, 2020
@kelson42
Copy link
Collaborator

kelson42 commented Feb 11, 2023

@mgautierfr @veloman-yunkan I think after 4 years a refresh of this ticket would be beneficial.

@stale stale bot removed the stale label Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants