import libgit2 0.12.0

libgit2 is a portable, pure C implementation of the Git core methods
provided as a re-entrant linkable library with a solid API, allowing you
to write native speed custom Git applications in any language which
supports C bindings.

ok sthen@
This commit is contained in:
jasper 2011-06-30 12:07:02 +00:00
parent 0d05c0ffa0
commit 917be4d61b
7 changed files with 254 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/06/30 12:07:02 jasper Exp $
COMMENT= the Git library, take 2
DISTNAME= libgit2-0.12.0
SHARED_LIBS += git2 0.0 # 0.12
MODULES= devel/cmake
do-regress:
cd ${WRKSRC} && ./libgit2_test
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (libgit2-0.12.0.tar.gz) = suUGnhEL3duxG95OVpIvUw==
RMD160 (libgit2-0.12.0.tar.gz) = j2l0en9VoIuE44Kr5Y7Oyp6E/IE=
SHA1 (libgit2-0.12.0.tar.gz) = /vcuGmDk/bffNam2X/AwuZVYj4Q=
SHA256 (libgit2-0.12.0.tar.gz) = fInn5P2VPyohyXa1KoUCqaI5m6t1YrjffWNIDbu7+aY=
SIZE (libgit2-0.12.0.tar.gz) = 928778

View File

@ -0,0 +1,110 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1.1.1 2011/06/30 12:07:02 jasper Exp $
Sync with upstream 0b10c9ea6ef5d85d862edd044d96561c4fd16e9b
--- CMakeLists.txt.orig Wed Jun 29 20:04:37 2011
+++ CMakeLists.txt Wed Jun 29 20:04:47 2011
@@ -24,36 +24,6 @@ SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.$
# Find required dependencies
INCLUDE_DIRECTORIES(deps/zlib src include)
-# Try finding openssl
-FIND_PACKAGE(OpenSSL)
-IF (OPENSSL_CRYPTO_LIBRARIES)
- SET(SHA1_TYPE "openssl" CACHE STRING "Which SHA1 implementation to use: builtin, ppc, openssl")
-ELSEIF ()
- SET(SHA1_TYPE "builtin" CACHE STRING "Which SHA1 implementation to use: builtin, ppc")
-ENDIF ()
-
-INCLUDE(FindPkgConfig)
-
-# Show SQLite3 settings in GUI (if they won't be found out)
-SET(SQLITE3_INCLUDE_DIRS "" CACHE PATH "SQLite include directory")
-SET(SQLITE3_LIBRARIES "" CACHE FILEPATH "SQLite library")
-
-# Are SQLite3 variables already set up? (poor Windows/no pkg-config/no sqlite3.pc)
-IF (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
- SET(SQLITE3_FOUND 1)
-ENDIF ()
-
-# Try to find SQLite3 via pkg-config
-IF (PKG_CONFIG_FOUND AND NOT SQLITE3_FOUND)
- pkg_check_modules(SQLITE3 sqlite3)
-ENDIF ()
-
-# Compile SQLite backend if SQLite3 is available
-IF (SQLITE3_FOUND)
- ADD_DEFINITIONS(-DGIT2_SQLITE_BACKEND)
- INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIRS})
-ENDIF ()
-
# Installation paths
SET(INSTALL_BIN bin CACHE PATH "Where to install binaries to.")
SET(INSTALL_LIB lib CACHE PATH "Where to install libraries to.")
@@ -64,9 +34,21 @@ OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF f
OPTION (BUILD_TESTS "Build Tests" ON)
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
-# Build Release by default
+# Platform specific compilation flags
+IF (MSVC)
+ SET(CMAKE_C_FLAGS "/W4 /WX /nologo /Zi")
+ # TODO: bring back /RTC1 /RTCc
+ SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd")
+ SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")
+ELSE ()
+ SET(CMAKE_C_FLAGS "-Wall -Wextra -fPIC")
+ SET(CMAKE_C_FLAGS_DEBUG "-g -O0")
+ SET(CMAKE_C_FLAGS_RELEASE "-O2")
+ENDIF()
+
+# Build Debug by default
IF (NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
+ SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF ()
IF (THREADSAFE)
@@ -90,20 +72,9 @@ IF (WIN32 AND NOT CYGWIN)
FILE(GLOB SRC_PLAT src/win32/*.c)
ENDIF ()
-# Specify sha1 implementation
-IF (SHA1_TYPE STREQUAL "ppc")
- ADD_DEFINITIONS(-DPPC_SHA1)
- FILE(GLOB SRC_SHA1 src/ppc/*.c)
-ELSEIF (SHA1_TYPE STREQUAL "openssl")
- ADD_DEFINITIONS(-DOPENSSL_SHA1)
- SET (SRC_SHA1)
- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
- SET (LIB_SHA1 ${OPENSSL_CRYPTO_LIBRARIES})
-ENDIF ()
-
# Compile and link libgit2
ADD_LIBRARY(git2 ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_ZLIB})
-TARGET_LINK_LIBRARIES(git2 ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIBRARIES})
+TARGET_LINK_LIBRARIES(git2 ${CMAKE_THREAD_LIBS_INIT})
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
@@ -118,16 +89,15 @@ INSTALL(FILES include/git2.h DESTINATION ${INSTALL_INC
# Tests
IF (BUILD_TESTS)
- SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
+ SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
ADD_DEFINITIONS(-DTEST_RESOURCES=\"${TEST_RESOURCES}\")
-
- ENABLE_TESTING()
- INCLUDE_DIRECTORIES(tests)
+ INCLUDE_DIRECTORIES(tests)
FILE(GLOB SRC_TEST tests/t??-*.c)
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_TEST} ${SRC_ZLIB})
- TARGET_LINK_LIBRARIES(libgit2_test ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIBRARIES})
+ TARGET_LINK_LIBRARIES(libgit2_test ${CMAKE_THREAD_LIBS_INIT})
+ ENABLE_TESTING()
ADD_TEST(libgit2_test libgit2_test)
ENDIF ()

View File

@ -0,0 +1,86 @@
$OpenBSD: patch-include_git2_thread-utils_h,v 1.1.1.1 2011/06/30 12:07:02 jasper Exp $
From upstream git: 340fc0d40ac03680d6f7964bc47f8c8d7fbbc57c
"threads: Cleanup TLS declarations"
--- include/git2/thread-utils.h.orig Wed Jun 29 20:01:17 2011
+++ include/git2/thread-utils.h Wed Jun 29 20:01:25 2011
@@ -31,41 +31,48 @@
* http://predef.sourceforge.net/precomp.html
*/
-#define GIT_HAS_TLS 1
+#ifdef GIT_THREADS
+# define GIT_HAS_TLS 1
-#if defined(__APPLE__) && defined(__MACH__)
-# undef GIT_TLS
-# define GIT_TLS
+/* No TLS in Cygwin */
+# if defined(__CHECKER__) || defined(__CYGWIN__)
+# undef GIT_HAS_TLS
+# define GIT_TLS
-#elif defined(__GNUC__) || \
- defined(__SUNPRO_C) || \
- defined(__SUNPRO_CC) || \
- defined(__xlc__) || \
- defined(__xlC__)
-# define GIT_TLS __thread
+/* No TLS in Mach binaries for Mac OS X */
+# elif defined(__APPLE__) && defined(__MACH__)
+# undef GIT_TLS
+# define GIT_TLS
-#elif defined(__INTEL_COMPILER)
-# if defined(_WIN32) || defined(_WIN32_CE)
-# define GIT_TLS __declspec(thread)
-# else
-# define GIT_TLS __thread
-# endif
+/* Normal TLS for GCC */
+# elif defined(__GNUC__) || \
+ defined(__SUNPRO_C) || \
+ defined(__SUNPRO_CC) || \
+ defined(__xlc__) || \
+ defined(__xlC__)
+# define GIT_TLS __thread
-#elif defined(_WIN32) || \
- defined(_WIN32_CE) || \
- defined(__BORLANDC__)
-# define GIT_TLS __declspec(thread)
+/* ICC may run on Windows or Linux */
+# elif defined(__INTEL_COMPILER)
+# if defined(_WIN32) || defined(_WIN32_CE)
+# define GIT_TLS __declspec(thread)
+# else
+# define GIT_TLS __thread
+# endif
-#else
-# undef GIT_HAS_TLS
-# define GIT_TLS /* nothing: tls vars are thread-global */
-#endif
+/* Declspec for MSVC in Win32 */
+# elif defined(_WIN32) || \
+ defined(_WIN32_CE) || \
+ defined(__BORLANDC__)
+# define GIT_TLS __declspec(thread)
-/* sparse and cygwin don't grok thread-local variables */
-#if defined(__CHECKER__) || defined(__CYGWIN__)
-# undef GIT_HAS_TLS
-# undef GIT_TLS
-# define GIT_TLS
-#endif
+/* Other platform; no TLS */
+# else
+# undef GIT_HAS_TLS
+# define GIT_TLS /* nothing: tls vars are thread-global */
+# endif
+#else /* Disable TLS if libgit2 is not threadsafe */
+# define GIT_TLS
+#endif /* GIT_THREADS */
#endif /* INCLUDE_git_thread_utils_h__ */

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-src_common_h,v 1.1.1.1 2011/06/30 12:07:02 jasper Exp $
--- src/common.h.orig Tue May 10 23:47:51 2011
+++ src/common.h Thu Jun 30 13:21:38 2011
@@ -40,8 +40,8 @@
typedef SSIZE_T ssize_t;
#else
-# include <unistd.h>
# include <arpa/inet.h>
+# include <unistd.h>
# ifdef GIT_THREADS
# include <pthread.h>

View File

@ -0,0 +1,4 @@
libgit2 is a portable, pure C implementation of the Git core methods
provided as a re-entrant linkable library with a solid API, allowing you
to write native speed custom Git applications in any language which
supports C bindings.

View File

@ -0,0 +1,23 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/06/30 12:07:02 jasper Exp $
include/git2/
include/git2.h
include/git2/blob.h
include/git2/commit.h
include/git2/common.h
include/git2/errors.h
include/git2/index.h
include/git2/object.h
include/git2/odb.h
include/git2/odb_backend.h
include/git2/oid.h
include/git2/refs.h
include/git2/repository.h
include/git2/revwalk.h
include/git2/signature.h
include/git2/tag.h
include/git2/thread-utils.h
@comment include/git2/thread-utils.h.orig
include/git2/tree.h
include/git2/types.h
include/git2/zlib.h
@lib lib/libgit2.so.${LIBgit2_VERSION}