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

SSH support #7

Open
Therzok opened this issue Jun 4, 2015 · 9 comments
Open

SSH support #7

Therzok opened this issue Jun 4, 2015 · 9 comments

Comments

@Therzok
Copy link
Member

Therzok commented Jun 4, 2015

Okay so, I'm going to lay down the docs over this issue so I don't lose them:

Windows:

We need cmake, zlib-1.2.8 package and libssh2 repo cloned.

Having these side-by-side, inside libssh2 directory:

cd path/to/libssh2_repo ; mkdir build ; cd build ;
cmake .. -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON -DZLIB_LIBRARY="....\zlib-1.2.8\lib\zdll.lib" -DZLIB_INCLUDE_DIR="....\zlib-1.2.8\include"

This will build libssh2 dll and .lib inside path/to/libssh2_repo/build/src/Debug

It will link against zlib and we'd have to use zlib-1.2.8/zlib1.dll file side-by-side with libssh2.dll and libgit2.dll

TODO: Update docs on what parameters we need to send libgit2 to pick up libssh2. We have to modify all these properties manually, so we set FOUND manually, and so do we set link and include directories.

Mac:

brew install libssh2
build cmake with DUSE_SSH
copy libssh2 to output directory and install_name_tool -id libssh2.dylib libssh2.dylib

Linux:
Magic script: https://github.com/mono/monodevelop/blob/master/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/build_libgit2.sh

@Therzok
Copy link
Member Author

Therzok commented Jun 4, 2015

cc @bording @nulltoken

These are the preliminary steps for getting libraries built with ssh support (libssh2 and zlib).

@Therzok
Copy link
Member Author

Therzok commented Jun 4, 2015

Please cc any interested parties, we could probably end up shipping binaries for windows at least. :D

@nulltoken
Copy link
Member

/cc @ethomson @jamill @shiftkey

@shiftkey
Copy link

shiftkey commented Jun 4, 2015

👀

@Therzok
Copy link
Member Author

Therzok commented Jun 4, 2015

So, lemme lay out more information on the plate:

Licensing:

Building:

We use libgit2's zlib on mac/linux, on Windows we might need to use the same one as libgit2 uses, I'm really not sure how that works (since I've used a custom binary build from their website on Windows).

On Mac, it'll all be simple, we link against native openssl, Apple hasn't broken backwards compatibility on dylib versioning, so we should be a-ok on shipping them with libgit2.dylib and libssh2.dylib side-by-side. It's the easiest to achieve, said above too. Libssh2 building on Mac should be easy, either autotools or cmake, boom.

On Windows, we need to take into account that we have to make libgit2 and libssh2 use the same zlib library. That might be tough, might be not. Libssh2 building is cmake based, just set flags, poof, done.

Linux is a bit more complex. I'd stray away from shipping binaries for linux and have people build things from source for their target system.

@Therzok
Copy link
Member Author

Therzok commented Jun 11, 2015

I've investigated this a bit more and structured the whole workflow a bit more.

On Windows:

Libz:

  • Option 1: Use libgit2's zlib.
  • Option 2: Compile it from source and link against it.

Libssh2:

  • Option 1: Bring back libssh2 embedding (that was removed from libgit2), and we can trick libssh2 into using zlib that's provided by libgit2. Win-win situation, probably issues with licensing.
  • Option 2: Set cmake ZLIB_* stuff, link both libgit2 and libssh2 against it, easy ez.

LibGit2:

Set LIBSSH2_* properties in cmake, build and link, done.

On Mac:

Libssh2:

We can link against system zlib, set libssh2 runtime path to use its name as identity.

LibGit2:

  • Option 1: Use an installed libssh2 we set by doing make install when building libssh2, copy it to the output directory and change runtime path to take libssh2 from @loader_path/, set libgit2 runtime path to use its name as identity.
  • Option 2: Set LIBSSH2_* properties, then do the runtime path majiik.

On Linux:

No idea what to do here, since binaries differ from system to system. So we'd best let people build their own stuff from source.

@Therzok
Copy link
Member Author

Therzok commented Jun 11, 2015

Also, fixing the runtime path on Mac is as easy as doing: https://github.com/mono/libgit-binary/blob/master/fixify.sh

On Linux, we'd need to add a new CMAKE property: SET(CMAKE_SKIP_RPATH TRUE)

@dannyzhan
Copy link

so the latest libgit2sharp supports SSH url?

@nulltoken
Copy link
Member

@dannyzhan Not yet. Main SSH related discussion is happening at libgit2/libgit2sharp#1072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants