Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer
Submodule .devcontainer added at 1eda63
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json

This file was deleted.

9 changes: 0 additions & 9 deletions .devcontainer/setup.sh

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: "CodeQL"

on:
workflow_dispatch:
schedule:
- cron: '21 3 * * 1'
on: [workflow_dispatch]

env:
docker-registry: docker.pkg.github.com
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
# main and maintenance branches.
name: CI Build

on:
push:
branches: [ main, maint/* ]
pull_request:
branches: [ main, maint/* ]
workflow_dispatch:
on: [workflow_dispatch]

env:
docker-registry: docker.pkg.github.com
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Nightly build for the main branch across multiple targets.
name: Nightly Build

on:
workflow_dispatch:
schedule:
- cron: '15 1 * * *'
on: [workflow_dispatch]

env:
docker-registry: docker.pkg.github.com
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/xpbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_dispatch:
jobs:
linux:
uses: externpro/externpro/.github/workflows/build-linux.yml@25.06
with:
cmake-workflow-preset: Linux
runon: ubuntu-latest
secrets: inherit
linux-arm64:
uses: externpro/externpro/.github/workflows/build-linux.yml@25.06
with:
cmake-workflow-preset: Linux
runon: ubuntu-24.04-arm
secrets: inherit
macos:
uses: externpro/externpro/.github/workflows/build-macos.yml@25.06
with:
cmake-workflow-preset: Darwin
secrets: inherit
windows:
uses: externpro/externpro/.github/workflows/build-windows.yml@25.06
with:
cmake-workflow-preset: Windows
secrets: inherit
20 changes: 20 additions & 0 deletions .github/workflows/xprelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release
on:
workflow_dispatch:
inputs:
workflow_run_url:
description: 'URL of the workflow run containing artifacts to upload (e.g., https://github.com/owner/repo/actions/runs/123456789)'
required: true
type: string
jobs:
# Upload build artifacts as release assets
release-from-build:
uses: externpro/externpro/.github/workflows/release-from-build.yml@25.06
with:
workflow_run_url: ${{ github.event.inputs.workflow_run_url }}
artifact_pattern: "*.tar.xz"
permissions:
contents: write
id-token: write
attestations: write
secrets: inherit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
CMakeSettings.json
.vs
.idea
# externpro
.env
_bld*/
docker-compose.override.yml
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".devcontainer"]
path = .devcontainer
url = https://github.com/externpro/externpro
24 changes: 19 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
# Install:
# > cmake --build . --target install

CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1...3.31)

set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake)

project(libgit2 VERSION "1.3.0" LANGUAGES C)

Expand All @@ -33,13 +35,25 @@ INCLUDE(IdeSplitSources)
INCLUDE(FeatureSummary)
INCLUDE(EnableWarnings)
include(xpflags)
if(DEFINED XP_NAMESPACE)
set(XP_OPT_INSTALL EXCLUDE_FROM_ALL)
set(nameSpace NAMESPACE ${XP_NAMESPACE}::)
endif()
set(targetsFile ${PROJECT_NAME}-targets)
if(NOT DEFINED XP_INSTALL_CMAKEDIR)
set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake)
endif()
if(DEFINED XP_NAMESPACE)
set(XP_OPT_INSTALL FALSE)
set(nameSpace NAMESPACE ${XP_NAMESPACE}::)
set(USE_CMAKE_ICONV ON)
string(JOIN "\n" EXT1
"if(APPLE)"
" find_package(Iconv REQUIRED)"
"endif()"
""
)
xpPackageDevel(TARGETS_FILE ${targetsFile} DEPS libssh2 LIBRARIES ${XP_NAMESPACE}::git2)
else()
set(XP_OPT_INSTALL TRUE)
set(USE_CMAKE_ICONV OFF)
endif()

# Build options
#
Expand Down
8 changes: 8 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": 8,
"include": [
".devcontainer/cmake/presets/xpLinuxNinja.json",
".devcontainer/cmake/presets/xpDarwinNinja.json",
".devcontainer/cmake/presets/xpWindowsVs2022.json"
]
}
23 changes: 23 additions & 0 deletions CMakePresetsBase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": 8,
"configurePresets": [
{
"name": "config-base",
"hidden": true,
"binaryDir": "${sourceDir}/_bld-${presetName}",
"cacheVariables": {
"BUILD_CLAR": "OFF",
"BUILD_SHARED_LIBS": "OFF",
"REGEX_BACKEND": "builtin",
"THREADSAFE": "ON",
"XP_NAMESPACE": "xpro"
}
}
],
"buildPresets": [
{
"name": "build-base",
"hidden": true
}
]
}
4 changes: 3 additions & 1 deletion cmake/PkgBuildConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function(pkg_build_config)
endif()
file(APPEND "${PKGCONFIG_FILE}" "Cflags: -I\${includedir} ${PKGCONFIG_CFLAGS}\n")

if(XP_OPT_INSTALL)
# Install .pc file
install(FILES "${PKGCONFIG_FILE}" ${XP_OPT_INSTALL} DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(FILES "${PKGCONFIG_FILE}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
endfunction()
6 changes: 2 additions & 4 deletions cmake/SelectHTTPSBackend.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
INCLUDE(SanitizeBool)

# We try to find any packages our backends might use
if(COMMAND xpFindPkg)
xpFindPkg(PKGS openssl)
FIND_PACKAGE(OpenSSL)
if(TARGET xpro::crypto AND NOT DEFINED OPENSSL_INCLUDE_DIR)
get_target_property(OPENSSL_INCLUDE_DIR xpro::crypto INTERFACE_INCLUDE_DIRECTORIES)
else()
FIND_PACKAGE(OpenSSL)
endif()
FIND_PACKAGE(mbedTLS)
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
Expand Down
1 change: 1 addition & 0 deletions docker-compose.sh
1 change: 1 addition & 0 deletions docker-compose.yml
35 changes: 23 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,9 @@ IF(USE_BUNDLED_ZLIB STREQUAL ON)
ENDIF()

IF(USE_BUNDLED_ZLIB STREQUAL "OFF")
if(COMMAND xpFindPkg)
xpFindPkg(PKGS zlib)
get_target_property(ZLIB_INCLUDE_DIRS ${ZLIB_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
else()
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(ZLIB)
if(NOT DEFINED ZLIB_INCLUDE_DIRS)
get_target_property(ZLIB_INCLUDE_DIRS ${ZLIB_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
endif()
IF(ZLIB_FOUND)
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS})
Expand Down Expand Up @@ -236,8 +234,8 @@ ENDIF()

# Optional external dependency: libssh2
IF (USE_SSH)
if(COMMAND xpFindPkg)
xpFindPkg(PKGS libssh2)
if(COMMAND xpFindPkg) # externpro dependency provider
find_package(libssh2)
get_target_property(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
else()
FIND_PKGLIBRARIES(LIBSSH2 libssh2)
Expand Down Expand Up @@ -280,12 +278,26 @@ INCLUDE(SelectGSSAPI)

# Optional external dependency: iconv
IF (USE_ICONV)
FIND_PACKAGE(Iconv)
IF (USE_CMAKE_ICONV)
LIST(REMOVE_ITEM CMAKE_MODULE_PATH "${libgit2_SOURCE_DIR}/cmake/")
FIND_PACKAGE(Iconv)
LIST(APPEND CMAKE_MODULE_PATH "${libgit2_SOURCE_DIR}/cmake/")
INCLUDE(FindIconv) # populate the ICONV_* variables
# Iconv_INCLUDE_DIR (cmake) and ICONV_INCLUDE_DIR (libgit2)
# are assumed to be the same below... it was true on my system
ELSE()
FIND_PACKAGE(Iconv)
ENDIF()
ENDIF()
IF (ICONV_FOUND)
SET(GIT_USE_ICONV 1)
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${ICONV_INCLUDE_DIR})
LIST(APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES})
if(USE_CMAKE_ICONV AND TARGET Iconv::Iconv)
# Iconv::Iconv avoids hard-coded build system paths in targetsFile
LIST(APPEND LIBGIT2_LIBS Iconv::Iconv)
else()
LIST(APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES})
endif()
LIST(APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES})
ENDIF()
ADD_FEATURE_INFO(iconv GIT_USE_ICONV "iconv encoding conversion support")
Expand Down Expand Up @@ -435,12 +447,11 @@ IF (MSVC_IDE)
ENDIF ()

# Install
set(LIBGIT2_TARGETS_FILE ${PROJECT_NAME}-targets)
INSTALL(TARGETS git2 EXPORT ${LIBGIT2_TARGETS_FILE}
INSTALL(TARGETS git2 EXPORT ${targetsFile}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
INSTALL(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
INSTALL(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT ${LIBGIT2_TARGETS_FILE} DESTINATION ${XP_INSTALL_CMAKEDIR} ${nameSpace})
install(EXPORT ${targetsFile} DESTINATION ${XP_INSTALL_CMAKEDIR} ${nameSpace})