[botan] Update, higher level maintainer functions (#27750)

* Use higher level maintainer functions, cleanup

* Update

* Check vcpkg version

* Only static linkage on mingw

* Fix zlib linkage

* Patch for command line lenght issue
This commit is contained in:
Kai Pastor 2022-11-18 08:22:14 +01:00 коммит произвёл GitHub
Родитель 2d6279beda
Коммит abce84432c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 255 добавлений и 147 удалений

46
ports/botan/configure поставляемый Executable file
Просмотреть файл

@ -0,0 +1,46 @@
#!/bin/bash
set -e
declare -a OUT_OPTIONS
INTERPRETER=python3
LAST_SEEN=
COPY_OPTIONS=no
COPY_PREFIX=yes
BUILD_TYPE=RELEASE
for OPTION; do
case "${OPTION},${COPY_OPTIONS}" in
*/configure.py,no)
OUT_OPTIONS+=("${OPTION}")
INTERPRETER="${LAST_SEEN}"
COPY_OPTIONS=yes
;;
--prefix=*,yes)
if [ "${COPY_PREFIX}" = "yes" ] ; then
OUT_OPTIONS+=("${OPTION}")
COPY_PREFIX=no
fi
;;
--*=*,yes)
OUT_OPTIONS+=("${OPTION}")
;;
*=*)
;;
*,yes)
OUT_OPTIONS+=("${OPTION}")
if [ "${OPTION}" = "--debug-mode" ] ; then
BUILD_TYPE=DEBUG
fi
;;
esac
LAST_SEEN="${OPTION}"
done
set -x
export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
"${INTERPRETER}" "${OUT_OPTIONS[@]}"
sed -e "1i\\
ZLIB_LIBS = \$(ZLIB_LIBS_${BUILD_TYPE})" -i -- Makefile

Просмотреть файл

@ -0,0 +1,24 @@
diff --git a/src/build-data/makefile.in b/src/build-data/makefile.in
index 5102933..0fa5920 100644
--- a/src/build-data/makefile.in
+++ b/src/build-data/makefile.in
@@ -20,7 +20,7 @@ LDFLAGS = %{ldflags}
EXE_LINK_CMD = %{exe_link_cmd}
-LIB_LINKS_TO = %{external_link_cmd} %{link_to}
+LIB_LINKS_TO = %{external_link_cmd} $(ZLIB_LIBS) %{link_to}
BUILD_DIR_LINK_PATH = %{build_dir_link_path}
EXE_LINKS_TO = %{link_to_botan} $(LIB_LINKS_TO) %{extra_libs}
diff --git a/src/lib/compression/zlib/info.txt b/src/lib/compression/zlib/info.txt
index 1102bc5..34047fa 100644
--- a/src/lib/compression/zlib/info.txt
+++ b/src/lib/compression/zlib/info.txt
@@ -5,6 +5,4 @@ ZLIB -> 20160412
load_on vendor
<libs>
-all!windows -> z
-windows -> zlib
</libs>

Просмотреть файл

@ -0,0 +1,23 @@
diff --git a/configure.py b/configure.py
index 2474860a5..7d320d470 100755
--- a/configure.py
+++ b/configure.py
@@ -1821,13 +1821,12 @@ def yield_objectfile_list(sources, obj_dir, obj_suffix, options):
for src in sources:
(directory, filename) = os.path.split(os.path.normpath(src))
- parts = directory.split(os.sep)
+ parts_in_src = directory.split(os.sep + 'src' + os.sep)
+ parts = []
- if 'src' in parts:
- parts = parts[parts.index('src')+2:]
- elif options.amalgamation and filename.find(options.name_amalgamation) != -1:
- parts = []
- else:
+ if len(parts_in_src) > 1:
+ parts = [ 'src' ] + parts_in_src[-1].split(os.sep)
+ elif not options.amalgamation or filename.find(options.name_amalgamation) == -1:
raise InternalError("Unexpected file '%s/%s'" % (directory, filename))
if parts != []:

Просмотреть файл

@ -0,0 +1,14 @@
diff --git a/src/build-data/botan.pc.in b/src/build-data/botan.pc.in
index 7139436..81214fe 100644
--- a/src/build-data/botan.pc.in
+++ b/src/build-data/botan.pc.in
@@ -1,7 +1,7 @@
prefix=%{prefix}
exec_prefix=${prefix}
-libdir=%{libdir}
-includedir=${prefix}/include/botan-%{version_major}
+libdir=${prefix}/lib
+includedir=${prefix}/include
Name: Botan
Description: Crypto and TLS for C++11

Просмотреть файл

@ -1,192 +1,167 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO randombit/botan
REF fe62c1f5ce6c4379a52bd018c2ff68bed3024c4d # 2.19.1
SHA512 09c5fdb3a05978373fb1512a7a9b5c3d89e6e103d7fe86a0e126c417117950c2a63559dc06e8a9c895c892e9fc3888d7ed97686e15d8c2fd941ddb629af0e5a0
REF "${VERSION}"
SHA512 b467f8613832873b3337794d52bb46ddc77ffa78ee3498481b67aec66d35acd347d34056c7bdf68b303b836f0da18ce11ffa751b4cfbdce606780c292b417827
HEAD_REF master
PATCHES
fix-generate-build-path.patch
embed-debug-info.patch
arm64-windows.patch
pkgconfig.patch
verbose-install.patch
configure-zlib.patch
fix-objectfile-list.patch # https://github.com/randombit/botan/pull/3069
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}")
if(CMAKE_HOST_WIN32)
vcpkg_find_acquire_program(JOM)
set(build_tool "${JOM}")
set(parallel_build "/J${VCPKG_CONCURRENCY}")
else()
find_program(MAKE make)
set(build_tool "${MAKE}")
set(parallel_build "-j${VCPKG_CONCURRENCY}")
if(VCPKG_TARGET_IS_MINGW)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(BOTAN_FLAG_SHARED --enable-shared-library)
set(BOTAN_FLAG_STATIC --disable-static-library)
else()
set(BOTAN_FLAG_SHARED --disable-shared-library)
set(BOTAN_FLAG_STATIC --enable-static-library)
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
set(pkgconfig_syntax "")
if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(pkgconfig_syntax "--msvc-syntax")
endif()
if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(BOTAN_MSVC_RUNTIME "--msvc-runtime=MD")
else()
set(BOTAN_MSVC_RUNTIME "--msvc-runtime=MT")
vcpkg_list(SET configure_arguments
"--distribution-info=vcpkg ${TARGET_TRIPLET}"
--with-pkg-config
--link-method=copy
--with-debug-info
--includedir=include
--bindir=bin
--libdir=lib
--without-documentation
"--with-external-includedir=${CURRENT_INSTALLED_DIR}/include"
)
vcpkg_list(SET pkgconfig_requires)
if("amalgamation" IN_LIST FEATURES)
vcpkg_list(APPEND configure_arguments --amalgamation)
endif()
set(ZLIB_LIBS_RELEASE "")
set(ZLIB_LIBS_DEBUG "")
if("zlib" IN_LIST FEATURES)
vcpkg_list(APPEND configure_arguments --with-zlib)
vcpkg_list(APPEND pkgconfig_requires zlib)
x_vcpkg_pkgconfig_get_modules(LIBS PREFIX "ZLIB" MODULES "zlib" ${pkgconfig_syntax})
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(BOTAN_FLAG_CPU x86)
vcpkg_list(APPEND configure_arguments --cpu=x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(BOTAN_FLAG_CPU x86_64)
vcpkg_list(APPEND configure_arguments --cpu=x86_64)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(BOTAN_FLAG_CPU arm32)
vcpkg_list(APPEND configure_arguments --cpu=arm32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(BOTAN_FLAG_CPU arm64)
vcpkg_list(APPEND configure_arguments --cpu=arm64)
else()
message(FATAL_ERROR "Unsupported architecture")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
amalgamation BOTAN_AMALGAMATION
zlib BOTAN_WITH_ZLIB
)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_list(APPEND configure_arguments --os=windows)
function(BOTAN_BUILD BOTAN_BUILD_TYPE)
if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
vcpkg_list(APPEND configure_arguments --cc=msvc)
endif()
if(BOTAN_BUILD_TYPE STREQUAL "dbg")
set(BOTAN_FLAG_PREFIX "${CURRENT_PACKAGES_DIR}/debug")
set(BOTAN_FLAG_DEBUGMODE --debug-mode)
set(BOTAN_DEBUG_SUFFIX "")
set(BOTAN_MSVC_RUNTIME_SUFFIX "d")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_list(APPEND configure_arguments --enable-shared-library --disable-static-library)
else()
set(BOTAN_FLAG_DEBUGMODE)
set(BOTAN_FLAG_PREFIX "${CURRENT_PACKAGES_DIR}")
set(BOTAN_MSVC_RUNTIME_SUFFIX "")
vcpkg_list(APPEND configure_arguments --disable-shared-library --enable-static-library)
endif()
message(STATUS "Configure ${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}")
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}")
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}")
endif()
make_directory("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}")
set(configure_arguments --cpu=${BOTAN_FLAG_CPU}
${BOTAN_FLAG_SHARED}
${BOTAN_FLAG_STATIC}
${BOTAN_FLAG_DEBUGMODE}
"--distribution-info=vcpkg ${TARGET_TRIPLET}"
--prefix=${BOTAN_FLAG_PREFIX}
--with-pkg-config
--link-method=copy
--with-debug-info)
if(CMAKE_HOST_WIN32)
list(APPEND configure_arguments ${BOTAN_MSVC_RUNTIME}${BOTAN_MSVC_RUNTIME_SUFFIX})
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
set(BOTAN_MSVC_RUNTIME MD)
else()
set(BOTAN_MSVC_RUNTIME MT)
endif()
if(VCPKG_CXX_FLAGS)
list(APPEND configure_arguments --extra-cxxflags ${VCPKG_CXX_FLAGS})
vcpkg_install_nmake(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_NAME "Makefile"
PREFER_JOM
PRERUN_SHELL_RELEASE
"${PYTHON3}" "${SOURCE_PATH}/configure.py"
${configure_arguments}
"--prefix=${CURRENT_PACKAGES_DIR}"
"--msvc-runtime=${BOTAN_MSVC_RUNTIME}"
"--with-external-libdir=${CURRENT_INSTALLED_DIR}/lib"
PRERUN_SHELL_DEBUG
"${PYTHON3}" "${SOURCE_PATH}/configure.py"
${configure_arguments}
"--prefix=${CURRENT_PACKAGES_DIR}/debug"
"--msvc-runtime=${BOTAN_MSVC_RUNTIME}d"
"--with-external-libdir=${CURRENT_INSTALLED_DIR}/debug/lib"
--debug-mode
OPTIONS_RELEASE
"ZLIB_LIBS=${ZLIB_LIBS_RELEASE}"
OPTIONS_DEBUG
"ZLIB_LIBS=${ZLIB_LIBS_DEBUG}"
)
vcpkg_copy_tools(TOOL_NAMES botan-cli AUTO_CLEAN)
vcpkg_copy_pdbs()
else()
if(VCPKG_TARGET_IS_MINGW)
vcpkg_list(APPEND configure_arguments --os=mingw)
endif()
if("-DBOTAN_AMALGAMATION=ON" IN_LIST FEATURE_OPTIONS)
list(APPEND configure_arguments --amalgamation)
if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
vcpkg_list(APPEND configure_arguments --cc=gcc)
elseif(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "Clang")
vcpkg_list(APPEND configure_arguments --cc=clang)
endif()
if("-DBOTAN_WITH_ZLIB=ON" IN_LIST FEATURE_OPTIONS)
list(APPEND configure_arguments --with-zlib)
list(APPEND configure_arguments --with-external-includedir="${CURRENT_INSTALLED_DIR}/include")
list(APPEND configure_arguments --with-external-libdir="${CURRENT_INSTALLED_DIR}/lib")
endif()
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "${SOURCE_PATH}/configure.py" ${configure_arguments}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}"
LOGNAME configure-${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE})
message(STATUS "Configure ${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE} done")
message(STATUS "Build ${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}")
vcpkg_execute_build_process(
COMMAND "${build_tool}" ${parallel_build}
NO_PARALLEL_COMMAND "${build_tool}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}"
LOGNAME build-${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE})
message(STATUS "Build ${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE} done")
message(STATUS "Package ${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}")
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "${SOURCE_PATH}/src/scripts/install.py"
--prefix=${BOTAN_FLAG_PREFIX}
--bindir=${BOTAN_FLAG_PREFIX}/bin
--libdir=${BOTAN_FLAG_PREFIX}/lib
--pkgconfigdir=${BOTAN_FLAG_PREFIX}/lib
--includedir=${BOTAN_FLAG_PREFIX}/include
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE}"
LOGNAME install-${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE})
message(STATUS "Package ${TARGET_TRIPLET}-${BOTAN_BUILD_TYPE} done")
endfunction()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
BOTAN_BUILD(rel)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
BOTAN_BUILD(dbg)
# botan's install.py doesn't handle DESTDIR on windows host,
# so we must avoid the standard '--prefix' and 'DESTDIR' install.
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_VERBOSE_FLAGS
NO_ADDITIONAL_PATHS
OPTIONS
"${PYTHON3}" "${SOURCE_PATH}/configure.py"
${configure_arguments}
OPTIONS_RELEASE
"--prefix=${CURRENT_PACKAGES_DIR}"
"--with-external-libdir=${CURRENT_INSTALLED_DIR}/lib"
OPTIONS_DEBUG
--debug-mode
"--prefix=${CURRENT_PACKAGES_DIR}/debug"
"--with-external-libdir=${CURRENT_INSTALLED_DIR}/debug/lib"
)
vcpkg_build_make(
BUILD_TARGET install
OPTIONS
"ZLIB_LIBS_RELEASE=${ZLIB_LIBS_RELEASE}"
"ZLIB_LIBS_DEBUG=${ZLIB_LIBS_DEBUG}"
)
vcpkg_copy_tools(TOOL_NAMES botan AUTO_CLEAN)
endif()
file(RENAME "${CURRENT_PACKAGES_DIR}/include/botan-2/botan" "${CURRENT_PACKAGES_DIR}/include/botan")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/botan-2.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/botan-2.pc")
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/botan-2.pc"
[[\lib]]
[[/lib]]
)
if(pkgconfig_requires)
list(JOIN pkgconfig_requires ", " pkgconfig_requires)
file(APPEND "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/botan-2.pc" "Requires.private: ${pkgconfig_requires}")
if(NOT VCPKG_BUILD_TYPE)
file(APPEND "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/botan-2.pc" "Requires.private: ${pkgconfig_requires}")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/botan-2.pc"
[[${prefix}/include/botan-2]]
[[${prefix}/include]]
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/botan-2.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/botan-2.pc")
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/botan-2.pc"
[[\lib]]
[[/lib]]
)
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/botan-2.pc"
[[${prefix}/include/botan-2]]
[[${prefix}/include]]
)
endif()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
if(CMAKE_HOST_WIN32)
vcpkg_copy_tools(TOOL_NAMES botan-cli AUTO_CLEAN)
else()
vcpkg_copy_tools(TOOL_NAMES botan AUTO_CLEAN)
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/include/botan-2"
"${CURRENT_PACKAGES_DIR}/share/doc")
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/botan/build.h" "#define BOTAN_INSTALL_PREFIX R\"(${CURRENT_PACKAGES_DIR})\"" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/botan/build.h" "#define BOTAN_INSTALL_LIB_DIR R\"(${CURRENT_PACKAGES_DIR}\\lib)\"" "")

Просмотреть файл

@ -1,11 +1,16 @@
{
"name": "botan",
"version": "2.19.1",
"port-version": 1,
"version": "2.19.2",
"description": "A cryptography library written in C++11",
"homepage": "https://botan.randombit.net",
"license": "BSD-2-Clause",
"supports": "!(arm & uwp)",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake-get-vars",
"host": true
}
],
"features": {
"amalgamation": {
"description": "Do an amalgamation build of the library"
@ -13,6 +18,10 @@
"zlib": {
"description": "Build with zlib. Enable compression pipes.",
"dependencies": [
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
},
"zlib"
]
}

Просмотреть файл

@ -0,0 +1,13 @@
diff --git a/src/build-data/makefile.in b/src/build-data/makefile.in
index 4839112..5102933 100644
--- a/src/build-data/makefile.in
+++ b/src/build-data/makefile.in
@@ -58,7 +58,7 @@ distclean:
"$(PYTHON_EXE)" "$(SCRIPTS_DIR)/cleanup.py" --build-dir="%{build_dir}" --distclean
install: %{install_targets}
- "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/install.py" --prefix="%{prefix}" --build-dir="%{build_dir}" --bindir="%{bindir}" --libdir="%{libdir}" --docdir="%{docdir}" --includedir="%{includedir}"
+ "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/install.py" --prefix="%{prefix}" --build-dir="%{build_dir}" --bindir="%{bindir}" --libdir="%{libdir}" --docdir="%{docdir}" --includedir="%{includedir}" --verbose
check: tests
"$(PYTHON_EXE)" "$(SCRIPTS_DIR)/check.py" --build-dir="%{build_dir}"

Просмотреть файл

@ -59,7 +59,6 @@ bond:arm-uwp=fail
bond:x64-osx=fail
bond:arm64-osx=fail
bond:x64-uwp=fail
botan:x64-uwp=fail
caf:arm-uwp=fail
caf:x64-uwp=fail
caffe2:x86-windows=fail

Просмотреть файл

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "50c9b636dc542dc13c62b04e09b106354e131b3d",
"version": "2.19.2",
"port-version": 0
},
{
"git-tree": "46addf1e5297d40d351cf84d2a62d831592df1d1",
"version": "2.19.1",

Просмотреть файл

@ -1165,8 +1165,8 @@
"port-version": 3
},
"botan": {
"baseline": "2.19.1",
"port-version": 1
"baseline": "2.19.2",
"port-version": 0
},
"box2d": {
"baseline": "2.4.1",