diff options
Diffstat (limited to 'vcpkg/ports/b64')
| -rw-r--r-- | vcpkg/ports/b64/CMakeLists.txt | 40 | ||||
| -rw-r--r-- | vcpkg/ports/b64/b64_dynamic_config.h | 14 | ||||
| -rw-r--r-- | vcpkg/ports/b64/b64_static_config.h | 6 | ||||
| -rw-r--r-- | vcpkg/ports/b64/portfile.cmake | 28 | ||||
| -rw-r--r-- | vcpkg/ports/b64/vcpkg.json | 18 | ||||
| -rw-r--r-- | vcpkg/ports/b64/windows-fix.patch | 130 |
6 files changed, 236 insertions, 0 deletions
diff --git a/vcpkg/ports/b64/CMakeLists.txt b/vcpkg/ports/b64/CMakeLists.txt new file mode 100644 index 0000000..e40d14e --- /dev/null +++ b/vcpkg/ports/b64/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.20) +project(b64) + +if (BUILD_SHARED_LIBS) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/b64_dynamic_config.h ${CMAKE_CURRENT_BINARY_DIR}/b64_config.h) +else() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/b64_static_config.h ${CMAKE_CURRENT_BINARY_DIR}/b64_config.h) +endif() + +set(SRC_DIR src) +set(INC_DIR include/b64) +set(SOURCE_FILES ${SRC_DIR}/cdecode.c ${SRC_DIR}/cencode.c) +set(HEADER_FILES ${INC_DIR}/cdecode.h ${INC_DIR}/cencode.h ${INC_DIR}/decode.h ${INC_DIR}/encode.h ${INC_DIR}/ccommon.h ${CMAKE_CURRENT_BINARY_DIR}/b64_config.h) + +add_library(b64 ${SOURCE_FILES} ${HEADER_FILES}) + +if (BUILD_SHARED_LIBS) + target_compile_definitions(b64 PRIVATE LIBB64_EXPORTS=1) +endif() + +target_include_directories(b64 + PRIVATE include ${CMAKE_CURRENT_BINARY_DIR} + INTERFACE $<INSTALL_INTERFACE:include> +) + +set_property(TARGET b64 + PROPERTY PUBLIC_HEADER ${HEADER_FILES}) + +install(TARGETS b64 + EXPORT unofficial-b64-config + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/b64 +) + +install(EXPORT unofficial-b64-config + FILE unofficial-b64-config.cmake + NAMESPACE unofficial::b64:: + DESTINATION share/unofficial-b64 +) + diff --git a/vcpkg/ports/b64/b64_dynamic_config.h b/vcpkg/ports/b64/b64_dynamic_config.h new file mode 100644 index 0000000..b836ca2 --- /dev/null +++ b/vcpkg/ports/b64/b64_dynamic_config.h @@ -0,0 +1,14 @@ +#ifndef B64_CONFIG_H +#define B64_CONFIG_H + +#ifdef _WIN32 + #ifdef LIBB64_EXPORTS + #define LIBB64 __declspec(dllexport) + #else + #define LIBB64 __declspec(dllimport) + #endif +#else +#define LIBB64 +#endif + +#endif diff --git a/vcpkg/ports/b64/b64_static_config.h b/vcpkg/ports/b64/b64_static_config.h new file mode 100644 index 0000000..f261c7c --- /dev/null +++ b/vcpkg/ports/b64/b64_static_config.h @@ -0,0 +1,6 @@ +#ifndef B64_CONFIG_H +#define B64_CONFIG_H + +#define LIBB64 + +#endif diff --git a/vcpkg/ports/b64/portfile.cmake b/vcpkg/ports/b64/portfile.cmake new file mode 100644 index 0000000..51ba611 --- /dev/null +++ b/vcpkg/ports/b64/portfile.cmake @@ -0,0 +1,28 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libb64/libb64 + REF v2.0.0.1 + SHA512 72c2fd4c81575b505f4851cd3820b6a2d8e78cd031a1ed138ffe5667ca711558f43b515428971966f7a73ace7c9951f1f0b39c362a59fe4691958875775cce23 + HEAD_REF master + PATCHES "windows-fix.patch" +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/b64_dynamic_config.h" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/b64_static_config.h" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-b64) + +vcpkg_copy_pdbs() + + +# handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/b64/vcpkg.json b/vcpkg/ports/b64/vcpkg.json new file mode 100644 index 0000000..e9e289e --- /dev/null +++ b/vcpkg/ports/b64/vcpkg.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "b64", + "version": "2.0.0.1", + "port-version": 2, + "description": "libb64 is a library of ANSI C routines for fast encoding/decoding data into and from a base64-encoded format", + "license": null, + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/vcpkg/ports/b64/windows-fix.patch b/vcpkg/ports/b64/windows-fix.patch new file mode 100644 index 0000000..ccabfad --- /dev/null +++ b/vcpkg/ports/b64/windows-fix.patch @@ -0,0 +1,130 @@ +diff --git a/include/b64/ccommon.h b/include/b64/ccommon.h +index 2b614df..0e46141 100644 +--- a/include/b64/ccommon.h ++++ b/include/b64/ccommon.h +@@ -10,11 +10,12 @@ For details, see http://sourceforge.net/projects/libb64 + + #define BASE64_VER_MAJOR 2 + #define BASE64_VER_MINOR 0 ++#include "b64_config.h" + + #ifndef HAVE_SIZE_T + #ifdef _WIN32 + #include <crtdefs.h> +- #elseif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) ++ #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) + #include <stdlib.h> + #else + typedef unsigned long size_t; +diff --git a/include/b64/cdecode.h b/include/b64/cdecode.h +index d6ff24c..4553efc 100644 +--- a/include/b64/cdecode.h ++++ b/include/b64/cdecode.h +@@ -24,11 +24,11 @@ typedef struct + char plainchar; + } base64_decodestate; + +-extern void base64_init_decodestate(base64_decodestate* state_in); ++extern LIBB64 void base64_init_decodestate(base64_decodestate* state_in); + +-extern size_t base64_decode_maxlength(size_t encode_len); ++extern LIBB64 size_t base64_decode_maxlength(size_t encode_len); + +-extern int base64_decode_value(signed char value_in); +-extern size_t base64_decode_block(const char* code_in, const size_t length_in, void* plaintext_out, base64_decodestate* state_in); ++extern LIBB64 int base64_decode_value(signed char value_in); ++extern LIBB64 size_t base64_decode_block(const char* code_in, const size_t length_in, void* plaintext_out, base64_decodestate* state_in); + + #endif /* BASE64_CDECODE_H */ +diff --git a/include/b64/cencode.h b/include/b64/cencode.h +index 96b0cdb..1feb695 100644 +--- a/include/b64/cencode.h ++++ b/include/b64/cencode.h +@@ -31,12 +31,12 @@ typedef struct + char result; + } base64_encodestate; + +-extern void base64_init_encodestate(base64_encodestate* state_in); ++extern LIBB64 void base64_init_encodestate(base64_encodestate* state_in); + +-extern size_t base64_encode_length(size_t plain_len, base64_encodestate* state_in); ++extern LIBB64 size_t base64_encode_length(size_t plain_len, base64_encodestate* state_in); + +-extern char base64_encode_value(signed char value_in); +-extern size_t base64_encode_block(const void* plaintext_in, const size_t length_in, char* code_out, base64_encodestate* state_in); +-extern size_t base64_encode_blockend(char* code_out, base64_encodestate* state_in); ++extern LIBB64 char base64_encode_value(signed char value_in); ++extern LIBB64 size_t base64_encode_block(const void* plaintext_in, const size_t length_in, char* code_out, base64_encodestate* state_in); ++extern LIBB64 size_t base64_encode_blockend(char* code_out, base64_encodestate* state_in); + + #endif /* BASE64_CENCODE_H */ +diff --git a/include/b64/decode.h b/include/b64/decode.h +index b2362e5..dd772d4 100644 +--- a/include/b64/decode.h ++++ b/include/b64/decode.h +@@ -22,23 +22,23 @@ namespace base64 + base64_decodestate _state; + int _buffersize; + +- decoder(int buffersize_in = BUFFERSIZE) ++ LIBB64 decoder(int buffersize_in = BUFFERSIZE) + : _buffersize(buffersize_in) + { + base64_init_decodestate(&_state); + } + +- int decode(char value_in) ++ LIBB64 int decode(char value_in) + { + return base64_decode_value(value_in); + } + +- std::streamsize decode(const char* code_in, const std::streamsize length_in, char* plaintext_out) ++ LIBB64 std::streamsize decode(const char* code_in, const std::streamsize length_in, char* plaintext_out) + { + return base64_decode_block(code_in, static_cast<int>(length_in), plaintext_out, &_state); + } + +- void decode(std::istream& istream_in, std::ostream& ostream_in) ++ LIBB64 void decode(std::istream& istream_in, std::ostream& ostream_in) + { + base64_init_decodestate(&_state); + // +diff --git a/include/b64/encode.h b/include/b64/encode.h +index c1a5f88..ff2c9b4 100644 +--- a/include/b64/encode.h ++++ b/include/b64/encode.h +@@ -22,28 +22,28 @@ namespace base64 + base64_encodestate _state; + int _buffersize; + +- encoder(int buffersize_in = BUFFERSIZE) ++ LIBB64 encoder(int buffersize_in = BUFFERSIZE) + : _buffersize(buffersize_in) + { + base64_init_encodestate(&_state); + } + +- int encode(char value_in) ++ LIBB64 int encode(char value_in) + { + return base64_encode_value(value_in); + } + +- std::streamsize encode(const char* code_in, const std::streamsize length_in, char* plaintext_out) ++ LIBB64 std::streamsize encode(const char* code_in, const std::streamsize length_in, char* plaintext_out) + { + return base64_encode_block(code_in, static_cast<int>(length_in), plaintext_out, &_state); + } + +- int encode_end(char* plaintext_out) ++ LIBB64 int encode_end(char* plaintext_out) + { + return base64_encode_blockend(plaintext_out, &_state); + } + +- void encode(std::istream& istream_in, std::ostream& ostream_in) ++ LIBB64 void encode(std::istream& istream_in, std::ostream& ostream_in) + { + base64_init_encodestate(&_state); + // |