Open Therzok opened 9 years ago
cc @bording @nulltoken
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
/cc @ethomson @jamill @shiftkey
:eyes:
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.
I've investigated this a bit more and structured the whole workflow a bit more.
Set LIBSSH2_* properties in cmake, build and link, done.
We can link against system zlib, set libssh2 runtime path to use its name as identity.
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.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 https://github.com/libgit2/libgit2sharp/pull/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.8
package andlibssh2
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