Skip to content

Instantly share code, notes, and snippets.

@ryanwoodsmall
Last active April 14, 2020 04:41
Show Gist options
  • Save ryanwoodsmall/2cbce4664f13b95ec7b0385fcee0b957 to your computer and use it in GitHub Desktop.
Save ryanwoodsmall/2cbce4664f13b95ec7b0385fcee0b957 to your computer and use it in GitHub Desktop.
opengit on linux
#!/bin/sh
# segfaulting on clone, but builds now
# needs:
# bmake
# libbsd
# libmd
# libfetch
# libressl/openssl
# zlib
bmake clean
bmake -C lib CC="${CC}" CFLAGS="${CFLAGS} $(pkg-config --cflags libmd) $(pkg-config --cflags libbsd-overlay libssl libcrypto zlib) $(pkg-config --cflags libssl) -I${PWD} -I/tmp/libfetch"
bmake -C src CC="${CC} ${CFLAGS} $(pkg-config --cflags libmd) $(pkg-config --cflags --libs libbsd-overlay libmd libssl libcrypto zlib) $(pkg-config --cflags libcrypto)/openssl -I/tmp/libfetch -L/tmp/libfetch -static"
diff --git a/lib/Makefile b/lib/Makefile
index f80a8c7..500cc11 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,7 +1,7 @@
LIB= ogit
-SHLIB_MAJOR= 0
-SHLIB_MINOR= 0
+#SHLIB_MAJOR= 0
+#SHLIB_MINOR= 0
SRCS= buffering.c common.c index.c ini.c loose.c pack.c protocol.c \
zlib-handler.c
diff --git a/lib/common.h b/lib/common.h
index be1923b..8881821 100644
--- a/lib/common.h
+++ b/lib/common.h
@@ -34,7 +34,7 @@
#define EXIT_INVALID_COMMAND 129 /* Invalid command */
/* Portability */
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__linux__)
#include <sha.h>
#elif defined(__OpenBSD__)
#include <sha1.h>
diff --git a/lib/loose.c b/lib/loose.c
index 2ee60d3..ff140ab 100644
--- a/lib/loose.c
+++ b/lib/loose.c
@@ -110,7 +110,7 @@
* Handler for loose_content_handler
*/
unsigned char *
-get_type_loose_cb(unsigned char *buf, int size, int __unused deflated_bytes, void *arg)
+get_type_loose_cb(unsigned char *buf, int size, int deflated_bytes, void *arg)
{
uint8_t *type = arg;
struct loosearg loosearg;
diff --git a/lib/loose.h b/lib/loose.h
index c2bb0ea..3867e27 100644
--- a/lib/loose.h
+++ b/lib/loose.h
@@ -46,6 +46,6 @@
int loose_get_headers(unsigned char *buf, int size, void *arg);
int loose_content_handler(char *sha, inflated_handler inflated_handler, void *iarg);
-unsigned char *get_type_loose_cb(unsigned char *buf, int size, int __unused deflated_bytes, void *arg);
+unsigned char *get_type_loose_cb(unsigned char *buf, int size, int deflated_bytes, void *arg);
#endif
diff --git a/lib/zlib-handler.c b/lib/zlib-handler.c
index 2b6133b..c839c6c 100644
--- a/lib/zlib-handler.c
+++ b/lib/zlib-handler.c
@@ -78,7 +78,7 @@
unsigned char *
-write_cb(unsigned char *buf, int size, int __unused deflate_bytes, void *arg)
+write_cb(unsigned char *buf, int size, int deflate_bytes, void *arg)
{
struct writer_args *writer_args = arg;
diff --git a/lib/zlib-handler.h b/lib/zlib-handler.h
index d33ff82..9ce81d9 100644
--- a/lib/zlib-handler.h
+++ b/lib/zlib-handler.h
@@ -46,7 +46,7 @@
int deflate_caller(int sourcefd, deflated_handler deflated_handler, void *darg,
inflated_handler inflated_handler, void *arg);
-unsigned char *write_cb(unsigned char *buf, int size, int __unused deflate_bytes, void *arg);
+unsigned char *write_cb(unsigned char *buf, int size, int deflate_bytes, void *arg);
unsigned char *buffer_cb(unsigned char *buf, int size, int deflate_size, void *arg);
int zlib_update_sha(unsigned char *data, int use, void *darg);
int zlib_update_crc(unsigned char *data, int use, void *darg);
diff --git a/src/Makefile b/src/Makefile
index b650aa8..c14f8db 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -7,8 +7,8 @@
.endif
CFLAGS+= -Wall -I${.CURDIR}/..
# Currently statically linking against libogit.a library
-LDADD+= ${.OBJDIR}/../lib/libogit.a
-LDFLAGS+= -lmd -lz -lfetch
+LDADD+= ${.OBJDIR}/../lib/libogit.a -lmd -lfetch -lssl -lcrypto -lz -lbsd
+LDFLAGS+= -lfetch -lmd -lssl -lcrypto -lz -lbsd
PROG= ogit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment