mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
Merge remote-tracking branch 'origin/main' into worktree
This commit is contained in:
92
.clang-format
Normal file
92
.clang-format
Normal file
@@ -0,0 +1,92 @@
|
||||
# This file is an example configuration for clang-format 5.0.
|
||||
#
|
||||
# Note that this style definition should only be understood as a hint
|
||||
# for writing new code. The rules are still work-in-progress and does
|
||||
# not yet exactly match the style we have in the existing code.
|
||||
|
||||
# C Language specifics
|
||||
Language: Cpp
|
||||
|
||||
# Use tabs whenever we need to fill whitespace that spans at least from one tab
|
||||
# stop to the next one.
|
||||
#
|
||||
# These settings are mirrored in .editorconfig. Keep them in sync.
|
||||
UseTab: ForIndentation
|
||||
TabWidth: 8
|
||||
IndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
ColumnLimit: 80
|
||||
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignEscapedNewlines: Left
|
||||
AlignTrailingComments: false
|
||||
|
||||
# Allow putting parameters onto the next line
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
|
||||
# Don't allow short braced statements to be on a single line
|
||||
# if (a) not if (a) return;
|
||||
# return;
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: None
|
||||
|
||||
# Pack as many parameters or arguments onto the same line as possible
|
||||
# int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
|
||||
# int cccc);
|
||||
BinPackArguments: true
|
||||
BinPackParameters: false
|
||||
|
||||
BreakBeforeBraces: Linux
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakStringLiterals: false
|
||||
|
||||
# The number of spaces before trailing line comments (// - comments).
|
||||
# This does not affect trailing block comments (/* - comments).
|
||||
SpacesBeforeTrailingComments: 1
|
||||
|
||||
# Don't insert spaces in casts
|
||||
# x = (int32) y; not x = ( int32 ) y;
|
||||
SpacesInCStyleCastParentheses: false
|
||||
|
||||
# Don't insert spaces inside container literals
|
||||
# var arr = [1, 2, 3]; not var arr = [ 1, 2, 3 ];
|
||||
SpacesInContainerLiterals: false
|
||||
|
||||
# Don't insert spaces after '(' or before ')'
|
||||
# f(arg); not f( arg );
|
||||
SpacesInParentheses: false
|
||||
|
||||
# Don't insert spaces after '[' or before ']'
|
||||
# int a[5]; not int a[ 5 ];
|
||||
SpacesInSquareBrackets: false
|
||||
|
||||
# Insert a space after '{' and before '}' in struct initializers
|
||||
Cpp11BracedListStyle: false
|
||||
|
||||
# A list of macros that should be interpreted as foreach loops instead of as
|
||||
# function calls.
|
||||
ForEachMacros:
|
||||
- 'git_array_foreach'
|
||||
- 'git_vector_foreach'
|
||||
|
||||
# The maximum number of consecutive empty lines to keep.
|
||||
MaxEmptyLinesToKeep: 1
|
||||
|
||||
# No empty line at the start of a block.
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
|
||||
# Penalties
|
||||
# This decides what order things should be done if a line is too long
|
||||
PenaltyBreakAssignment: 10
|
||||
PenaltyBreakBeforeFirstCallParameter: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
SortIncludes: false
|
||||
3
.devcontainer/devcontainer.json
Normal file
3
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"postCreateCommand": "bash .devcontainer/setup.sh"
|
||||
}
|
||||
9
.devcontainer/setup.sh
Executable file
9
.devcontainer/setup.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -y --no-install-recommends install cmake
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@@ -15,3 +15,7 @@ indent_size = 2
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -1 +1,4 @@
|
||||
* text=auto
|
||||
ci/**/*.sh text eol=lf
|
||||
script/**/*.sh text eol=lf
|
||||
tests/resources/** linguist-vendored
|
||||
|
||||
109
.github/actions/download-or-build-container/action.yml
vendored
Normal file
109
.github/actions/download-or-build-container/action.yml
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# Run a build step in a container or directly on the Actions runner
|
||||
name: Download or Build Container
|
||||
description: Download a container from the package registry, or build it if it's not found
|
||||
|
||||
inputs:
|
||||
container:
|
||||
description: Container name
|
||||
type: string
|
||||
required: true
|
||||
dockerfile:
|
||||
description: Dockerfile
|
||||
type: string
|
||||
base:
|
||||
description: Container base
|
||||
type: string
|
||||
registry:
|
||||
description: Docker registry to read and publish to
|
||||
type: string
|
||||
default: ghcr.io
|
||||
config-path:
|
||||
description: Path to Dockerfiles
|
||||
type: string
|
||||
github_token:
|
||||
description: GitHub Token
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Download container
|
||||
run: |
|
||||
IMAGE_NAME="${{ inputs.container }}"
|
||||
DOCKERFILE_PATH="${{ inputs.dockerfile }}"
|
||||
DOCKER_REGISTRY="${{ inputs.registry }}"
|
||||
DOCKERFILE_ROOT="${{ inputs.config-path }}"
|
||||
|
||||
if [ "${DOCKERFILE_PATH}" = "" ]; then
|
||||
DOCKERFILE_PATH="${DOCKERFILE_ROOT}/${IMAGE_NAME}"
|
||||
else
|
||||
DOCKERFILE_PATH="${DOCKERFILE_ROOT}/${DOCKERFILE_PATH}"
|
||||
fi
|
||||
|
||||
GIT_WORKTREE=$(cd "${GITHUB_ACTION_PATH}" && git rev-parse --show-toplevel)
|
||||
echo "::: git worktree is ${GIT_WORKTREE}"
|
||||
cd "${GIT_WORKTREE}"
|
||||
|
||||
DOCKER_CONTAINER="${GITHUB_REPOSITORY}/${IMAGE_NAME}"
|
||||
DOCKER_REGISTRY_CONTAINER="${DOCKER_REGISTRY}/${DOCKER_CONTAINER}"
|
||||
|
||||
echo "dockerfile=${DOCKERFILE_PATH}" >> $GITHUB_ENV
|
||||
echo "docker-container=${DOCKER_CONTAINER}" >> $GITHUB_ENV
|
||||
echo "docker-registry-container=${DOCKER_REGISTRY_CONTAINER}" >> $GITHUB_ENV
|
||||
|
||||
# Identify the last git commit that touched the Dockerfiles
|
||||
# Use this as a hash to identify the resulting docker containers
|
||||
echo "::: dockerfile path is ${DOCKERFILE_PATH}"
|
||||
|
||||
DOCKER_SHA=$(git log -1 --pretty=format:"%h" -- "${DOCKERFILE_PATH}")
|
||||
echo "docker-sha=${DOCKER_SHA}" >> $GITHUB_ENV
|
||||
|
||||
echo "::: docker sha is ${DOCKER_SHA}"
|
||||
|
||||
DOCKER_REGISTRY_CONTAINER_SHA="${DOCKER_REGISTRY_CONTAINER}:${DOCKER_SHA}"
|
||||
|
||||
echo "docker-registry-container-sha=${DOCKER_REGISTRY_CONTAINER_SHA}" >> $GITHUB_ENV
|
||||
echo "docker-registry-container-latest=${DOCKER_REGISTRY_CONTAINER}:latest" >> $GITHUB_ENV
|
||||
|
||||
echo "::: logging in to ${DOCKER_REGISTRY} as ${GITHUB_ACTOR}"
|
||||
|
||||
exists="true"
|
||||
docker login https://${DOCKER_REGISTRY} -u ${GITHUB_ACTOR} -p ${GITHUB_TOKEN} || exists="false"
|
||||
|
||||
echo "::: pulling ${DOCKER_REGISTRY_CONTAINER_SHA}"
|
||||
|
||||
if [ "${exists}" != "false" ]; then
|
||||
docker pull ${DOCKER_REGISTRY_CONTAINER_SHA} || exists="false"
|
||||
fi
|
||||
|
||||
if [ "${exists}" = "true" ]; then
|
||||
echo "::: docker container exists in registry"
|
||||
echo "docker-container-exists=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "::: docker container does not exist in registry"
|
||||
echo "docker-container-exists=false" >> $GITHUB_ENV
|
||||
fi
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.github_token }}
|
||||
- name: Create container
|
||||
run: |
|
||||
if [ "${{ inputs.base }}" != "" ]; then
|
||||
BASE_ARG="--build-arg BASE=${{ inputs.base }}"
|
||||
fi
|
||||
|
||||
GIT_WORKTREE=$(cd "${GITHUB_ACTION_PATH}" && git rev-parse --show-toplevel)
|
||||
echo "::: git worktree is ${GIT_WORKTREE}"
|
||||
cd "${GIT_WORKTREE}"
|
||||
|
||||
docker build -t ${{ env.docker-registry-container-sha }} --build-arg UID=$(id -u) --build-arg GID=$(id -g) ${BASE_ARG} -f ${{ env.dockerfile }} .
|
||||
docker tag ${{ env.docker-registry-container-sha }} ${{ env.docker-registry-container-latest }}
|
||||
shell: bash
|
||||
working-directory: source/${{ inputs.config-path }}
|
||||
if: env.docker-container-exists != 'true'
|
||||
- name: Publish container
|
||||
run: |
|
||||
docker push ${{ env.docker-registry-container-sha }}
|
||||
docker push ${{ env.docker-registry-container-latest }}
|
||||
shell: bash
|
||||
if: env.docker-container-exists != 'true' && github.event_name != 'pull_request'
|
||||
51
.github/actions/run-build/action.yml
vendored
Normal file
51
.github/actions/run-build/action.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# Run a build step in a container or directly on the Actions runner
|
||||
name: Run Build Step
|
||||
description: Run a build step in a container or directly on the Actions runner
|
||||
|
||||
inputs:
|
||||
command:
|
||||
description: Command to run
|
||||
type: string
|
||||
required: true
|
||||
container:
|
||||
description: Optional container to run in
|
||||
type: string
|
||||
container-version:
|
||||
description: Version of the container to run
|
||||
type: string
|
||||
shell:
|
||||
description: Shell to use
|
||||
type: string
|
||||
required: true
|
||||
default: 'bash'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- run: |
|
||||
if [ -n "${{ inputs.container }}" ]; then
|
||||
docker run \
|
||||
--rm \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-v "$(pwd)/source:/home/libgit2/source" \
|
||||
-v "$(pwd)/build:/home/libgit2/build" \
|
||||
-w /home/libgit2 \
|
||||
-e ASAN_SYMBOLIZER_PATH \
|
||||
-e CC \
|
||||
-e CFLAGS \
|
||||
-e CMAKE_GENERATOR \
|
||||
-e CMAKE_OPTIONS \
|
||||
-e GITTEST_NEGOTIATE_PASSWORD \
|
||||
-e GITTEST_FLAKY_STAT \
|
||||
-e PKG_CONFIG_PATH \
|
||||
-e SKIP_NEGOTIATE_TESTS \
|
||||
-e SKIP_SSH_TESTS \
|
||||
-e SKIP_PUSHOPTIONS_TESTS \
|
||||
-e TSAN_OPTIONS \
|
||||
-e UBSAN_OPTIONS \
|
||||
${{ inputs.container-version }} \
|
||||
/bin/bash -c "${{ inputs.command }}"
|
||||
else
|
||||
${{ inputs.command }}
|
||||
fi
|
||||
shell: ${{ inputs.shell != '' && inputs.shell || 'bash' }}
|
||||
35
.github/release.yml
vendored
Normal file
35
.github/release.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
changelog:
|
||||
categories:
|
||||
- title: New features
|
||||
labels:
|
||||
- feature
|
||||
- title: Performance improvements
|
||||
labels:
|
||||
- performance
|
||||
- title: Bug fixes
|
||||
labels:
|
||||
- bug
|
||||
- title: Security fixes
|
||||
labels:
|
||||
- security
|
||||
- title: Code cleanups
|
||||
labels:
|
||||
- cleanup
|
||||
- title: Build and CI improvements
|
||||
labels:
|
||||
- build
|
||||
- title: Documentation improvements
|
||||
labels:
|
||||
- documentation
|
||||
- title: Platform compatibility fixes
|
||||
labels:
|
||||
- compatibility
|
||||
- title: Git compatibility fixes
|
||||
labels:
|
||||
- git compatibility
|
||||
- title: Dependency updates
|
||||
labels:
|
||||
- dependency
|
||||
- title: Other changes
|
||||
labels:
|
||||
- '*'
|
||||
140
.github/workflows/benchmark.yml
vendored
Normal file
140
.github/workflows/benchmark.yml
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
# Benchmark libgit2 against the git reference implementation.
|
||||
name: Benchmark
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '15 4 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Run our benchmarks. We build a matrix with the various build
|
||||
# targets and their details. Unlike our CI builds, we run these
|
||||
# directly on the VM instead of in containers since we do not
|
||||
# need the breadth of platform diversity.
|
||||
build:
|
||||
# Only run scheduled workflows on the main repository; prevents people
|
||||
# from using build minutes on their forks.
|
||||
if: github.repository == 'libgit2/libgit2'
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- name: "Linux (clang, OpenSSL)"
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_GSSAPI=ON -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||
CMAKE_BUILD_OPTIONS: --config Release
|
||||
id: linux
|
||||
os: ubuntu-latest
|
||||
setup-script: ubuntu
|
||||
- name: "macOS"
|
||||
os: macos-12
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_GSSAPI=ON -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||
CMAKE_BUILD_OPTIONS: --config Release
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
id: macos
|
||||
setup-script: osx
|
||||
- name: "Windows (amd64, Visual Studio)"
|
||||
os: windows-2019
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A x64 -DDEPRECATE_HARD=ON -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||
CMAKE_BUILD_OPTIONS: --config Release
|
||||
id: windows
|
||||
setup-script: win32
|
||||
fail-fast: false
|
||||
name: "Benchmark ${{ matrix.platform.name }}"
|
||||
env: ${{ matrix.platform.env }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: source
|
||||
fetch-depth: 0
|
||||
- name: Set up benchmark environment
|
||||
run: source/ci/setup-${{ matrix.platform.setup-script }}-benchmark.sh
|
||||
shell: bash
|
||||
if: matrix.platform.setup-script != ''
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
../source/ci/build.sh
|
||||
shell: bash
|
||||
- name: Benchmark
|
||||
run: |
|
||||
if [[ "$(uname -s)" == MINGW* ]]; then
|
||||
GIT2_CLI="$(cygpath -w $(pwd))\\build\\Release\\git2"
|
||||
else
|
||||
GIT2_CLI="$(pwd)/build/git2"
|
||||
fi
|
||||
|
||||
mkdir benchmark && cd benchmark
|
||||
../source/tests/benchmarks/benchmark.sh --baseline-cli "git" --cli "${GIT2_CLI}" --name libgit2 --json benchmarks.json --zip benchmarks.zip
|
||||
shell: bash
|
||||
- name: Upload results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: benchmark-${{ matrix.platform.id }}
|
||||
path: benchmark
|
||||
if: always()
|
||||
|
||||
# Publish the results
|
||||
publish:
|
||||
name: Publish results
|
||||
needs: [ build ]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out benchmark repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: libgit2/benchmarks
|
||||
path: site
|
||||
fetch-depth: 0
|
||||
ssh-key: ${{ secrets.BENCHMARKS_PUBLISH_KEY }}
|
||||
- name: Download test results
|
||||
uses: actions/download-artifact@v3
|
||||
- name: Publish API
|
||||
run: |
|
||||
# Move today's benchmark run into the right place
|
||||
for platform in linux macos windows; do
|
||||
TIMESTAMP=$(jq .time.start < "benchmark-${platform}/benchmarks.json")
|
||||
TIMESTAMP_LEN=$(echo -n ${TIMESTAMP} | wc -c | xargs)
|
||||
DENOMINATOR=1
|
||||
if [ "${TIMESTAMP_LEN}" = "19" ]; then
|
||||
DENOMINATOR="1000000000"
|
||||
elif [ "${TIMESTAMP_LEN}" = "13" ]; then
|
||||
DENOMINATOR="1000"
|
||||
else
|
||||
echo "unknown timestamp"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
||||
DATE=$(date -R -r $(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
|
||||
else
|
||||
DATE=$(date -d @$(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
|
||||
fi
|
||||
|
||||
mkdir -p "site/public/api/runs/${DATE}"
|
||||
cp "benchmark-${platform}/benchmarks.json" "site/public/api/runs/${DATE}/${platform}.json"
|
||||
done
|
||||
|
||||
(cd site && node scripts/aggregate.js)
|
||||
|
||||
(
|
||||
cd site &&
|
||||
git config user.name 'Benchmark Site Generation' &&
|
||||
git config user.email 'libgit2@users.noreply.github.com' &&
|
||||
git add . &&
|
||||
git commit --allow-empty -m"benchmark update ${DATE}" &&
|
||||
git push origin main
|
||||
)
|
||||
shell: bash
|
||||
73
.github/workflows/build-containers.yml
vendored
Normal file
73
.github/workflows/build-containers.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
# Generate the containers that we use for builds.
|
||||
name: Build Containers
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
docker-registry: ghcr.io
|
||||
docker-config-path: source/ci/docker
|
||||
|
||||
jobs:
|
||||
# Build the docker container images that we will use for our Linux
|
||||
# builds. This will identify the last commit to the repository that
|
||||
# updated the docker images, and try to download the image tagged with
|
||||
# that sha. If it does not exist, we'll do a docker build and push
|
||||
# the image up to GitHub Packages for the actual CI/CD runs. We tag
|
||||
# with both the sha and "latest" so that the subsequent runs need not
|
||||
# know the sha. Only do this on CI builds (when the event is a "push")
|
||||
# because PR builds from forks lack permission to write packages.
|
||||
containers:
|
||||
strategy:
|
||||
matrix:
|
||||
container:
|
||||
- name: xenial
|
||||
- name: bionic
|
||||
- name: focal
|
||||
- name: noble
|
||||
- name: docurium
|
||||
- name: bionic-x86
|
||||
dockerfile: bionic
|
||||
base: multiarch/ubuntu-core:x86-bionic
|
||||
qemu: true
|
||||
- name: bionic-arm32
|
||||
dockerfile: bionic
|
||||
base: multiarch/ubuntu-core:armhf-bionic
|
||||
qemu: true
|
||||
- name: bionic-arm64
|
||||
dockerfile: bionic
|
||||
base: multiarch/ubuntu-core:arm64-bionic
|
||||
qemu: true
|
||||
- name: centos7
|
||||
- name: centos8
|
||||
runs-on: ubuntu-latest
|
||||
name: "Create container: ${{ matrix.container.name }}"
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: source
|
||||
fetch-depth: 0
|
||||
if: github.event_name != 'pull_request'
|
||||
- name: Setup QEMU
|
||||
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
if: matrix.container.qemu == true
|
||||
- name: Download existing container
|
||||
run: |
|
||||
"${{ github.workspace }}/source/ci/getcontainer.sh" "${{ matrix.container.name }}" "${{ matrix.container.dockerfile }}"
|
||||
env:
|
||||
DOCKER_REGISTRY: ${{ env.docker-registry }}
|
||||
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||
working-directory: ${{ env.docker-config-path }}
|
||||
if: github.event_name != 'pull_request'
|
||||
- name: Build and publish image
|
||||
run: |
|
||||
if [ "${{ matrix.container.base }}" != "" ]; then
|
||||
BASE_ARG="--build-arg BASE=${{ matrix.container.base }}"
|
||||
fi
|
||||
docker build -t ${{ env.docker-registry-container-sha }} --build-arg UID=$(id -u) --build-arg GID=$(id -g) ${BASE_ARG} -f ${{ env.dockerfile }} .
|
||||
docker tag ${{ env.docker-registry-container-sha }} ${{ env.docker-registry-container-latest }}
|
||||
docker push ${{ env.docker-registry-container-sha }}
|
||||
docker push ${{ env.docker-registry-container-latest }}
|
||||
working-directory: ${{ env.docker-config-path }}
|
||||
if: github.event_name != 'pull_request' && env.docker-container-exists != 'true'
|
||||
323
.github/workflows/main.yml
vendored
Normal file
323
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
# Continuous integration and pull request validation builds for the
|
||||
# main and maintenance branches.
|
||||
name: CI Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, maint/* ]
|
||||
pull_request:
|
||||
branches: [ main, maint/* ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
docker-registry: ghcr.io
|
||||
docker-config-path: ci/docker
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
# Run our CI/CD builds. We build a matrix with the various build targets
|
||||
# and their details. Then we build either in a docker container (Linux)
|
||||
# or on the actual hosts (macOS, Windows).
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
# All builds: core platforms
|
||||
- name: "Linux (Noble, GCC, OpenSSL, libssh2)"
|
||||
id: noble-gcc-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2 -DDEBUG_STRICT_ALLOC=ON -DDEBUG_STRICT_OPEN=ON
|
||||
- name: "Linux (Noble, Clang, mbedTLS, OpenSSH)"
|
||||
id: noble-clang-mbedtls
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec
|
||||
CMAKE_GENERATOR: Ninja
|
||||
- name: "Linux (Xenial, GCC, OpenSSL, OpenSSH)"
|
||||
id: xenial-gcc-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec -DDEBUG_STRICT_ALLOC=ON -DDEBUG_STRICT_OPEN=ON
|
||||
- name: "Linux (Xenial, Clang, mbedTLS, libssh2)"
|
||||
id: xenial-gcc-mbedtls
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2
|
||||
- name: "macOS"
|
||||
id: macos
|
||||
os: macos-12
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
setup-script: osx
|
||||
- name: "Windows (amd64, Visual Studio, Schannel)"
|
||||
id: windows-amd64-vs
|
||||
os: windows-2019
|
||||
setup-script: win32
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A x64 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DUSE_HTTPS=Schannel -DUSE_SSH=ON -DCMAKE_PREFIX_PATH=D:\Temp\libssh2
|
||||
BUILD_PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin;D:\Temp\libssh2\bin
|
||||
BUILD_TEMP: D:\Temp
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (x86, Visual Studio, WinHTTP)"
|
||||
id: windows-x86-vs
|
||||
os: windows-2019
|
||||
setup-script: win32
|
||||
env:
|
||||
ARCH: x86
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A Win32 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON -DCMAKE_PREFIX_PATH=D:\Temp\libssh2
|
||||
BUILD_PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin;D:\Temp\libssh2\bin
|
||||
BUILD_TEMP: D:\Temp
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (amd64, mingw, WinHTTP)"
|
||||
id: windows-amd64-mingw
|
||||
os: windows-2019
|
||||
setup-script: mingw
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
BUILD_TEMP: D:\Temp
|
||||
BUILD_PATH: D:\Temp\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (x86, mingw, Schannel)"
|
||||
id: windows-x86-mingw
|
||||
os: windows-2019
|
||||
setup-script: mingw
|
||||
env:
|
||||
ARCH: x86
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON -DUSE_HTTPS=Schannel
|
||||
BUILD_TEMP: D:\Temp
|
||||
BUILD_PATH: D:\Temp\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
# All builds: sanitizers
|
||||
- name: "Sanitizer (Memory)"
|
||||
id: sanitizer-memory
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
os: ubuntu-latest
|
||||
- name: "Sanitizer (Address)"
|
||||
id: sanitizer-address
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -fsanitize=address -ggdb -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
os: ubuntu-latest
|
||||
- name: "Sanitizer (UndefinedBehavior)"
|
||||
id: sanitizer-ub
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -fsanitize=undefined,nullability -fno-sanitize-recover=undefined,nullability -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
- name: "Sanitizer (Thread)"
|
||||
id: sanitizer-thread
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
TSAN_OPTIONS: suppressions=/home/libgit2/source/script/thread-sanitizer.supp second_deadlock_stack=1
|
||||
|
||||
# All builds: experimental SHA256 support
|
||||
- name: "Linux (SHA256, Xenial, Clang, OpenSSL)"
|
||||
id: xenial-clang-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON -DEXPERIMENTAL_SHA256=ON
|
||||
- name: "macOS (SHA256)"
|
||||
id: macos
|
||||
os: macos-12
|
||||
setup-script: osx
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DEXPERIMENTAL_SHA256=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (SHA256, amd64, Visual Studio)"
|
||||
id: windows-amd64-vs
|
||||
os: windows-2019
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A x64 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DEXPERIMENTAL_SHA256=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
fail-fast: false
|
||||
env: ${{ matrix.platform.env }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
name: "Build: ${{ matrix.platform.name }}"
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: source
|
||||
fetch-depth: 0
|
||||
- name: Set up build environment
|
||||
run: source/ci/setup-${{ matrix.platform.setup-script }}-build.sh
|
||||
shell: bash
|
||||
if: matrix.platform.setup-script != ''
|
||||
- name: Setup QEMU
|
||||
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
if: matrix.platform.container.qemu == true
|
||||
- name: Set up container
|
||||
uses: ./source/.github/actions/download-or-build-container
|
||||
with:
|
||||
registry: ${{ env.docker-registry }}
|
||||
config-path: ${{ env.docker-config-path }}
|
||||
container: ${{ matrix.platform.container.name }}
|
||||
github_token: ${{ secrets.github_token }}
|
||||
dockerfile: ${{ matrix.platform.container.dockerfile }}
|
||||
if: matrix.platform.container.name != ''
|
||||
- name: Prepare build
|
||||
run: mkdir build
|
||||
- name: Build
|
||||
uses: ./source/.github/actions/run-build
|
||||
with:
|
||||
command: cd ${BUILD_WORKSPACE:-.}/build && ../source/ci/build.sh
|
||||
container: ${{ matrix.platform.container.name }}
|
||||
container-version: ${{ env.docker-registry-container-sha }}
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
- name: Test
|
||||
uses: ./source/.github/actions/run-build
|
||||
with:
|
||||
command: cd ${BUILD_WORKSPACE:-.}/build && ../source/ci/test.sh
|
||||
container: ${{ matrix.platform.container.name }}
|
||||
container-version: ${{ env.docker-registry-container-sha }}
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: test-results-${{ matrix.platform.id }}
|
||||
path: build/results_*.xml
|
||||
|
||||
test_results:
|
||||
name: Test results
|
||||
needs: [ build ]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download test results
|
||||
uses: actions/download-artifact@v3
|
||||
- name: Generate test summary
|
||||
uses: test-summary/action@v2
|
||||
with:
|
||||
paths: 'test-results-*/*.xml'
|
||||
|
||||
|
||||
# Generate documentation using docurium. We'll upload the documentation
|
||||
# as a build artifact so that it can be reviewed as part of a pull
|
||||
# request or in a forked build. For CI builds in the main repository's
|
||||
# main branch, we'll push the gh-pages branch back up so that it is
|
||||
# published to our documentation site.
|
||||
documentation:
|
||||
name: Generate documentation
|
||||
if: success() || failure()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: source
|
||||
fetch-depth: 0
|
||||
- name: Set up container
|
||||
uses: ./source/.github/actions/download-or-build-container
|
||||
with:
|
||||
registry: ${{ env.docker-registry }}
|
||||
config-path: ${{ env.docker-config-path }}
|
||||
container: docurium
|
||||
github_token: ${{ secrets.github_token }}
|
||||
dockerfile: ${{ matrix.platform.container.dockerfile }}
|
||||
- name: Generate documentation
|
||||
working-directory: source
|
||||
run: |
|
||||
git config user.name 'Documentation Generation'
|
||||
git config user.email 'libgit2@users.noreply.github.com'
|
||||
git branch gh-pages origin/gh-pages
|
||||
docker login https://${{ env.docker-registry }} -u ${{ github.actor }} -p ${{ github.token }}
|
||||
docker run \
|
||||
--rm \
|
||||
-v "$(pwd):/home/libgit2" \
|
||||
-w /home/libgit2 \
|
||||
${{ env.docker-registry }}/${{ github.repository }}/docurium:latest \
|
||||
cm doc api.docurium
|
||||
git checkout gh-pages
|
||||
zip --exclude .git/\* --exclude .gitignore --exclude .gitattributes -r api-documentation.zip .
|
||||
- uses: actions/upload-artifact@v3
|
||||
name: Upload artifact
|
||||
with:
|
||||
name: api-documentation
|
||||
path: source/api-documentation.zip
|
||||
- name: Push documentation branch
|
||||
working-directory: source
|
||||
run: git push origin gh-pages
|
||||
if: github.event_name == 'push' && github.repository == 'libgit2/libgit2'
|
||||
469
.github/workflows/nightly.yml
vendored
Normal file
469
.github/workflows/nightly.yml
vendored
Normal file
@@ -0,0 +1,469 @@
|
||||
# Nightly build for the main branch across multiple targets.
|
||||
name: Nightly Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '15 1 * * *'
|
||||
|
||||
env:
|
||||
docker-registry: ghcr.io
|
||||
docker-config-path: ci/docker
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
# Run our nightly builds. We build a matrix with the various build
|
||||
# targets and their details. Then we build either in a docker container
|
||||
# (Linux) or on the actual hosts (macOS, Windows).
|
||||
build:
|
||||
# Only run scheduled workflows on the main repository; prevents people
|
||||
# from using build minutes on their forks.
|
||||
if: github.repository == 'libgit2/libgit2'
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
# All builds: core platforms
|
||||
- name: "Linux (Noble, GCC, OpenSSL, libssh2)"
|
||||
id: noble-gcc-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2 -DDEBUG_STRICT_ALLOC=ON -DDEBUG_STRICT_OPEN=ON
|
||||
- name: "Linux (Noble, Clang, mbedTLS, OpenSSH)"
|
||||
id: noble-clang-mbedtls
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec
|
||||
CMAKE_GENERATOR: Ninja
|
||||
- name: "Linux (Xenial, GCC, OpenSSL, OpenSSH)"
|
||||
id: xenial-gcc-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec -DDEBUG_STRICT_ALLOC=ON -DDEBUG_STRICT_OPEN=ON
|
||||
- name: "Linux (Xenial, Clang, mbedTLS, libssh2)"
|
||||
id: xenial-gcc-mbedtls
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2
|
||||
- name: "macOS"
|
||||
id: macos
|
||||
os: macos-12
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
setup-script: osx
|
||||
- name: "Windows (amd64, Visual Studio, Schannel)"
|
||||
id: windows-amd64-vs
|
||||
os: windows-2019
|
||||
setup-script: win32
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A x64 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DUSE_HTTPS=Schannel -DUSE_SSH=ON -DCMAKE_PREFIX_PATH=D:\Temp\libssh2
|
||||
BUILD_PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin;D:\Temp\libssh2\bin
|
||||
BUILD_TEMP: D:\Temp
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (x86, Visual Studio, WinHTTP)"
|
||||
id: windows-x86-vs
|
||||
os: windows-2019
|
||||
setup-script: win32
|
||||
env:
|
||||
ARCH: x86
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A Win32 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON -DCMAKE_PREFIX_PATH=D:\Temp\libssh2
|
||||
BUILD_PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin;D:\Temp\libssh2\bin
|
||||
BUILD_TEMP: D:\Temp
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (amd64, mingw, WinHTTP)"
|
||||
id: windows-amd64-mingw
|
||||
os: windows-2019
|
||||
setup-script: mingw
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
BUILD_TEMP: D:\Temp
|
||||
BUILD_PATH: D:\Temp\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (x86, mingw, Schannel)"
|
||||
id: windows-x86-mingw
|
||||
os: windows-2019
|
||||
setup-script: mingw
|
||||
env:
|
||||
ARCH: x86
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON -DUSE_HTTPS=Schannel
|
||||
BUILD_TEMP: D:\Temp
|
||||
BUILD_PATH: D:\Temp\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
# All builds: sanitizers
|
||||
- name: "Sanitizer (Memory)"
|
||||
id: memorysanitizer
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang-17
|
||||
CFLAGS: -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
os: ubuntu-latest
|
||||
- name: "Sanitizer (UndefinedBehavior)"
|
||||
id: ubsanitizer
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang-17
|
||||
CFLAGS: -fsanitize=undefined,nullability -fno-sanitize-recover=undefined,nullability -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
- name: "Sanitizer (Thread)"
|
||||
id: threadsanitizer
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: clang-17
|
||||
CFLAGS: -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
TSAN_OPTIONS: suppressions=/home/libgit2/source/script/thread-sanitizer.supp second_deadlock_stack=1
|
||||
|
||||
# Nightly builds: extended platforms
|
||||
- name: "Linux (CentOS 7, OpenSSL)"
|
||||
id: centos7-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: centos7
|
||||
env:
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
- name: "Linux (CentOS 7, dynamically-loaded OpenSSL)"
|
||||
id: centos7-dynamicopenssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: centos7
|
||||
env:
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL-Dynamic -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
- name: "Linux (CentOS 8, OpenSSL)"
|
||||
id: centos8-openssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: centos8
|
||||
env:
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON
|
||||
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
- name: "Linux (CentOS 8, dynamically-loaded OpenSSL)"
|
||||
id: centos8-dynamicopenssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: centos8
|
||||
env:
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL-Dynamic -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON
|
||||
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
ARCH: x86
|
||||
|
||||
- name: "Linux (Bionic, GCC, dynamically-loaded OpenSSL)"
|
||||
container:
|
||||
name: bionic
|
||||
dockerfile: bionic
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL-Dynamic -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
os: ubuntu-latest
|
||||
- name: "Linux (x86, Bionic, Clang, OpenSSL)"
|
||||
container:
|
||||
name: bionic-x86
|
||||
dockerfile: bionic
|
||||
qemu: true
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
os: ubuntu-latest
|
||||
- name: "Linux (x86, Bionic, GCC, OpenSSL)"
|
||||
container:
|
||||
name: bionic-x86
|
||||
dockerfile: bionic
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
os: ubuntu-latest
|
||||
- name: "Linux (arm32, Bionic, GCC, OpenSSL)"
|
||||
container:
|
||||
name: bionic-arm32
|
||||
dockerfile: bionic
|
||||
qemu: true
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_PROXY_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
GITTEST_FLAKY_STAT: true
|
||||
os: ubuntu-latest
|
||||
- name: "Linux (arm64, Bionic, GCC, OpenSSL)"
|
||||
container:
|
||||
name: bionic-arm64
|
||||
dockerfile: bionic
|
||||
qemu: true
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_PROXY_TESTS: true
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
os: ubuntu-latest
|
||||
|
||||
# Nightly builds: ensure we fallback when missing core functionality
|
||||
- name: "Linux (no threads)"
|
||||
id: xenial-nothreads
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: gcc
|
||||
CMAKE_OPTIONS: -DTHREADSAFE=OFF -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_PUSHOPTIONS_TESTS: true
|
||||
- name: "Linux (no mmap)"
|
||||
id: noble-nommap
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: noble
|
||||
env:
|
||||
CC: gcc
|
||||
CFLAGS: -DNO_MMAP
|
||||
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local
|
||||
CMAKE_GENERATOR: Ninja
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "Windows (no mmap)"
|
||||
os: windows-2019
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CFLAGS: -DNO_MMAP
|
||||
CMAKE_OPTIONS: -A x64 -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
# Nightly builds: extended SSL support
|
||||
- name: "Linux (dynamically-loaded OpenSSL)"
|
||||
id: xenial-dynamicopenssl
|
||||
os: ubuntu-latest
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL-Dynamic -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
CMAKE_GENERATOR: Ninja
|
||||
|
||||
# All builds: experimental SHA256 support
|
||||
- name: "Linux (SHA256, Xenial, Clang, OpenSSL)"
|
||||
id: xenial-clang-openssl
|
||||
container:
|
||||
name: xenial
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=ON
|
||||
os: ubuntu-latest
|
||||
- name: "macOS (SHA256)"
|
||||
id: macos
|
||||
os: macos-12
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DEXPERIMENTAL_SHA256=ON
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
setup-script: osx
|
||||
- name: "Windows (SHA256, amd64, Visual Studio)"
|
||||
id: windows-amd64-vs
|
||||
os: windows-2019
|
||||
env:
|
||||
ARCH: amd64
|
||||
CMAKE_GENERATOR: Visual Studio 16 2019
|
||||
CMAKE_OPTIONS: -A x64 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DEXPERIMENTAL_SHA256=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
fail-fast: false
|
||||
env: ${{ matrix.platform.env }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
name: "Build ${{ matrix.platform.name }}"
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: source
|
||||
fetch-depth: 0
|
||||
- name: Set up build environment
|
||||
run: source/ci/setup-${{ matrix.platform.setup-script }}-build.sh
|
||||
shell: bash
|
||||
if: matrix.platform.setup-script != ''
|
||||
- name: Setup QEMU
|
||||
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
if: matrix.platform.container.qemu == true
|
||||
- name: Set up container
|
||||
uses: ./source/.github/actions/download-or-build-container
|
||||
with:
|
||||
registry: ${{ env.docker-registry }}
|
||||
config-path: ${{ env.docker-config-path }}
|
||||
container: ${{ matrix.platform.container.name }}
|
||||
github_token: ${{ secrets.github_token }}
|
||||
dockerfile: ${{ matrix.platform.container.dockerfile }}
|
||||
if: matrix.platform.container.name != ''
|
||||
- name: Prepare build
|
||||
run: mkdir build
|
||||
- name: Build
|
||||
uses: ./source/.github/actions/run-build
|
||||
with:
|
||||
command: cd ${BUILD_WORKSPACE:-.}/build && ../source/ci/build.sh
|
||||
container: ${{ matrix.platform.container.name }}
|
||||
container-version: ${{ env.docker-registry-container-sha }}
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
- name: Test
|
||||
uses: ./source/.github/actions/run-build
|
||||
with:
|
||||
command: cd ${BUILD_WORKSPACE:-.}/build && ../source/ci/test.sh
|
||||
container: ${{ matrix.platform.container.name }}
|
||||
container-version: ${{ env.docker-registry-container-sha }}
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: test-results-${{ matrix.platform.id }}
|
||||
path: build/results_*.xml
|
||||
|
||||
test_results:
|
||||
name: Test results
|
||||
needs: [ build ]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download test results
|
||||
uses: actions/download-artifact@v3
|
||||
- name: Generate test summary
|
||||
uses: test-summary/action@v2
|
||||
with:
|
||||
paths: 'test-results-*/*.xml'
|
||||
|
||||
coverity:
|
||||
# Only run scheduled workflows on the main repository; prevents people
|
||||
# from using build minutes on their forks.
|
||||
if: github.repository == 'libgit2/libgit2'
|
||||
|
||||
name: Coverity
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: source
|
||||
fetch-depth: 0
|
||||
- name: Set up container
|
||||
uses: ./source/.github/actions/download-or-build-container
|
||||
with:
|
||||
registry: ${{ env.docker-registry }}
|
||||
config-path: ${{ env.docker-config-path }}
|
||||
container: xenial
|
||||
github_token: ${{ secrets.github_token }}
|
||||
if: matrix.platform.container.name != ''
|
||||
- name: Run Coverity
|
||||
run: source/ci/coverity.sh
|
||||
env:
|
||||
COVERITY_TOKEN: ${{ secrets.coverity_token }}
|
||||
|
||||
codeql:
|
||||
# Only run scheduled workflows on the main repository; prevents people
|
||||
# from using build minutes on their forks.
|
||||
if: github.repository == 'libgit2/libgit2'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
name: CodeQL
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: 'cpp'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON
|
||||
cmake --build .
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
35
.gitignore
vendored
35
.gitignore
vendored
@@ -1,37 +1,8 @@
|
||||
/tests/clar.suite
|
||||
/tests/clar.suite.rule
|
||||
/tests/.clarcache
|
||||
/apidocs
|
||||
/trash-*.exe
|
||||
/libgit2.pc
|
||||
/config.mak
|
||||
*.o
|
||||
*.a
|
||||
*.exe
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.gcov
|
||||
.lock-wafbuild
|
||||
.waf*
|
||||
build/
|
||||
build-amiga/
|
||||
tests/tmp/
|
||||
msvc/Debug/
|
||||
msvc/Release/
|
||||
*.sln
|
||||
*.suo
|
||||
*.vc*proj*
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.aps
|
||||
*.cmake
|
||||
!cmake/Modules/*.cmake
|
||||
/build/
|
||||
.DS_Store
|
||||
*~
|
||||
.*.swp
|
||||
tags
|
||||
mkmf.log
|
||||
*.profdata
|
||||
*.profraw
|
||||
/tags
|
||||
CMakeSettings.json
|
||||
.vs
|
||||
.idea
|
||||
|
||||
27
.vscode/launch.json
vendored
Normal file
27
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/libgit2_tests",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${fileDirname}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
27
.vscode/tasks.json
vendored
Normal file
27
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build",
|
||||
"type": "shell",
|
||||
"command": "cd build && cmake --build . --parallel",
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Tests",
|
||||
"type": "shell",
|
||||
"command": "build/libgit2_tests -v",
|
||||
"group": "test",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
422
CMakeLists.txt
422
CMakeLists.txt
@@ -1,339 +1,145 @@
|
||||
# CMake build script for the libgit2 project
|
||||
# libgit2: the cross-platform, linkable library implementation of git.
|
||||
# See `README.md` for build instructions.
|
||||
#
|
||||
# Building (out of source build):
|
||||
# > mkdir build && cd build
|
||||
# > cmake .. [-DSETTINGS=VALUE]
|
||||
# > cmake --build .
|
||||
#
|
||||
# Testing:
|
||||
# > ctest -V
|
||||
#
|
||||
# Install:
|
||||
# > cmake --build . --target install
|
||||
# This top-level CMakeLists.txt sets up configuration options and
|
||||
# determines which subprojects to build.
|
||||
|
||||
PROJECT(libgit2 C)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
|
||||
CMAKE_POLICY(SET CMP0015 NEW)
|
||||
IF(POLICY CMP0051)
|
||||
CMAKE_POLICY(SET CMP0051 NEW)
|
||||
ENDIF()
|
||||
IF(POLICY CMP0042)
|
||||
CMAKE_POLICY(SET CMP0042 NEW)
|
||||
ENDIF()
|
||||
IF(POLICY CMP0054)
|
||||
CMAKE_POLICY(SET CMP0054 NEW)
|
||||
ENDIF()
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
project(libgit2 VERSION "1.8.0" LANGUAGES C)
|
||||
|
||||
# Add find modules to the path
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
INCLUDE(CheckLibraryExists)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckSymbolExists)
|
||||
INCLUDE(CheckStructHasMember)
|
||||
INCLUDE(CheckPrototypeDefinition) # Added in CMake 3.0
|
||||
INCLUDE(AddCFlagIfSupported)
|
||||
INCLUDE(FindPkgLibraries)
|
||||
INCLUDE(FindThreads)
|
||||
INCLUDE(FindStatNsec)
|
||||
INCLUDE(IdeSplitSources)
|
||||
INCLUDE(FeatureSummary)
|
||||
INCLUDE(EnableWarnings)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
#
|
||||
# Build options
|
||||
#
|
||||
OPTION(SONAME "Set the (SO)VERSION of the target" ON)
|
||||
OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
|
||||
OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
|
||||
OPTION(BUILD_CLAR "Build Tests using the Clar suite" ON)
|
||||
OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
|
||||
OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF)
|
||||
OPTION(TAGS "Generate tags" OFF)
|
||||
OPTION(PROFILE "Generate profiling information" OFF)
|
||||
OPTION(ENABLE_TRACE "Enables tracing support" ON)
|
||||
OPTION(LIBGIT2_FILENAME "Name of the produced binary" OFF)
|
||||
OPTION(USE_SSH "Link with libssh2 to enable SSH support" ON)
|
||||
OPTION(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
|
||||
OPTION(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS/Generic" ON)
|
||||
OPTION(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
|
||||
OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
|
||||
OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
|
||||
OPTION(VALGRIND "Configure build for valgrind" OFF)
|
||||
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
|
||||
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
|
||||
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
|
||||
SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
|
||||
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
|
||||
SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
|
||||
|
||||
IF (UNIX)
|
||||
IF (NOT USE_HTTPS)
|
||||
OPTION(USE_NTLMCLIENT "Enable NTLM support on Unix." OFF )
|
||||
ELSE()
|
||||
OPTION(USE_NTLMCLIENT "Enable NTLM support on Unix." ON )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
# Experimental features
|
||||
option(EXPERIMENTAL_SHA256 "Enable experimental SHA256 support (for R&D/testing)" OFF)
|
||||
|
||||
IF (UNIX AND NOT APPLE)
|
||||
OPTION(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)
|
||||
ENDIF()
|
||||
# Optional subsystems
|
||||
option(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
|
||||
option(BUILD_TESTS "Build Tests using the Clar suite" ON)
|
||||
option(BUILD_CLI "Build the command-line interface" ON)
|
||||
option(BUILD_EXAMPLES "Build library usage example apps" OFF)
|
||||
option(BUILD_FUZZERS "Build the fuzz targets" OFF)
|
||||
|
||||
IF (APPLE)
|
||||
OPTION(USE_ICONV "Link with and use iconv library" ON)
|
||||
ENDIF()
|
||||
# Suggested functionality that may not be available on a per-platform basis
|
||||
option(USE_THREADS "Use threads for parallel processing when possible" ON)
|
||||
option(USE_NSEC "Support nanosecond precision file mtimes and ctimes" ON)
|
||||
|
||||
IF(MSVC)
|
||||
# Backend selection
|
||||
option(USE_SSH "Enable SSH support. Can be set to a specific backend" OFF)
|
||||
option(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
|
||||
option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS" ON)
|
||||
option(USE_SHA256 "Enable SHA256. Can be set to HTTPS/Builtin" ON)
|
||||
option(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
|
||||
set(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
|
||||
# set(USE_XDIFF "" CACHE STRING "Specifies the xdiff implementation; either system or builtin.")
|
||||
set(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
|
||||
option(USE_BUNDLED_ZLIB "Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL" OFF)
|
||||
|
||||
# Debugging options
|
||||
option(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
|
||||
option(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
|
||||
option(DEBUG_POOL "Enable debug pool allocator" OFF)
|
||||
option(DEBUG_STRICT_ALLOC "Enable strict allocator behavior" OFF)
|
||||
option(DEBUG_STRICT_OPEN "Enable path validation in open" OFF)
|
||||
|
||||
# Output options
|
||||
option(SONAME "Set the (SO)VERSION of the target" ON)
|
||||
set(LIBGIT2_FILENAME "git2" CACHE STRING "Name of the produced binary")
|
||||
option(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
|
||||
|
||||
# Compilation options
|
||||
option(ENABLE_WERROR "Enable compilation with -Werror" OFF)
|
||||
|
||||
if(UNIX)
|
||||
# NTLM client requires crypto libraries from the system HTTPS stack
|
||||
if(NOT USE_HTTPS)
|
||||
option(USE_NTLMCLIENT "Enable NTLM support on Unix." OFF)
|
||||
else()
|
||||
option(USE_NTLMCLIENT "Enable NTLM support on Unix." ON)
|
||||
endif()
|
||||
|
||||
option(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
option(USE_ICONV "Link with and use iconv library" ON)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# This option must match the settings used in your program, in particular if you
|
||||
# are linking statically
|
||||
OPTION(STATIC_CRT "Link the static CRT libraries" ON)
|
||||
option(STATIC_CRT "Link the static CRT libraries" ON)
|
||||
|
||||
# If you want to embed a copy of libssh2 into libgit2, pass a
|
||||
# path to libssh2
|
||||
OPTION(EMBED_SSH_PATH "Path to libssh2 to embed (Windows)" OFF)
|
||||
ENDIF()
|
||||
option(EMBED_SSH_PATH "Path to libssh2 to embed (Windows)" OFF)
|
||||
|
||||
# Enable leak checking using the debugging C runtime.
|
||||
option(WIN32_LEAKCHECK "Enable leak reporting via crtdbg" OFF)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
# By default, libgit2 is built with WinHTTP. To use the built-in
|
||||
# HTTP transport, invoke CMake with the "-DWINHTTP=OFF" argument.
|
||||
OPTION(WINHTTP "Use Win32 WinHTTP routines" ON)
|
||||
ENDIF()
|
||||
# Modules
|
||||
|
||||
IF(MSVC)
|
||||
# Enable MSVC CRTDBG memory leak reporting when in debug mode.
|
||||
OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF)
|
||||
ENDIF()
|
||||
include(CheckLibraryExists)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckStructHasMember)
|
||||
include(CheckPrototypeDefinitionSafe)
|
||||
include(AddCFlagIfSupported)
|
||||
include(FindPkgLibraries)
|
||||
include(FindThreads)
|
||||
include(FindStatNsec)
|
||||
include(Findfutimens)
|
||||
include(GNUInstallDirs)
|
||||
include(IdeSplitSources)
|
||||
include(FeatureSummary)
|
||||
include(EnableWarnings)
|
||||
include(DefaultCFlags)
|
||||
include(ExperimentalFeatures)
|
||||
|
||||
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$")
|
||||
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${GIT2_HEADER}")
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_MINOR "${GIT2_HEADER}")
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_REV "${GIT2_HEADER}")
|
||||
SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
|
||||
#
|
||||
# Subdirectories
|
||||
#
|
||||
|
||||
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
|
||||
add_subdirectory(src)
|
||||
|
||||
IF (DEPRECATE_HARD)
|
||||
ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
|
||||
ENDIF()
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
# Platform specific compilation flags
|
||||
IF (MSVC)
|
||||
IF (STDCALL)
|
||||
MESSAGE(FATAL_ERROR "The STDCALL option is no longer supported; libgit2 is now always built as a cdecl library. If you're using PInvoke, please add the CallingConventions.Cdecl attribute for support.")
|
||||
ENDIF()
|
||||
if(BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
if(BUILD_FUZZERS)
|
||||
if((BUILD_TESTS OR BUILD_EXAMPLES) AND NOT USE_STANDALONE_FUZZERS)
|
||||
message(FATAL_ERROR "Cannot build the fuzzer and the tests or examples together")
|
||||
endif()
|
||||
add_subdirectory(fuzzers)
|
||||
endif()
|
||||
|
||||
STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
# /GF - String pooling
|
||||
# /MP - Parallel build
|
||||
SET(CMAKE_C_FLAGS "/GF /MP /nologo ${CMAKE_C_FLAGS}")
|
||||
# Export for people who use us as a dependency
|
||||
|
||||
# /Gd - explicitly set cdecl calling convention
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
|
||||
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
||||
set(LIBGIT2_DEPENDENCY_OBJECTS ${LIBGIT2_DEPENDENCY_OBJECTS} PARENT_SCOPE)
|
||||
set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
IF (STATIC_CRT)
|
||||
SET(CRT_FLAG_DEBUG "/MTd")
|
||||
SET(CRT_FLAG_RELEASE "/MT")
|
||||
ELSE()
|
||||
SET(CRT_FLAG_DEBUG "/MDd")
|
||||
SET(CRT_FLAG_RELEASE "/MD")
|
||||
ENDIF()
|
||||
|
||||
IF (MSVC_CRTDBG)
|
||||
SET(GIT_MSVC_CRTDBG 1)
|
||||
SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
|
||||
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
|
||||
ENDIF()
|
||||
# Summary
|
||||
|
||||
# /Zi - Create debugging information
|
||||
# /Od - Disable optimization
|
||||
# /D_DEBUG - #define _DEBUG
|
||||
# /MTd - Statically link the multithreaded debug version of the CRT
|
||||
# /MDd - Dynamically link the multithreaded debug version of the CRT
|
||||
# /RTC1 - Run time checks
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi /Od /D_DEBUG /RTC1 ${CRT_FLAG_DEBUG}")
|
||||
|
||||
# /DNDEBUG - Disables asserts
|
||||
# /MT - Statically link the multithreaded release version of the CRT
|
||||
# /MD - Dynamically link the multithreaded release version of the CRT
|
||||
# /O2 - Optimize for speed
|
||||
# /Oy - Enable frame pointer omission (FPO) (otherwise CMake will automatically turn it off)
|
||||
# /GL - Link time code generation (whole program optimization)
|
||||
# /Gy - Function-level linking
|
||||
SET(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
|
||||
|
||||
# /Oy- - Disable frame pointer omission (FPO)
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy ${CRT_FLAG_RELEASE}")
|
||||
|
||||
# /O1 - Optimize for size
|
||||
SET(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /O1 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
|
||||
|
||||
# /IGNORE:4221 - Ignore empty compilation units
|
||||
SET(CMAKE_STATIC_LINKER_FLAGS "/IGNORE:4221")
|
||||
|
||||
# /DYNAMICBASE - Address space load randomization (ASLR)
|
||||
# /NXCOMPAT - Data execution prevention (DEP)
|
||||
# /LARGEADDRESSAWARE - >2GB user address space on x86
|
||||
# /VERSION - Embed version information in PE header
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}")
|
||||
|
||||
# /DEBUG - Create a PDB
|
||||
# /LTCG - Link time code generation (whole program optimization)
|
||||
# /OPT:REF /OPT:ICF - Fold out duplicate code at link step
|
||||
# /INCREMENTAL:NO - Required to use /LTCG
|
||||
# /DEBUGTYPE:cv,fixup - Additional data embedded in the PDB (requires /INCREMENTAL:NO, so not on for Debug)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||
|
||||
# Same linker settings for DLL as EXE
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
|
||||
ELSE ()
|
||||
IF (ENABLE_REPRODUCIBLE_BUILDS)
|
||||
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
|
||||
|
||||
ENABLE_WARNINGS(all)
|
||||
ENABLE_WARNINGS(extra)
|
||||
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
||||
SET(CMAKE_C_FLAGS "-D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0")
|
||||
|
||||
IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
|
||||
STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
|
||||
ELSEIF (BUILD_SHARED_LIBS)
|
||||
ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
|
||||
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
ENDIF ()
|
||||
|
||||
IF (MINGW)
|
||||
# MinGW >= 3.14 uses the C99-style stdio functions
|
||||
# automatically, but forks like mingw-w64 still want
|
||||
# us to define this in order to use them
|
||||
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
|
||||
ENDIF ()
|
||||
|
||||
ENABLE_WARNINGS(documentation)
|
||||
DISABLE_WARNINGS(missing-field-initializers)
|
||||
ENABLE_WARNINGS(strict-aliasing)
|
||||
ENABLE_WARNINGS(strict-prototypes)
|
||||
ENABLE_WARNINGS(declaration-after-statement)
|
||||
ENABLE_WARNINGS(shift-count-overflow)
|
||||
ENABLE_WARNINGS(unused-const-variable)
|
||||
ENABLE_WARNINGS(unused-function)
|
||||
ENABLE_WARNINGS(int-conversion)
|
||||
|
||||
# MinGW uses gcc, which expects POSIX formatting for printf, but
|
||||
# uses the Windows C library, which uses its own format specifiers.
|
||||
# Disable format specifier warnings.
|
||||
IF(MINGW)
|
||||
DISABLE_WARNINGS(format)
|
||||
DISABLE_WARNINGS(format-security)
|
||||
ELSE()
|
||||
ENABLE_WARNINGS(format)
|
||||
ENABLE_WARNINGS(format-security)
|
||||
ENDIF()
|
||||
|
||||
IF("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
DISABLE_WARNINGS(documentation-deprecated-sync)
|
||||
ENDIF()
|
||||
|
||||
IF (PROFILE)
|
||||
SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "-pg ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
ENDIF ()
|
||||
ENDIF()
|
||||
|
||||
# Ensure that MinGW provides the correct header files.
|
||||
IF (WIN32 AND NOT CYGWIN)
|
||||
ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0600)
|
||||
ENDIF()
|
||||
|
||||
IF( NOT CMAKE_CONFIGURATION_TYPES )
|
||||
# Build Debug by default
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
ENDIF ()
|
||||
ELSE()
|
||||
# Using a multi-configuration generator eg MSVC or Xcode
|
||||
# that uses CMAKE_CONFIGURATION_TYPES and not CMAKE_BUILD_TYPE
|
||||
ENDIF()
|
||||
|
||||
IF(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS)
|
||||
# The actual sanitizer link target will be added when linking the fuzz
|
||||
# targets.
|
||||
SET(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link")
|
||||
ADD_C_FLAG(-fsanitize=fuzzer-no-link)
|
||||
UNSET(CMAKE_REQUIRED_FLAGS)
|
||||
ENDIF ()
|
||||
|
||||
ADD_SUBDIRECTORY(src)
|
||||
|
||||
# Tests
|
||||
IF (NOT MSVC)
|
||||
IF (NOT BUILD_SHARED_LIBS)
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
|
||||
IF (BUILD_CLAR)
|
||||
ENABLE_TESTING()
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
ENDIF ()
|
||||
|
||||
IF (TAGS)
|
||||
FIND_PROGRAM(CTAGS ctags)
|
||||
IF (NOT CTAGS)
|
||||
MESSAGE(FATAL_ERROR "Could not find ctags command")
|
||||
ENDIF ()
|
||||
|
||||
FILE(GLOB_RECURSE SRC_ALL *.[ch])
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT tags
|
||||
COMMAND ${CTAGS} -a ${SRC_ALL}
|
||||
DEPENDS ${SRC_ALL}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(
|
||||
do_tags ALL
|
||||
DEPENDS tags
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
IF (BUILD_EXAMPLES)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
ENDIF ()
|
||||
|
||||
IF(BUILD_FUZZERS)
|
||||
IF(NOT USE_STANDALONE_FUZZERS)
|
||||
IF(BUILD_EXAMPLES)
|
||||
MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the examples together")
|
||||
ENDIF()
|
||||
IF(BUILD_CLAR)
|
||||
MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the tests together")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(fuzzers)
|
||||
ENDIF()
|
||||
|
||||
FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
||||
FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
||||
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
||||
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
||||
|
||||
237
COPYING
237
COPYING
@@ -365,7 +365,7 @@ Public License instead of this License.
|
||||
|
||||
The bundled ZLib code is licensed under the ZLib license:
|
||||
|
||||
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
|
||||
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -406,30 +406,35 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
The regex library (deps/regex/) is licensed under the GNU LGPL
|
||||
(available at the end of this file).
|
||||
The bundled PCRE implementation (deps/pcre/) is licensed under the BSD
|
||||
license.
|
||||
|
||||
Definitions for data structures and routines for the regular
|
||||
expression library.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006,2008
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
* Neither the name of the University of Cambridge nor the name of Google
|
||||
Inc. nor the names of their contributors may be used to endorse or
|
||||
promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
@@ -1019,3 +1024,193 @@ following restrictions are are met:
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Portions of the OpenSSL headers are included under the OpenSSL license:
|
||||
|
||||
Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
All rights reserved.
|
||||
|
||||
This package is an SSL implementation written
|
||||
by Eric Young (eay@cryptsoft.com).
|
||||
The implementation was written so as to conform with Netscapes SSL.
|
||||
|
||||
This library is free for commercial and non-commercial use as long as
|
||||
the following conditions are aheared to. The following conditions
|
||||
apply to all code found in this distribution, be it the RC4, RSA,
|
||||
lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
included with this distribution is covered by the same copyright terms
|
||||
except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
|
||||
Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
the code are not to be removed.
|
||||
If this package is used in a product, Eric Young should be given attribution
|
||||
as the author of the parts of the library used.
|
||||
This can be in the form of a textual message at program startup or
|
||||
in documentation (online or textual) provided with the package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
"This product includes cryptographic software written by
|
||||
Eric Young (eay@cryptsoft.com)"
|
||||
The word 'cryptographic' can be left out if the rouines from the library
|
||||
being used are not cryptographic related :-).
|
||||
4. If you include any Windows specific code (or a derivative thereof) from
|
||||
the apps directory (application code) you must include an acknowledgement:
|
||||
"This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
The licence and distribution terms for any publically available version or
|
||||
derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
copied and put under another distribution licence
|
||||
[including the GNU Public Licence.]
|
||||
|
||||
====================================================================
|
||||
Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
3. All advertising materials mentioning features or use of this
|
||||
software must display the following acknowledgment:
|
||||
"This product includes software developed by the OpenSSL Project
|
||||
for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
|
||||
4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
endorse or promote products derived from this software without
|
||||
prior written permission. For written permission, please contact
|
||||
openssl-core@openssl.org.
|
||||
|
||||
5. Products derived from this software may not be called "OpenSSL"
|
||||
nor may "OpenSSL" appear in their names without prior written
|
||||
permission of the OpenSSL Project.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes software developed by the OpenSSL Project
|
||||
for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
The xoroshiro256** implementation is licensed in the public domain:
|
||||
|
||||
Written in 2018 by David Blackman and Sebastiano Vigna (vigna@acm.org)
|
||||
|
||||
To the extent possible under law, the author has dedicated all copyright
|
||||
and related and neighboring rights to this software to the public domain
|
||||
worldwide. This software is distributed without any warranty.
|
||||
|
||||
See <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
The built-in SHA256 support (src/hash/rfc6234) is taken from RFC 6234
|
||||
under the following license:
|
||||
|
||||
Copyright (c) 2011 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and
|
||||
the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
- Neither the name of Internet Society, IETF or IETF Trust, nor
|
||||
the names of specific contributors, may be used to endorse or
|
||||
promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
The built-in git_fs_path_basename_r() function is based on the
|
||||
Android implementation, BSD licensed:
|
||||
|
||||
Copyright (C) 2008 The Android Open Source Project
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
94
README.md
94
README.md
@@ -3,11 +3,10 @@ libgit2 - the Git linkable library
|
||||
|
||||
| Build Status | |
|
||||
| ------------ | - |
|
||||
| **master** branch CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=master) |
|
||||
| **v0.28 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.28) |
|
||||
| **v0.27 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.27) |
|
||||
| **v0.26 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.26) |
|
||||
| **Nightly** builds | [](https://libgit2.visualstudio.com/libgit2/_build/latest?definitionId=9&branchName=master) [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=21?branchName=master) [](https://scan.coverity.com/projects/639) |
|
||||
| **main** branch CI builds | [](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush) |
|
||||
| **v1.7 branch** CI builds | [](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.7) |
|
||||
| **v1.6 branch** CI builds | [](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.6) |
|
||||
| **Nightly** builds | [](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22Nightly+Build%22) [](https://scan.coverity.com/projects/639) |
|
||||
|
||||
`libgit2` is a portable, pure C implementation of the Git core methods
|
||||
provided as a linkable library with a solid API, allowing to build Git
|
||||
@@ -19,21 +18,23 @@ functionality into your application. Language bindings like
|
||||
in your favorite language.
|
||||
|
||||
`libgit2` is used to power Git GUI clients like
|
||||
[GitKraken](https://gitkraken.com/) and [gmaster](https://gmaster.io/)
|
||||
[GitKraken](https://gitkraken.com/) and [GitButler](https://gitbutler.com/)
|
||||
and on Git hosting providers like [GitHub](https://github.com/),
|
||||
[GitLab](https://gitlab.com/) and
|
||||
[Azure DevOps](https://azure.com/devops).
|
||||
We perform the merge every time you click "merge pull request".
|
||||
|
||||
`libgit2` is licensed under a **very permissive license** (GPLv2 with a special
|
||||
Linking Exception). This basically means that you can link it (unmodified)
|
||||
with any kind of software without having to release its source code.
|
||||
Linking Exception). This means that you can link against the library with any
|
||||
kind of software without making that software fall under the GPL.
|
||||
Changes to libgit2 would still be covered under its GPL license.
|
||||
Additionally, the example code has been released to the public domain (see the
|
||||
[separate license](examples/COPYING) for more information).
|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
|
||||
* [Using libgit2](#using-libgit2)
|
||||
* [Quick Start](#quick-start)
|
||||
* [Getting Help](#getting-help)
|
||||
* [What It Can Do](#what-it-can-do)
|
||||
@@ -48,10 +49,33 @@ Table of Contents
|
||||
* [Compiler and linker options](#compiler-and-linker-options)
|
||||
* [MacOS X](#macos-x)
|
||||
* [Android](#android)
|
||||
* [MinGW](#mingw)
|
||||
* [Language Bindings](#language-bindings)
|
||||
* [How Can I Contribute?](#how-can-i-contribute)
|
||||
* [License](#license)
|
||||
|
||||
Using libgit2
|
||||
=============
|
||||
|
||||
Most of these instructions assume that you're writing an application
|
||||
in C and want to use libgit2 directly. If you're _not_ using C,
|
||||
and you're writing in a different language or platform like .NET,
|
||||
Node.js, or Ruby, then there is probably a
|
||||
"[language binding](#language-bindings)" that you can use to take care
|
||||
of the messy tasks of calling into native code.
|
||||
|
||||
But if you _do_ want to use libgit2 directly - because you're building
|
||||
an application in C - then you may be able use an existing binary.
|
||||
There are packages for the
|
||||
[vcpkg](https://github.com/Microsoft/vcpkg) and
|
||||
[conan](https://conan.io/center/recipes/libgit2)
|
||||
package managers. And libgit2 is available in
|
||||
[Homebrew](https://formulae.brew.sh/formula/libgit2) and most Linux
|
||||
distributions.
|
||||
|
||||
However, these versions _may_ be outdated and we recommend using the
|
||||
latest version if possible. Thankfully libgit2 is not hard to compile.
|
||||
|
||||
Quick Start
|
||||
===========
|
||||
|
||||
@@ -81,7 +105,8 @@ Getting Help
|
||||
|
||||
**Chat with us**
|
||||
|
||||
- via IRC: join [#libgit2](https://webchat.freenode.net/#libgit2) on Freenode
|
||||
- via IRC: join [#libgit2](https://web.libera.chat/#libgit2) on
|
||||
[libera](https://libera.chat).
|
||||
- via Slack: visit [slack.libgit2.org](http://slack.libgit2.org/) to sign up,
|
||||
then join us in `#libgit2`
|
||||
|
||||
@@ -201,6 +226,8 @@ On most systems you can build the library using the following commands
|
||||
|
||||
Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace.
|
||||
|
||||
If you're not familiar with CMake, [a more detailed explanation](https://preshing.com/20170511/how-to-build-a-cmake-based-project/) may be helpful.
|
||||
|
||||
Running Tests
|
||||
-------------
|
||||
|
||||
@@ -210,18 +237,18 @@ Once built, you can run the tests from the `build` directory with the command
|
||||
|
||||
Alternatively you can run the test suite directly using,
|
||||
|
||||
$ ./libgit2_clar
|
||||
$ ./libgit2_tests
|
||||
|
||||
Invoking the test suite directly is useful because it allows you to execute
|
||||
individual tests, or groups of tests using the `-s` flag. For example, to
|
||||
run the index tests:
|
||||
|
||||
$ ./libgit2_clar -sindex
|
||||
$ ./libgit2_tests -sindex
|
||||
|
||||
To run a single test named `index::racy::diff`, which corresponds to the test
|
||||
function [`test_index_racy__diff`](https://github.com/libgit2/libgit2/blob/master/tests/index/racy.c#L23):
|
||||
function [`test_index_racy__diff`](https://github.com/libgit2/libgit2/blob/main/tests/index/racy.c#L23):
|
||||
|
||||
$ ./libgit2_clar -sindex::racy::diff
|
||||
$ ./libgit2_tests -sindex::racy::diff
|
||||
|
||||
The test suite will print a `.` for every passing test, and an `F` for any
|
||||
failing test. An `S` indicates that a test was skipped because it is not
|
||||
@@ -229,7 +256,7 @@ applicable to your platform or is particularly expensive.
|
||||
|
||||
**Note:** There should be _no_ failing tests when you build an unmodified
|
||||
source tree from a [release](https://github.com/libgit2/libgit2/releases),
|
||||
or from the [master branch](https://github.com/libgit2/libgit2/tree/master).
|
||||
or from the [main branch](https://github.com/libgit2/libgit2/tree/main).
|
||||
Please contact us or [open an issue](https://github.com/libgit2/libgit2/issues)
|
||||
if you see test failures.
|
||||
|
||||
@@ -248,12 +275,12 @@ For more advanced use or questions about CMake please read <https://cmake.org/Wi
|
||||
|
||||
The following CMake variables are declared:
|
||||
|
||||
- `BIN_INSTALL_DIR`: Where to install binaries to.
|
||||
- `LIB_INSTALL_DIR`: Where to install libraries to.
|
||||
- `INCLUDE_INSTALL_DIR`: Where to install headers to.
|
||||
- `CMAKE_INSTALL_BINDIR`: Where to install binaries to.
|
||||
- `CMAKE_INSTALL_LIBDIR`: Where to install libraries to.
|
||||
- `CMAKE_INSTALL_INCLUDEDIR`: Where to install headers to.
|
||||
- `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON)
|
||||
- `BUILD_CLAR`: Build [Clar](https://github.com/vmg/clar)-based test suite (defaults to ON)
|
||||
- `THREADSAFE`: Build libgit2 with threading support (defaults to ON)
|
||||
- `BUILD_TESTS`: Build the unit and integration test suites (defaults to ON)
|
||||
- `USE_THREADS`: Build libgit2 with threading support (defaults to ON)
|
||||
|
||||
To list all build options and their current value, you can do the
|
||||
following:
|
||||
@@ -275,6 +302,8 @@ compiler and linker. These flags are rarely used but can be useful for
|
||||
- `CMAKE_FIND_ROOT_PATH`: Override the search path for libraries
|
||||
- `ZLIB_LIBRARY`, `OPENSSL_SSL_LIBRARY` AND `OPENSSL_CRYPTO_LIBRARY`:
|
||||
Tell CMake where to find those specific libraries
|
||||
- `LINK_WITH_STATIC_LIBRARIES`: Link only with static versions of
|
||||
system libraries
|
||||
|
||||
MacOS X
|
||||
-------
|
||||
@@ -305,6 +334,20 @@ with full path to the toolchain):
|
||||
Add `-DCMAKE_TOOLCHAIN_FILE={pathToToolchainFile}` to cmake command
|
||||
when configuring.
|
||||
|
||||
MinGW
|
||||
-----
|
||||
|
||||
If you want to build the library in MinGW environment with SSH support enabled,
|
||||
you may need to pass `-DCMAKE_LIBRARY_PATH="${MINGW_PREFIX}/${MINGW_CHOST}/lib/"` flag
|
||||
to CMake when configuring. This is because CMake cannot find the Win32 libraries in
|
||||
MinGW folders by default and you might see an error message stating that CMake
|
||||
could not resolve `ws2_32` library during configuration.
|
||||
|
||||
Another option would be to install `msys2-w32api-runtime` package before configuring.
|
||||
This package installs the Win32 libraries into `/usr/lib` folder which is by default
|
||||
recognized as the library path by CMake. Please note though that this package is meant
|
||||
for MSYS subsystem which is different from MinGW.
|
||||
|
||||
Language Bindings
|
||||
==================================
|
||||
|
||||
@@ -318,6 +361,7 @@ Here are the bindings to libgit2 that are currently available:
|
||||
* dlibgit <https://github.com/s-ludwig/dlibgit>
|
||||
* Delphi
|
||||
* GitForDelphi <https://github.com/libgit2/GitForDelphi>
|
||||
* libgit2-delphi <https://github.com/todaysoftware/libgit2-delphi>
|
||||
* Erlang
|
||||
* Geef <https://github.com/carlosmn/geef>
|
||||
* Go
|
||||
@@ -330,6 +374,9 @@ Here are the bindings to libgit2 that are currently available:
|
||||
* hgit2 <https://github.com/jwiegley/gitlib>
|
||||
* Java
|
||||
* Jagged <https://github.com/ethomson/jagged>
|
||||
* Git24j <https://github.com/git24j/git24j>
|
||||
* Javascript / WebAssembly ( browser and nodejs )
|
||||
* WASM-git <https://github.com/petersalomonsen/wasm-git>
|
||||
* Julia
|
||||
* LibGit2.jl <https://github.com/JuliaLang/julia/tree/master/stdlib/LibGit2>
|
||||
* Lua
|
||||
@@ -346,13 +393,14 @@ Here are the bindings to libgit2 that are currently available:
|
||||
* parrot-libgit2 <https://github.com/letolabs/parrot-libgit2>
|
||||
* Perl
|
||||
* Git-Raw <https://github.com/jacquesg/p5-Git-Raw>
|
||||
* Pharo Smalltalk
|
||||
* libgit2-pharo-bindings <https://github.com/pharo-vcs/libgit2-pharo-bindings>
|
||||
* PHP
|
||||
* php-git <https://github.com/libgit2/php-git>
|
||||
* PowerShell
|
||||
* PSGit <https://github.com/PoshCode/PSGit>
|
||||
* php-git2 <https://github.com/RogerGee/php-git2>
|
||||
* Python
|
||||
* pygit2 <https://github.com/libgit2/pygit2>
|
||||
* R
|
||||
* gert <https://docs.ropensci.org/gert>
|
||||
* git2r <https://github.com/ropensci/git2r>
|
||||
* Ruby
|
||||
* Rugged <https://github.com/libgit2/rugged>
|
||||
@@ -360,6 +408,8 @@ Here are the bindings to libgit2 that are currently available:
|
||||
* git2-rs <https://github.com/rust-lang/git2-rs>
|
||||
* Swift
|
||||
* SwiftGit2 <https://github.com/SwiftGit2/SwiftGit2>
|
||||
* Tcl
|
||||
* lg2 <https://github.com/apnadkarni/tcl-libgit2>
|
||||
* Vala
|
||||
* libgit2.vapi <https://github.com/apmasell/vapis/blob/master/libgit2.vapi>
|
||||
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
resources:
|
||||
- repo: self
|
||||
|
||||
trigger:
|
||||
- master
|
||||
- maint/*
|
||||
|
||||
jobs:
|
||||
- job: linux_amd64_xenial_gcc_openssl
|
||||
displayName: 'Linux (amd64; Xenial; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DVALGRIND=on -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: linux_amd64_xenial_gcc_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; GCC; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DVALGRIND=on -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: linux_amd64_xenial_clang_openssl
|
||||
displayName: 'Linux (amd64; Xenial; Clang; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DVALGRIND=on -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: linux_amd64_xenial_clang_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; Clang; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DVALGRIND=on -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: macos
|
||||
displayName: 'macOS'
|
||||
pool:
|
||||
vmImage: 'macOS 10.13'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh'
|
||||
displayName: Setup
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
TMPDIR: $(Agent.TempDirectory)
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
GITTEST_NEGOTIATE_PASSWORD: ${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: windows_vs_amd64
|
||||
displayName: 'Windows (amd64; Visual Studio)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013 Win64
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: windows_vs_x86
|
||||
displayName: 'Windows (x86; Visual Studio)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: windows_mingw_amd64
|
||||
displayName: 'Windows (amd64; MinGW)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
env:
|
||||
TEMP: $(Agent.TempDirectory)
|
||||
ARCH: amd64
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: windows_mingw_x86
|
||||
displayName: 'Windows (x86; MinGW)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
env:
|
||||
TEMP: $(Agent.TempDirectory)
|
||||
ARCH: x86
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: documentation
|
||||
displayName: 'Generate Documentation'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- script: |
|
||||
cd $(Build.SourcesDirectory)/azure-pipelines/docker
|
||||
docker build -t libgit2/docurium --build-arg BASE=ubuntu:trusty -f docurium .
|
||||
displayName: 'Build Docker image'
|
||||
- script: |
|
||||
git config user.name 'Documentation Generation'
|
||||
git config user.email 'libgit2@users.noreply.github.com'
|
||||
git branch gh-pages origin/gh-pages
|
||||
docker run --rm -v $(Build.SourcesDirectory):/home/libgit2/source -w /home/libgit2/source libgit2/docurium:latest cm doc api.docurium
|
||||
git checkout gh-pages
|
||||
cp -R * '$(Build.BinariesDirectory)'
|
||||
displayName: 'Generate Documentation'
|
||||
- task: archivefiles@2
|
||||
displayName: 'Archive Documentation'
|
||||
inputs:
|
||||
rootFolderOrFile: '$(Build.BinariesDirectory)'
|
||||
includeRootFolder: false
|
||||
archiveFile: '$(Build.ArtifactStagingDirectory)/api-documentation.zip'
|
||||
- task: publishbuildartifacts@1
|
||||
displayName: 'Upload Documentation Artifact'
|
||||
inputs:
|
||||
pathToPublish: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: 'docs'
|
||||
- script: |
|
||||
git remote -v
|
||||
echo 'machine github.com' > ~/.netrc
|
||||
echo 'login $(GITHUB_USERNAME)' >> ~/.netrc
|
||||
echo 'password $(GITHUB_PAT)' >> ~/.netrc
|
||||
git push origin gh-pages
|
||||
displayName: 'Publish Documentation'
|
||||
condition: and(eq(variables['Build.Repository.Name'], 'libgit2/libgit2'), eq(variables['Build.Reason'], 'IndividualCI'))
|
||||
@@ -1,17 +0,0 @@
|
||||
# These are the steps used for building on machines with bash.
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/build.sh'
|
||||
displayName: Build
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
env: ${{ parameters.environmentVariables }}
|
||||
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/test.sh'
|
||||
displayName: Test
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
env: ${{ parameters.environmentVariables }}
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Test Results
|
||||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
testResultsFiles: 'results_*.xml'
|
||||
searchFolder: '$(Build.BinariesDirectory)'
|
||||
mergeTestResults: true
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Environment variables:
|
||||
#
|
||||
# SOURCE_DIR: Set to the directory of the libgit2 source (optional)
|
||||
# If not set, it will be derived relative to this script.
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
BUILD_PATH=${BUILD_PATH:=$PATH}
|
||||
CMAKE=$(which cmake)
|
||||
CMAKE_GENERATOR=${CMAKE_GENERATOR:-Unix Makefiles}
|
||||
|
||||
indent() { sed "s/^/ /"; }
|
||||
|
||||
echo "Source directory: ${SOURCE_DIR}"
|
||||
echo "Build directory: ${BUILD_DIR}"
|
||||
echo ""
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "macOS version:"
|
||||
sw_vers | indent
|
||||
fi
|
||||
|
||||
if [ -f "/etc/debian_version" ]; then
|
||||
echo "Debian version:"
|
||||
(source /etc/lsb-release && echo "${DISTRIB_DESCRIPTION}") | indent
|
||||
fi
|
||||
|
||||
echo "Kernel version:"
|
||||
uname -a 2>&1 | indent
|
||||
|
||||
echo "CMake version:"
|
||||
env PATH="$BUILD_PATH" "$CMAKE" --version 2>&1 | indent
|
||||
|
||||
if test -n "$CC"; then
|
||||
echo "Compiler version:"
|
||||
"$CC" --version 2>&1 | indent
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Configuring build environment"
|
||||
echo "##############################################################################"
|
||||
|
||||
echo cmake ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G \"${CMAKE_GENERATOR}\" ${CMAKE_OPTIONS}
|
||||
env PATH="$BUILD_PATH" "$CMAKE" ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G "${CMAKE_GENERATOR}" ${CMAKE_OPTIONS}
|
||||
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Building libgit2"
|
||||
echo "##############################################################################"
|
||||
|
||||
env PATH="$BUILD_PATH" "$CMAKE" --build .
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Environment check
|
||||
[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
|
||||
case $(uname -m) in
|
||||
i?86) BITS=32 ;;
|
||||
amd64|x86_64) BITS=64 ;;
|
||||
esac
|
||||
SCAN_TOOL=https://scan.coverity.com/download/cxx/linux${BITS}
|
||||
TOOL_BASE=$(pwd)/_coverity-scan
|
||||
|
||||
# Install coverity tools
|
||||
if [ ! -d "$TOOL_BASE" ]; then
|
||||
echo "Downloading coverity..."
|
||||
mkdir -p "$TOOL_BASE"
|
||||
pushd "$TOOL_BASE"
|
||||
wget -O coverity_tool.tgz $SCAN_TOOL \
|
||||
--post-data "project=libgit2&token=$COVERITY_TOKEN"
|
||||
tar xzf coverity_tool.tgz
|
||||
popd
|
||||
TOOL_DIR=$(find "$TOOL_BASE" -type d -name 'cov-analysis*')
|
||||
ln -s "$TOOL_DIR" "$TOOL_BASE"/cov-analysis
|
||||
fi
|
||||
|
||||
cp "${SOURCE_DIR}/script/user_nodefs.h" "$TOOL_BASE"/cov-analysis/config/user_nodefs.h
|
||||
|
||||
COV_BUILD="$TOOL_BASE/cov-analysis/bin/cov-build"
|
||||
|
||||
# Configure and build
|
||||
cmake ${SOURCE_DIR}
|
||||
|
||||
COVERITY_UNSUPPORTED=1 \
|
||||
$COV_BUILD --dir cov-int \
|
||||
cmake --build .
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Results check
|
||||
[ ! -d "cov-int" ] && echo "Coverity directory not found" && exit 1
|
||||
|
||||
# Upload results
|
||||
tar czf libgit2.tgz cov-int
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
SHA=$(cd ${SOURCE_DIR} && git rev-parse --short HEAD)
|
||||
|
||||
HTML="$(curl \
|
||||
--silent \
|
||||
--write-out "\n%{http_code}" \
|
||||
--form token="$COVERITY_TOKEN" \
|
||||
--form email=libgit2@gmail.com \
|
||||
--form file=@libgit2.tgz \
|
||||
--form version="$SHA" \
|
||||
--form description="libgit2 build" \
|
||||
https://scan.coverity.com/builds?project=libgit2)"
|
||||
|
||||
# Body is everything up to the last line
|
||||
BODY="$(echo "$HTML" | head -n-1)"
|
||||
|
||||
# Status code is the last line
|
||||
STATUS_CODE="$(echo "$HTML" | tail -n1)"
|
||||
|
||||
if [ "${STATUS_CODE}" != "200" -a "${STATUS_CODE}" != "201" ]; then
|
||||
echo "Received error code ${STATUS_CODE} from Coverity"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,38 +0,0 @@
|
||||
resources:
|
||||
- repo: self
|
||||
|
||||
jobs:
|
||||
- job: coverity
|
||||
displayName: 'Coverity'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: Docker@0
|
||||
displayName: Build
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
docker:
|
||||
image: xenial
|
||||
base: xenial
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: |
|
||||
COVERITY_TOKEN=$(COVERITY_TOKEN)
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/coverity-build.sh'
|
||||
detached: false
|
||||
- task: Docker@0
|
||||
displayName: Publish
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: 'libgit2/trusty-openssl:latest'
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: |
|
||||
COVERITY_TOKEN=$(COVERITY_TOKEN)
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/coverity-publish.sh'
|
||||
detached: false
|
||||
continueOnError: true
|
||||
@@ -1,51 +0,0 @@
|
||||
# These are the steps used in a container-based build in VSTS.
|
||||
steps:
|
||||
- ${{ if eq(parameters.qemu, 'true') }}:
|
||||
- script: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
displayName: 'Register Docker QEMU'
|
||||
|
||||
- task: cache@2
|
||||
displayName: Cache Docker layers
|
||||
inputs:
|
||||
key: docker
|
||||
path: /tmp/dockercache
|
||||
- script: |
|
||||
if [ -f /tmp/dockercache/${{parameters.docker.image}}.tar ]; then docker load < /tmp/dockercache/${{parameters.docker.image}}.tar; fi
|
||||
displayName: 'Load Docker cache'
|
||||
- script: |
|
||||
cd $(Build.SourcesDirectory)/azure-pipelines/docker
|
||||
docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} .
|
||||
if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi
|
||||
docker save libgit2/${{parameters.docker.image}} $(docker history -q libgit2/${{parameters.docker.image}} | grep -v '<missing>') > /tmp/dockercache/${{parameters.docker.image}}.tar
|
||||
displayName: 'Build Docker image'
|
||||
- task: docker@0
|
||||
displayName: Build
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: libgit2/${{ parameters.docker.image }}
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: ${{ parameters.environmentVariables }}
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/build.sh'
|
||||
detached: false
|
||||
- task: docker@0
|
||||
displayName: Test
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: libgit2/${{ parameters.docker.image }}
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: ${{ parameters.environmentVariables }}
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/test.sh'
|
||||
detached: false
|
||||
- task: publishtestresults@2
|
||||
displayName: Publish Test Results
|
||||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
testResultsFiles: 'results_*.xml'
|
||||
searchFolder: '$(Build.BinariesDirectory)'
|
||||
mergeTestResults: true
|
||||
@@ -1,41 +0,0 @@
|
||||
ARG BASE
|
||||
FROM $BASE
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
gosu \
|
||||
libcurl4-openssl-dev \
|
||||
libpcre3-dev \
|
||||
libssh2-1-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN mkdir /var/run/sshd
|
||||
|
||||
RUN cd /tmp && \
|
||||
curl -LO https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz && \
|
||||
tar -xf mbedtls-2.16.2-apache.tgz && \
|
||||
rm -f mbedtls-2.16.2-apache.tgz && \
|
||||
cd mbedtls-2.16.2 && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-2.16.2
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod a+x /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
@@ -1,6 +0,0 @@
|
||||
FROM debian:jessie-slim
|
||||
ARG CACHEBUST=1
|
||||
RUN apt-get update
|
||||
RUN apt install -y cmake pkg-config ruby ruby-dev llvm libclang-3.5-dev libssl-dev python-pygments
|
||||
ARG CACHEBUST=1
|
||||
RUN gem install docurium
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
useradd --shell /bin/bash --create-home libgit2
|
||||
chown -R $(id -u libgit2) /home/libgit2
|
||||
exec gosu libgit2 "$@"
|
||||
@@ -1,68 +0,0 @@
|
||||
ARG BASE
|
||||
FROM $BASE AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
bzip2 \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
gosu \
|
||||
krb5-user \
|
||||
libcurl4-gnutls-dev \
|
||||
libgcrypt20-dev \
|
||||
libkrb5-dev \
|
||||
libpcre3-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
make \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
valgrind
|
||||
|
||||
FROM apt AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl -LO https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz && \
|
||||
tar -xf mbedtls-2.16.2-apache.tgz && \
|
||||
rm -f mbedtls-2.16.2-apache.tgz && \
|
||||
cd mbedtls-2.16.2 && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-2.16.2
|
||||
|
||||
FROM mbedtls AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl -LO https://www.libssh2.org/download/libssh2-1.8.2.tar.gz && \
|
||||
tar -xf libssh2-1.8.2.tar.gz && \
|
||||
rm -f libssh2-1.8.2.tar.gz && \
|
||||
cd libssh2-1.8.2 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCRYPTO_BACKEND=Libgcrypt . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.8.2
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl -LO https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2 && \
|
||||
tar -xf valgrind-3.15.0.tar.bz2 && \
|
||||
rm -f valgrind-3.15.0.tar.bz2 && \
|
||||
cd valgrind-3.15.0 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.15.0
|
||||
|
||||
FROM valgrind AS configure
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod a+x /usr/local/bin/entrypoint.sh
|
||||
RUN mkdir /var/run/sshd
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
@@ -1,215 +0,0 @@
|
||||
resources:
|
||||
- repo: self
|
||||
|
||||
jobs:
|
||||
- job: linux_amd64_xenial_gcc_openssl
|
||||
displayName: 'Linux (amd64; Xenial; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_amd64_xenial_gcc_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; GCC; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_amd64_xenial_clang_openssl
|
||||
displayName: 'Linux (amd64; Xenial; Clang; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_amd64_xenial_clang_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; Clang; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: macos
|
||||
displayName: 'macOS'
|
||||
pool:
|
||||
vmImage: 'macOS 10.13'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh'
|
||||
displayName: Setup
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
TMPDIR: $(Agent.TempDirectory)
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_vs_amd64
|
||||
displayName: 'Windows (amd64; Visual Studio)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013 Win64
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_vs_x86
|
||||
displayName: 'Windows (x86; Visual Studio)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_mingw_amd64
|
||||
displayName: 'Windows (amd64; MinGW)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
env:
|
||||
TEMP: $(Agent.TempDirectory)
|
||||
ARCH: amd64
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_mingw_x86
|
||||
displayName: 'Windows (x86; MinGW)'
|
||||
pool: Hosted
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
env:
|
||||
TEMP: $(Agent.TempDirectory)
|
||||
ARCH: x86
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: linux_x86_bionic_gcc_openssl
|
||||
displayName: 'Linux (x86; Bionic; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:x86-bionic
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_x86_bionic_clang_openssl
|
||||
displayName: 'Linux (x86; Bionic; Clang; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:x86-bionic
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_arm32_bionic_gcc_openssl
|
||||
displayName: 'Linux (arm32; Bionic; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:armhf-bionic
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS=true
|
||||
SKIP_PROXY_TESTS=true
|
||||
|
||||
- job: linux_arm64_bionic_gcc_openssl
|
||||
displayName: 'Linux (arm64; Bionic; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:arm64-bionic
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS=true
|
||||
SKIP_PROXY_TESTS=true
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
|
||||
if [ -z "$SKIP_APT" ]; then
|
||||
apt-get update
|
||||
apt-get -y install build-essential pkg-config clang cmake openssl libssl-dev libssh2-1-dev libcurl4-gnutls-dev openssh-server
|
||||
fi
|
||||
|
||||
mkdir -p /var/run/sshd
|
||||
|
||||
if [ "$MBEDTLS" ]; then
|
||||
MBEDTLS_DIR=${MBEDTLS_DIR:-$(mktemp -d ${TMPDIR}/mbedtls.XXXXXXXX)}
|
||||
|
||||
git clone --depth 10 --single-branch --branch mbedtls-2.6.1 https://github.com/ARMmbed/mbedtls.git ${MBEDTLS_DIR}
|
||||
cd ${MBEDTLS_DIR}
|
||||
|
||||
CFLAGS=-fPIC cmake -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON .
|
||||
cmake --build .
|
||||
|
||||
if [ -z "$SKIP_MBEDTLS_INSTALL" ]; then
|
||||
make install
|
||||
fi
|
||||
fi
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Downloading mingw"
|
||||
echo "##############################################################################"
|
||||
|
||||
case "$ARCH" in
|
||||
amd64)
|
||||
MINGW_URI="https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-x86_64-8.1.0-release-win32-seh-rt_v6-rev0.zip";;
|
||||
x86)
|
||||
MINGW_URI="https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-i686-8.1.0-release-win32-sjlj-rt_v6-rev0.zip";;
|
||||
esac
|
||||
|
||||
curl -s -L "$MINGW_URI" -o "$TEMP"/mingw-"$ARCH".zip
|
||||
unzip -q "$TEMP"/mingw-"$ARCH".zip -d "$TEMP"
|
||||
@@ -1,321 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -n "$SKIP_TESTS" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Windows doesn't run the NTLM tests properly (yet)
|
||||
if [[ "$(uname -s)" == MINGW* ]]; then
|
||||
SKIP_NTLM_TESTS=1
|
||||
fi
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
USER=${USER:-$(whoami)}
|
||||
|
||||
SUCCESS=1
|
||||
|
||||
cleanup() {
|
||||
echo "Cleaning up..."
|
||||
|
||||
if [ ! -z "$GITDAEMON_PID" ]; then
|
||||
echo "Stopping git daemon..."
|
||||
kill $GITDAEMON_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$SSHD_DIR" -a -f "${SSHD_DIR}/pid" ]; then
|
||||
echo "Stopping SSH..."
|
||||
kill $(cat "${SSHD_DIR}/pid")
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
run_test() {
|
||||
if [[ "$GITTEST_FLAKY_RETRY" > 0 ]]; then
|
||||
ATTEMPTS_REMAIN=$GITTEST_FLAKY_RETRY
|
||||
else
|
||||
ATTEMPTS_REMAIN=1
|
||||
fi
|
||||
|
||||
FAILED=0
|
||||
while [[ "$ATTEMPTS_REMAIN" > 0 ]]; do
|
||||
if [ "$FAILED" -eq 1 ]; then
|
||||
echo ""
|
||||
echo "Re-running flaky ${1} tests..."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
RETURN_CODE=0
|
||||
|
||||
CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml" ctest -V -R "^${1}$" || RETURN_CODE=$? && true
|
||||
|
||||
if [ "$RETURN_CODE" -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Test exited with code: $RETURN_CODE"
|
||||
ATTEMPTS_REMAIN="$(($ATTEMPTS_REMAIN-1))"
|
||||
FAILED=1
|
||||
done
|
||||
|
||||
if [ "$FAILED" -ne 0 ]; then
|
||||
SUCCESS=0
|
||||
fi
|
||||
}
|
||||
|
||||
# Configure the test environment; run them early so that we're certain
|
||||
# that they're started by the time we need them.
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Configuring test environment"
|
||||
echo "##############################################################################"
|
||||
|
||||
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
|
||||
echo "Starting git daemon..."
|
||||
GITDAEMON_DIR=`mktemp -d ${TMPDIR}/gitdaemon.XXXXXXXX`
|
||||
git init --bare "${GITDAEMON_DIR}/test.git"
|
||||
git daemon --listen=localhost --export-all --enable=receive-pack --base-path="${GITDAEMON_DIR}" "${GITDAEMON_DIR}" 2>/dev/null &
|
||||
GITDAEMON_PID=$!
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_PROXY_TESTS" ]; then
|
||||
curl -L https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar
|
||||
|
||||
echo ""
|
||||
echo "Starting HTTP proxy (Basic)..."
|
||||
java -jar poxyproxy.jar --address 127.0.0.1 --port 8080 --credentials foo:bar --auth-type basic --quiet &
|
||||
|
||||
echo ""
|
||||
echo "Starting HTTP proxy (NTLM)..."
|
||||
java -jar poxyproxy.jar --address 127.0.0.1 --port 8090 --credentials foo:bar --auth-type ntlm --quiet &
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_NTLM_TESTS" ]; then
|
||||
curl -L https://github.com/ethomson/poxygit/releases/download/v0.4.0/poxygit-0.4.0.jar >poxygit.jar
|
||||
|
||||
echo ""
|
||||
echo "Starting HTTP server..."
|
||||
NTLM_DIR=`mktemp -d ${TMPDIR}/ntlm.XXXXXXXX`
|
||||
git init --bare "${NTLM_DIR}/test.git"
|
||||
java -jar poxygit.jar --address 127.0.0.1 --port 9000 --credentials foo:baz --quiet "${NTLM_DIR}" &
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_SSH_TESTS" ]; then
|
||||
echo "Starting ssh daemon..."
|
||||
HOME=`mktemp -d ${TMPDIR}/home.XXXXXXXX`
|
||||
SSHD_DIR=`mktemp -d ${TMPDIR}/sshd.XXXXXXXX`
|
||||
git init --bare "${SSHD_DIR}/test.git"
|
||||
cat >"${SSHD_DIR}/sshd_config" <<-EOF
|
||||
Port 2222
|
||||
ListenAddress 0.0.0.0
|
||||
Protocol 2
|
||||
HostKey ${SSHD_DIR}/id_rsa
|
||||
PidFile ${SSHD_DIR}/pid
|
||||
AuthorizedKeysFile ${HOME}/.ssh/authorized_keys
|
||||
LogLevel DEBUG
|
||||
RSAAuthentication yes
|
||||
PasswordAuthentication yes
|
||||
PubkeyAuthentication yes
|
||||
ChallengeResponseAuthentication no
|
||||
StrictModes no
|
||||
# Required here as sshd will simply close connection otherwise
|
||||
UsePAM no
|
||||
EOF
|
||||
ssh-keygen -t rsa -f "${SSHD_DIR}/id_rsa" -N "" -q
|
||||
/usr/sbin/sshd -f "${SSHD_DIR}/sshd_config" -E "${SSHD_DIR}/log"
|
||||
|
||||
# Set up keys
|
||||
mkdir "${HOME}/.ssh"
|
||||
ssh-keygen -t rsa -f "${HOME}/.ssh/id_rsa" -N "" -q
|
||||
cat "${HOME}/.ssh/id_rsa.pub" >>"${HOME}/.ssh/authorized_keys"
|
||||
while read algorithm key comment; do
|
||||
echo "[localhost]:2222 $algorithm $key" >>"${HOME}/.ssh/known_hosts"
|
||||
done <"${SSHD_DIR}/id_rsa.pub"
|
||||
|
||||
# Get the fingerprint for localhost and remove the colons so we can
|
||||
# parse it as a hex number. Older versions have a different output
|
||||
# format.
|
||||
if [[ $(ssh -V 2>&1) == OpenSSH_6* ]]; then
|
||||
SSH_FINGERPRINT=$(ssh-keygen -F '[localhost]:2222' -f "${HOME}/.ssh/known_hosts" -l | tail -n 1 | cut -d ' ' -f 2 | tr -d ':')
|
||||
else
|
||||
SSH_FINGERPRINT=$(ssh-keygen -E md5 -F '[localhost]:2222' -f "${HOME}/.ssh/known_hosts" -l | tail -n 1 | cut -d ' ' -f 3 | cut -d : -f2- | tr -d :)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the tests that do not require network connectivity.
|
||||
|
||||
if [ -z "$SKIP_OFFLINE_TESTS" ]; then
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Running (offline) tests"
|
||||
echo "##############################################################################"
|
||||
|
||||
run_test offline
|
||||
fi
|
||||
|
||||
if [ -n "$RUN_INVASIVE_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running invasive tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_INVASIVE_FS_SIZE=1
|
||||
export GITTEST_INVASIVE_MEMORY=1
|
||||
export GITTEST_INVASIVE_SPEED=1
|
||||
run_test invasive
|
||||
unset GITTEST_INVASIVE_FS_SIZE
|
||||
unset GITTEST_INVASIVE_MEMORY
|
||||
unset GITTEST_INVASIVE_SPEED
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_ONLINE_TESTS" ]; then
|
||||
# Run the various online tests. The "online" test suite only includes the
|
||||
# default online tests that do not require additional configuration. The
|
||||
# "proxy" and "ssh" test suites require further setup.
|
||||
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Running (online) tests"
|
||||
echo "##############################################################################"
|
||||
|
||||
export GITTEST_FLAKY_RETRY=5
|
||||
run_test online
|
||||
unset GITTEST_FLAKY_RETRY
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running gitdaemon tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="git://localhost/test.git"
|
||||
run_test gitdaemon
|
||||
unset GITTEST_REMOTE_URL
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_PROXY_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running proxy tests (Basic authentication)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_PROXY_HOST="localhost:8080"
|
||||
export GITTEST_REMOTE_PROXY_USER="foo"
|
||||
export GITTEST_REMOTE_PROXY_PASS="bar"
|
||||
run_test proxy
|
||||
unset GITTEST_REMOTE_PROXY_HOST
|
||||
unset GITTEST_REMOTE_PROXY_USER
|
||||
unset GITTEST_REMOTE_PROXY_PASS
|
||||
|
||||
echo ""
|
||||
echo "Running proxy tests (NTLM authentication)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_PROXY_HOST="localhost:8090"
|
||||
export GITTEST_REMOTE_PROXY_USER="foo"
|
||||
export GITTEST_REMOTE_PROXY_PASS="bar"
|
||||
run_test proxy
|
||||
unset GITTEST_REMOTE_PROXY_HOST
|
||||
unset GITTEST_REMOTE_PROXY_USER
|
||||
unset GITTEST_REMOTE_PROXY_PASS
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_NTLM_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running NTLM tests (IIS emulation)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="http://localhost:9000/ntlm/test.git"
|
||||
export GITTEST_REMOTE_USER="foo"
|
||||
export GITTEST_REMOTE_PASS="baz"
|
||||
run_test auth_clone_and_push
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_PASS
|
||||
|
||||
echo ""
|
||||
echo "Running NTLM tests (Apache emulation)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="http://localhost:9000/broken-ntlm/test.git"
|
||||
export GITTEST_REMOTE_USER="foo"
|
||||
export GITTEST_REMOTE_PASS="baz"
|
||||
run_test auth_clone_and_push
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_PASS
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
|
||||
echo ""
|
||||
echo "Running SPNEGO tests"
|
||||
echo ""
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
KINIT_FLAGS="--password-file=STDIN"
|
||||
fi
|
||||
|
||||
echo $GITTEST_NEGOTIATE_PASSWORD | kinit $KINIT_FLAGS test@LIBGIT2.ORG
|
||||
klist -5f
|
||||
|
||||
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
|
||||
export GITTEST_REMOTE_DEFAULT="true"
|
||||
run_test auth_clone
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_DEFAULT
|
||||
|
||||
echo ""
|
||||
echo "Running SPNEGO tests (expect/continue)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
|
||||
export GITTEST_REMOTE_DEFAULT="true"
|
||||
export GITTEST_REMOTE_EXPECTCONTINUE="true"
|
||||
run_test auth_clone
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_DEFAULT
|
||||
unset GITTEST_REMOTE_EXPECTCONTINUE
|
||||
|
||||
kdestroy -A
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_SSH_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running ssh tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="ssh://localhost:2222/$SSHD_DIR/test.git"
|
||||
export GITTEST_REMOTE_USER=$USER
|
||||
export GITTEST_REMOTE_SSH_KEY="${HOME}/.ssh/id_rsa"
|
||||
export GITTEST_REMOTE_SSH_PUBKEY="${HOME}/.ssh/id_rsa.pub"
|
||||
export GITTEST_REMOTE_SSH_PASSPHRASE=""
|
||||
export GITTEST_REMOTE_SSH_FINGERPRINT="${SSH_FINGERPRINT}"
|
||||
run_test ssh
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_SSH_KEY
|
||||
unset GITTEST_REMOTE_SSH_PUBKEY
|
||||
unset GITTEST_REMOTE_SSH_PASSPHRASE
|
||||
unset GITTEST_REMOTE_SSH_FINGERPRINT
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_FUZZERS" ]; then
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Running fuzzers"
|
||||
echo "##############################################################################"
|
||||
|
||||
ctest -V -R 'fuzzer'
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
||||
if [ "$SUCCESS" -ne 1 ]; then
|
||||
echo "Some tests failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Success."
|
||||
exit 0
|
||||
95
ci/build.sh
Executable file
95
ci/build.sh
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Environment variables:
|
||||
#
|
||||
# SOURCE_DIR: Set to the directory of the libgit2 source (optional)
|
||||
# If not set, it will be derived relative to this script.
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
BUILD_PATH=${BUILD_PATH:=$PATH}
|
||||
CMAKE=$(which cmake)
|
||||
CMAKE_GENERATOR=${CMAKE_GENERATOR:-Unix Makefiles}
|
||||
|
||||
indent() { sed "s/^/ /"; }
|
||||
|
||||
cygfullpath() {
|
||||
result=$(echo "${1}" | tr \; \\n | while read -r element; do
|
||||
if [ "${last}" != "" ]; then echo -n ":"; fi
|
||||
echo -n $(cygpath "${element}")
|
||||
last="${element}"
|
||||
done)
|
||||
if [ "${result}" = "" ]; then exit 1; fi
|
||||
echo "${result}"
|
||||
}
|
||||
|
||||
if [[ "$(uname -s)" == MINGW* ]]; then
|
||||
BUILD_PATH=$(cygfullpath "${BUILD_PATH}")
|
||||
fi
|
||||
|
||||
|
||||
echo "Source directory: ${SOURCE_DIR}"
|
||||
echo "Build directory: ${BUILD_DIR}"
|
||||
echo ""
|
||||
|
||||
echo "Platform:"
|
||||
uname -s | indent
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "macOS version:"
|
||||
sw_vers | indent
|
||||
fi
|
||||
|
||||
if [ -f "/etc/debian_version" ]; then
|
||||
echo "Debian version:"
|
||||
(source /etc/lsb-release && echo "${DISTRIB_DESCRIPTION}") | indent
|
||||
fi
|
||||
|
||||
CORES=$(getconf _NPROCESSORS_ONLN || true)
|
||||
echo "Number of cores: ${CORES:-(Unknown)}"
|
||||
|
||||
echo "Kernel version:"
|
||||
uname -a 2>&1 | indent
|
||||
|
||||
echo "CMake version:"
|
||||
env PATH="${BUILD_PATH}" "${CMAKE}" --version | head -1 2>&1 | indent
|
||||
|
||||
if test -n "${CC}"; then
|
||||
echo "Compiler version:"
|
||||
"${CC}" --version 2>&1 | indent
|
||||
fi
|
||||
echo "Environment:"
|
||||
echo "PATH=${BUILD_PATH}" | indent
|
||||
|
||||
if test -n "${CC}"; then
|
||||
echo "CC=${CC}" | indent
|
||||
fi
|
||||
if test -n "${CFLAGS}"; then
|
||||
echo "CFLAGS=${CFLAGS}" | indent
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Configuring build environment"
|
||||
echo "##############################################################################"
|
||||
|
||||
echo "${CMAKE}" -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G \"${CMAKE_GENERATOR}\" ${CMAKE_OPTIONS} -S \"${SOURCE_DIR}\"
|
||||
env PATH="${BUILD_PATH}" "${CMAKE}" -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G "${CMAKE_GENERATOR}" ${CMAKE_OPTIONS} -S "${SOURCE_DIR}"
|
||||
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Building libgit2"
|
||||
echo "##############################################################################"
|
||||
|
||||
# Determine parallelism; newer cmake supports `--build --parallel` but
|
||||
# we cannot yet rely on that.
|
||||
if [ "${CMAKE_GENERATOR}" = "Unix Makefiles" -a "${CORES}" != "" -a "${CMAKE_BUILD_OPTIONS}" = "" ]; then
|
||||
BUILDER=(make -j ${CORES})
|
||||
else
|
||||
BUILDER=("${CMAKE}" --build . ${CMAKE_BUILD_OPTIONS})
|
||||
fi
|
||||
|
||||
echo "${BUILDER[@]}"
|
||||
env PATH="${BUILD_PATH}" "${BUILDER[@]}"
|
||||
62
ci/coverity.sh
Executable file
62
ci/coverity.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if test -z "$COVERITY_TOKEN"
|
||||
then
|
||||
echo "Need to set a coverity token"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $(uname -m) in
|
||||
i?86)
|
||||
BITS=32;;
|
||||
amd64|x86_64)
|
||||
BITS=64;;
|
||||
*)
|
||||
echo "Unsupported arch '$(uname -m)'"
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
SCAN_TOOL=https://scan.coverity.com/download/cxx/linux${BITS}
|
||||
SOURCE_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/..)
|
||||
BUILD_DIR=${SOURCE_DIR}/coverity-build
|
||||
TOOL_DIR=${BUILD_DIR}/coverity-tools
|
||||
|
||||
# Install coverity tools
|
||||
if ! test -d "$TOOL_DIR"
|
||||
then
|
||||
mkdir -p "$TOOL_DIR"
|
||||
curl --silent --show-error --location --data "project=libgit2&token=$COVERITY_TOKEN" "$SCAN_TOOL" |
|
||||
tar -xzC "$TOOL_DIR"
|
||||
ln -s "$(find "$TOOL_DIR" -type d -name 'cov-analysis*')" "$TOOL_DIR"/cov-analysis
|
||||
fi
|
||||
|
||||
cp "${SOURCE_DIR}/script/user_nodefs.h" "$TOOL_DIR"/cov-analysis/config/
|
||||
|
||||
# Build libgit2 with Coverity
|
||||
mkdir -p "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
cmake "$SOURCE_DIR"
|
||||
COVERITY_UNSUPPORTED=1 \
|
||||
"$TOOL_DIR/cov-analysis/bin/cov-build" --dir cov-int \
|
||||
cmake --build .
|
||||
|
||||
# Upload results
|
||||
tar -czf libgit2.tgz cov-int
|
||||
REVISION=$(cd ${SOURCE_DIR} && git rev-parse --short HEAD)
|
||||
HTML="$(curl \
|
||||
--silent --show-error \
|
||||
--write-out "\n%{http_code}" \
|
||||
--form token="$COVERITY_TOKEN" \
|
||||
--form email=libgit2@gmail.com \
|
||||
--form file=@libgit2.tgz \
|
||||
--form version="$REVISION" \
|
||||
--form description="libgit2 build" \
|
||||
https://scan.coverity.com/builds?project=libgit2)"
|
||||
|
||||
# Status code is the last line
|
||||
STATUS_CODE="$(echo "$HTML" | tail -n1)"
|
||||
if test "${STATUS_CODE}" != 200 && test "${STATUS_CODE}" != 201
|
||||
then
|
||||
echo "Received error code ${STATUS_CODE} from Coverity"
|
||||
exit 1
|
||||
fi
|
||||
57
ci/docker/bionic
Normal file
57
ci/docker/bionic
Normal file
@@ -0,0 +1,57 @@
|
||||
ARG BASE=ubuntu:bionic
|
||||
|
||||
FROM ${BASE} AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
krb5-user \
|
||||
libcurl4-openssl-dev \
|
||||
libkrb5-dev \
|
||||
libpcre3-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
sudo \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM apt AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.16.2.tar.gz | \
|
||||
tar -xz && \
|
||||
cd mbedtls-mbedtls-2.16.2 && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-mbedtls-2.16.2
|
||||
|
||||
FROM mbedtls AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.11.0.tar.gz | tar -xz && \
|
||||
cd libssh2-1.11.0 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DBUILD_SHARED_LIBS=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.11.0
|
||||
|
||||
FROM libssh2 AS adduser
|
||||
ARG UID=""
|
||||
ARG GID=""
|
||||
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
|
||||
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
|
||||
groupadd ${GROUP_ARG} libgit2 && \
|
||||
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
|
||||
|
||||
FROM adduser AS configure
|
||||
RUN mkdir /var/run/sshd
|
||||
60
ci/docker/centos7
Normal file
60
ci/docker/centos7
Normal file
@@ -0,0 +1,60 @@
|
||||
ARG BASE=centos:7
|
||||
|
||||
FROM ${BASE} AS yum
|
||||
RUN yum install -y \
|
||||
which \
|
||||
bzip2 \
|
||||
git \
|
||||
libarchive \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
openssl-devel \
|
||||
openssh-server \
|
||||
git-daemon \
|
||||
java-1.8.0-openjdk-headless \
|
||||
sudo \
|
||||
python
|
||||
|
||||
FROM yum AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.11.0.tar.gz | tar -xz && \
|
||||
cd libssh2-1.11.0 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf libssh-1.11.0
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2 | \
|
||||
tar -xj && \
|
||||
cd valgrind-3.15.0 && \
|
||||
./configure && \
|
||||
make MAKEFLAGS="-j -l$(grep -c ^processor /proc/cpuinfo)" && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.15.0
|
||||
|
||||
FROM valgrind AS cmake
|
||||
RUN cd /tmp && \
|
||||
curl -L https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1.tar.gz | tar -xz && \
|
||||
cd cmake-3.21.1 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf cmake-3.21.1
|
||||
|
||||
FROM cmake AS adduser
|
||||
ARG UID=""
|
||||
ARG GID=""
|
||||
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
|
||||
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
|
||||
groupadd ${GROUP_ARG} libgit2 && \
|
||||
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
|
||||
|
||||
FROM adduser AS configure
|
||||
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
|
||||
RUN mkdir /var/run/sshd
|
||||
58
ci/docker/centos8
Normal file
58
ci/docker/centos8
Normal file
@@ -0,0 +1,58 @@
|
||||
ARG BASE=centos:8
|
||||
|
||||
FROM ${BASE} AS stream
|
||||
RUN dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos && \
|
||||
dnf -y distro-sync
|
||||
|
||||
FROM stream AS yum
|
||||
RUN yum install -y \
|
||||
which \
|
||||
bzip2 \
|
||||
git \
|
||||
libarchive \
|
||||
cmake \
|
||||
gcc \
|
||||
make \
|
||||
openssl-devel \
|
||||
openssh-server \
|
||||
git-daemon \
|
||||
java-1.8.0-openjdk-headless \
|
||||
sudo \
|
||||
python39 \
|
||||
krb5-workstation \
|
||||
krb5-libs
|
||||
|
||||
FROM yum AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.11.0.tar.gz | tar -xz && \
|
||||
cd libssh2-1.11.0 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.11.0
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2 | \
|
||||
tar -xj && \
|
||||
cd valgrind-3.15.0 && \
|
||||
./configure && \
|
||||
make MAKEFLAGS="-j -l$(grep -c ^processor /proc/cpuinfo)" && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.15.0
|
||||
|
||||
FROM valgrind AS adduser
|
||||
ARG UID=""
|
||||
ARG GID=""
|
||||
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
|
||||
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
|
||||
groupadd ${GROUP_ARG} libgit2 && \
|
||||
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
|
||||
|
||||
FROM adduser AS configure
|
||||
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
|
||||
RUN mkdir /var/run/sshd
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local && \
|
||||
ldconfig
|
||||
5
ci/docker/docurium
Normal file
5
ci/docker/docurium
Normal file
@@ -0,0 +1,5 @@
|
||||
ARG BASE=ubuntu:bionic
|
||||
|
||||
FROM ${BASE}
|
||||
RUN apt update && apt install -y cmake pkg-config ruby ruby-dev llvm libclang-dev libssl-dev python-pygments
|
||||
RUN gem install docurium
|
||||
85
ci/docker/focal
Normal file
85
ci/docker/focal
Normal file
@@ -0,0 +1,85 @@
|
||||
ARG BASE=ubuntu:focal
|
||||
|
||||
FROM ${BASE} AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
bzip2 \
|
||||
clang-10 \
|
||||
cmake \
|
||||
curl \
|
||||
gcc-10 \
|
||||
git \
|
||||
krb5-user \
|
||||
libcurl4-gnutls-dev \
|
||||
libgcrypt20-dev \
|
||||
libkrb5-dev \
|
||||
libpcre3-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
llvm-10 \
|
||||
make \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
sudo \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
mkdir /usr/local/msan
|
||||
|
||||
FROM apt AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.16.2.tar.gz | \
|
||||
tar -xz && \
|
||||
cd mbedtls-mbedtls-2.16.2 && \
|
||||
scripts/config.pl unset MBEDTLS_AESNI_C && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
mkdir build build-msan && \
|
||||
cd build && \
|
||||
CC=clang-10 CFLAGS="-fPIC" cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
|
||||
ninja install && \
|
||||
cd ../build-msan && \
|
||||
CC=clang-10 CFLAGS="-fPIC" cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF -DCMAKE_BUILD_TYPE=MemSanDbg -DCMAKE_INSTALL_PREFIX=/usr/local/msan .. && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-mbedtls-2.16.2
|
||||
|
||||
FROM mbedtls AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.9.0.tar.gz | tar -xz && \
|
||||
cd libssh2-1.9.0 && \
|
||||
mkdir build build-msan && \
|
||||
cd build && \
|
||||
CC=clang-10 CFLAGS="-fPIC" cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
|
||||
ninja install && \
|
||||
cd ../build-msan && \
|
||||
CC=clang-10 CFLAGS="-fPIC -fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" LDFLAGS="-fsanitize=memory" cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCRYPTO_BACKEND=mbedTLS -DCMAKE_PREFIX_PATH=/usr/local/msan -DCMAKE_INSTALL_PREFIX=/usr/local/msan .. && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.9.0
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2 | \
|
||||
tar -xj && \
|
||||
cd valgrind-3.15.0 && \
|
||||
CC=clang-10 ./configure && \
|
||||
make MAKEFLAGS="-j -l$(grep -c ^processor /proc/cpuinfo)" && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.15.0
|
||||
|
||||
FROM valgrind AS adduser
|
||||
ARG UID=""
|
||||
ARG GID=""
|
||||
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
|
||||
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
|
||||
groupadd ${GROUP_ARG} libgit2 && \
|
||||
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
|
||||
|
||||
|
||||
FROM adduser AS configure
|
||||
RUN mkdir /var/run/sshd
|
||||
88
ci/docker/noble
Normal file
88
ci/docker/noble
Normal file
@@ -0,0 +1,88 @@
|
||||
ARG BASE=ubuntu:noble
|
||||
|
||||
FROM ${BASE} AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
bzip2 \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
krb5-user \
|
||||
libclang-rt-17-dev \
|
||||
libcurl4-gnutls-dev \
|
||||
libgcrypt20-dev \
|
||||
libkrb5-dev \
|
||||
libpcre3-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
llvm-17 \
|
||||
make \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python3 \
|
||||
sudo \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
mkdir /usr/local/msan
|
||||
|
||||
FROM apt AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.28.6.tar.gz | \
|
||||
tar -xz && \
|
||||
cd mbedtls-mbedtls-2.28.6 && \
|
||||
scripts/config.pl unset MBEDTLS_AESNI_C && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
mkdir build build-msan && \
|
||||
cd build && \
|
||||
CC=clang-17 CFLAGS="-fPIC" cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
|
||||
ninja install && \
|
||||
cd ../build-msan && \
|
||||
CC=clang-17 CFLAGS="-fPIC" cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF -DCMAKE_BUILD_TYPE=MemSanDbg -DCMAKE_INSTALL_PREFIX=/usr/local/msan .. && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-mbedtls-2.28.6
|
||||
|
||||
FROM mbedtls AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.11.0.tar.gz | tar -xz && \
|
||||
cd libssh2-1.11.0 && \
|
||||
mkdir build build-msan && \
|
||||
cd build && \
|
||||
CC=clang-17 CFLAGS="-fPIC" cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
|
||||
ninja install && \
|
||||
cd ../build-msan && \
|
||||
CC=clang-17 CFLAGS="-fPIC -fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" LDFLAGS="-fsanitize=memory" cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCRYPTO_BACKEND=mbedTLS -DCMAKE_PREFIX_PATH=/usr/local/msan -DCMAKE_INSTALL_PREFIX=/usr/local/msan .. && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.11.0
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://sourceware.org/pub/valgrind/valgrind-3.22.0.tar.bz2 | \
|
||||
tar -xj && \
|
||||
cd valgrind-3.22.0 && \
|
||||
CC=clang-17 ./configure && \
|
||||
make MAKEFLAGS="-j -l$(grep -c ^processor /proc/cpuinfo)" && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.22.0
|
||||
|
||||
FROM valgrind AS adduser
|
||||
ARG UID=""
|
||||
ARG GID=""
|
||||
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
|
||||
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
|
||||
groupadd ${GROUP_ARG} libgit2 && \
|
||||
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
|
||||
|
||||
FROM adduser AS ldconfig
|
||||
RUN ldconfig
|
||||
|
||||
FROM ldconfig AS configure
|
||||
RUN mkdir /var/run/sshd
|
||||
84
ci/docker/xenial
Normal file
84
ci/docker/xenial
Normal file
@@ -0,0 +1,84 @@
|
||||
ARG BASE=ubuntu:xenial
|
||||
|
||||
FROM ${BASE} AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
bzip2 \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gettext \
|
||||
gcc \
|
||||
krb5-user \
|
||||
libcurl4-gnutls-dev \
|
||||
libexpat1-dev \
|
||||
libgcrypt20-dev \
|
||||
libintl-perl \
|
||||
libkrb5-dev \
|
||||
libpcre3-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
make \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
sudo \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM apt AS git
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://github.com/git/git/archive/refs/tags/v2.39.1.tar.gz | \
|
||||
tar -xz && \
|
||||
cd git-2.39.1 && \
|
||||
make && \
|
||||
make prefix=/usr install && \
|
||||
cd .. && \
|
||||
rm -rf git-2.39.1
|
||||
|
||||
FROM git AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.16.2.tar.gz | \
|
||||
tar -xz && \
|
||||
cd mbedtls-mbedtls-2.16.2 && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-mbedtls-2.16.2
|
||||
|
||||
FROM mbedtls AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.11.0.tar.gz | tar -xz && \
|
||||
cd libssh2-1.11.0 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DBUILD_SHARED_LIBS=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.11.0
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2 | \
|
||||
tar -xj && \
|
||||
cd valgrind-3.15.0 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.15.0
|
||||
|
||||
FROM valgrind AS adduser
|
||||
ARG UID=""
|
||||
ARG GID=""
|
||||
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
|
||||
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
|
||||
groupadd ${GROUP_ARG} libgit2 && \
|
||||
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
|
||||
|
||||
|
||||
FROM adduser AS configure
|
||||
RUN mkdir /var/run/sshd
|
||||
27
ci/setup-mingw-build.sh
Executable file
27
ci/setup-mingw-build.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Downloading mingw"
|
||||
echo "##############################################################################"
|
||||
|
||||
BUILD_TEMP=${BUILD_TEMP:=$TEMP}
|
||||
BUILD_TEMP=$(cygpath $BUILD_TEMP)
|
||||
|
||||
case "$ARCH" in
|
||||
amd64)
|
||||
MINGW_URI="https://github.com/libgit2/ci-dependencies/releases/download/2023-01-23/mingw-x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.zip";;
|
||||
x86)
|
||||
MINGW_URI="https://github.com/libgit2/ci-dependencies/releases/download/2023-01-23/mingw-i686-8.1.0-release-win32-sjlj-rt_v6-rev0.zip";;
|
||||
esac
|
||||
|
||||
if [ -z "$MINGW_URI" ]; then
|
||||
echo "No URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$BUILD_TEMP"
|
||||
|
||||
curl -s -L "$MINGW_URI" -o "$BUILD_TEMP"/mingw-"$ARCH".zip
|
||||
unzip -q "$BUILD_TEMP"/mingw-"$ARCH".zip -d "$BUILD_TEMP"
|
||||
6
ci/setup-osx-benchmark.sh
Executable file
6
ci/setup-osx-benchmark.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
brew update
|
||||
brew install hyperfine
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -ex
|
||||
|
||||
brew update
|
||||
brew install pkgconfig zlib curl openssl libssh2 ninja
|
||||
brew install pkgconfig libssh2 ninja
|
||||
|
||||
ln -s /Applications/Xcode.app/Contents/Developer/usr/lib/libLeaksAtExit.dylib /usr/local/lib
|
||||
20
ci/setup-ubuntu-benchmark.sh
Executable file
20
ci/setup-ubuntu-benchmark.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
cargo \
|
||||
cmake \
|
||||
gcc \
|
||||
git \
|
||||
krb5-user \
|
||||
libkrb5-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
make \
|
||||
ninja-build \
|
||||
pkgconf
|
||||
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.12.0/hyperfine_1.12.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.12.0_amd64.deb
|
||||
9
ci/setup-win32-benchmark.sh
Executable file
9
ci/setup-win32-benchmark.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
choco install hyperfine zip
|
||||
|
||||
CHOCO_PATH=$(mktemp -d)
|
||||
curl -L https://github.com/ethomson/PurgeStandbyList/releases/download/v1.0/purgestandbylist.1.0.0.nupkg -o "${CHOCO_PATH}/purgestandbylist.1.0.0.nupkg"
|
||||
choco install purgestandbylist -s $(cygpath -w "${CHOCO_PATH}")
|
||||
27
ci/setup-win32-build.sh
Executable file
27
ci/setup-win32-build.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Downloading libssh2"
|
||||
echo "##############################################################################"
|
||||
|
||||
BUILD_TEMP=${BUILD_TEMP:=$TEMP}
|
||||
BUILD_TEMP=$(cygpath $BUILD_TEMP)
|
||||
|
||||
case "$ARCH" in
|
||||
amd64)
|
||||
LIBSSH2_URI="https://github.com/libgit2/ci-dependencies/releases/download/2023-02-01/libssh2-20230201-amd64.zip";;
|
||||
x86)
|
||||
LIBSSH2_URI="https://github.com/libgit2/ci-dependencies/releases/download/2023-02-01-v2/libssh2-20230201-x86.zip";;
|
||||
esac
|
||||
|
||||
if [ -z "$LIBSSH2_URI" ]; then
|
||||
echo "No URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$BUILD_TEMP"
|
||||
|
||||
curl -s -L "$LIBSSH2_URI" -o "$BUILD_TEMP"/libssh2-"$ARCH".zip
|
||||
unzip -q "$BUILD_TEMP"/libssh2-"$ARCH".zip -d "$BUILD_TEMP"
|
||||
492
ci/test.sh
Executable file
492
ci/test.sh
Executable file
@@ -0,0 +1,492 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -n "$SKIP_TESTS" ]; then
|
||||
if [ -z "$SKIP_OFFLINE_TESTS" ]; then SKIP_OFFLINE_TESTS=1; fi
|
||||
if [ -z "$SKIP_ONLINE_TESTS" ]; then SKIP_ONLINE_TESTS=1; fi
|
||||
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then SKIP_GITDAEMON_TESTS=1; fi
|
||||
if [ -z "$SKIP_PROXY_TESTS" ]; then SKIP_PROXY_TESTS=1; fi
|
||||
if [ -z "$SKIP_NTLM_TESTS" ]; then SKIP_NTLM_TESTS=1; fi
|
||||
if [ -z "$SKIP_NEGOTIATE_TESTS" ]; then SKIP_NEGOTIATE_TESTS=1; fi
|
||||
if [ -z "$SKIP_SSH_TESTS" ]; then SKIP_SSH_TESTS=1; fi
|
||||
if [ -z "$SKIP_FUZZERS" ]; then SKIP_FUZZERS=1; fi
|
||||
fi
|
||||
|
||||
# Windows doesn't run the NTLM tests properly (yet)
|
||||
if [[ "$(uname -s)" == MINGW* ]]; then
|
||||
SKIP_NTLM_TESTS=1
|
||||
fi
|
||||
|
||||
# older versions of git don't support push options
|
||||
if [ -z "$SKIP_PUSHOPTIONS_TESTS" ]; then
|
||||
export GITTEST_PUSH_OPTIONS=true
|
||||
fi
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
BUILD_PATH=${BUILD_PATH:=$PATH}
|
||||
CTEST=$(which ctest)
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
USER=${USER:-$(whoami)}
|
||||
|
||||
GITTEST_SSH_KEYTYPE=${GITTEST_SSH_KEYTYPE:="ecdsa"}
|
||||
|
||||
HOME=`mktemp -d ${TMPDIR}/home.XXXXXXXX`
|
||||
export CLAR_HOMEDIR=${HOME}
|
||||
|
||||
SUCCESS=1
|
||||
CONTINUE_ON_FAILURE=0
|
||||
|
||||
should_run() {
|
||||
eval "skip=\${SKIP_${1}}"
|
||||
[ -z "$skip" \
|
||||
-o "$skip" == "no" -o "$skip" == "NO" \
|
||||
-o "$skip" == "n" -o "$skip" == "N" \
|
||||
-o "$skip" == "false" -o "$skip" == "FALSE" \
|
||||
-o "$skip" == "f" -o "$skip" == "F" \
|
||||
-o "$skip" == "0" ]
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
echo "Cleaning up..."
|
||||
|
||||
if [ ! -z "$GIT_STANDARD_PID" ]; then
|
||||
echo "Stopping git daemon (standard)..."
|
||||
kill $GIT_STANDARD_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$GIT_NAMESPACE_PID" ]; then
|
||||
echo "Stopping git daemon (namespace)..."
|
||||
kill $GIT_NAMESPACE_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$GIT_SHA256_PID" ]; then
|
||||
echo "Stopping git daemon (sha256)..."
|
||||
kill $GIT_SHA256_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$PROXY_BASIC_PID" ]; then
|
||||
echo "Stopping proxy (Basic)..."
|
||||
kill $PROXY_BASIC_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$PROXY_NTLM_PID" ]; then
|
||||
echo "Stopping proxy (NTLM)..."
|
||||
kill $PROXY_NTLM_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$HTTP_PID" ]; then
|
||||
echo "Stopping HTTP server..."
|
||||
kill $HTTP_PID
|
||||
fi
|
||||
|
||||
if [ ! -z "$SSHD_DIR" -a -f "${SSHD_DIR}/pid" ]; then
|
||||
echo "Stopping SSH server..."
|
||||
kill $(cat "${SSHD_DIR}/pid")
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
run_test() {
|
||||
if [[ "$GITTEST_FLAKY_RETRY" > 0 ]]; then
|
||||
ATTEMPTS_REMAIN=$GITTEST_FLAKY_RETRY
|
||||
else
|
||||
ATTEMPTS_REMAIN=1
|
||||
fi
|
||||
|
||||
FAILED=0
|
||||
while [[ "$ATTEMPTS_REMAIN" > 0 ]]; do
|
||||
if [ "$FAILED" -eq 1 ]; then
|
||||
echo ""
|
||||
echo "Re-running flaky ${1} tests..."
|
||||
echo ""
|
||||
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
RETURN_CODE=0
|
||||
|
||||
(
|
||||
export PATH="${BUILD_PATH}"
|
||||
export CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml"
|
||||
"${CTEST}" -V -R "^${1}$"
|
||||
) || RETURN_CODE=$? && true
|
||||
|
||||
if [ "$RETURN_CODE" -eq 0 ]; then
|
||||
FAILED=0
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Test exited with code: $RETURN_CODE"
|
||||
ATTEMPTS_REMAIN="$(($ATTEMPTS_REMAIN-1))"
|
||||
FAILED=1
|
||||
done
|
||||
|
||||
if [ "$FAILED" -ne 0 ]; then
|
||||
if [ "$CONTINUE_ON_FAILURE" -ne 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SUCCESS=0
|
||||
fi
|
||||
}
|
||||
|
||||
indent() { sed "s/^/ /"; }
|
||||
|
||||
cygfullpath() {
|
||||
result=$(echo "${1}" | tr \; \\n | while read -r element; do
|
||||
if [ "${last}" != "" ]; then echo -n ":"; fi
|
||||
echo -n $(cygpath "${element}")
|
||||
last="${element}"
|
||||
done)
|
||||
if [ "${result}" = "" ]; then exit 1; fi
|
||||
echo "${result}"
|
||||
}
|
||||
|
||||
if [[ "$(uname -s)" == MINGW* ]]; then
|
||||
BUILD_PATH=$(cygfullpath "$BUILD_PATH")
|
||||
fi
|
||||
|
||||
|
||||
# Configure the test environment; run them early so that we're certain
|
||||
# that they're started by the time we need them.
|
||||
|
||||
echo "CTest version:"
|
||||
env PATH="${BUILD_PATH}" "${CTEST}" --version | head -1 2>&1 | indent
|
||||
|
||||
echo ""
|
||||
|
||||
echo "##############################################################################"
|
||||
echo "## Configuring test environment"
|
||||
echo "##############################################################################"
|
||||
|
||||
echo ""
|
||||
|
||||
if should_run "GITDAEMON_TESTS"; then
|
||||
echo "Starting git daemon (standard)..."
|
||||
GIT_STANDARD_DIR=`mktemp -d ${TMPDIR}/git_standard.XXXXXXXX`
|
||||
cp -R "${SOURCE_DIR}/tests/resources/pushoptions.git" "${GIT_STANDARD_DIR}/test.git"
|
||||
git daemon --listen=localhost --export-all --enable=receive-pack --base-path="${GIT_STANDARD_DIR}" "${GIT_STANDARD_DIR}" 2>/dev/null &
|
||||
|
||||
GIT_STANDARD_PID=$!
|
||||
|
||||
echo "Starting git daemon (namespace)..."
|
||||
GIT_NAMESPACE_DIR=`mktemp -d ${TMPDIR}/git_namespace.XXXXXXXX`
|
||||
cp -R "${SOURCE_DIR}/tests/resources/namespace.git" "${GIT_NAMESPACE_DIR}/namespace.git"
|
||||
GIT_NAMESPACE="name1" git daemon --listen=localhost --port=9419 --export-all --enable=receive-pack --base-path="${GIT_NAMESPACE_DIR}" "${GIT_NAMESPACE_DIR}" &
|
||||
GIT_NAMESPACE_PID=$!
|
||||
|
||||
echo "Starting git daemon (sha256)..."
|
||||
GIT_SHA256_DIR=`mktemp -d ${TMPDIR}/git_sha256.XXXXXXXX`
|
||||
cp -R "${SOURCE_DIR}/tests/resources/testrepo_256.git" "${GIT_SHA256_DIR}/testrepo_256.git"
|
||||
git daemon --listen=localhost --port=9420 --export-all --enable=receive-pack --base-path="${GIT_SHA256_DIR}" "${GIT_SHA256_DIR}" &
|
||||
GIT_SHA256_PID=$!
|
||||
fi
|
||||
|
||||
if should_run "PROXY_TESTS"; then
|
||||
curl --location --silent --show-error https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar
|
||||
|
||||
echo "Starting HTTP proxy (Basic)..."
|
||||
java -jar poxyproxy.jar --address 127.0.0.1 --port 8080 --credentials foo:bar --auth-type basic --quiet &
|
||||
PROXY_BASIC_PID=$!
|
||||
|
||||
echo "Starting HTTP proxy (NTLM)..."
|
||||
java -jar poxyproxy.jar --address 127.0.0.1 --port 8090 --credentials foo:bar --auth-type ntlm --quiet &
|
||||
PROXY_NTLM_PID=$!
|
||||
fi
|
||||
|
||||
if should_run "NTLM_TESTS" || should_run "ONLINE_TESTS"; then
|
||||
curl --location --silent --show-error https://github.com/ethomson/poxygit/releases/download/v0.6.0/poxygit-0.6.0.jar >poxygit.jar
|
||||
|
||||
echo "Starting HTTP server..."
|
||||
HTTP_DIR=`mktemp -d ${TMPDIR}/http.XXXXXXXX`
|
||||
cp -R "${SOURCE_DIR}/tests/resources/pushoptions.git" "${HTTP_DIR}/test.git"
|
||||
|
||||
java -jar poxygit.jar --address 127.0.0.1 --port 9000 --credentials foo:baz --quiet "${HTTP_DIR}" &
|
||||
HTTP_PID=$!
|
||||
fi
|
||||
|
||||
if should_run "SSH_TESTS"; then
|
||||
echo "Starting SSH server..."
|
||||
SSHD_DIR=`mktemp -d ${TMPDIR}/sshd.XXXXXXXX`
|
||||
cp -R "${SOURCE_DIR}/tests/resources/pushoptions.git" "${SSHD_DIR}/test.git"
|
||||
|
||||
cat >"${SSHD_DIR}/sshd_config" <<-EOF
|
||||
Port 2222
|
||||
ListenAddress 0.0.0.0
|
||||
Protocol 2
|
||||
HostKey ${SSHD_DIR}/id_${GITTEST_SSH_KEYTYPE}
|
||||
PidFile ${SSHD_DIR}/pid
|
||||
AuthorizedKeysFile ${HOME}/.ssh/authorized_keys
|
||||
LogLevel DEBUG
|
||||
RSAAuthentication yes
|
||||
PasswordAuthentication yes
|
||||
PubkeyAuthentication yes
|
||||
ChallengeResponseAuthentication no
|
||||
StrictModes no
|
||||
HostCertificate ${SSHD_DIR}/id_${GITTEST_SSH_KEYTYPE}.pub
|
||||
HostKey ${SSHD_DIR}/id_${GITTEST_SSH_KEYTYPE}
|
||||
# Required here as sshd will simply close connection otherwise
|
||||
UsePAM no
|
||||
EOF
|
||||
ssh-keygen -t "${GITTEST_SSH_KEYTYPE}" -f "${SSHD_DIR}/id_${GITTEST_SSH_KEYTYPE}" -N "" -q
|
||||
/usr/sbin/sshd -f "${SSHD_DIR}/sshd_config" -E "${SSHD_DIR}/log"
|
||||
|
||||
# Set up keys
|
||||
mkdir "${HOME}/.ssh"
|
||||
ssh-keygen -t "${GITTEST_SSH_KEYTYPE}" -f "${HOME}/.ssh/id_${GITTEST_SSH_KEYTYPE}" -N "" -q
|
||||
cat "${HOME}/.ssh/id_${GITTEST_SSH_KEYTYPE}.pub" >>"${HOME}/.ssh/authorized_keys"
|
||||
while read algorithm key comment; do
|
||||
echo "[localhost]:2222 $algorithm $key" >>"${HOME}/.ssh/known_hosts"
|
||||
done <"${SSHD_DIR}/id_${GITTEST_SSH_KEYTYPE}.pub"
|
||||
|
||||
# Append the github.com keys for the tests that don't override checks.
|
||||
# We ask for ssh-rsa to test that the selection based off of known_hosts
|
||||
# is working.
|
||||
ssh-keyscan -t ssh-rsa github.com >>"${HOME}/.ssh/known_hosts"
|
||||
|
||||
# Get the fingerprint for localhost and remove the colons so we can
|
||||
# parse it as a hex number. Older versions have a different output
|
||||
# format.
|
||||
if [[ $(ssh -V 2>&1) == OpenSSH_6* ]]; then
|
||||
SSH_FINGERPRINT=$(ssh-keygen -F '[localhost]:2222' -f "${HOME}/.ssh/known_hosts" -l | tail -n 1 | cut -d ' ' -f 2 | tr -d ':')
|
||||
else
|
||||
SSH_FINGERPRINT=$(ssh-keygen -E md5 -F '[localhost]:2222' -f "${HOME}/.ssh/known_hosts" -l | tail -n 1 | cut -d ' ' -f 3 | cut -d : -f2- | tr -d :)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the tests that do not require network connectivity.
|
||||
|
||||
if should_run "OFFLINE_TESTS"; then
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Running core tests"
|
||||
echo "##############################################################################"
|
||||
|
||||
echo ""
|
||||
echo "Running libgit2 integration (offline) tests"
|
||||
echo ""
|
||||
run_test offline
|
||||
|
||||
echo ""
|
||||
echo "Running utility tests"
|
||||
echo ""
|
||||
run_test util
|
||||
fi
|
||||
|
||||
if [ -n "$RUN_INVASIVE_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running invasive tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_INVASIVE_FS_SIZE=1
|
||||
export GITTEST_INVASIVE_MEMORY=1
|
||||
export GITTEST_INVASIVE_SPEED=1
|
||||
run_test invasive
|
||||
unset GITTEST_INVASIVE_FS_SIZE
|
||||
unset GITTEST_INVASIVE_MEMORY
|
||||
unset GITTEST_INVASIVE_SPEED
|
||||
fi
|
||||
|
||||
# the various network tests can fail due to network connectivity problems;
|
||||
# allow them to retry up to 5 times
|
||||
export GITTEST_FLAKY_RETRY=5
|
||||
|
||||
if should_run "ONLINE_TESTS"; then
|
||||
# Run the online tests. The "online" test suite only includes the
|
||||
# default online tests that do not require additional configuration.
|
||||
# The "proxy" and "ssh" test suites require further setup.
|
||||
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Running networking (online) tests"
|
||||
echo "##############################################################################"
|
||||
|
||||
export GITTEST_REMOTE_REDIRECT_INITIAL="http://localhost:9000/initial-redirect/libgit2/TestGitRepository"
|
||||
export GITTEST_REMOTE_REDIRECT_SUBSEQUENT="http://localhost:9000/subsequent-redirect/libgit2/TestGitRepository"
|
||||
export GITTEST_REMOTE_SPEED_SLOW="http://localhost:9000/speed-9600/test.git"
|
||||
export GITTEST_REMOTE_SPEED_TIMESOUT="http://localhost:9000/speed-0.5/test.git"
|
||||
run_test online
|
||||
unset GITTEST_REMOTE_REDIRECT_INITIAL
|
||||
unset GITTEST_REMOTE_REDIRECT_SUBSEQUENT
|
||||
unset GITTEST_REMOTE_SPEED_SLOW
|
||||
unset GITTEST_REMOTE_SPEED_TIMESOUT
|
||||
|
||||
# Run the online tests that immutably change global state separately
|
||||
# to avoid polluting the test environment.
|
||||
echo ""
|
||||
echo "Running custom certificate (online_customcert) tests"
|
||||
echo ""
|
||||
|
||||
run_test online_customcert
|
||||
fi
|
||||
|
||||
if should_run "GITDAEMON_TESTS"; then
|
||||
echo ""
|
||||
echo "Running gitdaemon (standard) tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="git://localhost/test.git"
|
||||
run_test gitdaemon
|
||||
unset GITTEST_REMOTE_URL
|
||||
|
||||
echo ""
|
||||
echo "Running gitdaemon (namespace) tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="git://localhost:9419/namespace.git"
|
||||
export GITTEST_REMOTE_BRANCH="four"
|
||||
run_test gitdaemon_namespace
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_BRANCH
|
||||
|
||||
echo ""
|
||||
echo "Running gitdaemon (sha256) tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="git://localhost:9420/testrepo_256.git"
|
||||
run_test gitdaemon_sha256
|
||||
unset GITTEST_REMOTE_URL
|
||||
fi
|
||||
|
||||
if should_run "PROXY_TESTS"; then
|
||||
echo ""
|
||||
echo "Running proxy tests (Basic authentication)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_PROXY_HOST="localhost:8080"
|
||||
export GITTEST_REMOTE_PROXY_USER="foo"
|
||||
export GITTEST_REMOTE_PROXY_PASS="bar"
|
||||
run_test proxy
|
||||
unset GITTEST_REMOTE_PROXY_HOST
|
||||
unset GITTEST_REMOTE_PROXY_USER
|
||||
unset GITTEST_REMOTE_PROXY_PASS
|
||||
|
||||
echo ""
|
||||
echo "Running proxy tests (NTLM authentication)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_PROXY_HOST="localhost:8090"
|
||||
export GITTEST_REMOTE_PROXY_USER="foo"
|
||||
export GITTEST_REMOTE_PROXY_PASS="bar"
|
||||
run_test proxy
|
||||
unset GITTEST_REMOTE_PROXY_HOST
|
||||
unset GITTEST_REMOTE_PROXY_USER
|
||||
unset GITTEST_REMOTE_PROXY_PASS
|
||||
fi
|
||||
|
||||
if should_run "NTLM_TESTS"; then
|
||||
echo ""
|
||||
echo "Running NTLM tests (IIS emulation)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="http://localhost:9000/ntlm/test.git"
|
||||
export GITTEST_REMOTE_USER="foo"
|
||||
export GITTEST_REMOTE_PASS="baz"
|
||||
run_test auth_clone_and_push
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_PASS
|
||||
|
||||
echo ""
|
||||
echo "Running NTLM tests (Apache emulation)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="http://localhost:9000/broken-ntlm/test.git"
|
||||
export GITTEST_REMOTE_USER="foo"
|
||||
export GITTEST_REMOTE_PASS="baz"
|
||||
run_test auth_clone_and_push
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_PASS
|
||||
fi
|
||||
|
||||
if should_run "NEGOTIATE_TESTS" && -n "$GITTEST_NEGOTIATE_PASSWORD" ; then
|
||||
echo ""
|
||||
echo "Running SPNEGO tests"
|
||||
echo ""
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
KINIT_FLAGS="--password-file=STDIN"
|
||||
fi
|
||||
|
||||
echo $GITTEST_NEGOTIATE_PASSWORD | kinit $KINIT_FLAGS test@LIBGIT2.ORG
|
||||
klist -5f
|
||||
|
||||
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
|
||||
export GITTEST_REMOTE_DEFAULT="true"
|
||||
run_test auth_clone
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_DEFAULT
|
||||
|
||||
echo ""
|
||||
echo "Running SPNEGO tests (expect/continue)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
|
||||
export GITTEST_REMOTE_DEFAULT="true"
|
||||
export GITTEST_REMOTE_EXPECTCONTINUE="true"
|
||||
run_test auth_clone
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_DEFAULT
|
||||
unset GITTEST_REMOTE_EXPECTCONTINUE
|
||||
|
||||
kdestroy -A
|
||||
fi
|
||||
|
||||
if should_run "SSH_TESTS"; then
|
||||
export GITTEST_REMOTE_USER=$USER
|
||||
export GITTEST_REMOTE_SSH_KEY="${HOME}/.ssh/id_${GITTEST_SSH_KEYTYPE}"
|
||||
export GITTEST_REMOTE_SSH_PUBKEY="${HOME}/.ssh/id_${GITTEST_SSH_KEYTYPE}.pub"
|
||||
export GITTEST_REMOTE_SSH_PASSPHRASE=""
|
||||
export GITTEST_REMOTE_SSH_FINGERPRINT="${SSH_FINGERPRINT}"
|
||||
|
||||
export GITTEST_SSH_CMD="ssh -i ${HOME}/.ssh/id_${GITTEST_SSH_KEYTYPE} -o UserKnownHostsFile=${HOME}/.ssh/known_hosts"
|
||||
|
||||
echo ""
|
||||
echo "Running ssh tests"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="ssh://localhost:2222/$SSHD_DIR/test.git"
|
||||
run_test ssh
|
||||
unset GITTEST_REMOTE_URL
|
||||
|
||||
echo ""
|
||||
echo "Running ssh tests (scp-style paths)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="[localhost:2222]:$SSHD_DIR/test.git"
|
||||
run_test ssh
|
||||
unset GITTEST_REMOTE_URL
|
||||
|
||||
unset GITTEST_SSH_CMD
|
||||
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_SSH_KEY
|
||||
unset GITTEST_REMOTE_SSH_PUBKEY
|
||||
unset GITTEST_REMOTE_SSH_PASSPHRASE
|
||||
unset GITTEST_REMOTE_SSH_FINGERPRINT
|
||||
fi
|
||||
|
||||
unset GITTEST_FLAKY_RETRY
|
||||
|
||||
if should_run "FUZZERS"; then
|
||||
echo ""
|
||||
echo "##############################################################################"
|
||||
echo "## Running fuzzers"
|
||||
echo "##############################################################################"
|
||||
|
||||
env PATH="${BUILD_PATH}" "${CTEST}" -V -R 'fuzzer'
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
||||
if [ "$SUCCESS" -ne 1 ]; then
|
||||
echo "Some tests failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Success."
|
||||
exit 0
|
||||
30
cmake/AddCFlagIfSupported.cmake
Normal file
30
cmake/AddCFlagIfSupported.cmake
Normal file
@@ -0,0 +1,30 @@
|
||||
# - Append compiler flag to CMAKE_C_FLAGS if compiler supports it
|
||||
# ADD_C_FLAG_IF_SUPPORTED(<flag>)
|
||||
# <flag> - the compiler flag to test
|
||||
# This internally calls the CHECK_C_COMPILER_FLAG macro.
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
macro(ADD_C_FLAG _FLAG)
|
||||
string(TOUPPER ${_FLAG} UPCASE)
|
||||
string(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
|
||||
string(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
|
||||
check_c_compiler_flag(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
|
||||
if(IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
|
||||
else()
|
||||
message(FATAL_ERROR "Required flag ${_FLAG} is not supported")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ADD_C_FLAG_IF_SUPPORTED _FLAG)
|
||||
string(TOUPPER ${_FLAG} UPCASE)
|
||||
string(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
|
||||
string(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
|
||||
check_c_compiler_flag(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
|
||||
if(IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
|
||||
endif()
|
||||
endmacro()
|
||||
7
cmake/AddClarTest.cmake
Normal file
7
cmake/AddClarTest.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
function(ADD_CLAR_TEST project name)
|
||||
if(NOT USE_LEAK_CHECKER STREQUAL "OFF")
|
||||
add_test(${name} "${PROJECT_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${PROJECT_BINARY_DIR}/${project}" ${ARGN})
|
||||
else()
|
||||
add_test(${name} "${PROJECT_BINARY_DIR}/${project}" ${ARGN})
|
||||
endif()
|
||||
endfunction(ADD_CLAR_TEST)
|
||||
16
cmake/CheckPrototypeDefinitionSafe.cmake
Normal file
16
cmake/CheckPrototypeDefinitionSafe.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
include(CheckPrototypeDefinition)
|
||||
|
||||
function(check_prototype_definition_safe function prototype return header variable)
|
||||
# temporarily save CMAKE_C_FLAGS and disable warnings about unused
|
||||
# unused functions and parameters, otherwise they will always fail
|
||||
# if ENABLE_WERROR is on
|
||||
set(SAVED_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
disable_warnings(unused-function)
|
||||
disable_warnings(unused-parameter)
|
||||
|
||||
check_prototype_definition("${function}" "${prototype}" "${return}" "${header}" "${variable}")
|
||||
|
||||
# restore CMAKE_C_FLAGS
|
||||
set(CMAKE_C_FLAGS "${SAVED_CMAKE_C_FLAGS}")
|
||||
endfunction()
|
||||
154
cmake/DefaultCFlags.cmake
Normal file
154
cmake/DefaultCFlags.cmake
Normal file
@@ -0,0 +1,154 @@
|
||||
# Platform specific compilation flags
|
||||
if(MSVC)
|
||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
|
||||
string(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
# /GF - String pooling
|
||||
# /MP - Parallel build
|
||||
set(CMAKE_C_FLAGS "/GF /MP /nologo ${CMAKE_C_FLAGS}")
|
||||
|
||||
# /Gd - explicitly set cdecl calling convention
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
|
||||
|
||||
if(NOT (MSVC_VERSION LESS 1900))
|
||||
# /guard:cf - Enable Control Flow Guard
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
|
||||
endif()
|
||||
|
||||
if(STATIC_CRT)
|
||||
set(CRT_FLAG_DEBUG "/MTd")
|
||||
set(CRT_FLAG_RELEASE "/MT")
|
||||
else()
|
||||
set(CRT_FLAG_DEBUG "/MDd")
|
||||
set(CRT_FLAG_RELEASE "/MD")
|
||||
endif()
|
||||
|
||||
if(WIN32_LEAKCHECK)
|
||||
set(GIT_WIN32_LEAKCHECK 1)
|
||||
set(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
|
||||
endif()
|
||||
|
||||
# /Zi - Create debugging information
|
||||
# /Od - Disable optimization
|
||||
# /D_DEBUG - #define _DEBUG
|
||||
# /MTd - Statically link the multithreaded debug version of the CRT
|
||||
# /MDd - Dynamically link the multithreaded debug version of the CRT
|
||||
# /RTC1 - Run time checks
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi /Od /D_DEBUG /RTC1 ${CRT_FLAG_DEBUG}")
|
||||
|
||||
# /DNDEBUG - Disables asserts
|
||||
# /MT - Statically link the multithreaded release version of the CRT
|
||||
# /MD - Dynamically link the multithreaded release version of the CRT
|
||||
# /O2 - Optimize for speed
|
||||
# /Oy - Enable frame pointer omission (FPO) (otherwise CMake will automatically turn it off)
|
||||
# /GL - Link time code generation (whole program optimization)
|
||||
# /Gy - Function-level linking
|
||||
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
|
||||
|
||||
# /Oy- - Disable frame pointer omission (FPO)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy ${CRT_FLAG_RELEASE}")
|
||||
|
||||
# /O1 - Optimize for size
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /O1 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
|
||||
|
||||
# /IGNORE:4221 - Ignore empty compilation units
|
||||
set(CMAKE_STATIC_LINKER_FLAGS "/IGNORE:4221")
|
||||
|
||||
# /DYNAMICBASE - Address space load randomization (ASLR)
|
||||
# /NXCOMPAT - Data execution prevention (DEP)
|
||||
# /LARGEADDRESSAWARE - >2GB user address space on x86
|
||||
# /VERSION - Embed version information in PE header
|
||||
set(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${libgit2_VERSION_MAJOR}.${libgit2_VERSION_MINOR}")
|
||||
|
||||
if(NOT (MSVC_VERSION LESS 1900))
|
||||
# /GUARD:CF - Enable Control Flow Guard
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF")
|
||||
endif()
|
||||
|
||||
# /DEBUG - Create a PDB
|
||||
# /LTCG - Link time code generation (whole program optimization)
|
||||
# /OPT:REF /OPT:ICF - Fold out duplicate code at link step
|
||||
# /INCREMENTAL:NO - Required to use /LTCG
|
||||
# /DEBUGTYPE:cv,fixup - Additional data embedded in the PDB (requires /INCREMENTAL:NO, so not on for Debug)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||
|
||||
# Same linker settings for DLL as EXE
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
|
||||
else()
|
||||
if(ENABLE_REPRODUCIBLE_BUILDS)
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS AND LINK_WITH_STATIC_LIBRARIES)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
|
||||
|
||||
enable_warnings(all)
|
||||
enable_warnings(extra)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
||||
set(CMAKE_C_FLAGS "-D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0")
|
||||
|
||||
if(MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
|
||||
string(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
|
||||
elseif(BUILD_SHARED_LIBS)
|
||||
add_c_flag_IF_SUPPORTED(-fvisibility=hidden)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
# MinGW >= 3.14 uses the C99-style stdio functions
|
||||
# automatically, but forks like mingw-w64 still want
|
||||
# us to define this in order to use them
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
|
||||
endif()
|
||||
|
||||
enable_warnings(documentation)
|
||||
disable_warnings(documentation-deprecated-sync)
|
||||
disable_warnings(missing-field-initializers)
|
||||
enable_warnings(missing-declarations)
|
||||
enable_warnings(strict-aliasing)
|
||||
enable_warnings(strict-prototypes)
|
||||
enable_warnings(declaration-after-statement)
|
||||
enable_warnings(shift-count-overflow)
|
||||
enable_warnings(unused-const-variable)
|
||||
enable_warnings(unused-function)
|
||||
enable_warnings(int-conversion)
|
||||
enable_warnings(c11-extensions)
|
||||
enable_warnings(c99-c11-compat)
|
||||
|
||||
# MinGW uses gcc, which expects POSIX formatting for printf, but
|
||||
# uses the Windows C library, which uses its own format specifiers.
|
||||
# Disable format specifier warnings.
|
||||
if(MINGW)
|
||||
disable_warnings(format)
|
||||
disable_warnings(format-security)
|
||||
else()
|
||||
enable_warnings(format)
|
||||
enable_warnings(format-security)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Ensure that MinGW provides the correct header files.
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
add_definitions(-DWIN32 -D_WIN32_WINNT=0x0600)
|
||||
endif()
|
||||
15
cmake/EnableWarnings.cmake
Normal file
15
cmake/EnableWarnings.cmake
Normal file
@@ -0,0 +1,15 @@
|
||||
macro(ENABLE_WARNINGS flag)
|
||||
add_c_flag_if_supported(-W${flag})
|
||||
endmacro()
|
||||
|
||||
macro(DISABLE_WARNINGS flag)
|
||||
add_c_flag_if_supported(-Wno-${flag})
|
||||
endmacro()
|
||||
|
||||
if(ENABLE_WERROR)
|
||||
if(MSVC)
|
||||
add_compile_options(-WX)
|
||||
else()
|
||||
add_c_flag_if_supported(-Werror)
|
||||
endif()
|
||||
endif()
|
||||
23
cmake/ExperimentalFeatures.cmake
Normal file
23
cmake/ExperimentalFeatures.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
# Experimental feature support for libgit2 - developers can opt in to
|
||||
# experimental functionality, like sha256 support. When experimental
|
||||
# functionality is enabled, we set both a cmake flag *and* a compile
|
||||
# definition. The cmake flag is used to generate `experimental.h`,
|
||||
# which will be installed by a `make install`. But the compile definition
|
||||
# is used by the libgit2 sources to detect the functionality at library
|
||||
# build time. This allows us to have an in-tree `experimental.h` with
|
||||
# *no* experiments enabled. This lets us support users who build without
|
||||
# cmake and cannot generate the `experimental.h` file.
|
||||
|
||||
if(EXPERIMENTAL_SHA256)
|
||||
add_feature_info("SHA256 API" ON "experimental SHA256 APIs")
|
||||
|
||||
set(EXPERIMENTAL 1)
|
||||
set(GIT_EXPERIMENTAL_SHA256 1)
|
||||
add_definitions(-DGIT_EXPERIMENTAL_SHA256=1)
|
||||
else()
|
||||
add_feature_info("SHA256 API" OFF "experimental SHA256 APIs")
|
||||
endif()
|
||||
|
||||
if(EXPERIMENTAL)
|
||||
set(LIBGIT2_FILENAME "${LIBGIT2_FILENAME}-experimental")
|
||||
endif()
|
||||
26
cmake/FindCoreFoundation.cmake
Normal file
26
cmake/FindCoreFoundation.cmake
Normal file
@@ -0,0 +1,26 @@
|
||||
# Find CoreFoundation.framework
|
||||
# This will define :
|
||||
#
|
||||
# COREFOUNDATION_FOUND
|
||||
# COREFOUNDATION_LIBRARIES
|
||||
# COREFOUNDATION_LDFLAGS
|
||||
#
|
||||
|
||||
find_path(COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h)
|
||||
find_library(COREFOUNDATION_LIBRARIES NAMES CoreFoundation)
|
||||
if(COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_LIBRARIES)
|
||||
if(NOT CoreFoundation_FIND_QUIETLY)
|
||||
message(STATUS "Found CoreFoundation ${COREFOUNDATION_LIBRARIES}")
|
||||
endif()
|
||||
set(COREFOUNDATION_FOUND TRUE)
|
||||
set(COREFOUNDATION_LDFLAGS "-framework CoreFoundation")
|
||||
endif()
|
||||
|
||||
if(CoreFoundation_FIND_REQUIRED AND NOT COREFOUNDATION_FOUND)
|
||||
message(FATAL_ERROR "CoreFoundation not found")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
COREFOUNDATION_INCLUDE_DIR
|
||||
COREFOUNDATION_LIBRARIES
|
||||
)
|
||||
208
cmake/FindGSSAPI.cmake
Normal file
208
cmake/FindGSSAPI.cmake
Normal file
@@ -0,0 +1,208 @@
|
||||
# - Try to find GSSAPI
|
||||
# Once done this will define
|
||||
#
|
||||
# KRB5_CONFIG - Path to krb5-config
|
||||
# GSSAPI_ROOT_DIR - Set this variable to the root installation of GSSAPI
|
||||
#
|
||||
# Read-Only variables:
|
||||
# GSSAPI_FLAVOR_MIT - set to TRUE if MIT Kerberos has been found
|
||||
# GSSAPI_FLAVOR_HEIMDAL - set to TRUE if Heimdal Kerberos has been found
|
||||
# GSSAPI_FOUND - system has GSSAPI
|
||||
# GSSAPI_INCLUDE_DIR - the GSSAPI include directory
|
||||
# GSSAPI_LIBRARIES - Link these to use GSSAPI
|
||||
# GSSAPI_DEFINITIONS - Compiler switches required for using GSSAPI
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
#
|
||||
|
||||
find_path(GSSAPI_ROOT_DIR
|
||||
NAMES include/gssapi.h include/gssapi/gssapi.h
|
||||
HINTS ${_GSSAPI_ROOT_HINTS}
|
||||
PATHS ${_GSSAPI_ROOT_PATHS})
|
||||
mark_as_advanced(GSSAPI_ROOT_DIR)
|
||||
|
||||
if(UNIX)
|
||||
find_program(KRB5_CONFIG
|
||||
NAMES krb5-config
|
||||
PATHS ${GSSAPI_ROOT_DIR}/bin /opt/local/bin)
|
||||
mark_as_advanced(KRB5_CONFIG)
|
||||
|
||||
if(KRB5_CONFIG)
|
||||
# Check if we have MIT KRB5
|
||||
execute_process(
|
||||
COMMAND ${KRB5_CONFIG} --vendor
|
||||
RESULT_VARIABLE _GSSAPI_VENDOR_RESULT
|
||||
OUTPUT_VARIABLE _GSSAPI_VENDOR_STRING)
|
||||
|
||||
if(_GSSAPI_VENDOR_STRING MATCHES ".*Massachusetts.*")
|
||||
set(GSSAPI_FLAVOR_MIT TRUE)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${KRB5_CONFIG} --libs gssapi
|
||||
RESULT_VARIABLE _GSSAPI_LIBS_RESULT
|
||||
OUTPUT_VARIABLE _GSSAPI_LIBS_STRING)
|
||||
|
||||
if(_GSSAPI_LIBS_STRING MATCHES ".*roken.*")
|
||||
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Get the include dir
|
||||
execute_process(
|
||||
COMMAND ${KRB5_CONFIG} --cflags gssapi
|
||||
RESULT_VARIABLE _GSSAPI_INCLUDE_RESULT
|
||||
OUTPUT_VARIABLE _GSSAPI_INCLUDE_STRING)
|
||||
string(REGEX REPLACE "(\r?\n)+$" "" _GSSAPI_INCLUDE_STRING "${_GSSAPI_INCLUDE_STRING}")
|
||||
string(REGEX REPLACE " *-I" "" _GSSAPI_INCLUDEDIR "${_GSSAPI_INCLUDE_STRING}")
|
||||
endif()
|
||||
|
||||
if(NOT GSSAPI_FLAVOR_MIT AND NOT GSSAPI_FLAVOR_HEIMDAL)
|
||||
# Check for HEIMDAL
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_GSSAPI heimdal-gssapi)
|
||||
endif()
|
||||
|
||||
if(_GSSAPI_FOUND)
|
||||
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
||||
else()
|
||||
find_path(_GSSAPI_ROKEN
|
||||
NAMES roken.h
|
||||
PATHS ${GSSAPI_ROOT_DIR}/include ${_GSSAPI_INCLUDEDIR})
|
||||
if(_GSSAPI_ROKEN)
|
||||
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(GSSAPI_INCLUDE_DIR
|
||||
NAMES gssapi.h gssapi/gssapi.h
|
||||
PATHS ${GSSAPI_ROOT_DIR}/include ${_GSSAPI_INCLUDEDIR})
|
||||
|
||||
if(GSSAPI_FLAVOR_MIT)
|
||||
find_library(GSSAPI_LIBRARY
|
||||
NAMES gssapi_krb5
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(KRB5_LIBRARY
|
||||
NAMES krb5
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(K5CRYPTO_LIBRARY
|
||||
NAMES k5crypto
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(COM_ERR_LIBRARY
|
||||
NAMES com_err
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
if(GSSAPI_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${GSSAPI_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(KRB5_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${KRB5_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(K5CRYPTO_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${K5CRYPTO_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(COM_ERR_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${COM_ERR_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GSSAPI_FLAVOR_HEIMDAL)
|
||||
find_library(GSSAPI_LIBRARY
|
||||
NAMES gssapi
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(KRB5_LIBRARY
|
||||
NAMES krb5
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(HCRYPTO_LIBRARY
|
||||
NAMES hcrypto
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(COM_ERR_LIBRARY
|
||||
NAMES com_err
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(HEIMNTLM_LIBRARY
|
||||
NAMES heimntlm
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(HX509_LIBRARY
|
||||
NAMES hx509
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(ASN1_LIBRARY
|
||||
NAMES asn1
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(WIND_LIBRARY
|
||||
NAMES wind
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
find_library(ROKEN_LIBRARY
|
||||
NAMES roken
|
||||
PATHS ${GSSAPI_ROOT_DIR}/lib ${_GSSAPI_LIBDIR})
|
||||
|
||||
if(GSSAPI_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${GSSAPI_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(KRB5_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${KRB5_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HCRYPTO_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${HCRYPTO_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(COM_ERR_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${COM_ERR_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HEIMNTLM_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${HEIMNTLM_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HX509_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${HX509_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(ASN1_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${ASN1_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(WIND_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${WIND_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(ROKEN_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES ${GSSAPI_LIBRARIES} ${WIND_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
|
||||
|
||||
if(GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES)
|
||||
set(GSSAPI_FOUND TRUE)
|
||||
endif(GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES)
|
||||
|
||||
# show the GSSAPI_INCLUDE_DIRS and GSSAPI_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(GSSAPI_INCLUDE_DIRS GSSAPI_LIBRARIES)
|
||||
28
cmake/FindGSSFramework.cmake
Normal file
28
cmake/FindGSSFramework.cmake
Normal file
@@ -0,0 +1,28 @@
|
||||
# Find GSS.framework
|
||||
# This will define :
|
||||
#
|
||||
# GSSFRAMEWORK_FOUND
|
||||
# GSSFRAMEWORK_INCLUDE_DIR
|
||||
# GSSFRAMEWORK_LIBRARIES
|
||||
# GSSFRAMEWORK_LDFLAGS
|
||||
#
|
||||
|
||||
find_path(GSSFRAMEWORK_INCLUDE_DIR NAMES GSS.h)
|
||||
find_library(GSSFRAMEWORK_LIBRARIES NAMES GSS)
|
||||
if(GSSFRAMEWORK_INCLUDE_DIR AND GSSFRAMEWORK_LIBRARIES)
|
||||
if(NOT CoreFoundation_FIND_QUIETLY)
|
||||
message(STATUS "Found GSS.framework ${GSSFRAMEWORK_LIBRARIES}")
|
||||
endif()
|
||||
set(GSSFRAMEWORK_FOUND TRUE)
|
||||
set(GSSFRAMEWORK_LDFLAGS "-framework GSS")
|
||||
endif()
|
||||
|
||||
if(GSS_FIND_REQUIRED AND NOT GSSFRAMEWORK_FOUND)
|
||||
message(FATAL_ERROR "CoreFoundation not found")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
GSSFRAMEWORK_INCLUDE_DIR
|
||||
GSSFRAMEWORK_LIBRARIES
|
||||
GSSFRAMEWORK_LDFLAGS
|
||||
)
|
||||
@@ -10,30 +10,30 @@
|
||||
# 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)
|
||||
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()
|
||||
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)
|
||||
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)
|
||||
mark_as_advanced(HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)
|
||||
|
||||
# Set standard variables
|
||||
IF (HTTP_PARSER_FOUND)
|
||||
SET(HTTP_PARSER_LIBRARIES ${HTTP_PARSER_LIBRARY})
|
||||
if(HTTP_PARSER_FOUND)
|
||||
set(HTTP_PARSER_LIBRARIES ${HTTP_PARSER_LIBRARY})
|
||||
set(HTTP_PARSER_INCLUDE_DIRS ${HTTP_PARSER_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
endif()
|
||||
45
cmake/FindIntlIconv.cmake
Normal file
45
cmake/FindIntlIconv.cmake
Normal file
@@ -0,0 +1,45 @@
|
||||
# - Try to find Iconv
|
||||
# Once done this will define
|
||||
#
|
||||
# ICONV_FOUND - system has Iconv
|
||||
# ICONV_INCLUDE_DIR - the Iconv include directory
|
||||
# ICONV_LIBRARIES - Link these to use Iconv
|
||||
#
|
||||
|
||||
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
set(ICONV_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
find_path(ICONV_INCLUDE_DIR iconv.h)
|
||||
check_function_exists(iconv_open libc_has_iconv)
|
||||
find_library(iconv_lib NAMES iconv libiconv libiconv-2 c)
|
||||
|
||||
if(ICONV_INCLUDE_DIR AND libc_has_iconv)
|
||||
set(ICONV_FOUND TRUE)
|
||||
set(ICONV_LIBRARIES "")
|
||||
if(NOT ICONV_FIND_QUIETLY)
|
||||
message(STATUS "Found Iconv: provided by libc")
|
||||
endif(NOT ICONV_FIND_QUIETLY)
|
||||
elseif(ICONV_INCLUDE_DIR AND iconv_lib)
|
||||
set(ICONV_FOUND TRUE)
|
||||
# split iconv into -L and -l linker options, so we can
|
||||
# set them for pkg-config
|
||||
get_filename_component(iconv_path ${iconv_lib} PATH)
|
||||
get_filename_component(iconv_name ${iconv_lib} NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" iconv_name ${iconv_name})
|
||||
set(ICONV_LIBRARIES "-L${iconv_path} -l${iconv_name}")
|
||||
|
||||
if(NOT ICONV_FIND_QUIETLY)
|
||||
message(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
||||
endif()
|
||||
else()
|
||||
if(Iconv_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find Iconv")
|
||||
endif(Iconv_FIND_REQUIRED)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
ICONV_INCLUDE_DIR
|
||||
ICONV_LIBRARIES
|
||||
)
|
||||
13
cmake/FindLibSSH2.cmake
Normal file
13
cmake/FindLibSSH2.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
# LIBSSH2_FOUND - system has the libssh2 library
|
||||
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
|
||||
# LIBSSH2_LIBRARY - the libssh2 library name
|
||||
|
||||
find_path(LIBSSH2_INCLUDE_DIR libssh2.h)
|
||||
|
||||
find_library(LIBSSH2_LIBRARY NAMES ssh2 libssh2)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LibSSH2
|
||||
REQUIRED_VARS LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)
|
||||
@@ -16,23 +16,22 @@
|
||||
# PCRE_FOUND - True if pcre found.
|
||||
|
||||
# Look for the header file.
|
||||
FIND_PATH(PCRE_INCLUDE_DIR NAMES pcreposix.h)
|
||||
find_path(PCRE_INCLUDE_DIR NAMES pcre.h)
|
||||
|
||||
# Look for the library.
|
||||
FIND_LIBRARY(PCRE_LIBRARY NAMES pcre)
|
||||
FIND_LIBRARY(PCRE_POSIX_LIBRARY NAMES pcreposix)
|
||||
find_library(PCRE_LIBRARY NAMES pcre)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_POSIX_LIBRARY PCRE_INCLUDE_DIR)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
IF(PCRE_FOUND)
|
||||
SET(PCRE_LIBRARIES ${PCRE_LIBRARY} ${PCRE_POSIX_LIBRARY})
|
||||
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
|
||||
ELSE(PCRE_FOUND)
|
||||
SET(PCRE_LIBRARIES)
|
||||
SET(PCRE_INCLUDE_DIRS)
|
||||
ENDIF(PCRE_FOUND)
|
||||
if(PCRE_FOUND)
|
||||
set(PCRE_LIBRARIES ${PCRE_LIBRARY})
|
||||
set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
|
||||
else(PCRE_FOUND)
|
||||
set(PCRE_LIBRARIES)
|
||||
set(PCRE_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES)
|
||||
mark_as_advanced(PCRE_INCLUDE_DIRS PCRE_LIBRARIES)
|
||||
@@ -16,22 +16,22 @@
|
||||
# PCRE2_FOUND - True if pcre found.
|
||||
|
||||
# Look for the header file.
|
||||
FIND_PATH(PCRE2_INCLUDE_DIR NAMES pcre2posix.h)
|
||||
find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h)
|
||||
|
||||
# Look for the library.
|
||||
FIND_LIBRARY(PCRE2_LIBRARY NAMES pcre2-8)
|
||||
find_library(PCRE2_LIBRARY NAMES pcre2-8)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set PCRE2_FOUND to TRUE if all listed variables are TRUE.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
IF(PCRE2_FOUND)
|
||||
SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
|
||||
SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
|
||||
ELSE(PCRE2_FOUND)
|
||||
SET(PCRE2_LIBRARIES)
|
||||
SET(PCRE2_INCLUDE_DIRS)
|
||||
ENDIF(PCRE2_FOUND)
|
||||
if(PCRE2_FOUND)
|
||||
set(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
|
||||
set(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
|
||||
else(PCRE2_FOUND)
|
||||
set(PCRE2_LIBRARIES)
|
||||
set(PCRE2_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
MARK_AS_ADVANCED(PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES)
|
||||
mark_as_advanced(PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES)
|
||||
28
cmake/FindPkgLibraries.cmake
Normal file
28
cmake/FindPkgLibraries.cmake
Normal file
@@ -0,0 +1,28 @@
|
||||
include(FindPkgConfig)
|
||||
|
||||
# This function will find and set up a pkg-config based module.
|
||||
# If a pc-file was found, it will resolve library paths to
|
||||
# absolute paths. Furthermore, the function will automatically
|
||||
# fall back to use static libraries in case no dynamic libraries
|
||||
# were found.
|
||||
function(FIND_PKGLIBRARIES prefix package)
|
||||
pkg_check_modules(${prefix} ${package})
|
||||
if(NOT ${prefix}_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
foreach(LIBRARY ${${prefix}_LIBRARIES})
|
||||
find_library(${LIBRARY}_RESOLVED ${LIBRARY} PATHS ${${prefix}_LIBRARY_DIRS})
|
||||
if(${${LIBRARY}_RESOLVED} STREQUAL "${LIBRARY}_RESOLVED-NOTFOUND")
|
||||
message(FATAL_ERROR "could not resolve ${LIBRARY}")
|
||||
endif()
|
||||
list(APPEND RESOLVED_LIBRARIES ${${LIBRARY}_RESOLVED})
|
||||
endforeach()
|
||||
|
||||
set(${prefix}_FOUND 1 PARENT_SCOPE)
|
||||
set(${prefix}_LIBRARIES ${RESOLVED_LIBRARIES} PARENT_SCOPE)
|
||||
set(${prefix}_INCLUDE_DIRS ${${prefix}_INCLUDE_DIRS} PARENT_SCOPE)
|
||||
set(${prefix}_LDFLAGS ${${prefix}_LDFLAGS} PARENT_SCOPE)
|
||||
|
||||
message(STATUS " Resolved libraries: ${RESOLVED_LIBRARIES}")
|
||||
endfunction()
|
||||
28
cmake/FindSecurity.cmake
Normal file
28
cmake/FindSecurity.cmake
Normal file
@@ -0,0 +1,28 @@
|
||||
# Find Security.framework
|
||||
# This will define :
|
||||
#
|
||||
# SECURITY_FOUND
|
||||
# SECURITY_LIBRARIES
|
||||
# SECURITY_LDFLAGS
|
||||
# SECURITY_HAS_SSLCREATECONTEXT
|
||||
#
|
||||
|
||||
find_path(SECURITY_INCLUDE_DIR NAMES Security/Security.h)
|
||||
find_library(SECURITY_LIBRARIES NAMES Security)
|
||||
if(SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES)
|
||||
if(NOT Security_FIND_QUIETLY)
|
||||
message(STATUS "Found Security ${SECURITY_LIBRARIES}")
|
||||
endif()
|
||||
set(SECURITY_FOUND TRUE)
|
||||
set(SECURITY_LDFLAGS "-framework Security")
|
||||
check_library_exists("${SECURITY_LIBRARIES}" SSLCreateContext "Security/SecureTransport.h" SECURITY_HAS_SSLCREATECONTEXT)
|
||||
endif()
|
||||
|
||||
if(Security_FIND_REQUIRED AND NOT SECURITY_FOUND)
|
||||
message(FATAL_ERROR "Security not found")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
SECURITY_INCLUDE_DIR
|
||||
SECURITY_LIBRARIES
|
||||
)
|
||||
20
cmake/FindStatNsec.cmake
Normal file
20
cmake/FindStatNsec.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
include(FeatureSummary)
|
||||
|
||||
check_struct_has_member("struct stat" st_mtim "sys/types.h;sys/stat.h"
|
||||
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
|
||||
check_struct_has_member("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
|
||||
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
|
||||
check_struct_has_member("struct stat" st_mtime_nsec sys/stat.h
|
||||
HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
|
||||
|
||||
if(HAVE_STRUCT_STAT_ST_MTIM)
|
||||
check_struct_has_member("struct stat" st_mtim.tv_nsec sys/stat.h
|
||||
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
||||
elseif(HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
||||
check_struct_has_member("struct stat" st_mtimespec.tv_nsec sys/stat.h
|
||||
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
||||
else()
|
||||
set(HAVE_STRUCT_STAT_NSEC ON )
|
||||
endif()
|
||||
|
||||
add_feature_info(nanoseconds USE_NSEC "support nanosecond precision file mtimes and ctimes")
|
||||
14
cmake/Findfutimens.cmake
Normal file
14
cmake/Findfutimens.cmake
Normal file
@@ -0,0 +1,14 @@
|
||||
include(EnableWarnings)
|
||||
|
||||
if(APPLE)
|
||||
# We cannot simply CHECK_FUNCTION_EXISTS on macOS because
|
||||
# MACOSX_DEPLOYMENT_TARGET may be set to a version in the past
|
||||
# that doesn't have futimens. Instead we need to enable warnings
|
||||
# as errors, then check for the symbol existing in `sys/stat.h`,
|
||||
# then reset warnings as errors.
|
||||
enable_warnings(error)
|
||||
check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
|
||||
disable_warnings(error)
|
||||
else()
|
||||
check_function_exists(futimens HAVE_FUTIMENS)
|
||||
endif()
|
||||
86
cmake/FindmbedTLS.cmake
Normal file
86
cmake/FindmbedTLS.cmake
Normal file
@@ -0,0 +1,86 @@
|
||||
# - Try to find mbedTLS
|
||||
# Once done this will define
|
||||
#
|
||||
# Read-Only variables
|
||||
# MBEDTLS_FOUND - system has mbedTLS
|
||||
# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
|
||||
# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
|
||||
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
|
||||
# MBEDTLS_LIBRARY - path to mbedTLS library
|
||||
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
|
||||
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
|
||||
#
|
||||
# Hint
|
||||
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
|
||||
|
||||
set(_MBEDTLS_ROOT_HINTS
|
||||
${MBEDTLS_ROOT_DIR}
|
||||
ENV MBEDTLS_ROOT_DIR)
|
||||
|
||||
set(_MBEDTLS_ROOT_HINTS_AND_PATHS
|
||||
HINTS ${_MBEDTLS_ROOT_HINTS}
|
||||
PATHS ${_MBEDTLS_ROOT_PATHS})
|
||||
|
||||
find_path(MBEDTLS_INCLUDE_DIR
|
||||
NAMES mbedtls/version.h
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
set(MBEDTLS_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
find_library(MBEDTLS_LIBRARY
|
||||
NAMES mbedtls libmbedtls
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library)
|
||||
find_library(MBEDX509_LIBRARY
|
||||
NAMES mbedx509 libmbedx509
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library)
|
||||
find_library(MBEDCRYPTO_LIBRARY
|
||||
NAMES mbedcrypto libmbedcrypto
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library)
|
||||
|
||||
if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
|
||||
set(MBEDTLS_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(MBEDTLS_FOUND)
|
||||
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
|
||||
get_filename_component(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
|
||||
get_filename_component(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
|
||||
get_filename_component(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
|
||||
get_filename_component(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
|
||||
string(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
|
||||
string(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
|
||||
set(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
|
||||
|
||||
if(NOT MBEDTLS_FIND_QUIETLY)
|
||||
message(STATUS "Found mbedTLS:")
|
||||
file(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
|
||||
string(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
|
||||
if(MBEDTLSMATCH)
|
||||
string(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
|
||||
message(STATUS " version ${MBEDTLS_VERSION}")
|
||||
endif()
|
||||
message(STATUS " TLS: ${MBEDTLS_LIBRARY}")
|
||||
message(STATUS " X509: ${MBEDX509_LIBRARY}")
|
||||
message(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
|
||||
endif()
|
||||
else(MBEDTLS_FOUND)
|
||||
if(MBEDTLS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find mbedTLS")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
MBEDTLS_INCLUDE_DIR
|
||||
MBEDTLS_LIBRARY_DIR
|
||||
MBEDTLS_LIBRARIES
|
||||
MBEDTLS_LIBRARY
|
||||
MBEDX509_LIBRARY
|
||||
MBEDCRYPTO_LIBRARY)
|
||||
22
cmake/IdeSplitSources.cmake
Normal file
22
cmake/IdeSplitSources.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
# This function splits the sources files up into their appropriate
|
||||
# subdirectories. This is especially useful for IDEs like Xcode and
|
||||
# Visual Studio, so that you can navigate into the libgit2_tests project,
|
||||
# and see the folders within the tests folder (instead of just seeing all
|
||||
# source and tests in a single folder.)
|
||||
function(IDE_SPLIT_SOURCES target)
|
||||
if(MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode)
|
||||
get_target_property(sources ${target} SOURCES)
|
||||
foreach(source ${sources})
|
||||
if(source MATCHES ".*/")
|
||||
string(REPLACE ${PROJECT_SOURCE_DIR}/ "" rel ${source})
|
||||
if(rel)
|
||||
string(REGEX REPLACE "/([^/]*)$" "" rel ${rel})
|
||||
if(rel)
|
||||
string(REPLACE "/" "\\\\" rel ${rel})
|
||||
source_group(${rel} FILES ${source})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,30 +0,0 @@
|
||||
# - Append compiler flag to CMAKE_C_FLAGS if compiler supports it
|
||||
# ADD_C_FLAG_IF_SUPPORTED(<flag>)
|
||||
# <flag> - the compiler flag to test
|
||||
# This internally calls the CHECK_C_COMPILER_FLAG macro.
|
||||
|
||||
INCLUDE(CheckCCompilerFlag)
|
||||
|
||||
MACRO(ADD_C_FLAG _FLAG)
|
||||
STRING(TOUPPER ${_FLAG} UPCASE)
|
||||
STRING(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
|
||||
STRING(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
|
||||
CHECK_C_COMPILER_FLAG(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
|
||||
IF(IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Required flag ${_FLAG} is not supported")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_C_FLAG_IF_SUPPORTED _FLAG)
|
||||
STRING(TOUPPER ${_FLAG} UPCASE)
|
||||
STRING(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
|
||||
STRING(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
|
||||
CHECK_C_COMPILER_FLAG(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
|
||||
IF(IS_${UPCASE_PRETTY}_SUPPORTED)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
@@ -1,29 +0,0 @@
|
||||
@CHECK_PROTOTYPE_DEFINITION_HEADER@
|
||||
|
||||
static void cmakeRequireSymbol(int dummy, ...) {
|
||||
(void) dummy;
|
||||
}
|
||||
|
||||
static void checkSymbol(void) {
|
||||
#ifndef @CHECK_PROTOTYPE_DEFINITION_SYMBOL@
|
||||
cmakeRequireSymbol(0, &@CHECK_PROTOTYPE_DEFINITION_SYMBOL@);
|
||||
#endif
|
||||
}
|
||||
|
||||
@CHECK_PROTOTYPE_DEFINITION_PROTO@ {
|
||||
return @CHECK_PROTOTYPE_DEFINITION_RETURN@;
|
||||
}
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main() {
|
||||
int ac;
|
||||
char*av[];
|
||||
#else
|
||||
int main(int ac, char *av[]) {
|
||||
#endif
|
||||
checkSymbol();
|
||||
if (ac > 1000) {
|
||||
return *av[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
# - Check if the protoype we expect is correct.
|
||||
# check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
|
||||
# FUNCTION - The name of the function (used to check if prototype exists)
|
||||
# PROTOTYPE- The prototype to check.
|
||||
# RETURN - The return value of the function.
|
||||
# HEADER - The header files required.
|
||||
# VARIABLE - The variable to store the result.
|
||||
# Example:
|
||||
# check_prototype_definition(getpwent_r
|
||||
# "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
|
||||
# "NULL"
|
||||
# "unistd.h;pwd.h"
|
||||
# SOLARIS_GETPWENT_R)
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
# Copyright 2010-2011 Andreas Schneider <asn@cryptomilk.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
#
|
||||
|
||||
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
|
||||
|
||||
if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
|
||||
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
if (CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
else(CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS)
|
||||
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||
if (CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
else(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES)
|
||||
endif(CMAKE_REQUIRED_INCLUDES)
|
||||
|
||||
foreach(_FILE ${_HEADER})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_HEADER
|
||||
"${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n")
|
||||
endforeach(_FILE)
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN})
|
||||
|
||||
configure_file("${__check_proto_def_dir}/CheckPrototypeDefinition.c.in"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY)
|
||||
|
||||
file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
|
||||
|
||||
try_compile(${_VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
|
||||
"${CHECK_PROTOTYPE_DEFINITION_LIBS}"
|
||||
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
if (${_VARIABLE})
|
||||
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
else (${_VARIABLE})
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
|
||||
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"
|
||||
"${OUTPUT}\n\n${_SOURCE}\n\n")
|
||||
endif (${_VARIABLE})
|
||||
endif("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
|
||||
|
||||
endfunction(CHECK_PROTOTYPE_DEFINITION)
|
||||
@@ -1,15 +0,0 @@
|
||||
MACRO(ENABLE_WARNINGS flag)
|
||||
ADD_C_FLAG_IF_SUPPORTED(-W${flag})
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DISABLE_WARNINGS flag)
|
||||
ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
|
||||
ENDMACRO()
|
||||
|
||||
IF(ENABLE_WERROR)
|
||||
IF(MSVC)
|
||||
ADD_COMPILE_OPTIONS(-WX)
|
||||
ELSE()
|
||||
ADD_C_FLAG_IF_SUPPORTED(-Werror)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
@@ -1,26 +0,0 @@
|
||||
# Find CoreFoundation.framework
|
||||
# This will define :
|
||||
#
|
||||
# COREFOUNDATION_FOUND
|
||||
# COREFOUNDATION_LIBRARIES
|
||||
# COREFOUNDATION_LDFLAGS
|
||||
#
|
||||
|
||||
FIND_PATH(COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h)
|
||||
FIND_LIBRARY(COREFOUNDATION_LIBRARIES NAMES CoreFoundation)
|
||||
IF (COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_LIBRARIES)
|
||||
IF (NOT CoreFoundation_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found CoreFoundation ${COREFOUNDATION_LIBRARIES}")
|
||||
ENDIF()
|
||||
SET(COREFOUNDATION_FOUND TRUE)
|
||||
SET(COREFOUNDATION_LDFLAGS "-framework CoreFoundation")
|
||||
ENDIF ()
|
||||
|
||||
IF (CoreFoundation_FIND_REQUIRED AND NOT COREFOUNDATION_FOUND)
|
||||
MESSAGE(FATAL_ERROR "CoreFoundation not found")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
COREFOUNDATION_INCLUDE_DIR
|
||||
COREFOUNDATION_LIBRARIES
|
||||
)
|
||||
@@ -1,324 +0,0 @@
|
||||
# - Try to find GSSAPI
|
||||
# Once done this will define
|
||||
#
|
||||
# KRB5_CONFIG - Path to krb5-config
|
||||
# GSSAPI_ROOT_DIR - Set this variable to the root installation of GSSAPI
|
||||
#
|
||||
# Read-Only variables:
|
||||
# GSSAPI_FLAVOR_MIT - set to TURE if MIT Kerberos has been found
|
||||
# GSSAPI_FLAVOR_HEIMDAL - set to TRUE if Heimdal Kerberos has been found
|
||||
# GSSAPI_FOUND - system has GSSAPI
|
||||
# GSSAPI_INCLUDE_DIR - the GSSAPI include directory
|
||||
# GSSAPI_LIBRARIES - Link these to use GSSAPI
|
||||
# GSSAPI_DEFINITIONS - Compiler switches required for using GSSAPI
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
#
|
||||
|
||||
find_path(GSSAPI_ROOT_DIR
|
||||
NAMES
|
||||
include/gssapi.h
|
||||
include/gssapi/gssapi.h
|
||||
HINTS
|
||||
${_GSSAPI_ROOT_HINTS}
|
||||
PATHS
|
||||
${_GSSAPI_ROOT_PATHS}
|
||||
)
|
||||
mark_as_advanced(GSSAPI_ROOT_DIR)
|
||||
|
||||
if (UNIX)
|
||||
find_program(KRB5_CONFIG
|
||||
NAMES
|
||||
krb5-config
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/bin
|
||||
/opt/local/bin)
|
||||
mark_as_advanced(KRB5_CONFIG)
|
||||
|
||||
if (KRB5_CONFIG)
|
||||
# Check if we have MIT KRB5
|
||||
execute_process(
|
||||
COMMAND
|
||||
${KRB5_CONFIG} --vendor
|
||||
RESULT_VARIABLE
|
||||
_GSSAPI_VENDOR_RESULT
|
||||
OUTPUT_VARIABLE
|
||||
_GSSAPI_VENDOR_STRING)
|
||||
|
||||
if (_GSSAPI_VENDOR_STRING MATCHES ".*Massachusetts.*")
|
||||
set(GSSAPI_FLAVOR_MIT TRUE)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${KRB5_CONFIG} --libs gssapi
|
||||
RESULT_VARIABLE
|
||||
_GSSAPI_LIBS_RESULT
|
||||
OUTPUT_VARIABLE
|
||||
_GSSAPI_LIBS_STRING)
|
||||
|
||||
if (_GSSAPI_LIBS_STRING MATCHES ".*roken.*")
|
||||
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Get the include dir
|
||||
execute_process(
|
||||
COMMAND
|
||||
${KRB5_CONFIG} --cflags gssapi
|
||||
RESULT_VARIABLE
|
||||
_GSSAPI_INCLUDE_RESULT
|
||||
OUTPUT_VARIABLE
|
||||
_GSSAPI_INCLUDE_STRING)
|
||||
string(REGEX REPLACE "(\r?\n)+$" "" _GSSAPI_INCLUDE_STRING "${_GSSAPI_INCLUDE_STRING}")
|
||||
string(REGEX REPLACE " *-I" "" _GSSAPI_INCLUDEDIR "${_GSSAPI_INCLUDE_STRING}")
|
||||
endif()
|
||||
|
||||
if (NOT GSSAPI_FLAVOR_MIT AND NOT GSSAPI_FLAVOR_HEIMDAL)
|
||||
# Check for HEIMDAL
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_GSSAPI heimdal-gssapi)
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
|
||||
if (_GSSAPI_FOUND)
|
||||
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
||||
else()
|
||||
find_path(_GSSAPI_ROKEN
|
||||
NAMES
|
||||
roken.h
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/include
|
||||
${_GSSAPI_INCLUDEDIR})
|
||||
if (_GSSAPI_ROKEN)
|
||||
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
||||
endif()
|
||||
endif ()
|
||||
endif()
|
||||
endif (UNIX)
|
||||
|
||||
find_path(GSSAPI_INCLUDE_DIR
|
||||
NAMES
|
||||
gssapi.h
|
||||
gssapi/gssapi.h
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/include
|
||||
${_GSSAPI_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if (GSSAPI_FLAVOR_MIT)
|
||||
find_library(GSSAPI_LIBRARY
|
||||
NAMES
|
||||
gssapi_krb5
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(KRB5_LIBRARY
|
||||
NAMES
|
||||
krb5
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(K5CRYPTO_LIBRARY
|
||||
NAMES
|
||||
k5crypto
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(COM_ERR_LIBRARY
|
||||
NAMES
|
||||
com_err
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
if (GSSAPI_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${GSSAPI_LIBRARY}
|
||||
)
|
||||
endif (GSSAPI_LIBRARY)
|
||||
|
||||
if (KRB5_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${KRB5_LIBRARY}
|
||||
)
|
||||
endif (KRB5_LIBRARY)
|
||||
|
||||
if (K5CRYPTO_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${K5CRYPTO_LIBRARY}
|
||||
)
|
||||
endif (K5CRYPTO_LIBRARY)
|
||||
|
||||
if (COM_ERR_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${COM_ERR_LIBRARY}
|
||||
)
|
||||
endif (COM_ERR_LIBRARY)
|
||||
endif (GSSAPI_FLAVOR_MIT)
|
||||
|
||||
if (GSSAPI_FLAVOR_HEIMDAL)
|
||||
find_library(GSSAPI_LIBRARY
|
||||
NAMES
|
||||
gssapi
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(KRB5_LIBRARY
|
||||
NAMES
|
||||
krb5
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(HCRYPTO_LIBRARY
|
||||
NAMES
|
||||
hcrypto
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(COM_ERR_LIBRARY
|
||||
NAMES
|
||||
com_err
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(HEIMNTLM_LIBRARY
|
||||
NAMES
|
||||
heimntlm
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(HX509_LIBRARY
|
||||
NAMES
|
||||
hx509
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(ASN1_LIBRARY
|
||||
NAMES
|
||||
asn1
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(WIND_LIBRARY
|
||||
NAMES
|
||||
wind
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
find_library(ROKEN_LIBRARY
|
||||
NAMES
|
||||
roken
|
||||
PATHS
|
||||
${GSSAPI_ROOT_DIR}/lib
|
||||
${_GSSAPI_LIBDIR}
|
||||
)
|
||||
|
||||
if (GSSAPI_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${GSSAPI_LIBRARY}
|
||||
)
|
||||
endif (GSSAPI_LIBRARY)
|
||||
|
||||
if (KRB5_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${KRB5_LIBRARY}
|
||||
)
|
||||
endif (KRB5_LIBRARY)
|
||||
|
||||
if (HCRYPTO_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${HCRYPTO_LIBRARY}
|
||||
)
|
||||
endif (HCRYPTO_LIBRARY)
|
||||
|
||||
if (COM_ERR_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${COM_ERR_LIBRARY}
|
||||
)
|
||||
endif (COM_ERR_LIBRARY)
|
||||
|
||||
if (HEIMNTLM_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${HEIMNTLM_LIBRARY}
|
||||
)
|
||||
endif (HEIMNTLM_LIBRARY)
|
||||
|
||||
if (HX509_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${HX509_LIBRARY}
|
||||
)
|
||||
endif (HX509_LIBRARY)
|
||||
|
||||
if (ASN1_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${ASN1_LIBRARY}
|
||||
)
|
||||
endif (ASN1_LIBRARY)
|
||||
|
||||
if (WIND_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${WIND_LIBRARY}
|
||||
)
|
||||
endif (WIND_LIBRARY)
|
||||
|
||||
if (ROKEN_LIBRARY)
|
||||
set(GSSAPI_LIBRARIES
|
||||
${GSSAPI_LIBRARIES}
|
||||
${WIND_LIBRARY}
|
||||
)
|
||||
endif (ROKEN_LIBRARY)
|
||||
endif (GSSAPI_FLAVOR_HEIMDAL)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
|
||||
|
||||
if (GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES)
|
||||
set(GSSAPI_FOUND TRUE)
|
||||
endif (GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES)
|
||||
|
||||
# show the GSSAPI_INCLUDE_DIRS and GSSAPI_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(GSSAPI_INCLUDE_DIRS GSSAPI_LIBRARIES)
|
||||
@@ -1,28 +0,0 @@
|
||||
# Find GSS.framework
|
||||
# This will define :
|
||||
#
|
||||
# GSSFRAMEWORK_FOUND
|
||||
# GSSFRAMEWORK_INCLUDE_DIR
|
||||
# GSSFRAMEWORK_LIBRARIES
|
||||
# GSSFRAMEWORK_LDFLAGS
|
||||
#
|
||||
|
||||
FIND_PATH(GSSFRAMEWORK_INCLUDE_DIR NAMES GSS.h)
|
||||
FIND_LIBRARY(GSSFRAMEWORK_LIBRARIES NAMES GSS)
|
||||
IF (GSSFRAMEWORK_INCLUDE_DIR AND GSSFRAMEWORK_LIBRARIES)
|
||||
IF (NOT CoreFoundation_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found GSS.framework ${GSSFRAMEWORK_LIBRARIES}")
|
||||
ENDIF()
|
||||
SET(GSSFRAMEWORK_FOUND TRUE)
|
||||
SET(GSSFRAMEWORK_LDFLAGS "-framework GSS")
|
||||
ENDIF ()
|
||||
|
||||
IF (GSS_FIND_REQUIRED AND NOT GSSFRAMEWORK_FOUND)
|
||||
MESSAGE(FATAL_ERROR "CoreFoundation not found")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
GSSFRAMEWORK_INCLUDE_DIR
|
||||
GSSFRAMEWORK_LIBRARIES
|
||||
GSSFRAMEWORK_LDFLAGS
|
||||
)
|
||||
@@ -1,45 +0,0 @@
|
||||
# - Try to find Iconv
|
||||
# Once done this will define
|
||||
#
|
||||
# ICONV_FOUND - system has Iconv
|
||||
# ICONV_INCLUDE_DIR - the Iconv include directory
|
||||
# ICONV_LIBRARIES - Link these to use Iconv
|
||||
#
|
||||
|
||||
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(ICONV_FIND_QUIETLY TRUE)
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
|
||||
CHECK_FUNCTION_EXISTS(iconv_open libc_has_iconv)
|
||||
FIND_LIBRARY(iconv_lib NAMES iconv libiconv libiconv-2 c)
|
||||
|
||||
IF(ICONV_INCLUDE_DIR AND libc_has_iconv)
|
||||
SET(ICONV_FOUND TRUE)
|
||||
SET(ICONV_LIBRARIES "")
|
||||
IF(NOT ICONV_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Iconv: provided by libc")
|
||||
ENDIF(NOT ICONV_FIND_QUIETLY)
|
||||
ELSEIF(ICONV_INCLUDE_DIR AND iconv_lib)
|
||||
SET(ICONV_FOUND TRUE)
|
||||
# split iconv into -L and -l linker options, so we can
|
||||
# set them for pkg-config
|
||||
GET_FILENAME_COMPONENT(iconv_path ${iconv_lib} PATH)
|
||||
GET_FILENAME_COMPONENT(iconv_name ${iconv_lib} NAME_WE)
|
||||
STRING(REGEX REPLACE "^lib" "" iconv_name ${iconv_name})
|
||||
SET(ICONV_LIBRARIES "-L${iconv_path} -l${iconv_name}")
|
||||
|
||||
IF(NOT ICONV_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
||||
ENDIF(NOT ICONV_FIND_QUIETLY)
|
||||
ELSE()
|
||||
IF(Iconv_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Iconv")
|
||||
ENDIF(Iconv_FIND_REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ICONV_INCLUDE_DIR
|
||||
ICONV_LIBRARIES
|
||||
)
|
||||
@@ -1,28 +0,0 @@
|
||||
INCLUDE(FindPkgConfig)
|
||||
|
||||
# This function will find and set up a pkg-config based module.
|
||||
# If a pc-file was found, it will resolve library paths to
|
||||
# absolute paths. Furthermore, the function will automatically
|
||||
# fall back to use static libraries in case no dynamic libraries
|
||||
# were found.
|
||||
FUNCTION(FIND_PKGLIBRARIES prefix package)
|
||||
PKG_CHECK_MODULES(${prefix} ${package})
|
||||
IF(NOT ${prefix}_FOUND)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
FOREACH(LIBRARY ${${prefix}_LIBRARIES})
|
||||
FIND_LIBRARY(${LIBRARY}_RESOLVED ${LIBRARY} PATHS ${${prefix}_LIBRARY_DIRS})
|
||||
IF(${${LIBRARY}_RESOLVED} STREQUAL "${LIBRARY}_RESOLVED-NOTFOUND")
|
||||
MESSAGE(FATAL_ERROR "could not resolve ${LIBRARY}")
|
||||
ENDIF()
|
||||
LIST(APPEND RESOLVED_LIBRARIES ${${LIBRARY}_RESOLVED})
|
||||
ENDFOREACH(LIBRARY)
|
||||
|
||||
SET(${prefix}_FOUND 1 PARENT_SCOPE)
|
||||
SET(${prefix}_LIBRARIES ${RESOLVED_LIBRARIES} PARENT_SCOPE)
|
||||
SET(${prefix}_INCLUDE_DIRS ${${prefix}_INCLUDE_DIRS} PARENT_SCOPE)
|
||||
SET(${prefix}_LDFLAGS ${${prefix}_LDFLAGS} PARENT_SCOPE)
|
||||
|
||||
MESSAGE(STATUS " Resolved libraries: ${RESOLVED_LIBRARIES}")
|
||||
ENDFUNCTION()
|
||||
@@ -1,28 +0,0 @@
|
||||
# Find Security.framework
|
||||
# This will define :
|
||||
#
|
||||
# SECURITY_FOUND
|
||||
# SECURITY_LIBRARIES
|
||||
# SECURITY_LDFLAGS
|
||||
# SECURITY_HAS_SSLCREATECONTEXT
|
||||
#
|
||||
|
||||
FIND_PATH(SECURITY_INCLUDE_DIR NAMES Security/Security.h)
|
||||
FIND_LIBRARY(SECURITY_LIBRARIES NAMES Security)
|
||||
IF (SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES)
|
||||
IF (NOT Security_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Security ${SECURITY_LIBRARIES}")
|
||||
ENDIF()
|
||||
SET(SECURITY_FOUND TRUE)
|
||||
SET(SECURITY_LDFLAGS "-framework Security")
|
||||
CHECK_LIBRARY_EXISTS("${SECURITY_LIBRARIES}" SSLCreateContext "Security/SecureTransport.h" SECURITY_HAS_SSLCREATECONTEXT)
|
||||
ENDIF ()
|
||||
|
||||
IF (Security_FIND_REQUIRED AND NOT SECURITY_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Security not found")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
SECURITY_INCLUDE_DIR
|
||||
SECURITY_LIBRARIES
|
||||
)
|
||||
@@ -1,26 +0,0 @@
|
||||
INCLUDE(FeatureSummary)
|
||||
|
||||
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h"
|
||||
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
|
||||
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
|
||||
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h
|
||||
HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
|
||||
|
||||
IF (HAVE_STRUCT_STAT_ST_MTIM)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
|
||||
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
||||
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
|
||||
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
||||
ELSE ()
|
||||
SET( HAVE_STRUCT_STAT_NSEC ON )
|
||||
ENDIF()
|
||||
|
||||
IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
|
||||
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON )
|
||||
ELSE()
|
||||
SET(USE_NSEC OFF)
|
||||
ENDIF()
|
||||
|
||||
ADD_FEATURE_INFO(nanoseconds USE_NSEC "whether to use sub-second file mtimes and ctimes")
|
||||
@@ -1,93 +0,0 @@
|
||||
# - Try to find mbedTLS
|
||||
# Once done this will define
|
||||
#
|
||||
# Read-Only variables
|
||||
# MBEDTLS_FOUND - system has mbedTLS
|
||||
# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
|
||||
# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
|
||||
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
|
||||
# MBEDTLS_LIBRARY - path to mbedTLS library
|
||||
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
|
||||
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
|
||||
#
|
||||
# Hint
|
||||
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
|
||||
|
||||
SET(_MBEDTLS_ROOT_HINTS
|
||||
${MBEDTLS_ROOT_DIR}
|
||||
ENV MBEDTLS_ROOT_DIR
|
||||
)
|
||||
|
||||
SET(_MBEDTLS_ROOT_HINTS_AND_PATHS
|
||||
HINTS ${_MBEDTLS_ROOT_HINTS}
|
||||
PATHS ${_MBEDTLS_ROOT_PATHS}
|
||||
)
|
||||
|
||||
FIND_PATH(MBEDTLS_INCLUDE_DIR
|
||||
NAMES mbedtls/version.h
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(MBEDTLS_FIND_QUIETLY TRUE)
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(MBEDTLS_LIBRARY
|
||||
NAMES mbedtls libmbedtls
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library
|
||||
)
|
||||
FIND_LIBRARY(MBEDX509_LIBRARY
|
||||
NAMES mbedx509 libmbedx509
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library
|
||||
)
|
||||
FIND_LIBRARY(MBEDCRYPTO_LIBRARY
|
||||
NAMES mbedcrypto libmbedcrypto
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library
|
||||
)
|
||||
|
||||
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
|
||||
SET(MBEDTLS_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(MBEDTLS_FOUND)
|
||||
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
|
||||
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
|
||||
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
|
||||
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
|
||||
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
|
||||
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
|
||||
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
|
||||
|
||||
IF(NOT MBEDTLS_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found mbedTLS:")
|
||||
FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
|
||||
STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
|
||||
IF (MBEDTLSMATCH)
|
||||
STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
|
||||
MESSAGE(STATUS " version ${MBEDTLS_VERSION}")
|
||||
ENDIF(MBEDTLSMATCH)
|
||||
MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}")
|
||||
MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}")
|
||||
MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
|
||||
ENDIF(NOT MBEDTLS_FIND_QUIETLY)
|
||||
ELSE(MBEDTLS_FOUND)
|
||||
IF(MBEDTLS_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find mbedTLS")
|
||||
ENDIF(MBEDTLS_FIND_REQUIRED)
|
||||
ENDIF(MBEDTLS_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
MBEDTLS_INCLUDE_DIR
|
||||
MBEDTLS_LIBRARY_DIR
|
||||
MBEDTLS_LIBRARIES
|
||||
MBEDTLS_LIBRARY
|
||||
MBEDX509_LIBRARY
|
||||
MBEDCRYPTO_LIBRARY
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
# This function splits the sources files up into their appropriate
|
||||
# subdirectories. This is especially useful for IDEs like Xcode and
|
||||
# Visual Studio, so that you can navigate into the libgit2_clar project,
|
||||
# and see the folders within the tests folder (instead of just seeing all
|
||||
# source and tests in a single folder.)
|
||||
FUNCTION(IDE_SPLIT_SOURCES target)
|
||||
IF(MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode)
|
||||
GET_TARGET_PROPERTY(sources ${target} SOURCES)
|
||||
FOREACH(source ${sources})
|
||||
IF(source MATCHES ".*/")
|
||||
STRING(REPLACE ${libgit2_SOURCE_DIR}/ "" rel ${source})
|
||||
IF(rel)
|
||||
STRING(REGEX REPLACE "/([^/]*)$" "" rel ${rel})
|
||||
IF(rel)
|
||||
STRING(REPLACE "/" "\\\\" rel ${rel})
|
||||
SOURCE_GROUP(${rel} FILES ${source})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
@@ -1,110 +0,0 @@
|
||||
# pkg-config file generation
|
||||
#
|
||||
# Uses the following globals:
|
||||
# - PKG_BUILD_PREFIX: the build location (aka prefix). Defaults to CMAKE_INSTALL_PREFIX
|
||||
# - PKG_BUILD_LIBDIR: the libdir location. Defaults to ${prefix}/lib.
|
||||
# - PKG_BUILD_INCLUDEDIR: the includedir location. Defaults to ${prefix}/include.
|
||||
#
|
||||
|
||||
function(pkg_build_config)
|
||||
set(options)
|
||||
set(oneValueArgs NAME DESCRIPTION VERSION FILENAME LIBS_SELF)
|
||||
set(multiValueArgs LIBS PRIVATE_LIBS REQUIRES CFLAGS)
|
||||
|
||||
cmake_parse_arguments(PKGCONFIG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_FILENAME AND DEFINED PKGCONFIG_NAME)
|
||||
set(PKGCONFIG_FILENAME ${PKGCONFIG_NAME})
|
||||
endif()
|
||||
if (NOT DEFINED PKGCONFIG_FILENAME)
|
||||
message(FATAL_ERROR "Missing FILENAME argument")
|
||||
endif()
|
||||
set(PKGCONFIG_FILE "${PROJECT_BINARY_DIR}/${PKGCONFIG_FILENAME}.pc")
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_DESCRIPTION)
|
||||
message(FATAL_ERROR "Missing DESCRIPTION argument")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_VERSION)
|
||||
message(FATAL_ERROR "Missing VERSION argument")
|
||||
endif()
|
||||
|
||||
if (DEFINED PKG_BUILD_PREFIX)
|
||||
set(PKGCONFIG_PREFIX "${PKG_BUILD_PREFIX}")
|
||||
else()
|
||||
set(PKGCONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
if(DEFINED PKG_BUILD_LIBDIR)
|
||||
if (IS_ABSOLUTE ${PKG_BUILD_LIBDIR})
|
||||
set(PKGCONFIG_LIBDIR ${PKG_BUILD_LIBDIR})
|
||||
else()
|
||||
set(PKGCONFIG_LIBDIR "\${prefix}/${PKG_BUILD_LIBDIR}")
|
||||
endif()
|
||||
else()
|
||||
set(PKGCONFIG_LIBDIR "\${prefix}/lib")
|
||||
endif()
|
||||
|
||||
if(DEFINED PKG_BUILD_INCLUDEDIR)
|
||||
if (IS_ABSOLUTE ${PKG_BUILD_INCLUDEDIR})
|
||||
set(PKGCONFIG_INCLUDEDIR ${PKG_BUILD_INCLUDEDIR})
|
||||
else()
|
||||
set(PKGCONFIG_INCLUDEDIR "\${prefix}/${PKG_BUILD_INCLUDEDIR}")
|
||||
endif()
|
||||
else()
|
||||
set(PKGCONFIG_INCLUDEDIR "\${prefix}/include")
|
||||
endif()
|
||||
|
||||
# Write .pc "header"
|
||||
file(WRITE "${PKGCONFIG_FILE}"
|
||||
"prefix=\"${PKGCONFIG_PREFIX}\"\n"
|
||||
"libdir=\"${PKGCONFIG_LIBDIR}\"\n"
|
||||
"includedir=\"${PKGCONFIG_INCLUDEDIR}\"\n"
|
||||
"\n"
|
||||
"Name: ${PKGCONFIG_NAME}\n"
|
||||
"Description: ${PKGCONFIG_DESCRIPTION}\n"
|
||||
"Version: ${PKGCONFIG_VERSION}\n"
|
||||
)
|
||||
|
||||
# Prepare Libs
|
||||
if(NOT DEFINED PKGCONFIG_LIBS_SELF)
|
||||
set(PKGCONFIG_LIBS_SELF "${PKGCONFIG_FILE}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED PKGCONFIG_LIBS)
|
||||
set(PKGCONFIG_LIBS "-l${PKGCONFIG_LIBS_SELF}")
|
||||
else()
|
||||
list(INSERT PKGCONFIG_LIBS 0 "-l${PKGCONFIG_LIBS_SELF}")
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_LIBS)
|
||||
string(REPLACE ";" " " PKGCONFIG_LIBS "${PKGCONFIG_LIBS}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Libs: -L\${libdir} ${PKGCONFIG_LIBS}\n")
|
||||
|
||||
# Prepare Libs.private
|
||||
if(DEFINED PKGCONFIG_PRIVATE_LIBS)
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_PRIVATE_LIBS)
|
||||
string(REPLACE ";" " " PKGCONFIG_PRIVATE_LIBS "${PKGCONFIG_PRIVATE_LIBS}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Libs.private: ${PKGCONFIG_PRIVATE_LIBS}\n")
|
||||
endif()
|
||||
|
||||
# Prepare Requires.private
|
||||
if(DEFINED PKGCONFIG_REQUIRES)
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_REQUIRES)
|
||||
string(REPLACE ";" " " PKGCONFIG_REQUIRES "${PKGCONFIG_REQUIRES}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Requires.private: ${PKGCONFIG_REQUIRES}\n")
|
||||
endif()
|
||||
|
||||
# Prepare Cflags
|
||||
if(DEFINED PKGCONFIG_CFLAGS)
|
||||
string(REPLACE ";" " " PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS}")
|
||||
else()
|
||||
set(PKGCONFIG_CFLAGS "")
|
||||
endif()
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Cflags: -I\${includedir} ${PKGCONFIG_CFLAGS}\n")
|
||||
|
||||
# Install .pc file
|
||||
install(FILES "${PKGCONFIG_FILE}"
|
||||
DESTINATION "${PKGCONFIG_PREFIX}/${PKGCONFIG_LIBDIR}/pkgconfig"
|
||||
)
|
||||
endfunction()
|
||||
@@ -1,53 +0,0 @@
|
||||
# Select the backend to use
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
|
||||
FIND_PACKAGE(GSSAPI)
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
INCLUDE(FindGSSFramework)
|
||||
ENDIF()
|
||||
|
||||
# Auto-select GSS backend
|
||||
IF (USE_GSSAPI STREQUAL ON)
|
||||
IF (GSSFRAMEWORK_FOUND)
|
||||
SET(GSS_BACKEND "GSS.framework")
|
||||
ELSEIF(GSSAPI_FOUND)
|
||||
SET(GSS_BACKEND "gssapi")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to autodetect a usable GSS backend."
|
||||
"Please pass the backend name explicitly (-DUSE_GSS=backend)")
|
||||
ENDIF()
|
||||
ELSEIF(USE_GSSAPI)
|
||||
# Backend was explicitly set
|
||||
SET(GSS_BACKEND ${USE_GSSAPI})
|
||||
ELSE()
|
||||
SET(GSS_BACKEND NO)
|
||||
ENDIF()
|
||||
|
||||
IF(GSS_BACKEND)
|
||||
# Check that we can find what's required for the selected backend
|
||||
IF (GSS_BACKEND STREQUAL "GSS.framework")
|
||||
IF (NOT GSSFRAMEWORK_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Asked for GSS.framework backend, but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBGIT2_LIBS ${GSSFRAMEWORK_LIBRARIES})
|
||||
|
||||
SET(GIT_GSSFRAMEWORK 1)
|
||||
ADD_FEATURE_INFO(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${GSS_BACKEND})")
|
||||
ELSEIF (GSS_BACKEND STREQUAL "gssapi")
|
||||
IF (NOT GSSAPI_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES})
|
||||
|
||||
SET(GIT_GSSAPI 1)
|
||||
ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${GSS_BACKEND})")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Asked for backend ${GSS_BACKEND} but it wasn't found")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(GIT_GSSAPI 0)
|
||||
ADD_FEATURE_INFO(SPNEGO NO "SPNEGO authentication support")
|
||||
ENDIF()
|
||||
@@ -1,124 +0,0 @@
|
||||
# Select the backend to use
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
FIND_PACKAGE(mbedTLS)
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
FIND_PACKAGE(Security)
|
||||
FIND_PACKAGE(CoreFoundation)
|
||||
ENDIF()
|
||||
|
||||
# Auto-select TLS backend
|
||||
IF (USE_HTTPS STREQUAL ON)
|
||||
IF (SECURITY_FOUND)
|
||||
IF (SECURITY_HAS_SSLCREATECONTEXT)
|
||||
SET(HTTPS_BACKEND "SecureTransport")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Security framework is too old, falling back to OpenSSL")
|
||||
SET(HTTPS_BACKEND "OpenSSL")
|
||||
ENDIF()
|
||||
ELSEIF (WINHTTP)
|
||||
SET(HTTPS_BACKEND "WinHTTP")
|
||||
ELSEIF(OPENSSL_FOUND)
|
||||
SET(HTTPS_BACKEND "OpenSSL")
|
||||
ELSEIF(MBEDTLS_FOUND)
|
||||
SET(HTTPS_BACKEND "mbedTLS")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to autodetect a usable HTTPS backend."
|
||||
"Please pass the backend name explicitly (-DUSE_HTTPS=backend)")
|
||||
ENDIF()
|
||||
ELSEIF(USE_HTTPS)
|
||||
# HTTPS backend was explicitly set
|
||||
SET(HTTPS_BACKEND ${USE_HTTPS})
|
||||
ELSE()
|
||||
SET(HTTPS_BACKEND NO)
|
||||
ENDIF()
|
||||
|
||||
IF(HTTPS_BACKEND)
|
||||
# Check that we can find what's required for the selected backend
|
||||
IF (HTTPS_BACKEND STREQUAL "SecureTransport")
|
||||
IF (NOT COREFOUNDATION_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, CoreFoundation.framework not found")
|
||||
ENDIF()
|
||||
IF (NOT SECURITY_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, Security.framework not found")
|
||||
ENDIF()
|
||||
IF (NOT SECURITY_HAS_SSLCREATECONTEXT)
|
||||
MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, SSLCreateContext not supported")
|
||||
ENDIF()
|
||||
|
||||
SET(GIT_SECURE_TRANSPORT 1)
|
||||
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${SECURITY_INCLUDE_DIR})
|
||||
LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
|
||||
LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
|
||||
IF (NOT OPENSSL_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
SET(GIT_OPENSSL 1)
|
||||
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
LIST(APPEND LIBGIT2_LIBS ${OPENSSL_LIBRARIES})
|
||||
LIST(APPEND LIBGIT2_PC_LIBS ${OPENSSL_LDFLAGS})
|
||||
LIST(APPEND LIBGIT2_PC_REQUIRES "openssl")
|
||||
ELSEIF(HTTPS_BACKEND STREQUAL "mbedTLS")
|
||||
IF (NOT MBEDTLS_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Asked for mbedTLS backend, but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CERT_LOCATION)
|
||||
MESSAGE(STATUS "Auto-detecting default certificates location")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES Darwin)
|
||||
# Check for an Homebrew installation
|
||||
SET(OPENSSL_CMD "/usr/local/opt/openssl/bin/openssl")
|
||||
ELSE()
|
||||
SET(OPENSSL_CMD "openssl")
|
||||
ENDIF()
|
||||
EXECUTE_PROCESS(COMMAND ${OPENSSL_CMD} version -d OUTPUT_VARIABLE OPENSSL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
IF(OPENSSL_DIR)
|
||||
STRING(REGEX REPLACE "^OPENSSLDIR: \"(.*)\"$" "\\1/" OPENSSL_DIR ${OPENSSL_DIR})
|
||||
|
||||
SET(OPENSSL_CA_LOCATIONS
|
||||
"ca-bundle.pem" # OpenSUSE Leap 42.1
|
||||
"cert.pem" # Ubuntu 14.04, FreeBSD
|
||||
"certs/ca-certificates.crt" # Ubuntu 16.04
|
||||
"certs/ca.pem" # Debian 7
|
||||
)
|
||||
FOREACH(SUFFIX IN LISTS OPENSSL_CA_LOCATIONS)
|
||||
SET(LOC "${OPENSSL_DIR}${SUFFIX}")
|
||||
IF(NOT CERT_LOCATION AND EXISTS "${OPENSSL_DIR}${SUFFIX}")
|
||||
SET(CERT_LOCATION ${LOC})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find OpenSSL executable. Please provide default certificate location via CERT_LOCATION")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CERT_LOCATION)
|
||||
IF(NOT EXISTS ${CERT_LOCATION})
|
||||
MESSAGE(FATAL_ERROR "Cannot use CERT_LOCATION=${CERT_LOCATION} as it doesn't exist")
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(CERT_LOCATION ON "using certificates from ${CERT_LOCATION}")
|
||||
ADD_DEFINITIONS(-DGIT_DEFAULT_CERT_LOCATION="${CERT_LOCATION}")
|
||||
ENDIF()
|
||||
|
||||
SET(GIT_MBEDTLS 1)
|
||||
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR})
|
||||
LIST(APPEND LIBGIT2_LIBS ${MBEDTLS_LIBRARIES})
|
||||
# mbedTLS has no pkgconfig file, hence we can't require it
|
||||
# https://github.com/ARMmbed/mbedtls/issues/228
|
||||
# For now, pass its link flags as our own
|
||||
LIST(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "WinHTTP")
|
||||
# WinHTTP setup was handled in the WinHTTP-specific block above
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Asked for backend ${HTTPS_BACKEND} but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
SET(GIT_HTTPS 1)
|
||||
ADD_FEATURE_INFO(HTTPS GIT_HTTPS "using ${HTTPS_BACKEND}")
|
||||
ELSE()
|
||||
SET(GIT_HTTPS 0)
|
||||
ADD_FEATURE_INFO(HTTPS NO "")
|
||||
ENDIF()
|
||||
@@ -1,66 +0,0 @@
|
||||
# Select a hash backend
|
||||
|
||||
# USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF
|
||||
|
||||
IF(USE_SHA1 STREQUAL ON OR USE_SHA1 STREQUAL "CollisionDetection")
|
||||
SET(SHA1_BACKEND "CollisionDetection")
|
||||
ELSEIF(USE_SHA1 STREQUAL "HTTPS")
|
||||
message(STATUS "Checking HTTPS backend… ${HTTPS_BACKEND}")
|
||||
IF(HTTPS_BACKEND STREQUAL "SecureTransport")
|
||||
SET(SHA1_BACKEND "CommonCrypto")
|
||||
ELSEIF(HTTPS_BACKEND STREQUAL "WinHTTP")
|
||||
SET(SHA1_BACKEND "Win32")
|
||||
ELSEIF(HTTPS_BACKEND)
|
||||
SET(SHA1_BACKEND ${HTTPS_BACKEND})
|
||||
ELSE()
|
||||
ENDIF()
|
||||
IF(NOT HTTPS_BACKEND)
|
||||
SET(SHA1_BACKEND "CollisionDetection")
|
||||
ENDIF()
|
||||
message(STATUS "Using SHA1 backend ${SHA1_BACKEND}")
|
||||
ELSEIF(USE_SHA1 STREQUAL "Generic")
|
||||
SET(SHA1_BACKEND "Generic")
|
||||
# ELSEIF(NOT USE_SHA1)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Invalid value for USE_SHA1: ${USE_SHA1}")
|
||||
ENDIF()
|
||||
|
||||
IF(SHA1_BACKEND STREQUAL "CollisionDetection")
|
||||
SET(GIT_SHA1_COLLISIONDETECT 1)
|
||||
ADD_DEFINITIONS(-DSHA1DC_NO_STANDARD_INCLUDES=1)
|
||||
ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
|
||||
ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
|
||||
FILE(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
|
||||
ELSEIF(SHA1_BACKEND STREQUAL "OpenSSL")
|
||||
# OPENSSL_FOUND should already be set, we're checking HTTPS_BACKEND
|
||||
|
||||
SET(GIT_SHA1_OPENSSL 1)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
LIST(APPEND LIBGIT2_PC_LIBS "-lssl")
|
||||
ELSE()
|
||||
LIST(APPEND LIBGIT2_PC_REQUIRES "openssl")
|
||||
ENDIF()
|
||||
FILE(GLOB SRC_SHA1 hash/sha1/openssl.*)
|
||||
ELSEIF(SHA1_BACKEND STREQUAL "CommonCrypto")
|
||||
SET(GIT_SHA1_COMMON_CRYPTO 1)
|
||||
FILE(GLOB SRC_SHA1 hash/sha1/common_crypto.*)
|
||||
ELSEIF(SHA1_BACKEND STREQUAL "mbedTLS")
|
||||
SET(GIT_SHA1_MBEDTLS 1)
|
||||
FILE(GLOB SRC_SHA1 hash/sha1/mbedtls.*)
|
||||
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR})
|
||||
LIST(APPEND LIBGIT2_LIBS ${MBEDTLS_LIBRARIES})
|
||||
# mbedTLS has no pkgconfig file, hence we can't require it
|
||||
# https://github.com/ARMmbed/mbedtls/issues/228
|
||||
# For now, pass its link flags as our own
|
||||
LIST(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
|
||||
ELSEIF(SHA1_BACKEND STREQUAL "Win32")
|
||||
SET(GIT_SHA1_WIN32 1)
|
||||
FILE(GLOB SRC_SHA1 hash/sha1/win32.*)
|
||||
ELSEIF(SHA1_BACKEND STREQUAL "Generic")
|
||||
FILE(GLOB SRC_SHA1 hash/sha1/generic.*)
|
||||
# ELSEIF(NOT USE_SHA1)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend: ${SHA1_BACKEND}")
|
||||
ENDIF()
|
||||
|
||||
ADD_FEATURE_INFO(SHA ON "using ${SHA1_BACKEND}")
|
||||
77
cmake/PkgBuildConfig.cmake
Normal file
77
cmake/PkgBuildConfig.cmake
Normal file
@@ -0,0 +1,77 @@
|
||||
# pkg-config file generation
|
||||
#
|
||||
|
||||
function(pkg_build_config)
|
||||
set(options)
|
||||
set(oneValueArgs NAME DESCRIPTION VERSION FILENAME LIBS_SELF)
|
||||
set(multiValueArgs LIBS PRIVATE_LIBS REQUIRES CFLAGS)
|
||||
|
||||
cmake_parse_arguments(PKGCONFIG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_FILENAME AND DEFINED PKGCONFIG_NAME)
|
||||
set(PKGCONFIG_FILENAME ${PKGCONFIG_NAME})
|
||||
endif()
|
||||
if (NOT DEFINED PKGCONFIG_FILENAME)
|
||||
message(FATAL_ERROR "Missing FILENAME argument")
|
||||
endif()
|
||||
set(PKGCONFIG_FILE "${PROJECT_BINARY_DIR}/${PKGCONFIG_FILENAME}.pc")
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_DESCRIPTION)
|
||||
message(FATAL_ERROR "Missing DESCRIPTION argument")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_VERSION)
|
||||
message(FATAL_ERROR "Missing VERSION argument")
|
||||
endif()
|
||||
|
||||
# Write .pc "header"
|
||||
file(WRITE "${PKGCONFIG_FILE}"
|
||||
"prefix=\"${CMAKE_INSTALL_PREFIX}\"\n"
|
||||
"libdir=\"${CMAKE_INSTALL_FULL_LIBDIR}\"\n"
|
||||
"includedir=\"${CMAKE_INSTALL_FULL_INCLUDEDIR}\"\n"
|
||||
"\n"
|
||||
"Name: ${PKGCONFIG_NAME}\n"
|
||||
"Description: ${PKGCONFIG_DESCRIPTION}\n"
|
||||
"Version: ${PKGCONFIG_VERSION}\n"
|
||||
)
|
||||
|
||||
# Prepare Libs
|
||||
if(NOT DEFINED PKGCONFIG_LIBS_SELF)
|
||||
set(PKGCONFIG_LIBS_SELF "${PKGCONFIG_FILE}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED PKGCONFIG_LIBS)
|
||||
set(PKGCONFIG_LIBS "-l${PKGCONFIG_LIBS_SELF}")
|
||||
else()
|
||||
list(INSERT PKGCONFIG_LIBS 0 "-l${PKGCONFIG_LIBS_SELF}")
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_LIBS)
|
||||
string(REPLACE ";" " " PKGCONFIG_LIBS "${PKGCONFIG_LIBS}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Libs: -L\${libdir} ${PKGCONFIG_LIBS}\n")
|
||||
|
||||
# Prepare Libs.private
|
||||
if(DEFINED PKGCONFIG_PRIVATE_LIBS)
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_PRIVATE_LIBS)
|
||||
string(REPLACE ";" " " PKGCONFIG_PRIVATE_LIBS "${PKGCONFIG_PRIVATE_LIBS}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Libs.private: ${PKGCONFIG_PRIVATE_LIBS}\n")
|
||||
endif()
|
||||
|
||||
# Prepare Requires.private
|
||||
if(DEFINED PKGCONFIG_REQUIRES)
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_REQUIRES)
|
||||
string(REPLACE ";" " " PKGCONFIG_REQUIRES "${PKGCONFIG_REQUIRES}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Requires.private: ${PKGCONFIG_REQUIRES}\n")
|
||||
endif()
|
||||
|
||||
# Prepare Cflags
|
||||
if(DEFINED PKGCONFIG_CFLAGS)
|
||||
string(REPLACE ";" " " PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS}")
|
||||
else()
|
||||
set(PKGCONFIG_CFLAGS "")
|
||||
endif()
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Cflags: -I\${includedir} ${PKGCONFIG_CFLAGS}\n")
|
||||
|
||||
# Install .pc file
|
||||
install(FILES "${PKGCONFIG_FILE}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endfunction()
|
||||
20
cmake/SanitizeBool.cmake
Normal file
20
cmake/SanitizeBool.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
function(SanitizeBool VAR)
|
||||
string(TOLOWER "${${VAR}}" VALUE)
|
||||
if(VALUE STREQUAL "on")
|
||||
set(${VAR} "ON" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "yes")
|
||||
set(${VAR} "ON" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "true")
|
||||
set(${VAR} "ON" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "1")
|
||||
set(${VAR} "ON" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "off")
|
||||
set(${VAR} "OFF" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "no")
|
||||
set(${VAR} "OFF" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "false")
|
||||
set(${VAR} "OFF" PARENT_SCOPE)
|
||||
elseif(VALUE STREQUAL "0")
|
||||
set(${VAR} "OFF" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
48
cmake/SelectGSSAPI.cmake
Normal file
48
cmake/SelectGSSAPI.cmake
Normal file
@@ -0,0 +1,48 @@
|
||||
include(SanitizeBool)
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
find_package(GSSAPI)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
include(FindGSSFramework)
|
||||
endif()
|
||||
|
||||
if(USE_GSSAPI)
|
||||
# Auto-select GSS backend
|
||||
sanitizebool(USE_GSSAPI)
|
||||
if(USE_GSSAPI STREQUAL ON)
|
||||
if(GSSFRAMEWORK_FOUND)
|
||||
set(USE_GSSAPI "GSS.framework")
|
||||
elseif(GSSAPI_FOUND)
|
||||
set(USE_GSSAPI "gssapi")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to autodetect a usable GSS backend."
|
||||
"Please pass the backend name explicitly (-DUSE_GSS=backend)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check that we can find what's required for the selected backend
|
||||
if(USE_GSSAPI STREQUAL "GSS.framework")
|
||||
if(NOT GSSFRAMEWORK_FOUND)
|
||||
message(FATAL_ERROR "Asked for GSS.framework backend, but it wasn't found")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${GSSFRAMEWORK_LIBRARIES})
|
||||
|
||||
set(GIT_GSSFRAMEWORK 1)
|
||||
add_feature_info(GSSAPI GIT_GSSFRAMEWORK "GSSAPI support for SPNEGO authentication (${USE_GSSAPI})")
|
||||
elseif(USE_GSSAPI STREQUAL "gssapi")
|
||||
if(NOT GSSAPI_FOUND)
|
||||
message(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${GSSAPI_LIBRARIES})
|
||||
|
||||
set(GIT_GSSAPI 1)
|
||||
add_feature_info(GSSAPI GIT_GSSAPI "GSSAPI support for SPNEGO authentication (${USE_GSSAPI})")
|
||||
else()
|
||||
message(FATAL_ERROR "Asked for backend ${USE_GSSAPI} but it wasn't found")
|
||||
endif()
|
||||
else()
|
||||
set(GIT_GSSAPI 0)
|
||||
add_feature_info(GSSAPI NO "GSSAPI support for SPNEGO authentication")
|
||||
endif()
|
||||
19
cmake/SelectHTTPParser.cmake
Normal file
19
cmake/SelectHTTPParser.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# Optional external dependency: http-parser
|
||||
if(USE_HTTP_PARSER STREQUAL "system")
|
||||
find_package(HTTPParser)
|
||||
|
||||
if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${HTTP_PARSER_LIBRARIES})
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
|
||||
add_feature_info(http-parser ON "http-parser support (system)")
|
||||
else()
|
||||
message(FATAL_ERROR "http-parser support was requested but not found")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/http-parser" "${PROJECT_BINARY_DIR}/deps/http-parser")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/http-parser")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS "$<TARGET_OBJECTS:http-parser>")
|
||||
add_feature_info(http-parser ON "http-parser support (bundled)")
|
||||
endif()
|
||||
147
cmake/SelectHTTPSBackend.cmake
Normal file
147
cmake/SelectHTTPSBackend.cmake
Normal file
@@ -0,0 +1,147 @@
|
||||
include(SanitizeBool)
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
find_package(OpenSSL)
|
||||
find_package(mbedTLS)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
find_package(Security)
|
||||
find_package(CoreFoundation)
|
||||
endif()
|
||||
|
||||
if(USE_HTTPS)
|
||||
# Auto-select TLS backend
|
||||
sanitizebool(USE_HTTPS)
|
||||
if(USE_HTTPS STREQUAL ON)
|
||||
if(SECURITY_FOUND)
|
||||
if(SECURITY_HAS_SSLCREATECONTEXT)
|
||||
set(USE_HTTPS "SecureTransport")
|
||||
else()
|
||||
message(STATUS "Security framework is too old, falling back to OpenSSL")
|
||||
set(USE_HTTPS "OpenSSL")
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(USE_HTTPS "WinHTTP")
|
||||
elseif(OPENSSL_FOUND)
|
||||
set(USE_HTTPS "OpenSSL")
|
||||
elseif(MBEDTLS_FOUND)
|
||||
set(USE_HTTPS "mbedTLS")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to autodetect a usable HTTPS backend."
|
||||
"Please pass the backend name explicitly (-DUSE_HTTPS=backend)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check that we can find what's required for the selected backend
|
||||
if(USE_HTTPS STREQUAL "SecureTransport")
|
||||
if(NOT COREFOUNDATION_FOUND)
|
||||
message(FATAL_ERROR "Cannot use SecureTransport backend, CoreFoundation.framework not found")
|
||||
endif()
|
||||
if(NOT SECURITY_FOUND)
|
||||
message(FATAL_ERROR "Cannot use SecureTransport backend, Security.framework not found")
|
||||
endif()
|
||||
if(NOT SECURITY_HAS_SSLCREATECONTEXT)
|
||||
message(FATAL_ERROR "Cannot use SecureTransport backend, SSLCreateContext not supported")
|
||||
endif()
|
||||
|
||||
set(GIT_SECURE_TRANSPORT 1)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${SECURITY_INCLUDE_DIR})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
|
||||
list(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
|
||||
elseif(USE_HTTPS STREQUAL "OpenSSL")
|
||||
if(NOT OPENSSL_FOUND)
|
||||
message(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found")
|
||||
endif()
|
||||
|
||||
set(GIT_OPENSSL 1)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${OPENSSL_LIBRARIES})
|
||||
# Static OpenSSL (lib crypto.a) requires libdl, include it explicitly
|
||||
if(LINK_WITH_STATIC_LIBRARIES STREQUAL ON)
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
list(APPEND LIBGIT2_PC_LIBS ${OPENSSL_LDFLAGS})
|
||||
list(APPEND LIBGIT2_PC_REQUIRES "openssl")
|
||||
elseif(USE_HTTPS STREQUAL "mbedTLS")
|
||||
if(NOT MBEDTLS_FOUND)
|
||||
message(FATAL_ERROR "Asked for mbedTLS backend, but it wasn't found")
|
||||
endif()
|
||||
|
||||
if(NOT CERT_LOCATION)
|
||||
message(STATUS "Auto-detecting default certificates location")
|
||||
if(EXISTS "/usr/local/opt/openssl/bin/openssl")
|
||||
# Check for an Homebrew installation
|
||||
set(OPENSSL_CMD "/usr/local/opt/openssl/bin/openssl")
|
||||
else()
|
||||
set(OPENSSL_CMD "openssl")
|
||||
endif()
|
||||
execute_process(COMMAND ${OPENSSL_CMD} version -d OUTPUT_VARIABLE OPENSSL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(OPENSSL_DIR)
|
||||
string(REGEX REPLACE "^OPENSSLDIR: \"(.*)\"$" "\\1/" OPENSSL_DIR ${OPENSSL_DIR})
|
||||
|
||||
set(OPENSSL_CA_LOCATIONS
|
||||
"ca-bundle.pem" # OpenSUSE Leap 42.1
|
||||
"cert.pem" # Ubuntu 14.04, FreeBSD
|
||||
"certs/ca-certificates.crt" # Ubuntu 16.04
|
||||
"certs/ca.pem" # Debian 7
|
||||
)
|
||||
foreach(SUFFIX IN LISTS OPENSSL_CA_LOCATIONS)
|
||||
set(LOC "${OPENSSL_DIR}${SUFFIX}")
|
||||
if(NOT CERT_LOCATION AND EXISTS "${OPENSSL_DIR}${SUFFIX}")
|
||||
set(CERT_LOCATION ${LOC})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find OpenSSL executable. Please provide default certificate location via CERT_LOCATION")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CERT_LOCATION)
|
||||
if(NOT EXISTS ${CERT_LOCATION})
|
||||
message(FATAL_ERROR "Cannot use CERT_LOCATION=${CERT_LOCATION} as it doesn't exist")
|
||||
endif()
|
||||
add_feature_info(CERT_LOCATION ON "using certificates from ${CERT_LOCATION}")
|
||||
add_definitions(-DGIT_DEFAULT_CERT_LOCATION="${CERT_LOCATION}")
|
||||
endif()
|
||||
|
||||
set(GIT_MBEDTLS 1)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${MBEDTLS_LIBRARIES})
|
||||
# mbedTLS has no pkgconfig file, hence we can't require it
|
||||
# https://github.com/ARMmbed/mbedtls/issues/228
|
||||
# For now, pass its link flags as our own
|
||||
list(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
|
||||
elseif(USE_HTTPS STREQUAL "Schannel")
|
||||
set(GIT_SCHANNEL 1)
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS "rpcrt4" "crypt32" "ole32")
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
|
||||
elseif(USE_HTTPS STREQUAL "WinHTTP")
|
||||
set(GIT_WINHTTP 1)
|
||||
|
||||
# Since MinGW does not come with headers or an import library for winhttp,
|
||||
# we have to include a private header and generate our own import library
|
||||
if(MINGW)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/winhttp" "${PROJECT_BINARY_DIR}/deps/winhttp")
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS winhttp)
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/winhttp")
|
||||
else()
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS "winhttp")
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS "rpcrt4" "crypt32" "ole32")
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
|
||||
elseif(USE_HTTPS STREQUAL "OpenSSL-Dynamic")
|
||||
set(GIT_OPENSSL 1)
|
||||
set(GIT_OPENSSL_DYNAMIC 1)
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS dl)
|
||||
else()
|
||||
message(FATAL_ERROR "Asked for backend ${USE_HTTPS} but it wasn't found")
|
||||
endif()
|
||||
|
||||
set(GIT_HTTPS 1)
|
||||
add_feature_info(HTTPS GIT_HTTPS "using ${USE_HTTPS}")
|
||||
else()
|
||||
set(GIT_HTTPS 0)
|
||||
add_feature_info(HTTPS NO "")
|
||||
endif()
|
||||
104
cmake/SelectHashes.cmake
Normal file
104
cmake/SelectHashes.cmake
Normal file
@@ -0,0 +1,104 @@
|
||||
# Select a hash backend
|
||||
|
||||
include(SanitizeBool)
|
||||
|
||||
# USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF
|
||||
sanitizebool(USE_SHA1)
|
||||
sanitizebool(USE_SHA256)
|
||||
|
||||
# sha1
|
||||
|
||||
if(USE_SHA1 STREQUAL ON)
|
||||
SET(USE_SHA1 "CollisionDetection")
|
||||
elseif(USE_SHA1 STREQUAL "HTTPS")
|
||||
if(USE_HTTPS STREQUAL "SecureTransport")
|
||||
set(USE_SHA1 "CommonCrypto")
|
||||
elseif(USE_HTTPS STREQUAL "Schannel")
|
||||
set(USE_SHA1 "Win32")
|
||||
elseif(USE_HTTPS STREQUAL "WinHTTP")
|
||||
set(USE_SHA1 "Win32")
|
||||
elseif(USE_HTTPS)
|
||||
set(USE_SHA1 ${USE_HTTPS})
|
||||
else()
|
||||
set(USE_SHA1 "CollisionDetection")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_SHA1 STREQUAL "CollisionDetection")
|
||||
set(GIT_SHA1_COLLISIONDETECT 1)
|
||||
elseif(USE_SHA1 STREQUAL "OpenSSL")
|
||||
set(GIT_SHA1_OPENSSL 1)
|
||||
elseif(USE_SHA1 STREQUAL "OpenSSL-Dynamic")
|
||||
set(GIT_SHA1_OPENSSL 1)
|
||||
set(GIT_SHA1_OPENSSL_DYNAMIC 1)
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS dl)
|
||||
elseif(USE_SHA1 STREQUAL "CommonCrypto")
|
||||
set(GIT_SHA1_COMMON_CRYPTO 1)
|
||||
elseif(USE_SHA1 STREQUAL "mbedTLS")
|
||||
set(GIT_SHA1_MBEDTLS 1)
|
||||
elseif(USE_SHA1 STREQUAL "Win32")
|
||||
set(GIT_SHA1_WIN32 1)
|
||||
else()
|
||||
message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
|
||||
endif()
|
||||
|
||||
# sha256
|
||||
|
||||
if(USE_SHA256 STREQUAL ON AND USE_HTTPS)
|
||||
SET(USE_SHA256 "HTTPS")
|
||||
elseif(USE_SHA256 STREQUAL ON)
|
||||
SET(USE_SHA256 "Builtin")
|
||||
endif()
|
||||
|
||||
if(USE_SHA256 STREQUAL "HTTPS")
|
||||
if(USE_HTTPS STREQUAL "SecureTransport")
|
||||
set(USE_SHA256 "CommonCrypto")
|
||||
elseif(USE_HTTPS STREQUAL "Schannel")
|
||||
set(USE_SHA256 "Win32")
|
||||
elseif(USE_HTTPS STREQUAL "WinHTTP")
|
||||
set(USE_SHA256 "Win32")
|
||||
elseif(USE_HTTPS)
|
||||
set(USE_SHA256 ${USE_HTTPS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_SHA256 STREQUAL "Builtin")
|
||||
set(GIT_SHA256_BUILTIN 1)
|
||||
elseif(USE_SHA256 STREQUAL "OpenSSL")
|
||||
set(GIT_SHA256_OPENSSL 1)
|
||||
elseif(USE_SHA256 STREQUAL "OpenSSL-Dynamic")
|
||||
set(GIT_SHA256_OPENSSL 1)
|
||||
set(GIT_SHA256_OPENSSL_DYNAMIC 1)
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS dl)
|
||||
elseif(USE_SHA256 STREQUAL "CommonCrypto")
|
||||
set(GIT_SHA256_COMMON_CRYPTO 1)
|
||||
elseif(USE_SHA256 STREQUAL "mbedTLS")
|
||||
set(GIT_SHA256_MBEDTLS 1)
|
||||
elseif(USE_SHA256 STREQUAL "Win32")
|
||||
set(GIT_SHA256_WIN32 1)
|
||||
else()
|
||||
message(FATAL_ERROR "Asked for unknown SHA256 backend: ${USE_SHA256}")
|
||||
endif()
|
||||
|
||||
# add library requirements
|
||||
if(USE_SHA1 STREQUAL "OpenSSL" OR USE_SHA256 STREQUAL "OpenSSL")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lssl")
|
||||
else()
|
||||
list(APPEND LIBGIT2_PC_REQUIRES "openssl")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_SHA1 STREQUAL "mbedTLS" OR USE_SHA256 STREQUAL "mbedTLS")
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${MBEDTLS_LIBRARIES})
|
||||
# mbedTLS has no pkgconfig file, hence we can't require it
|
||||
# https://github.com/ARMmbed/mbedtls/issues/228
|
||||
# For now, pass its link flags as our own
|
||||
list(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# notify feature enablement
|
||||
|
||||
add_feature_info(SHA1 ON "using ${USE_SHA1}")
|
||||
add_feature_info(SHA256 ON "using ${USE_SHA256}")
|
||||
51
cmake/SelectRegex.cmake
Normal file
51
cmake/SelectRegex.cmake
Normal file
@@ -0,0 +1,51 @@
|
||||
# Specify regular expression implementation
|
||||
find_package(PCRE)
|
||||
|
||||
if(REGEX_BACKEND STREQUAL "")
|
||||
check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
|
||||
|
||||
if(HAVE_REGCOMP_L)
|
||||
set(REGEX_BACKEND "regcomp_l")
|
||||
elseif(PCRE_FOUND)
|
||||
set(REGEX_BACKEND "pcre")
|
||||
else()
|
||||
set(REGEX_BACKEND "builtin")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(REGEX_BACKEND STREQUAL "regcomp_l")
|
||||
add_feature_info(regex ON "using system regcomp_l")
|
||||
set(GIT_REGEX_REGCOMP_L 1)
|
||||
elseif(REGEX_BACKEND STREQUAL "pcre2")
|
||||
find_package(PCRE2)
|
||||
|
||||
if(NOT PCRE2_FOUND)
|
||||
MESSAGE(FATAL_ERROR "PCRE2 support was requested but not found")
|
||||
endif()
|
||||
|
||||
add_feature_info(regex ON "using system PCRE2")
|
||||
set(GIT_REGEX_PCRE2 1)
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${PCRE2_LIBRARIES})
|
||||
list(APPEND LIBGIT2_PC_REQUIRES "libpcre2-8")
|
||||
elseif(REGEX_BACKEND STREQUAL "pcre")
|
||||
add_feature_info(regex ON "using system PCRE")
|
||||
set(GIT_REGEX_PCRE 1)
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${PCRE_LIBRARIES})
|
||||
list(APPEND LIBGIT2_PC_REQUIRES "libpcre")
|
||||
elseif(REGEX_BACKEND STREQUAL "regcomp")
|
||||
add_feature_info(regex ON "using system regcomp")
|
||||
set(GIT_REGEX_REGCOMP 1)
|
||||
elseif(REGEX_BACKEND STREQUAL "builtin")
|
||||
add_feature_info(regex ON "using bundled PCRE")
|
||||
set(GIT_REGEX_BUILTIN 1)
|
||||
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/pcre" "${PROJECT_BINARY_DIR}/deps/pcre")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/pcre")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:pcre>)
|
||||
else()
|
||||
message(FATAL_ERROR "The REGEX_BACKEND option provided is not supported")
|
||||
endif()
|
||||
44
cmake/SelectSSH.cmake
Normal file
44
cmake/SelectSSH.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
if(USE_SSH STREQUAL "exec")
|
||||
set(GIT_SSH 1)
|
||||
set(GIT_SSH_EXEC 1)
|
||||
|
||||
add_feature_info(SSH ON "using OpenSSH exec support")
|
||||
elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2")
|
||||
find_pkglibraries(LIBSSH2 libssh2)
|
||||
|
||||
if(NOT LIBSSH2_FOUND)
|
||||
find_package(LibSSH2)
|
||||
set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR})
|
||||
get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY)
|
||||
set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY})
|
||||
set(LIBSSH2_LDFLAGS "-lssh2")
|
||||
endif()
|
||||
|
||||
if(NOT LIBSSH2_FOUND)
|
||||
message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES})
|
||||
list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
|
||||
|
||||
check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
|
||||
if(HAVE_LIBSSH2_MEMORY_CREDENTIALS)
|
||||
set(GIT_SSH_LIBSSH2_MEMORY_CREDENTIALS 1)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND EMBED_SSH_PATH)
|
||||
file(GLOB SSH_SRC "${EMBED_SSH_PATH}/src/*.c")
|
||||
list(SORT SSH_SRC)
|
||||
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS ${SSH_SRC})
|
||||
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${EMBED_SSH_PATH}/include")
|
||||
file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
|
||||
endif()
|
||||
|
||||
set(GIT_SSH 1)
|
||||
set(GIT_SSH_LIBSSH2 1)
|
||||
add_feature_info(SSH ON "using libssh2")
|
||||
else()
|
||||
add_feature_info(SSH OFF "SSH transport support")
|
||||
endif()
|
||||
9
cmake/SelectXdiff.cmake
Normal file
9
cmake/SelectXdiff.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
# Optional external dependency: xdiff
|
||||
if(USE_XDIFF STREQUAL "system")
|
||||
message(FATAL_ERROR "external/system xdiff is not yet supported")
|
||||
else()
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/xdiff" "${PROJECT_BINARY_DIR}/deps/xdiff")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/xdiff")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS "$<TARGET_OBJECTS:xdiff>")
|
||||
add_feature_info(xdiff ON "xdiff support (bundled)")
|
||||
endif()
|
||||
34
cmake/SelectZlib.cmake
Normal file
34
cmake/SelectZlib.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
# Optional external dependency: zlib
|
||||
include(SanitizeBool)
|
||||
|
||||
SanitizeBool(USE_BUNDLED_ZLIB)
|
||||
if(USE_BUNDLED_ZLIB STREQUAL ON)
|
||||
set(USE_BUNDLED_ZLIB "Bundled")
|
||||
endif()
|
||||
|
||||
if(USE_BUNDLED_ZLIB STREQUAL "OFF")
|
||||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS ${ZLIB_LIBRARIES})
|
||||
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lz")
|
||||
else()
|
||||
list(APPEND LIBGIT2_PC_REQUIRES "zlib")
|
||||
endif()
|
||||
add_feature_info(zlib ON "using system zlib")
|
||||
else()
|
||||
message(STATUS "zlib was not found; using bundled 3rd-party sources." )
|
||||
endif()
|
||||
endif()
|
||||
if(USE_BUNDLED_ZLIB STREQUAL "Chromium")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/chromium-zlib" "${PROJECT_BINARY_DIR}/deps/chromium-zlib")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/chromium-zlib")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:chromium_zlib>)
|
||||
add_feature_info(zlib ON "using (Chromium) bundled zlib")
|
||||
elseif(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/zlib" "${PROJECT_BINARY_DIR}/deps/zlib")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/zlib")
|
||||
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:zlib>)
|
||||
add_feature_info(zlib ON "using bundled zlib")
|
||||
endif()
|
||||
101
deps/chromium-zlib/CMakeLists.txt
vendored
Normal file
101
deps/chromium-zlib/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
# CMake build script for the bundled Chromium zlib implementation. So far, it
|
||||
# is only supported for x86_64 processors with CLMUL, SSE3, SSE4.2.
|
||||
#
|
||||
# TODO: The Chromium build file (in deps/chromium-zlib/zlib/BUILD.gn) supports
|
||||
# more platforms (like ARM with NEON), more can be enabled as needed.
|
||||
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
include(FetchContent)
|
||||
include(FindGit)
|
||||
|
||||
# Ensure that the git binary is present to download the sources.
|
||||
find_package(Git)
|
||||
if(NOT Git_FOUND)
|
||||
message(FATAL_ERROR "git is required to download the Chromium zlib sources")
|
||||
endif()
|
||||
|
||||
fetchcontent_populate(chromium_zlib_src
|
||||
GIT_REPOSITORY https://chromium.googlesource.com/chromium/src/third_party/zlib.git
|
||||
GIT_TAG 2c183c9f93a328bfb3121284da13cf89a0f7e64a
|
||||
QUIET
|
||||
)
|
||||
|
||||
# The Chromium build globally disables some warnings.
|
||||
disable_warnings(implicit-fallthrough)
|
||||
disable_warnings(unused-function)
|
||||
disable_warnings(unused-parameter)
|
||||
disable_warnings(sign-compare)
|
||||
disable_warnings(declaration-after-statement)
|
||||
disable_warnings(missing-declarations)
|
||||
|
||||
# -O3 is also set by the Chromium configuration and has been deemed safe enough
|
||||
# for them.
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
# Common definitions.
|
||||
add_definitions(
|
||||
-DSTDC
|
||||
-DNO_GZIP
|
||||
-DZLIB_IMPLEMENTATION
|
||||
)
|
||||
list(APPEND SRC_ZLIB
|
||||
"${chromium_zlib_src_SOURCE_DIR}/adler32.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/chromeconf.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/compress.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/contrib/optimizations/insert_string.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/cpu_features.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/cpu_features.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/crc32.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/crc32.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/deflate.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/deflate.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/gzclose.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/gzguts.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/gzlib.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/gzread.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/gzwrite.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/infback.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/inffast.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/inffast.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/inffixed.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/inflate.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/inftrees.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/inftrees.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/trees.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/trees.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/uncompr.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/zconf.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/zlib.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/zutil.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/zutil.h"
|
||||
)
|
||||
|
||||
# x86_64-specific optimizations
|
||||
string(APPEND CMAKE_C_FLAGS " -mssse3 -msse4.2 -mpclmul")
|
||||
add_definitions(
|
||||
-DCHROMIUM_ZLIB_NO_CHROMECONF
|
||||
-DX86_NOT_WINDOWS
|
||||
-DADLER32_SIMD_SSSE3
|
||||
-DCRC32_SIMD_SSE42_PCLMUL
|
||||
-DDEFLATE_FILL_WINDOW_SSE2
|
||||
-DINFLATE_CHUNK_READ_64LE
|
||||
-DINFLATE_CHUNK_SIMD_SSE2
|
||||
)
|
||||
list(APPEND SRC_ZLIB
|
||||
"${chromium_zlib_src_SOURCE_DIR}/adler32_simd.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/adler32_simd.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/contrib/optimizations/chunkcopy.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/contrib/optimizations/inffast_chunk.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/contrib/optimizations/inffast_chunk.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/contrib/optimizations/inflate.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/crc32_simd.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/crc32_simd.h"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/crc_folding.c"
|
||||
"${chromium_zlib_src_SOURCE_DIR}/fill_window_sse.c"
|
||||
)
|
||||
|
||||
list(SORT SRC_ZLIB)
|
||||
include_directories("${chromium_zlib_src_SOURCE_DIR}")
|
||||
add_library(chromium_zlib OBJECT ${SRC_ZLIB})
|
||||
7
deps/http-parser/CMakeLists.txt
vendored
7
deps/http-parser/CMakeLists.txt
vendored
@@ -1,5 +1,6 @@
|
||||
FILE(GLOB SRC_HTTP "*.c" "*.h")
|
||||
file(GLOB SRC_HTTP "*.c" "*.h")
|
||||
list(SORT SRC_HTTP)
|
||||
|
||||
ADD_LIBRARY(http-parser OBJECT ${SRC_HTTP})
|
||||
add_library(http-parser OBJECT ${SRC_HTTP})
|
||||
|
||||
ENABLE_WARNINGS(implicit-fallthrough=1)
|
||||
enable_warnings(implicit-fallthrough=1)
|
||||
|
||||
52
deps/ntlmclient/CMakeLists.txt
vendored
52
deps/ntlmclient/CMakeLists.txt
vendored
@@ -1,21 +1,39 @@
|
||||
FILE(GLOB SRC_NTLMCLIENT "ntlm.c" "unicode_builtin.c" "util.c")
|
||||
file(GLOB SRC_NTLMCLIENT "ntlm.c" "ntlm.h" "util.c" "util.h")
|
||||
list(SORT SRC_NTLMCLIENT)
|
||||
|
||||
ADD_DEFINITIONS(-DNTLM_STATIC=1)
|
||||
add_definitions(-DNTLM_STATIC=1)
|
||||
|
||||
DISABLE_WARNINGS(implicit-fallthrough)
|
||||
disable_warnings(implicit-fallthrough)
|
||||
|
||||
IF (HTTPS_BACKEND STREQUAL "SecureTransport")
|
||||
ADD_DEFINITIONS(-DCRYPT_COMMONCRYPTO)
|
||||
SET(SRC_NTLMCLIENT_CRYPTO "crypt_commoncrypto.c")
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
|
||||
ADD_DEFINITIONS(-DCRYPT_OPENSSL)
|
||||
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
||||
SET(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c")
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "mbedTLS")
|
||||
ADD_DEFINITIONS(-DCRYPT_MBEDTLS)
|
||||
SET(SRC_NTLMCLIENT_CRYPTO "crypt_mbedtls.c")
|
||||
ELSE ()
|
||||
MESSAGE(FATAL_ERROR "Unable to use libgit2's HTTPS backend (${HTTPS_BACKEND}) for NTLM crypto")
|
||||
ENDIF()
|
||||
if(USE_ICONV)
|
||||
add_definitions(-DUNICODE_ICONV=1)
|
||||
file(GLOB SRC_NTLMCLIENT_UNICODE "unicode_iconv.c" "unicode_iconv.h")
|
||||
else()
|
||||
add_definitions(-DUNICODE_BUILTIN=1)
|
||||
file(GLOB SRC_NTLMCLIENT_UNICODE "unicode_builtin.c" "unicode_builtin.h")
|
||||
endif()
|
||||
|
||||
ADD_LIBRARY(ntlmclient OBJECT ${SRC_NTLMCLIENT} ${SRC_NTLMCLIENT_CRYPTO})
|
||||
if(USE_HTTPS STREQUAL "SecureTransport")
|
||||
add_definitions(-DCRYPT_COMMONCRYPTO)
|
||||
set(SRC_NTLMCLIENT_CRYPTO "crypt_commoncrypto.c" "crypt_commoncrypto.h")
|
||||
# CC_MD4 has been deprecated in macOS 10.15.
|
||||
set_source_files_properties("crypt_commoncrypto.c" COMPILE_FLAGS "-Wno-deprecated")
|
||||
elseif(USE_HTTPS STREQUAL "OpenSSL")
|
||||
add_definitions(-DCRYPT_OPENSSL)
|
||||
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
set(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c" "crypt_openssl.h")
|
||||
elseif(USE_HTTPS STREQUAL "OpenSSL-Dynamic")
|
||||
add_definitions(-DCRYPT_OPENSSL)
|
||||
add_definitions(-DCRYPT_OPENSSL_DYNAMIC)
|
||||
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
||||
set(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c" "crypt_openssl.h")
|
||||
elseif(USE_HTTPS STREQUAL "mbedTLS")
|
||||
add_definitions(-DCRYPT_MBEDTLS)
|
||||
include_directories(${MBEDTLS_INCLUDE_DIR})
|
||||
set(SRC_NTLMCLIENT_CRYPTO "crypt_mbedtls.c" "crypt_mbedtls.h")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to use libgit2's HTTPS backend (${USE_HTTPS}) for NTLM crypto")
|
||||
endif()
|
||||
|
||||
add_library(ntlmclient OBJECT ${SRC_NTLMCLIENT} ${SRC_NTLMCLIENT_UNICODE} ${SRC_NTLMCLIENT_CRYPTO})
|
||||
|
||||
5
deps/ntlmclient/compat.h
vendored
5
deps/ntlmclient/compat.h
vendored
@@ -21,11 +21,6 @@
|
||||
# include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
# include <endian.h>
|
||||
# define htonll htobe64
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user