Initial import (#867959).

This commit is contained in:
Veeti Paananen 2013-06-15 13:16:20 +03:00
parent 7afb41398d
commit d3af3a530b
5 changed files with 232 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/v0.18.0.tar.gz

92
libgit2-0.18.0-http.patch Normal file
View File

@ -0,0 +1,92 @@
From 429218190bf4bcc90d86f0878e81469b3ae3c389 Mon Sep 17 00:00:00 2001
From: Veeti Paananen <veeti.paananen@rojekti.fi>
Date: Thu, 2 May 2013 14:07:22 +0300
Subject: [PATCH] Build with the system's http-parser installation if available
---
CMakeLists.txt | 15 +++++++++++++--
deps/cmake/FindHTTP_Parser.cmake | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 2 deletions(-)
create mode 100644 deps/cmake/FindHTTP_Parser.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f6b06b..b176035 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,9 @@
PROJECT(libgit2 C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+# Add find modules to the path
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules")
+
# Build options
#
OPTION( SONAME "Set the (SO)VERSION of the target" ON )
@@ -97,8 +100,16 @@ ELSE ()
IF (NOT AMIGA)
FIND_PACKAGE(OpenSSL)
ENDIF ()
- FILE(GLOB SRC_HTTP deps/http-parser/*.c)
- INCLUDE_DIRECTORIES(deps/http-parser)
+
+ FIND_PACKAGE(HTTP_Parser QUIET)
+ IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
+ INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
+ LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
+ ELSE()
+ MESSAGE("http-parser was not found or is too old; using bundled 3rd-party sources.")
+ INCLUDE_DIRECTORIES(deps/http-parser)
+ FILE(GLOB SRC_HTTP deps/http-parser/*.c)
+ ENDIF()
ENDIF()
# Specify sha1 implementation
diff --git a/cmake/Modules/FindHTTP_Parser.cmake b/cmake/Modules/FindHTTP_Parser.cmake
new file mode 100644
index 0000000..d92bf75
--- /dev/null
+++ b/cmake/Modules/FindHTTP_Parser.cmake
@@ -0,0 +1,39 @@
+# - Try to find http-parser
+#
+# Defines the following variables:
+#
+# HTTP_PARSER_FOUND - system has http-parser
+# HTTP_PARSER_INCLUDE_DIR - the http-parser include directory
+# HTTP_PARSER_LIBRARIES - Link these to use http-parser
+# HTTP_PARSER_VERSION_MAJOR - major version
+# HTTP_PARSER_VERSION_MINOR - minor version
+# HTTP_PARSER_VERSION_STRING - the version of http-parser found
+
+# Find the header and library
+FIND_PATH(HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h)
+FIND_LIBRARY(HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser)
+
+# Found the header, read version
+if (HTTP_PARSER_INCLUDE_DIR AND EXISTS "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h")
+ FILE(READ "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h" HTTP_PARSER_H)
+ IF (HTTP_PARSER_H)
+ STRING(REGEX REPLACE ".*#define[\t ]+HTTP_PARSER_VERSION_MAJOR[\t ]+([0-9]+).*" "\\1" HTTP_PARSER_VERSION_MAJOR "${HTTP_PARSER_H}")
+ STRING(REGEX REPLACE ".*#define[\t ]+HTTP_PARSER_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" HTTP_PARSER_VERSION_MINOR "${HTTP_PARSER_H}")
+ SET(HTTP_PARSER_VERSION_STRING "${HTTP_PARSER_VERSION_MAJOR}.${HTTP_PARSER_VERSION_MINOR}")
+ ENDIF()
+ UNSET(HTTP_PARSER_H)
+ENDIF()
+
+# Handle the QUIETLY and REQUIRED arguments and set HTTP_PARSER_FOUND
+# to TRUE if all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HTTP_Parser REQUIRED_VARS HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)
+
+# Hide advanced variables
+MARK_AS_ADVANCED(HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)
+
+# Set standard variables
+IF (HTTP_PARSER_FOUND)
+ SET(HTTP_PARSER_LIBRARIES ${HTTP_PARSER_LIBRARY})
+ set(HTTP_PARSER_INCLUDE_DIRS ${HTTP_PARSER_INCLUDE_DIR})
+ENDIF()
--
1.8.1.4

View File

@ -0,0 +1,26 @@
diff -up libgit2-0.18.0/CMakeLists.txt.system-libxdiff libgit2-0.18.0/CMakeLists.txt
--- libgit2-0.18.0/CMakeLists.txt.system-libxdiff 2013-05-30 12:50:45.703153568 -0400
+++ libgit2-0.18.0/CMakeLists.txt 2013-05-30 12:52:01.708154709 -0400
@@ -286,11 +286,11 @@ ELSEIF (AMIGA)
ELSE()
FILE(GLOB SRC_OS src/unix/*.c)
ENDIF()
-FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c src/xdiff/*.c)
+FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c)
# Compile and link libgit2
ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
-TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
+TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES} -lxdiff)
TARGET_OS_LIBRARIES(git2)
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
@@ -350,7 +350,7 @@ IF (BUILD_CLAR)
ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})
- TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
+ TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES} -lxdiff)
TARGET_OS_LIBRARIES(libgit2_clar)
MSVC_SPLIT_SOURCES(libgit2_clar)

112
libgit2.spec Normal file
View File

@ -0,0 +1,112 @@
Name: libgit2
Version: 0.18.0
Release: 4%{?dist}
Summary: A C implementation of the Git core methods as a library
License: GPLv2 with exceptions
URL: http://libgit2.github.com/
Source0: https://github.com/libgit2/libgit2/archive/v%{version}.tar.gz
# Remove bundling of http-parser
Patch0: libgit2-0.18.0-http.patch
# Use system libxdiff
Patch1: libgit2-0.18.0-system-libxdiff.patch
BuildRequires: cmake >= 2.6
BuildRequires: http-parser-devel
BuildRequires: libxdiff-devel
BuildRequires: openssl-devel
BuildRequires: python
BuildRequires: zlib-devel
%description
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
with bindings.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q
# Remove VCS files from examples
find examples -name ".gitignore" -delete
# Apply patches
%patch0 -p1
%patch1 -p1 -b .system-libxdiff
# Fix pkgconfig generation
sed -i 's|@CMAKE_INSTALL_PREFIX@/||' libgit2.pc.in
# Don't test network
sed -i 's/ionline/xonline/' CMakeLists.txt
# Remove bundled libraries
rm -rf deps
rm -rf src/xdiff
%build
%cmake .
make %{_smp_mflags}
%check
ctest -V
%install
make install DESTDIR=%{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc README.md COPYING AUTHORS
%{_libdir}/libgit2.so.*
%files devel
%doc docs examples
%{_libdir}/libgit2.so
%{_libdir}/pkgconfig/libgit2.pc
%{_includedir}/git2*
%changelog
* Thu May 30 2013 Veeti Paananen <veeti.paananen@rojekti.fi> - 0.18.0-4
- Update the http-parser patch
- Skip tests that require network connectivity
* Thu May 30 2013 Tom Callaway <spot@fedoraproject.org> - 0.18.0-3
- use system libxdiff instead of bundled copy
* Fri May 24 2013 Veeti Paananen <veeti.paananen@rojekti.fi> - 0.18.0-2
- Remove unnecessary CMake build flags
- Fix the pkgconfig file
* Thu May 02 2013 Veeti Paananen <veeti.paananen@rojekti.fi> - 0.18.0-1
- Update to version 0.18.0
- Unbundle the http-parser library
* Fri Oct 19 2012 Veeti Paananen <veeti.paananen@rojekti.fi> - 0.17.0-2
- Use make for building and installation
- Specify minimum CMake version
- Remove useless OpenSSL build dependency
- Move development documentation to the -devel package
- Add code examples to the -devel package
* Thu Oct 18 2012 Veeti Paananen <veeti.paananen@rojekti.fi> - 0.17.0-1
- Initial package.

View File

@ -0,0 +1 @@
ce6845df0dd084ef2633a69dba64929c v0.18.0.tar.gz