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

Wrap libgit2 in a framework #542

Open
pietbrauer opened this issue Jan 27, 2016 · 16 comments
Open

Wrap libgit2 in a framework #542

pietbrauer opened this issue Jan 27, 2016 · 16 comments
Assignees

Comments

@pietbrauer
Copy link
Member

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.

@phatblat
Copy link
Member

I started work on this a while ago, keeping some notes in phatblat/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 phatblat self-assigned this Jan 29, 2016
@joshaber joshaber changed the title Wrap libtgit2 in a framework Wrap libgit2 in a framework Jan 29, 2016
@pietbrauer
Copy link
Member Author

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

@phatblat
Copy link
Member

❤️

@phatblat phatblat mentioned this issue Jan 31, 2016
@pietbrauer
Copy link
Member Author

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.

@phatblat
Copy link
Member

phatblat commented Feb 1, 2016

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.

@pietbrauer
Copy link
Member Author

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

@pietbrauer
Copy link
Member Author

I can try and get something working with libgit2.

@phatblat
Copy link
Member

phatblat commented Feb 1, 2016

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
Copy link
Member

phatblat commented Feb 1, 2016

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

@pietbrauer
Copy link
Member Author

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

@phatblat
Copy link
Member

phatblat commented Feb 1, 2016

Do you mean keep git2 as a submodule?

@pietbrauer
Copy link
Member Author

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.

@phatblat
Copy link
Member

phatblat commented Feb 1, 2016

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.

@tiennou
Copy link
Contributor

tiennou commented Feb 1, 2016

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

@pietbrauer
Copy link
Member Author

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
Copy link
Member Author

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 libgit2/libgit2#3636 and not include the header in the first place. Git2Go now happily compiles under Xcode 7.3.

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

3 participants