Skip to content

Commit

Permalink
setting correct dependencies, fixed patches
Browse files Browse the repository at this point in the history
  • Loading branch information
wildart committed Jul 6, 2016
1 parent 3856181 commit fcda52b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 45 deletions.
4 changes: 2 additions & 2 deletions deps/libgit2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ LIBGIT2_OPTS += -DBUILD_CLAR=OFF -DDLLTOOL=`which $(CROSS_COMPILE)dlltool`
LIBGIT2_OPTS += -DCMAKE_FIND_ROOT_PATH=/usr/$(XC_HOST) -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
endif
else
LIBGIT2_OPTS += -DUSE_OPENSSL=OFF -DUSE_CUSTOM_TLS=ON -DCMAKE_INSTALL_RPATH=$(build_prefix) -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
LIBGIT2_OPTS += -DUSE_OPENSSL=OFF -DCMAKE_INSTALL_RPATH=$(build_prefix) -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
endif

$(BUILDDIR)/$(LIBGIT2_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(LIBGIT2_SRC_DIR)/CMakeLists.txt
$(BUILDDIR)/$(LIBGIT2_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(LIBGIT2_SRC_DIR)/CMakeLists.txt $(HTTPPARSER_OBJ_TARGET) $(LIBSSH2_OBJ_TARGET)
ifeq ($(OS),WINNT)
-cd $(SRCDIR)/srccache/$(LIBGIT2_SRC_DIR) && patch -p0 -f < $(SRCDIR)/patches/libgit2-ssh.patch
else
Expand Down
2 changes: 1 addition & 1 deletion deps/libssh2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ else
LIBSSH2_OPTS += -DCRYPTO_BACKEND=mbedTLS -DENABLE_ZLIB_COMPRESSION=ON
endif

$(BUILDDIR)/$(LIBSSH2_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(LIBSSH2_SRC_DIR)/CMakeLists.txt
$(BUILDDIR)/$(LIBSSH2_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(LIBSSH2_SRC_DIR)/CMakeLists.txt $(MBEDTLS_OBJ_TARGET)
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) $(dir $<) $(LIBSSH2_OPTS)
Expand Down
2 changes: 1 addition & 1 deletion deps/mbedtlsstream.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MBEDTLSSTREAM_OPTS := $(CMAKE_COMMON) -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_RPATH=$(build_prefix) \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE

$(BUILDDIR)/$(MBEDTLSSTREAM_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(MBEDTLSSTREAM_SRC_DIR)/CMakeLists.txt
$(BUILDDIR)/$(MBEDTLSSTREAM_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(MBEDTLSSTREAM_SRC_DIR)/CMakeLists.txt $(HTTPPARSER_OBJ_TARGET) $(LIBGIT2_OBJ_TARGET) $(MBEDTLS_OBJ_TARGET)
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) $(dir $<) $(MBEDTLSSTREAM_OPTS)
Expand Down
33 changes: 17 additions & 16 deletions deps/patches/http_parser-win.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
diff --git a/Makefile b/Makefile
index 5f4eb22..983f669 100644
--- a/Makefile
+++ b/Makefile
@@ -18,18 +18,30 @@
--- a/Makefile 2016-07-06 16:00:08.018383300 -0400
+++ b/Makefile 2016-07-06 16:07:00.211648100 -0400
@@ -18,18 +18,33 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

+VERSION = 2.7.0

+VERSION_MAJ = 2
+VERSION_MIN = 7
+VERSION_PCH = 0
+
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
+ifeq ($(findstring cygwin,$(PLATFORM)), cygwin)
+PLATFORM = winnt
Expand All @@ -19,23 +20,23 @@ index 5f4eb22..983f669 100644
BINEXT ?=
ifeq (darwin,$(PLATFORM))
-SONAME ?= libhttp_parser.2.7.0.dylib
+SONAME ?= libhttp_parser.$(VERSION).dylib
+SONAME ?= libhttp_parser.$(VERSION_MAJ).$(VERSION_MIN).$(VERSION_PCH).dylib
SOEXT ?= dylib
+else ifeq (winnt, $(PLATFORM))
+CC = gcc
+SONAME ?= libhttp_parser.$(VERSION).dll
+SONAME ?= libhttp_parser-$(VERSION_MAJ).$(VERSION_MIN).dll

This comment has been minimized.

Copy link
@tkelman

tkelman Jul 6, 2016

Contributor

no dots at all. just don't bother with an soname on Windows. I really don't see why you need to patch this at all

This comment has been minimized.

Copy link
@wildart

wildart Jul 7, 2016

Author Member

Current http_parser Makefile is a mess, so I created patch from these PRs: nodejs/http-parser#321 & nodejs/http-parser#294. I want to be consistent with naming on all platforms so I would not have any troubles (at least with this Makefile). Everything else I could fix in http_parser.mk.

+SOEXT ?= dll
else ifeq (wine,$(PLATFORM))
CC = winegcc
BINEXT = .exe.so
HELPER = wine
else
-SONAME ?= libhttp_parser.so.2.7.0
+SONAME ?= libhttp_parser.so.$(VERSION)
+SONAME ?= libhttp_parser.so.$(VERSION_MAJ).$(VERSION_MIN).$(VERSION_PCH)
SOEXT ?= so
endif
@@ -50,7 +62,12 @@ CFLAGS += -Wall -Wextra -Werror

@@ -50,7 +65,12 @@
CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
Expand All @@ -45,15 +46,15 @@ index 5f4eb22..983f669 100644
+else
CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
+endif

LDFLAGS_LIB = $(LDFLAGS) -shared
@@ -141,7 +158,7 @@ clean:

@@ -141,7 +161,7 @@
rm -f *.o *.a tags test test_fast test_g \
http_parser.tar libhttp_parser.so.* \
url_parser url_parser_g parsertrace parsertrace_g \
- *.exe *.exe.so
+ *.exe *.exe.so *.dll

contrib/url_parser.c: http_parser.h
contrib/parsertrace.c: http_parser.h
62 changes: 37 additions & 25 deletions deps/patches/libgit2-custom-tls.patch
Original file line number Diff line number Diff line change
@@ -1,53 +1,65 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93a9e47..75fe5ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -542,6 +542,9 @@ IF (OPENSSL_FOUND)
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})
ENDIF()

+IF (USE_CUSTOM_TLS)
+ ADD_DEFINITIONS(-DGIT_CUSTOM_TLS)
+ENDIF()


IF (THREADSAFE)
diff --git a/src/settings.c b/src/settings.c
index 00a3ef0..61e0199 100644
index 00a3ef0..21430bc 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -29,7 +29,7 @@ int git_libgit2_features(void)
@@ -29,9 +29,7 @@ int git_libgit2_features(void)
#ifdef GIT_THREADS
| GIT_FEATURE_THREADS
#endif
-#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT)
+#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CUSTOM_TLS)
| GIT_FEATURE_HTTPS
#endif
-#endif
#if defined(GIT_SSH)
| GIT_FEATURE_SSH
#endif
diff --git a/src/transport.c b/src/transport.c
index 327052f..c4f3254 100644
index 327052f..32f8464 100644
--- a/src/transport.c
+++ b/src/transport.c
@@ -29,7 +29,7 @@ static transport_definition local_transport_definition = { "file://", git_transp
@@ -29,9 +29,7 @@ static transport_definition local_transport_definition = { "file://", git_transp
static transport_definition transports[] = {
{ "git://", git_transport_smart, &git_subtransport_definition },
{ "http://", git_transport_smart, &http_subtransport_definition },
-#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT)
+#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CUSTOM_TLS)
{ "https://", git_transport_smart, &http_subtransport_definition },
#endif
-#endif
{ "file://", git_transport_local, NULL },
#ifdef GIT_SSH
{ "ssh://", git_transport_smart, &ssh_subtransport_definition },
diff --git a/src/transports/http.c b/src/transports/http.c
index 4fbbfbb..9ef05c6 100644
index 4fbbfbb..30520a0 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -620,7 +620,7 @@ static int http_connect(http_subtransport *t)
@@ -620,7 +620,6 @@ static int http_connect(http_subtransport *t)

error = git_stream_connect(t->io);

-#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL)
+#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL) || defined(GIT_CUSTOM_TLS)
if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL &&
git_stream_is_encrypted(t->io)) {
git_cert *cert;
@@ -640,7 +639,7 @@ static int http_connect(http_subtransport *t)
return error;
}
}
-#endif
+
if (error < 0)
return error;

diff --git a/tests/core/features.c b/tests/core/features.c
index 85cddfe..cf5e190 100644
--- a/tests/core/features.c
+++ b/tests/core/features.c
@@ -17,11 +17,7 @@ void test_core_features__0(void)
cl_assert((caps & GIT_FEATURE_THREADS) == 0);
#endif

-#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT)
cl_assert((caps & GIT_FEATURE_HTTPS) != 0);
-#else
- cl_assert((caps & GIT_FEATURE_HTTPS) == 0);
-#endif

#if defined(GIT_SSH)
cl_assert((caps & GIT_FEATURE_SSH) != 0);

0 comments on commit fcda52b

Please sign in to comment.