c – How to publish my library to a linux repository?


I developed a library in C and I want to make it available to other developers. I wish this library could be installed using the apt-get command, for example:

sudo apt-get install minhalib

and in the code the developers would include the headers…

#include <minhalib.h>

and compile linking the library:

gcc -o main.c -lminhalib main

How do I make the library available this way?


What you need then is a software automation system . There are several ways this can be done, but I myself have never dealt with any of them seriously, hehe!

This is a really vast subject – the Wikipedia page onsoftware automation systems alone ( ptBR ) is already pretty big. As you might expect, each has its pros and cons.

But to shorten your search, I would give three recommendations: waf , Meson and cmake . They are versatile and easy to learn, and the major distributions and software installation channels are well supported. Waf I would recommend for small projects and Cmake for larger ones. (The GNU Autotools are famous and used a lot, but I find them too complicated. I don't recommend it.)

After that, well, you can open an account on Github , Gitlab , Sourceforge , Bitbucket or whatever, and release your software to the world! (Then is the time to think about which license to choose…).

PS: As for apt-get , this is specifically a package install command. Each distribution handles this in its own way. Because of this, I would recommend leaving this package creation up to the developers of each distro.

Scroll to Top