From cd06dbb8f470c92bb2f6752fe1d8a78f7723b352 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 17:01:25 -0700 Subject: [PATCH 1/8] git submodule add https://github.com/externpro/externpro .devcontainer --- .devcontainer | 1 + .gitmodules | 3 +++ 2 files changed, 4 insertions(+) create mode 160000 .devcontainer create mode 100644 .gitmodules diff --git a/.devcontainer b/.devcontainer new file mode 160000 index 0000000000..af6b864abe --- /dev/null +++ b/.devcontainer @@ -0,0 +1 @@ +Subproject commit af6b864abe2df4237df0d71df82a476c1daab1e5 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..18932abfb9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".devcontainer"] + path = .devcontainer + url = https://github.com/externpro/externpro From 1279a443b4b3eaa7ffd2a86f4a33573f1b1ec8ab Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 17:08:01 -0700 Subject: [PATCH 2/8] docker-compose links --- docker-compose.sh | 1 + docker-compose.yml | 1 + 2 files changed, 2 insertions(+) create mode 120000 docker-compose.sh create mode 120000 docker-compose.yml diff --git a/docker-compose.sh b/docker-compose.sh new file mode 120000 index 0000000000..85f182f0be --- /dev/null +++ b/docker-compose.sh @@ -0,0 +1 @@ +.devcontainer/compose.pro.sh \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 120000 index 0000000000..46c1f8918f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1 @@ +.devcontainer/compose.bld.yml \ No newline at end of file From 58e291526e342612da4c9dc7de432f23b3ff4aa5 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 17:08:39 -0700 Subject: [PATCH 3/8] add CMakePresets cp .devcontainer/cmake/presets/CMakePresets* . --- CMakePresets.json | 8 ++++++++ CMakePresetsBase.json | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 CMakePresets.json create mode 100644 CMakePresetsBase.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..f82cfdd2cf --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,8 @@ +{ + "version": 8, + "include": [ + ".devcontainer/cmake/presets/xpLinuxNinja.json", + ".devcontainer/cmake/presets/xpDarwinNinja.json", + ".devcontainer/cmake/presets/xpWindowsVs2022.json" + ] +} diff --git a/CMakePresetsBase.json b/CMakePresetsBase.json new file mode 100644 index 0000000000..085cdc3e31 --- /dev/null +++ b/CMakePresetsBase.json @@ -0,0 +1,16 @@ +{ + "version": 8, + "configurePresets": [ + { + "name": "config-base", + "hidden": true, + "binaryDir": "${sourceDir}/_bld-${presetName}" + } + ], + "buildPresets": [ + { + "name": "build-base", + "hidden": true + } + ] +} From 4437fc4a8a33e33a090f4c9775569c51046fc968 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 17:09:31 -0700 Subject: [PATCH 4/8] gitignore: externpro ignores --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 997e51e1a3..333bf5ecf6 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,7 @@ tags libssh2.pc TAGS *~ +# externpro +.env +_bld*/ +docker-compose.override.yml From d6deedaba955db27f772f8823e3289caf9abfcae Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 17:12:46 -0700 Subject: [PATCH 5/8] externpro github/workflows @25.06 cp .devcontainer/.github/wf-templates/xp*.yml .github/workflows --- .github/workflows/xpbuild.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/xprelease.yml | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/xpbuild.yml create mode 100644 .github/workflows/xprelease.yml diff --git a/.github/workflows/xpbuild.yml b/.github/workflows/xpbuild.yml new file mode 100644 index 0000000000..169ff5269c --- /dev/null +++ b/.github/workflows/xpbuild.yml @@ -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 diff --git a/.github/workflows/xprelease.yml b/.github/workflows/xprelease.yml new file mode 100644 index 0000000000..146191466e --- /dev/null +++ b/.github/workflows/xprelease.yml @@ -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 From 0b6bf5f10399b528a7b01a11adda86e3c8e11e4b Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 18:32:42 -0700 Subject: [PATCH 6/8] CMakePresetsBase: add cacheVariables --- CMakePresetsBase.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakePresetsBase.json b/CMakePresetsBase.json index 085cdc3e31..e193a06bc9 100644 --- a/CMakePresetsBase.json +++ b/CMakePresetsBase.json @@ -4,7 +4,13 @@ { "name": "config-base", "hidden": true, - "binaryDir": "${sourceDir}/_bld-${presetName}" + "binaryDir": "${sourceDir}/_bld-${presetName}", + "cacheVariables": { + "BUILD_TESTING": "OFF", + "CRYPTO_BACKEND": "OpenSSL", + "ENABLE_ZLIB_COMPRESSION": "ON", + "XP_NAMESPACE": "xpro" + } } ], "buildPresets": [ From 57170975bb491cc7a1e8b2ca2668b9b2edd3e0ff Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 18:35:42 -0700 Subject: [PATCH 7/8] externpro dependency provider --- CMakeLists.txt | 7 ++----- src/CMakeLists.txt | 16 +++++----------- tests/CMakeLists.txt | 6 +----- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f57866e77..5dc16cf559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,11 +35,8 @@ cmake_minimum_required(VERSION 2.8.11...3.21) -if(DEFINED CMAKE_MODULE_PATH) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -else() - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -endif() +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake) project(libssh2 C) set(PROJECT_URL "https://www.libssh2.org/") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4586671a5c..5490242a48 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,11 +60,7 @@ endif() if(CRYPTO_BACKEND STREQUAL "OpenSSL" OR NOT CRYPTO_BACKEND) - if(COMMAND xpFindPkg) - xpFindPkg(PKGS openssl) - else() - find_package(OpenSSL ${SPECIFIC_CRYPTO_REQUIREMENT}) - endif() + find_package(OpenSSL ${SPECIFIC_CRYPTO_REQUIREMENT}) if(OPENSSL_FOUND) set(CRYPTO_BACKEND "OpenSSL") @@ -244,13 +240,11 @@ option(ENABLE_ZLIB_COMPRESSION "Use zlib for compression") add_feature_info(Compression ENABLE_ZLIB_COMPRESSION "using zlib for compression") if(ENABLE_ZLIB_COMPRESSION) - if(COMMAND xpFindPkg) - xpFindPkg(PKGS zlib) - else() - find_package(ZLIB REQUIRED) - target_include_directories(libssh2 PRIVATE ${ZLIB_INCLUDE_DIRS}) - endif() + find_package(ZLIB REQUIRED) + if(NOT TARGET xpro::zlib) + target_include_directories(libssh2 PRIVATE ${ZLIB_INCLUDE_DIRS}) + endif() list(APPEND LIBRARIES ${ZLIB_LIBRARIES}) list(APPEND PC_REQUIRES_PRIVATE zlib) if(ZLIB_FOUND) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ffbd835bac..1463331568 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -71,11 +71,7 @@ endif() if(CRYPTO_BACKEND STREQUAL "OpenSSL" OR NOT CRYPTO_BACKEND) - if(COMMAND xpFindPkg) - xpFindPkg(PKGS openssl) - else() - find_package(OpenSSL ${SPECIFIC_CRYPTO_REQUIREMENT}) - endif() + find_package(OpenSSL ${SPECIFIC_CRYPTO_REQUIREMENT}) if(OPENSSL_FOUND) set(CRYPTO_BACKEND "OpenSSL") From b973c28c7d0b749a75a904832e74e7bfc07d519a Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 13 Nov 2025 18:38:38 -0700 Subject: [PATCH 8/8] externpro devel package --- CMakeLists.txt | 17 ++++++++++++----- docs/CMakeLists.txt | 4 +++- src/CMakeLists.txt | 13 +++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dc16cf559..48ce563389 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,16 +41,22 @@ set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake) project(libssh2 C) set(PROJECT_URL "https://www.libssh2.org/") set(PROJECT_DESCRIPTION "The SSH library") +include(GNUInstallDirs) include(xpflags) +set(targetsFile Libssh2Config) +if(NOT DEFINED XP_INSTALL_CMAKEDIR) + set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}) +endif() if(DEFINED XP_NAMESPACE) - set(XP_OPT_INSTALL EXCLUDE_FROM_ALL) + set(XP_OPT_INSTALL FALSE) set(nameSpace ${XP_NAMESPACE}::) + xpPackageDevel(TARGETS_FILE ${targetsFile} DEPS openssl zlib + LIBRARIES ${XP_NAMESPACE}::${PROJECT_NAME} + ) else() + set(XP_OPT_INSTALL TRUE) set(nameSpace Libssh2::) endif() -if(NOT DEFINED XP_INSTALL_CMAKEDIR) - set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}) -endif() if (CMAKE_VERSION VERSION_LESS "3.1") if (CMAKE_C_COMPILER_ID STREQUAL "GNU") @@ -88,7 +94,6 @@ if(NOT LIBSSH2_VERSION OR "${CMAKE_CURRENT_SOURCE_DIR}/include/libssh2.h") endif() -include(GNUInstallDirs) install( FILES docs/AUTHORS COPYING docs/HACKING README RELEASE-NOTES NEWS DESTINATION ${CMAKE_INSTALL_DOCDIR}) @@ -117,4 +122,6 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${LIBSSH2_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${LIBSSH2_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${LIBSSH2_VERSION_PATCH}) set(CPACK_PACKAGE_VERSION ${LIBSSH2_VERSION}) +if(XP_OPT_INSTALL) include(CPack) +endif() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 5002089d28..9d505873bb 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -207,4 +207,6 @@ set(MAN_PAGES libssh2_version.3) include(GNUInstallDirs) -install(FILES ${MAN_PAGES} ${XP_OPT_INSTALL} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3) +if(XP_OPT_INSTALL) +install(FILES ${MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5490242a48..8f30081700 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -378,7 +378,7 @@ install(FILES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) install(TARGETS libssh2 - EXPORT Libssh2Config + EXPORT ${targetsFile} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) @@ -393,13 +393,13 @@ set(RUNTIME_DEPENDENCIES ${_RUNTIME_DEPENDENCIES} CACHE INTERNAL # Package config ## During package installation, install Libssh2Config.cmake -install(EXPORT Libssh2Config +install(EXPORT ${targetsFile} NAMESPACE ${nameSpace} DESTINATION ${XP_INSTALL_CMAKEDIR}) ## During build, register directly from build tree # create Libssh2Config.cmake -export(TARGETS libssh2 NAMESPACE ${nameSpace} FILE Libssh2Config.cmake) +export(TARGETS libssh2 NAMESPACE ${nameSpace} FILE ${targetsFile}.cmake) export(PACKAGE Libssh2) # register it ## Export a .pc file for client projects not using CMaek @@ -410,10 +410,11 @@ if(PC_LIBS) string(REPLACE ";" " " PC_LIBS "${PC_LIBS}") endif() configure_file(libssh2.pc.in libssh2.pc @ONLY) +if(XP_OPT_INSTALL) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libssh2.pc - ${XP_OPT_INSTALL} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +endif() ## Versioning @@ -423,9 +424,9 @@ set_target_properties(libssh2 PROPERTIES include(CMakePackageConfigHelpers) write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/Libssh2ConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${targetsFile}Version.cmake VERSION "${LIBSSH2_VERSION_MAJOR}.${LIBSSH2_VERSION_MINOR}.${LIBSSH2_VERSION_PATCH}" COMPATIBILITY SameMajorVersion) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/Libssh2ConfigVersion.cmake + FILES ${CMAKE_CURRENT_BINARY_DIR}/${targetsFile}Version.cmake DESTINATION ${XP_INSTALL_CMAKEDIR})