objective-git icon indicating copy to clipboard operation
objective-git copied to clipboard

Wrap libgit2 in a framework

Open pietbrauer opened this issue 9 years ago • 16 comments

As dynamic frameworks are now supported across all platforms and issues are popping up in every other Xcode version regarding modular framework inclusion @phatblat had the idea to wrap libgit2 in a dynamic framework.

This issue is to discuss is as Twitter is not the right place to include everyone.

pietbrauer avatar Jan 27 '16 14:01 pietbrauer

I started work on this a while ago, keeping some notes in phatblat/objective-git/pull/1 and overall the experiment was successful. I had a secondary goal of enabling Bitcode #529, but gave up as that is too much work with our current libssh2 and OpenSSL dependencies. Perhaps once libssh2 drops OpenSSL as a dependency.

I will start on some cleanup and move this into a branch here on the main repo where everyone can see and edit. I'd like to collapse the separate https://github.com/phatblat/git2 Xcode project into this one because it's not very big and that will make for less moving parts.

phatblat avatar Jan 29 '16 13:01 phatblat

I have a OpenSSL framework laying around if that is of any help? https://github.com/nerdishbynature/OpenSSL

pietbrauer avatar Jan 29 '16 15:01 pietbrauer

❤️

phatblat avatar Jan 29 '16 16:01 phatblat

Maybe something like gyp can help generating Xcode projects for the source this way we can just use libgit2 as a submodule and generate the Xcode project from the source each time? We did something like that in MX3 not sure if it supports dynamic frameworks though.

pietbrauer avatar Feb 01 '16 03:02 pietbrauer

Interesting. I haven't seen a tool like gyp before. Looks like the manual work is in creating the .gyp file which would then be used to generate the Xcode project. Are there any tools to generate a .gyp file from a Makefile?

I'm not too concerned about maintaining an Xcode project for libgit2 as its contents are very likely to be understood by contributors to this project. I'm more concerned about maintaining a parallel build system for our other dependencies, but that's outside the scope of this PR.

phatblat avatar Feb 01 '16 14:02 phatblat

I don't know about the Makefile but it seems more maintainable than an own Xcode project.

pietbrauer avatar Feb 01 '16 14:02 pietbrauer

I can try and get something working with libgit2.

pietbrauer avatar Feb 01 '16 14:02 pietbrauer

I've got a working project which is in a separate repo: https://github.com/phatblat/git2. I created it separate from ObjectiveGit thinking both it and SwiftGit2 could consume it. Since SwiftGit2 has stalled, it would be simpler if the project were here in the same repo as ObjectiveGit. Open to other opinions.

phatblat avatar Feb 01 '16 14:02 phatblat

It would be good to know if gym would make the project maintenance easier.

phatblat avatar Feb 01 '16 15:02 phatblat

Yep using that, just with gyp so we can keep the submodules?

pietbrauer avatar Feb 01 '16 15:02 pietbrauer

Do you mean keep git2 as a submodule?

phatblat avatar Feb 01 '16 15:02 phatblat

What the framework target should do is just take the source files and compile them into a dynamic framework right? Gyp takes all the files in a directory, takes the files from the include directory and makes a project out of it. Not sure if it supports framework targets yet so have to find out but maintaining a directory is easier than maintaining an Xcode project.

pietbrauer avatar Feb 01 '16 15:02 pietbrauer

yep. There a little bit more to it. The git2.modulemap and the git2.h umbrella headers need to include all the appropriate files (and not the ones for other platforms like windows and amiga). These could be static as they are in my example repo, but it would be ideal if they could be generated from the cmake build. They would only break if the files in the libgit2 build changed, so probably not a big deal to manage by hand.

phatblat avatar Feb 01 '16 15:02 phatblat

I might obviously be missing the whole picture, but IIRC CMake supports generating Xcode projects already ?

tiennou avatar Feb 01 '16 17:02 tiennou

Ha, I somehow completely missed @tiennou comment. The thing with cmake is that it still generates a static library with the Xcode project rather than a dynamic framework. As I have 0 knowledge about cmake I have no idea on how to do that either.

pietbrauer avatar Feb 23 '16 14:02 pietbrauer

I tried with the framework project but it has the same issue, the only thing I could come up with is fixing the root cause in https://github.com/libgit2/libgit2/pull/3636 and not include the header in the first place. Git2Go now happily compiles under Xcode 7.3.

pietbrauer avatar Feb 25 '16 10:02 pietbrauer