Skip to content

Commit

Permalink
Compile for android
Browse files Browse the repository at this point in the history
  • Loading branch information
talregev committed Aug 31, 2021
1 parent fefb2c1 commit 587b94c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 8 deletions.
35 changes: 35 additions & 0 deletions ports/sockpp/0001-fix-android-strerror.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From feb6183a307482313766ec07773cc61d70cb98da Mon Sep 17 00:00:00 2001
From: Ben Ahlbrand <bmahlbrand@gmail.com>
Date: Tue, 29 Sep 2020 00:37:02 -0400
Subject: [PATCH] fix: android strerror

---
src/exception.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/exception.cpp b/src/exception.cpp
index 5be94d0..7cb010d 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -66,8 +66,16 @@ std::string sys_error::error_str(int err)
buf, sizeof(buf), NULL);
#else
#ifdef _GNU_SOURCE
- auto s = strerror_r(err, buf, sizeof(buf));
- return s ? std::string(s) : std::string();
+ #if !defined(__GLIBC__)
+ // use the XSI standard behavior.
+ int e = strerror_r(err, buf, sizeof(buf));
+ auto s = strerror(e);
+ return s ? std::string(s) : std::string();
+ #else
+ // assume GNU exception
+ auto s = strerror_r(err, buf, sizeof(buf));
+ return s ? std::string(s) : std::string();
+ #endif
#else
ignore_result(strerror_r(err, buf, sizeof(buf)));
#endif
--
2.30.2.windows.1

5 changes: 0 additions & 5 deletions ports/sockpp/CONTROL

This file was deleted.

6 changes: 4 additions & 2 deletions ports/sockpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ vcpkg_from_github(
REF d8c86c01db43542a06ad05424da037f6b9892253
SHA512 9b7ae3fea08bfd4a0d6479d7fbcc24da9101476c4f8e4a684138c7d974827cdf374282a4641e58f03c08aeb83f2c1856fc3c5193e5847fb4b3d9182c1c396087
HEAD_REF master
PATCHES
0001-fix-android-strerror.patch
)

vcpkg_replace_string(${SOURCE_PATH}/CMakeLists.txt "\${SOCKPP}-static" "\${SOCKPP}")

vcpkg_configure_cmake(
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
Expand All @@ -22,7 +24,7 @@ vcpkg_configure_cmake(
-DSOCKPP_BUILD_TESTS=OFF
)

vcpkg_install_cmake()
vcpkg_cmake_install()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CURRENT_PORT_DIR}/sockppConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
Expand Down
18 changes: 18 additions & 0 deletions ports/sockpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "sockpp",
"version": "0.7",
"port-version": 1,
"description": "Simple, modern, C++ socket library. This is a fairly low-level C++ wrapper around the Berkeley sockets library using socket, acceptor, and connector classes that are familiar concepts from other languages.",
"homepage": "https://github.com/fpagliughi/sockpp",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5958,7 +5958,7 @@
},
"sockpp": {
"baseline": "0.7",
"port-version": 0
"port-version": 1
},
"soem": {
"baseline": "1.4.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/sockpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "97a77b226a4c2a655daac0100ec95411b9abbace",
"version": "0.7",
"port-version": 1
},
{
"git-tree": "259ad7f13a8184478a6a94922385f06ff5a7a00b",
"version-string": "0.7",
Expand Down

0 comments on commit 587b94c

Please sign in to comment.