-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[Libb64] Add new port #19447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Libb64] Add new port #19447
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
816b26a
Added libb64 port
9cvele3 8465fad
baseline.json updated
9cvele3 0e32228
windows build fix. cmakelists copied to source tree
9cvele3 3b49b26
libb64.json added
9cvele3 394a432
PR comment, libb64 renamed to b64
9cvele3 6a2b76f
Update version database
9cvele3 92a4756
Update ports/b64/vcpkg.json
9cvele3 e232fe4
Update ports/b64/portfile.cmake
9cvele3 0d06c4a
Update ports/b64/portfile.cmake
9cvele3 d14a468
Update ports/b64/portfile.cmake
9cvele3 7c13e79
Update ports/b64/portfile.cmake
9cvele3 83026aa
Update ports/b64/portfile.cmake
9cvele3 2a846a5
fixes
9cvele3 975e69b
update version database
9cvele3 13b86c1
set -> add_compile_definitions
7bd655b
linux fix
9cvele3 81e93e2
updated database
9cvele3 c46e30d
correctly handling static and dynamic libs
9cvele3 24f372e
update database versions
9cvele3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| cmake_minimum_required(VERSION 3.20) | ||
| project(b64) | ||
|
|
||
| set(SOURCE_FILES src/cdecode.c src/cencode.c) | ||
| set(HEADER_FILES include/b64/cdecode.h include/b64/cencode.h include/b64/decode.h include/b64/encode.h) | ||
|
|
||
| set(LIBB64_EXPORTS 1) | ||
| add_library(b64 ${SOURCE_FILES} ${HEADER_FILES}) | ||
| target_include_directories(b64 PRIVATE include) | ||
|
|
||
| set_target_properties(b64 PROPERTIES PUBLIC_HEADER "include/b64/cdecode.h;include/b64/cencode.h;include/b64/decode.h;include/b64/encode.h") | ||
|
|
||
| install(TARGETS b64 | ||
| EXPORT b64-targets | ||
| LIBRARY DESTINATION lib | ||
| PUBLIC_HEADER DESTINATION include/b64 | ||
| ) | ||
|
|
||
| install(EXPORT b64-targets | ||
| FILE b64-targets.cmake | ||
| DESTINATION lib/cmake/b64) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| 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 ports/b64/CMakeLists.txt DESTINATION ${SOURCE_PATH}/) | ||
|
9cvele3 marked this conversation as resolved.
Outdated
|
||
|
|
||
| vcpkg_configure_cmake( | ||
| SOURCE_PATH ${SOURCE_PATH} | ||
|
9cvele3 marked this conversation as resolved.
Outdated
|
||
| ) | ||
|
|
||
| vcpkg_install_cmake() | ||
|
9cvele3 marked this conversation as resolved.
Outdated
|
||
|
|
||
| file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) | ||
|
|
||
| vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) | ||
|
9cvele3 marked this conversation as resolved.
Outdated
|
||
|
|
||
| vcpkg_copy_pdbs() | ||
|
|
||
|
|
||
| # handle copyright | ||
| file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) | ||
|
9cvele3 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", | ||
| "name": "b64", | ||
| "version": "2.0.0.1" | ||
|
9cvele3 marked this conversation as resolved.
Outdated
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| diff --git a/include/b64/ccommon.h b/include/b64/ccommon.h | ||
| index 2b614df..6c5b52a 100644 | ||
| --- a/include/b64/ccommon.h | ||
| +++ b/include/b64/ccommon.h | ||
| @@ -14,11 +14,21 @@ For details, see http://sourceforge.net/projects/libb64 | ||
| #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; | ||
| #endif | ||
| #endif | ||
|
|
||
| +#ifdef _WIN32 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this will do the wrong thing for static triplets. |
||
| + #ifdef LIBB64_EXPORTS | ||
| + #define LIBB64 __declspec(dllexport) | ||
| + #else | ||
| + #define LIBB64 __declspec(dllimport) | ||
| + #endif | ||
| +#else | ||
| +#define LIBB64 | ||
| +#endif | ||
| + | ||
| #endif /* BASE64_CCOMMON_H */ | ||
| 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); | ||
| // | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "versions": [ | ||
| { | ||
| "git-tree": "e88dbb8ac8a4186b3d7ae49825ef8c4afe120dd6", | ||
| "version": "2.0.0.1", | ||
| "port-version": 0 | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LIBB64_EXPORTS seems unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in window-fix.patch, line 18.
I use it to handle dllimport dllexport stuff for dlls on Windows.
If you have some suggestion how to handle that in an different way, it's welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that constant used in the patch but I'm missing how this set is attached to that. Did I miss a configure_file or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably need
add_definitionshere, notset😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even better,
add_compile_definitions