Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
c46fe0c6
Commit
c46fe0c6
authored
Sep 02, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1823 from kadamski/building4android
Small changes enabling compiling libgit2 for Android.
parents
7b2b6da6
01cd5ae3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
CMakeLists.txt
+4
-2
README.md
+22
-0
src/util.c
+1
-1
tests-clar/odb/loose.c
+5
-0
No files found.
CMakeLists.txt
View file @
c46fe0c6
...
...
@@ -29,6 +29,8 @@ OPTION( PROFILE "Generate profiling information" OFF )
OPTION
(
ENABLE_TRACE
"Enables tracing support"
OFF
)
OPTION
(
LIBGIT2_FILENAME
"Name of the produced binary"
OFF
)
OPTION
(
ANDROID
"Build for android NDK"
OFF
)
IF
(
MSVC
)
# This option is only available when building with MSVC. By default, libgit2
# is build using the cdecl calling convention, which is useful if you're
...
...
@@ -127,7 +129,7 @@ IF (ENABLE_TRACE STREQUAL "ON")
ENDIF
()
# Include POSIX regex when it is required
IF
(
WIN32 OR AMIGA
)
IF
(
WIN32 OR AMIGA
OR ANDROID
)
INCLUDE_DIRECTORIES
(
deps/regex
)
SET
(
SRC_REGEX deps/regex/regex.c
)
ENDIF
()
...
...
@@ -409,7 +411,7 @@ ENDIF ()
IF (BUILD_EXAMPLES)
FILE(GLOB_RECURSE EXAMPLE_SRC examples/network/*.c examples/network/*.h)
ADD_EXECUTABLE(cgit2
${
EXAMPLE_SRC
}
)
IF(WIN32)
IF(WIN32
OR ANDROID
)
TARGET_LINK_LIBRARIES(cgit2 git2)
ELSE()
TARGET_LINK_LIBRARIES(cgit2 git2 pthread)
...
...
README.md
View file @
c46fe0c6
...
...
@@ -108,6 +108,28 @@ See [the wiki]
(https://github.com/libgit2/libgit2/wiki/Building-libgit2-on-Windows)
for more detailed instructions.
Android
-------
Extract toolchain from NDK using, `
make-standalone-toolchain.sh
` script.
Optionaly, crosscompile and install OpenSSL inside of it. Then create CMake
toolchain file that configures paths to your crosscompiler (substitude `
{PATH}
`
with full path to the toolchain):
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION Android)
SET(CMAKE_C_COMPILER {PATH}/bin/arm-linux-androideabi-gcc)
SET(CMAKE_CXX_COMPILER {PATH}/bin/arm-linux-androideabi-g++)
SET(CMAKE_FIND_ROOT_PATH {PATH}/sysroot/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Add `
-DCMAKE_TOOLCHAIN_FILE={pathToToolchainFile} -DANDROID=1
`
to cmake command
when configuring.
Language Bindings
==================================
...
...
src/util.c
View file @
c46fe0c6
...
...
@@ -711,7 +711,7 @@ void git__qsort_r(
void
*
els
,
size_t
nel
,
size_t
elsize
,
git__sort_r_cmp
cmp
,
void
*
payload
)
{
#if defined(__MINGW32__) || defined(__OpenBSD__) || defined(AMIGA) || \
defined(__gnu_hurd__) || \
defined(__gnu_hurd__) ||
defined(__ANDROID_API__) ||
\
(__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)
git__insertsort_r
(
els
,
nel
,
elsize
,
NULL
,
cmp
,
payload
);
#elif defined(GIT_WIN32)
...
...
tests-clar/odb/loose.c
View file @
c46fe0c6
...
...
@@ -3,6 +3,11 @@
#include "posix.h"
#include "loose_data.h"
#ifdef __ANDROID_API__
# define S_IREAD S_IRUSR
# define S_IWRITE S_IWUSR
#endif
static
void
write_object_files
(
object_data
*
d
)
{
int
fd
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment