[serf] new port (build using scons) (#41043)

This commit is contained in:
Timofei Zhakov 2024-11-11 09:11:29 +01:00 committed by GitHub
parent 813a241fb8
commit 6480b0fa85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 261 additions and 11 deletions

139
ports/serf/portfile.cmake Normal file
View File

@ -0,0 +1,139 @@
vcpkg_download_distfile(ARCHIVE
URLS "https://dlcdn.apache.org/serf/serf-${VERSION}.tar.bz2"
FILENAME "serf-${VERSION}.tar.bz2"
SHA512 19165274d35c694935cda33f99ef92a7663a5d9c540fb7fd6792aa0efe39941b2fa87ff8b61afd060c6676baec634fd33dc2e9d34ecbee45ed99dfaed077802c
)
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
serf-fix-expat.patch
serf-use-debug-libs.patch
)
# Note: custom architecture is not supported on Unix.
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(SCONS_ARCH "TARGET_ARCH=x86_64")
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(SCONS_ARCH "TARGET_ARCH=x86")
else()
set(SCONS_ARCH "")
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}/bin/libapr-1.dll")
set(APR_STATIC "no")
else()
set(APR_STATIC "yes")
endif()
vcpkg_find_acquire_program(SCONS)
message(STATUS "Building ${TARGET_TRIPLET}-rel")
if(VCPKG_TARGET_IS_WINDOWS)
SET(apr_opts
"APR=${CURRENT_INSTALLED_DIR}"
"APU=${CURRENT_INSTALLED_DIR}"
"APR_STATIC=${APR_STATIC}"
)
else()
SET(apr_opts
"APR=${CURRENT_INSTALLED_DIR}/tools/apr/bin/apr-1-config"
"APU=${CURRENT_INSTALLED_DIR}/tools/apr-util/bin/apu-1-config"
)
endif()
vcpkg_execute_build_process(
COMMAND ${SCONS}
"SOURCE_LAYOUT=no"
"PREFIX=${CURRENT_PACKAGES_DIR}"
"LIBDIR=${CURRENT_PACKAGES_DIR}/lib"
"OPENSSL=${CURRENT_INSTALLED_DIR}"
"ZLIB=${CURRENT_INSTALLED_DIR}"
${apr_opts}
"${SCONS_ARCH}"
"DEBUG=no"
"install-lib" "install-inc" "install-pc"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "scons-rel"
)
# Fixup installed files.
if(VCPKG_TARGET_IS_WINDOWS)
if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
file(RENAME
"${CURRENT_PACKAGES_DIR}/lib/libserf-1.dll"
"${CURRENT_PACKAGES_DIR}/bin/libserf-1.dll"
)
file(RENAME
"${CURRENT_PACKAGES_DIR}/lib/libserf-1.pdb"
"${CURRENT_PACKAGES_DIR}/bin/libserf-1.pdb"
)
else()
file(REMOVE
"${CURRENT_PACKAGES_DIR}/lib/libserf-1.dll"
"${CURRENT_PACKAGES_DIR}/lib/libserf-1.pdb"
"${CURRENT_PACKAGES_DIR}/lib/libserf-1.lib"
)
endif()
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libserf-1.exp")
endif()
if(NOT VCPKG_BUILD_TYPE)
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
if(VCPKG_TARGET_IS_WINDOWS)
SET(apr_opts
"APR=${CURRENT_INSTALLED_DIR}/debug"
"APU=${CURRENT_INSTALLED_DIR}/debug"
"APR_STATIC=${APR_STATIC}"
)
else()
SET(apr_opts
"APR=${CURRENT_INSTALLED_DIR}/tools/apr/debug/bin/apr-1-config"
"APU=${CURRENT_INSTALLED_DIR}/tools/apr-util/debug/bin/apu-1-config"
)
endif()
vcpkg_execute_build_process(
COMMAND ${SCONS}
"SOURCE_LAYOUT=no"
"PREFIX=${CURRENT_PACKAGES_DIR}/debug"
"LIBDIR=${CURRENT_PACKAGES_DIR}/debug/lib"
"OPENSSL=${CURRENT_INSTALLED_DIR}"
"ZLIB=${CURRENT_INSTALLED_DIR}"
${apr_opts}
"${SCONS_ARCH}"
"DEBUG=yes"
"install-lib" "install-pc"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "scons-dbg"
)
# Fixup installed files.
if(VCPKG_TARGET_IS_WINDOWS)
if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "dynamic")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
file(RENAME
"${CURRENT_PACKAGES_DIR}/debug/lib/libserf-1.dll"
"${CURRENT_PACKAGES_DIR}/debug/bin/libserf-1.dll"
)
file(RENAME
"${CURRENT_PACKAGES_DIR}/debug/lib/libserf-1.pdb"
"${CURRENT_PACKAGES_DIR}/debug/bin/libserf-1.pdb"
)
else()
file(REMOVE
"${CURRENT_PACKAGES_DIR}/debug/lib/libserf-1.dll"
"${CURRENT_PACKAGES_DIR}/debug/lib/libserf-1.pdb"
"${CURRENT_PACKAGES_DIR}/debug/lib/libserf-1.lib"
)
endif()
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libserf-1.exp")
endif()
endif()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
vcpkg_fixup_pkgconfig()

View File

@ -0,0 +1,17 @@
Index: SConstruct
===================================================================
--- SConstruct (revision 1920717)
+++ SConstruct (working copy)
@@ -324,7 +324,11 @@
if aprstatic:
apr_libs='apr-1.lib'
apu_libs='aprutil-1.lib'
- env.Append(LIBS=['shell32.lib', 'xml.lib'])
+ env.Append(LIBS=['shell32.lib'])
+ if debug:
+ env.Append(LIBS=['libexpatdMD.lib'])
+ else:
+ env.Append(LIBS=['libexpatMD.lib'])
else:
apr_libs='libapr-1.lib'
apu_libs='libaprutil-1.lib'

View File

@ -0,0 +1,68 @@
Index: SConstruct
===================================================================
--- SConstruct (revision 1920717)
+++ SConstruct (working copy)
@@ -331,8 +331,12 @@
env.Append(LIBS=[apr_libs, apu_libs])
if not env.get('SOURCE_LAYOUT', None):
- env.Append(LIBPATH=['$APR/lib', '$APU/lib'],
- CPPPATH=['$APR/include/apr-1', '$APU/include/apr-1'])
+ if debug:
+ env.Append(LIBPATH=['$APR/debug/lib', '$APU/lib'],
+ CPPPATH=['$APR/include/apr-1', '$APU/include/apr-1'])
+ else:
+ env.Append(LIBPATH=['$APR/lib', '$APU/debug/lib'],
+ CPPPATH=['$APR/include/apr-1', '$APU/include/apr-1'])
elif aprstatic:
env.Append(LIBPATH=['$APR/LibR','$APU/LibR'],
CPPPATH=['$APR/include', '$APU/include'])
@@ -341,10 +345,15 @@
CPPPATH=['$APR/include', '$APU/include'])
# zlib
- env.Append(LIBS=['zlib.lib'])
if not env.get('SOURCE_LAYOUT', None):
- env.Append(CPPPATH=['$ZLIB/include'],
- LIBPATH=['$ZLIB/lib'])
+ if debug:
+ env.Append(CPPPATH=['$ZLIB/include'],
+ LIBPATH=['$ZLIB/debug/lib'])
+ env.Append(LIBS=['zlibd.lib'])
+ else:
+ env.Append(CPPPATH=['$ZLIB/include'],
+ LIBPATH=['$ZLIB/lib'])
+ env.Append(LIBS=['zlib.lib'])
else:
env.Append(CPPPATH=['$ZLIB'],
LIBPATH=['$ZLIB'])
@@ -351,8 +360,12 @@
# openssl
if not env.get('SOURCE_LAYOUT', None):
- env.Append(CPPPATH=['$OPENSSL/include/openssl'],
- LIBPATH=['$OPENSSL/lib'])
+ if debug:
+ env.Append(CPPPATH=['$OPENSSL/include/openssl'],
+ LIBPATH=['$OPENSSL/debug/lib'])
+ else:
+ env.Append(CPPPATH=['$OPENSSL/include/openssl'],
+ LIBPATH=['$OPENSSL/lib'])
elif 0: # opensslstatic:
env.Append(CPPPATH=['$OPENSSL/inc32'],
LIBPATH=['$OPENSSL/out32'])
@@ -392,8 +405,12 @@
apr_libs = ''
apu_libs = ''
- env.Append(CPPPATH=['$OPENSSL/include'])
- env.Append(LIBPATH=['$OPENSSL/lib'])
+ if debug:
+ env.Append(CPPPATH=['$OPENSSL/include/openssl'],
+ LIBPATH=['$OPENSSL/debug/lib'])
+ else:
+ env.Append(CPPPATH=['$OPENSSL/include/openssl'],
+ LIBPATH=['$OPENSSL/debug'])
# If build with gssapi, get its information and define SERF_HAVE_GSSAPI

14
ports/serf/vcpkg.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "serf",
"version": "1.3.10",
"description": "The serf library is a high performance C-based HTTP client library built upon the Apache Portable Runtime (APR) library. It is permissively licensed under the Apache License, v2.",
"homepage": "https://serf.apache.org/",
"license": "Apache-2.0",
"supports": "!uwp & !staticcrt & !arm",
"dependencies": [
"apr",
"apr-util",
"openssl",
"zlib"
]
}

View File

@ -1,10 +1,9 @@
set(program_name scons) set(program_name scons)
set(program_version 4.1.0) set(program_version 4.8.1)
set(interpreter PYTHON2) set(interpreter PYTHON3)
set(search_names "scons.py") set(search_names "scons.py")
if(CMAKE_HOST_WIN32)
set(download_urls "https://sourceforge.net/projects/scons/files/scons-local-${program_version}.zip/download") set(download_urls "https://sourceforge.net/projects/scons/files/scons-local-${program_version}.zip/download")
set(download_filename "scons-local-${program_version}.zip") set(download_filename "scons-local-${program_version}.zip")
set(download_sha512 b173176ce8aca25039c64fcc68ec1b9ad31e03a926fd545e7631b3f9b374d914adffc593f505e3e7e2867b0ffe85e8deb0b39afe314edf05d02974ce5db1badb) set(download_sha512 7ce428ccb3279359f916417f0eaca93d36a101b0760156ce53e3aa2c9c3f0a14869aadf49f21a9eb27ba366a27e3f5deab61669e5bf0b43f1547668da940c3b7)
set(tool_subdirectory "${program_version}") set(tool_subdirectory "${program_version}")
endif()

View File

@ -3,7 +3,7 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
# For each vcpkg_find_acquire_program(NAME).cmake script, # For each vcpkg_find_acquire_program(NAME).cmake script,
# there must be a literal call to vcpkg_find_acquire_program(NAME).cmake # there must be a literal call to vcpkg_find_acquire_program(NAME).cmake
set(variables BAZEL BISON FLEX GIT GN NINJA PERL PKGCONFIG PYTHON3 YASM) set(variables BAZEL BISON FLEX GIT GN NINJA PERL PKGCONFIG PYTHON3 SCONS YASM)
vcpkg_find_acquire_program(BAZEL) vcpkg_find_acquire_program(BAZEL)
vcpkg_find_acquire_program(BISON) vcpkg_find_acquire_program(BISON)
vcpkg_find_acquire_program(FLEX) vcpkg_find_acquire_program(FLEX)
@ -13,6 +13,7 @@ vcpkg_find_acquire_program(NINJA)
vcpkg_find_acquire_program(PERL) vcpkg_find_acquire_program(PERL)
vcpkg_find_acquire_program(PKGCONFIG) vcpkg_find_acquire_program(PKGCONFIG)
vcpkg_find_acquire_program(PYTHON3) vcpkg_find_acquire_program(PYTHON3)
vcpkg_find_acquire_program(SCONS)
vcpkg_find_acquire_program(YASM) vcpkg_find_acquire_program(YASM)
if(NOT VCPKG_TARGET_IS_OSX) if(NOT VCPKG_TARGET_IS_OSX)
@ -32,7 +33,7 @@ if(VCPKG_HOST_IS_WINDOWS)
file(REMOVE_RECURSE "${DOWNLOADS}/tools/nasm") file(REMOVE_RECURSE "${DOWNLOADS}/tools/nasm")
file(MAKE_DIRECTORY "${DOWNLOADS}/tools/nasm") file(MAKE_DIRECTORY "${DOWNLOADS}/tools/nasm")
list(APPEND variables 7Z ARIA2 CLANG DARK DOXYGEN GASPREPROCESSOR GO GPERF JOM NASM NUGET PYTHON2 RUBY SCONS SWIG) list(APPEND variables 7Z ARIA2 CLANG DARK DOXYGEN GASPREPROCESSOR GO GPERF JOM NASM NUGET PYTHON2 RUBY SWIG)
vcpkg_find_acquire_program(7Z) vcpkg_find_acquire_program(7Z)
vcpkg_find_acquire_program(ARIA2) vcpkg_find_acquire_program(ARIA2)
vcpkg_find_acquire_program(CLANG) vcpkg_find_acquire_program(CLANG)
@ -46,7 +47,6 @@ if(VCPKG_HOST_IS_WINDOWS)
vcpkg_find_acquire_program(NUGET) vcpkg_find_acquire_program(NUGET)
vcpkg_find_acquire_program(PYTHON2) vcpkg_find_acquire_program(PYTHON2)
vcpkg_find_acquire_program(RUBY) vcpkg_find_acquire_program(RUBY)
vcpkg_find_acquire_program(SCONS)
vcpkg_find_acquire_program(SWIG) vcpkg_find_acquire_program(SWIG)
endif() endif()

View File

@ -8268,6 +8268,10 @@
"baseline": "0.1.4.1", "baseline": "0.1.4.1",
"port-version": 0 "port-version": 0
}, },
"serf": {
"baseline": "1.3.10",
"port-version": 0
},
"sese": { "sese": {
"baseline": "2.3.0", "baseline": "2.3.0",
"port-version": 2 "port-version": 2

9
versions/s-/serf.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "703faeed41a5142b4ee46dbd247823a14a05b31f",
"version": "1.3.10",
"port-version": 0
}
]
}