1
0
mirror of https://github.com/GitJournal/GitJournal.git synced 2025-07-27 06:04:37 +08:00

cLib: Add a Dockerfile

This is an env which we can use to develop the c-lib and run the test
executable.

I need to compile libgit2 as the one in ubunutu is version 0.26 not 0.28
This commit is contained in:
Vishesh Handa
2019-05-29 14:12:47 +02:00
parent 4c1ff7fc50
commit bf1544e2d9
2 changed files with 41 additions and 0 deletions

9
gj_common/Dockerfile Normal file

@ -0,0 +1,9 @@
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y build-essential libssl-dev autoconf git gettext
RUN apt-get install -y zlib1g-dev vim
RUN apt-get install -y clang cmake
COPY ./build-libgit2.sh /
RUN ./build-libgit2.sh

32
gj_common/build-libgit2.sh Executable file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -eux
LIBGIT2_VERSION="0.28.1"
if [ ! -f "libgit2.tar.gz" ]; then
curl https://codeload.github.com/libgit2/libgit2/tar.gz/v${LIBGIT2_VERSION} -o libgit2.tar.gz
fi
tar -xzf libgit2.tar.gz
cd libgit2-${LIBGIT2_VERSION}
mkdir build
cd build
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
if [ $? -ne 0 ]; then
echo "Error executing cmake"
exit 1
fi
cmake --build .
if [ $? -ne 0 ]; then
echo "Error building"
exit 1
fi
make install