Repository navigation
SSH support #7
Description
Activity
These are the preliminary steps for getting libraries built with ssh support (libssh2 and zlib).
Please cc any interested parties, we could probably end up shipping binaries for windows at least. :D
Reacted by Nikky👀
So, lemme lay out more information on the plate:
Licensing:
- libssh2 should be simple - http://www.libssh2.org/license.html - Add a license next to binary, done.
- zlib - http://www.zlib.net/zlib_license.html - Nothing specific comes to mind.
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.
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 installwhen 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.
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)so the latest libgit2sharp supports SSH url?
@dannyzhan Not yet. Main SSH related discussion is happening at libgit2/libgit2sharp#1072
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.8package andlibssh2repo 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