0

First of all, that question may sounds stupid, but I see no other way to do it.

For one of the project at work, I need to add a dependency. There is a script that automatically grabs the tarball archive, decompress it, add the patches and build it. In my case, I have a tarball of a github project (restbed), and it need his own dependencies, as a submodule (asio, openssl and catch). The main problem is that the archive contains only restbed's sources, and not the dependencies.

Hopefully, there's the .gitmodules file in the archive

[submodule "dependency/asio"]
        path = dependency/asio
        url = https://github.com/corvusoft/asio-dependency
        branch = master
[submodule "dependency/catch"]
        path = dependency/catch
        url = https://github.com/corvusoft/catch-dependency
        branch = master
[submodule "dependency/openssl"]
        path = dependency/openssl
        url = https://github.com/corvusoft/openssl-dependency
        branch = OpenSSL_1_0_2-stable

So I tried the classic git submodule init, which gave me fatal: Not a git repository (or any of the parent directories): .git.

So, is there a way to get the dependencies of the project, or do I have to add them manually to the project?

Thanks.

bl4ckb0ne
  • 1,097
  • 2
  • 15
  • 30
  • restbed is a 6MB clone. Just clone it. – jthill Jun 09 '16 at 19:28
  • @jthill The script doesnt support the git clone. Plus we want to take the tarball to have a stable version. – bl4ckb0ne Jun 09 '16 at 19:29
  • Your tarball won't get you a stable version, because it doesn't record the dependencies. Fix your script to do a checkout and submodule update. – jthill Jun 09 '16 at 19:31

1 Answers1

0

Install and build the dependencies required independently of Restbed. The project has cmake find modules which detect required components from common paths during the build process, see OpenSSL module below:

# Copyright 2013-2016, Corvusoft Ltd, All Rights Reserved.

find_library( ssl_LIBRARY ssl ssleay32 HINTS "${CMAKE_SOURCE_DIR}/dependency/openssl/out32dll" "${CMAKE_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_library( crypto_LIBRARY crypto libeay32 HINTS "${CMAKE_SOURCE_DIR}/dependency/openssl/out32dll" "${CMAKE_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_path( ssl_INCLUDE openssl/ssl.h HINTS "${CMAKE_SOURCE_DIR}/dependency/openssl/inc32" "${CMAKE_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/lib" "/usr/include" "/usr/local/include" "/opt/local/include" )

if ( ssl_INCLUDE AND ssl_LIBRARY AND crypto_LIBRARY )
    set( OPENSSL_FOUND TRUE )
    add_definitions( -DBUILD_SSL=TRUE )

    if ( APPLE AND BUILD_SSL )
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
    endif( )

    message( STATUS "${Green}Found OpenSSL library at: ${ssl_LIBRARY}${Reset}" )
    message( STATUS "${Green}Found OpenSSL include at: ${ssl_INCLUDE}${Reset}" )
    message( STATUS "${Green}Found Crypto library at: ${crypto_LIBRARY}${Reset}" )
else ( )
    message( FATAL_ERROR "${Red}Failed to locate OpenSSL dependency. see restbed/dependency/openssl; ./config shared; make all${Reset}" )
endif ( )
Ben Crowhurst
  • 8,204
  • 6
  • 48
  • 78