AppImageCommunity / libappimage

Implements functionality for dealing with AppImage files
https://appimage.org
Other
46 stars 29 forks source link

How to to compile? #106

Closed probonopd closed 5 years ago

probonopd commented 5 years ago

README.md should be updated to include compilation instructions.

sudo apt-get -y install automake cmake libtool libcairo-dev libfuse-dev
mkdir build
cmake ..
...

?

probonopd commented 5 years ago

Seems like we need git submodule update --init --recursive?

probonopd commented 5 years ago
sudo apt-get -y install automake cmake libtool libcairo-dev libfuse-dev git
git clone https://github.com/AppImage/libappimage
cd ./libappimage/
mkdir build
cmake .. -DBUILD_TESTING:bool=False
make
sudo make install
cd ..

@azubieta I was pointed to you by TA to answer this.

azubieta commented 5 years ago

What would I do if I wanted a static library instead (which we should recommend)?

In every build both static and dynamic libraries are produced. But the static library is difficult (if not impossible) to use as you should also provide as input to your final binary all the other static libraries that libappimage depends on. Those libraries are produced as part of the libappimage project (which is in the scope of libappimage a mono-repo). The solution will require us to configure the installation of such static libraries. That will require some ugly and fragile hacks. So currently the only recommended way of consuming libappimage is using it as a shared library. It's important to say that this is not a regression produced by the C++ port.

What would I do if I wanted to skip the tests and gtest (as a pure consumer rather than developer of this library)?

cmake $libappimage_source -DBUILD_TESTING:bool=False

As gtest is a submodule you will have to initialize it anyway.

azubieta commented 5 years ago

I'm just going to leave this link here https://github.com/appimage-conan-community/conan-libappimage and say that it doesn't add any new dependency, it remove the git submodule and cmake hell and it still can be built without conan.io.

probonopd commented 5 years ago

So currently the only recommended way of consuming libappimage is using it as a shared library.

Isn't this, combined with the fact that distributions may start shipping outdated versions of libappimage, a recipe for trouble down the line?

As pointed out before, Conan is not acceptable as a dependency for any AppImage project @azubieta. Are you saying that https://github.com/appimage-conan-community/conan-libappimage does not depend on Conan? (Then the naming might be misleading.)

azubieta commented 5 years ago

Isn't this, combined with the fact that distributions may start shipping outdated versions of libappimage, a recipe for trouble down the line?

An static linked library will not do it any better in this scenario. Distributions will also want to have their own outdated and reviewed copy.

Are you saying that https://github.com/appimage-conan-community/conan-libappimage does not depend on Conan? (Then the naming might be misleading.)

That repository only contains the conan.io recipe not the whole libppaimge code. The conan.io recipe obviously depends on conan.io but the rest of the code doesn't even notice that conan.io exists. So you can still build and install all it's dependencies manually (they don't have to be conan.io packages) or use the ones already provided by your favorite distribution with changing anything.

In resume it's a totally optional build procedure. Think on it as having a build_all.sh script but with steroids and a binaries repository on the other end. Did I mention that you can rebuild the entire software stack if you want (or don't trust the binaries) to?

probonopd commented 5 years ago

As gtest is a submodule you will have to initialize it anyway.

Why is that? If I disable the test stuff then why does it need to be downloaded?

azubieta commented 5 years ago

Option two is initialize the modules you require manually or add more hacks on cmake to initialize only the modules that are required.

probonopd commented 5 years ago

cmake $libappimage_source -DBUILD_TESTING:bool=False

As gtest is a submodule you will have to initialize it anyway.

Example:

When building appimaged, then I currently need to download gtest. Can we do without that?

probonopd commented 5 years ago

Since no one is answering: Yes we can. Going to update the README.md now.