[log4cxx] Add new port (#11659)

* Adding log4cxx 0.10.0

* adding the ci baseline.

* updated ci.baseline.txt

* Update portfile.cmake

* Update CONTROL
This commit is contained in:
Sean Yen 2020-06-11 00:56:42 -07:00 committed by GitHub
parent 0a3cc50c41
commit 67eb48da0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 455 additions and 0 deletions

View File

@ -0,0 +1,337 @@
diff --git a/src/main/cpp/locationinfo.cpp b/src/main/cpp/locationinfo.cpp
index e76ea29c..edcc05f5 100644
--- a/src/main/cpp/locationinfo.cpp
+++ b/src/main/cpp/locationinfo.cpp
@@ -148,7 +148,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
if (lineNumber == -1 && fileName == NA && methodName == NA_METHOD) {
os.writeNull(p);
} else {
- char prolog[] = {
+ uint8_t prolog[] = {
0x72, 0x00, 0x21, 0x6F, 0x72, 0x67, 0x2E,
0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6C,
0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69,
@@ -161,7 +161,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
0x78, 0x70 };
- os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, prolog, sizeof(prolog), p);
+ os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, (char *)prolog, sizeof(prolog), p);
char* line = p.itoa(lineNumber);
//
// construct Java-like fullInfo (replace "::" with ".")
diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
index 1c0d4be7..ba662147 100644
--- a/src/main/cpp/loggingevent.cpp
+++ b/src/main/cpp/loggingevent.cpp
@@ -236,7 +236,7 @@ void LoggingEvent::setProperty(const LogString& key, const LogString& value)
void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p) {
- char classDesc[] = {
+ uint8_t classDesc[] = {
0x72, 0x00, 0x21,
0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63,
0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A,
@@ -292,7 +292,7 @@ void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p) {
0x3B, 0x78, 0x70 };
os.writeProlog("org.apache.log4j.spi.LoggingEvent",
- 8, classDesc, sizeof(classDesc), p);
+ 8, (char *)classDesc, sizeof(classDesc), p);
}
void LoggingEvent::write(helpers::ObjectOutputStream& os, Pool& p) const {
diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
index 7cd696b8..f80261d9 100644
--- a/src/main/cpp/objectoutputstream.cpp
+++ b/src/main/cpp/objectoutputstream.cpp
@@ -36,8 +36,8 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
objectHandle(0x7E0000),
classDescriptions(new ClassDescriptionMap())
{
- char start[] = { 0xAC, 0xED, 0x00, 0x05 };
- ByteBuffer buf(start, sizeof(start));
+ uint8_t start[] = { 0xAC, 0xED, 0x00, 0x05 };
+ ByteBuffer buf((char *)start, sizeof(start));
os->write(buf, p);
}
@@ -81,7 +81,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
//
// TC_OBJECT and the classDesc for java.util.Hashtable
//
- char prolog[] = {
+ uint8_t prolog[] = {
0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
@@ -90,12 +90,12 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49,
0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
0x6F, 0x6C, 0x64, 0x78, 0x70 };
- writeProlog("java.util.Hashtable", 1, prolog, sizeof(prolog), p);
+ writeProlog("java.util.Hashtable", 1, (char *)prolog, sizeof(prolog), p);
//
// loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
- char data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+ uint8_t data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
TC_BLOCKDATA, 0x08, 0x00, 0x00, 0x00, 0x07 };
- ByteBuffer dataBuf(data, sizeof(data));
+ ByteBuffer dataBuf((char *)data, sizeof(data));
os->write(dataBuf, p);
char size[4];
size_t sz = val.size();
diff --git a/src/main/cpp/simpledateformat.cpp b/src/main/cpp/simpledateformat.cpp
index f18dfc75..cbce2db9 100644
--- a/src/main/cpp/simpledateformat.cpp
+++ b/src/main/cpp/simpledateformat.cpp
@@ -126,7 +126,7 @@ namespace log4cxx
size_t start = 0;
std::basic_ostringstream<wchar_t> os;
for(; valueIter != values.end(); valueIter++) {
- PUT_FACET(facet, os, &time, (wchar_t) wspec);
+ PUT_FACET(facet, os, &time, wspec);
Transcoder::decode(os.str().substr(start), *valueIter);
start = os.str().length();
(*inc)(time, aprtime);
diff --git a/src/main/cpp/stringhelper.cpp b/src/main/cpp/stringhelper.cpp
index ca4b1ace..b89dc65d 100644
--- a/src/main/cpp/stringhelper.cpp
+++ b/src/main/cpp/stringhelper.cpp
@@ -21,6 +21,7 @@
#include <log4cxx/helpers/transcoder.h>
#include <algorithm>
#include <vector>
+#include <iterator>
#include <apr_strings.h>
#include <log4cxx/helpers/pool.h>
#if !defined(LOG4CXX)
diff --git a/src/main/include/log4cxx/asyncappender.h b/src/main/include/log4cxx/asyncappender.h
index cbe9b3c7..86a7371c 100644
--- a/src/main/include/log4cxx/asyncappender.h
+++ b/src/main/include/log4cxx/asyncappender.h
@@ -35,6 +35,7 @@
namespace log4cxx
{
+ LOG4CXX_LIST_DEF(LoggingEventList, log4cxx::spi::LoggingEventPtr);
/**
The AsyncAppender lets users log events asynchronously. It uses a
@@ -194,7 +195,6 @@ namespace log4cxx
/**
* Event buffer.
*/
- LOG4CXX_LIST_DEF(LoggingEventList, log4cxx::spi::LoggingEventPtr);
LoggingEventList buffer;
/**
diff --git a/src/main/include/log4cxx/helpers/bytearrayinputstream.h b/src/main/include/log4cxx/helpers/bytearrayinputstream.h
index 92bcb595..11d33def 100755
--- a/src/main/include/log4cxx/helpers/bytearrayinputstream.h
+++ b/src/main/include/log4cxx/helpers/bytearrayinputstream.h
@@ -32,6 +32,7 @@ namespace log4cxx
{
namespace helpers {
+ LOG4CXX_LIST_DEF(ByteList, unsigned char);
/**
* InputStream implemented on top of a byte array.
@@ -39,7 +40,6 @@ namespace log4cxx
class LOG4CXX_EXPORT ByteArrayInputStream : public InputStream
{
private:
- LOG4CXX_LIST_DEF(ByteList, unsigned char);
ByteList buf;
size_t pos;
diff --git a/src/main/include/log4cxx/helpers/bytearrayoutputstream.h b/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
index 34e3d095..1f4233da 100644
--- a/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
+++ b/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
@@ -34,6 +34,7 @@ namespace log4cxx
namespace helpers {
class Pool;
+ LOG4CXX_LIST_DEF(ByteList, unsigned char);
/**
* OutputStream implemented on top of std::vector
@@ -41,7 +42,6 @@ namespace log4cxx
class LOG4CXX_EXPORT ByteArrayOutputStream : public OutputStream
{
private:
- LOG4CXX_LIST_DEF(ByteList, unsigned char);
ByteList array;
public:
diff --git a/src/main/include/log4cxx/helpers/simpledateformat.h b/src/main/include/log4cxx/helpers/simpledateformat.h
index 9c27f685..0b4dc5fd 100644
--- a/src/main/include/log4cxx/helpers/simpledateformat.h
+++ b/src/main/include/log4cxx/helpers/simpledateformat.h
@@ -39,6 +39,8 @@ namespace log4cxx
class PatternToken;
}
+ LOG4CXX_LIST_DEF(PatternTokenList, log4cxx::helpers::SimpleDateFormatImpl::PatternToken*);
+
/**
* Concrete class for formatting and parsing dates in a
* locale-sensitive manner.
@@ -75,8 +77,6 @@ namespace log4cxx
/**
* List of tokens.
*/
- LOG4CXX_LIST_DEF(PatternTokenList, log4cxx::helpers::SimpleDateFormatImpl::PatternToken*);
-
PatternTokenList pattern;
static void addToken(const logchar spec, const int repeat, const std::locale* locale, PatternTokenList& pattern);
diff --git a/src/main/include/log4cxx/helpers/socketoutputstream.h b/src/main/include/log4cxx/helpers/socketoutputstream.h
index 6bca1733..0c6fbb4f 100644
--- a/src/main/include/log4cxx/helpers/socketoutputstream.h
+++ b/src/main/include/log4cxx/helpers/socketoutputstream.h
@@ -32,6 +32,7 @@ namespace log4cxx
{
namespace helpers
{
+ LOG4CXX_LIST_DEF(ByteList, unsigned char);
class LOG4CXX_EXPORT SocketOutputStream : public OutputStream
{
@@ -50,7 +51,6 @@ namespace log4cxx
virtual void write(ByteBuffer& buf, Pool& p);
private:
- LOG4CXX_LIST_DEF(ByteList, unsigned char);
ByteList array;
SocketPtr socket;
//
diff --git a/src/main/include/log4cxx/net/sockethubappender.h b/src/main/include/log4cxx/net/sockethubappender.h
index 89948334..b4269943 100644
--- a/src/main/include/log4cxx/net/sockethubappender.h
+++ b/src/main/include/log4cxx/net/sockethubappender.h
@@ -38,6 +38,8 @@ namespace log4cxx
}
namespace net
{
+ LOG4CXX_LIST_DEF(ObjectOutputStreamList, log4cxx::helpers::ObjectOutputStreamPtr);
+
/**
Sends {@link log4cxx::spi::LoggingEvent LoggingEvent} objects to a set of remote log
servers, usually a SocketNode.
@@ -112,7 +114,6 @@ namespace log4cxx
static int DEFAULT_PORT;
int port;
- LOG4CXX_LIST_DEF(ObjectOutputStreamList, log4cxx::helpers::ObjectOutputStreamPtr);
ObjectOutputStreamList streams;
bool locationInfo;
diff --git a/src/main/include/log4cxx/net/telnetappender.h b/src/main/include/log4cxx/net/telnetappender.h
index 5cbe2b0b..17678d86 100644
--- a/src/main/include/log4cxx/net/telnetappender.h
+++ b/src/main/include/log4cxx/net/telnetappender.h
@@ -39,6 +39,8 @@ namespace log4cxx
}
namespace net
{
+ typedef log4cxx::helpers::SocketPtr Connection;
+ LOG4CXX_LIST_DEF(ConnectionList, Connection);
/**
<p>The TelnetAppender is a log4cxx appender that specializes in
writing to a read-only socket. The output is provided in a
@@ -131,9 +133,6 @@ servlet.
TelnetAppender(const TelnetAppender&);
TelnetAppender& operator=(const TelnetAppender&);
- typedef log4cxx::helpers::SocketPtr Connection;
- LOG4CXX_LIST_DEF(ConnectionList, Connection);
-
void write(log4cxx::helpers::ByteBuffer&);
void writeStatus(const log4cxx::helpers::SocketPtr& socket, const LogString& msg, log4cxx::helpers::Pool& p);
ConnectionList connections;
diff --git a/src/main/include/log4cxx/patternlayout.h b/src/main/include/log4cxx/patternlayout.h
index 55d6eb5b..d084b6cb 100644
--- a/src/main/include/log4cxx/patternlayout.h
+++ b/src/main/include/log4cxx/patternlayout.h
@@ -32,6 +32,8 @@
namespace log4cxx
{
+ LOG4CXX_LIST_DEF(LoggingEventPatternConverterList, log4cxx::pattern::LoggingEventPatternConverterPtr);
+ LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
/**
@@ -334,13 +336,11 @@ namespace log4cxx
/**
* Pattern converters.
*/
- LOG4CXX_LIST_DEF(LoggingEventPatternConverterList, log4cxx::pattern::LoggingEventPatternConverterPtr);
LoggingEventPatternConverterList patternConverters;
/**
* Field widths and alignment corresponding to pattern converters.
*/
- LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
FormattingInfoList patternFields;
diff --git a/src/main/include/log4cxx/rolling/rollingpolicybase.h b/src/main/include/log4cxx/rolling/rollingpolicybase.h
index 154b17d9..ab8dad70 100755
--- a/src/main/include/log4cxx/rolling/rollingpolicybase.h
+++ b/src/main/include/log4cxx/rolling/rollingpolicybase.h
@@ -34,6 +34,8 @@
namespace log4cxx {
namespace rolling {
+ LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr);
+ LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
/**
* Implements methods common to most, it not all, rolling
@@ -57,13 +59,11 @@ namespace log4cxx {
/**
* File name pattern converters.
*/
- LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr);
PatternConverterList patternConverters;
/**
* File name field specifiers.
*/
- LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
FormattingInfoList patternFields;
/**
diff --git a/src/main/include/log4cxx/spi/loggingevent.h b/src/main/include/log4cxx/spi/loggingevent.h
index 25f5c0dd..102bea21 100644
--- a/src/main/include/log4cxx/spi/loggingevent.h
+++ b/src/main/include/log4cxx/spi/loggingevent.h
@@ -43,6 +43,7 @@ namespace log4cxx
namespace spi
{
+ LOG4CXX_LIST_DEF(KeySet, LogString);
/**
The internal representation of logging events. When an affirmative
@@ -152,7 +153,6 @@ namespace log4cxx
*/
bool getMDC(const LogString& key, LogString& dest) const;
- LOG4CXX_LIST_DEF(KeySet, LogString);
/**
* Returns the set of of the key values in the MDC for the event.
* The returned set is unmodifiable by the caller.
@@ -160,6 +160,7 @@ namespace log4cxx
* @return Set an unmodifiable set of the MDC keys.
*
*/
+ typedef spi::KeySet KeySet;
KeySet getMDCKeySet() const;
/**

View File

@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 2.8.9)
project (log4cxx)
find_path(APR_INCLUDE_DIR
NAMES apr.h
)
if(APR_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Cannot locate apr.h")
endif()
find_library(APR_LIBRARIES
NAMES libapr-1
)
if(APR_LIBRARIES-NOTFOUND)
message(FATAL_ERROR "Cannot locate the library of `libapr-1`")
endif()
find_path(APRUTIL_INCLUDE_DIR
NAMES apu.h
)
if(APRUTIL_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Cannot locate apu.h")
endif()
find_library(APRUTIL_LIBRARIES
NAMES libaprutil-1
)
if(APRUTIL_LIBRARIES-NOTFOUND)
message(FATAL_ERROR "Cannot locate the library of `libaprutil-1`")
endif()
add_compile_options(
/wd4101
/wd4275
/wd4251
/wd4250
)
configure_file(src/main/include/log4cxx/log4cxx.hw
${PROJECT_BINARY_DIR}/include/log4cxx/log4cxx.h COPYONLY)
configure_file(src/main/include/log4cxx/private/log4cxx_private.hw
${PROJECT_BINARY_DIR}/include/log4cxx/private/log4cxx_private.h COPYONLY)
set(LOG4CXX_INCLUDE_DIRECTORIES
${PROJECT_BINARY_DIR}/include
src/main/include
${APR_INCLUDE_DIR}
${APRUTIL_INCLUDE_DIR}
)
file(GLOB_RECURSE LOG4CXX_SRC
"${PROJECT_SOURCE_DIR}/src/main/cpp/*.cpp"
)
add_library(log4cxx SHARED ${LOG4CXX_SRC})
target_include_directories(log4cxx PUBLIC ${LOG4CXX_INCLUDE_DIRECTORIES})
SET_TARGET_PROPERTIES(log4cxx PROPERTIES COMPILE_DEFINITIONS "_USRDLL;DLL_EXPORTS;LOG4CXX;WIN32")
target_link_libraries(log4cxx
${APRUTIL_LIBRARIES}
${APR_LIBRARIES}
odbc32
)
install(TARGETS log4cxx
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
INSTALL(DIRECTORY src/main/include/ DESTINATION include
FILES_MATCHING PATTERN "*.h")
INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/include/ DESTINATION include
FILES_MATCHING PATTERN "*.h")

6
ports/log4cxx/CONTROL Normal file
View File

@ -0,0 +1,6 @@
Source: log4cxx
Version: 0.10.0-2
Homepage: https://logging.apache.org/log4cxx/
Description: Apache log4cxx is a logging framework for C++ patterned after Apache log4j, which uses Apache Portable Runtime for most platform-specific code and should be usable on any platform supported by APR. Apache log4cxx is licensed under the Apache License, an open source license certified by the Open Source Initiative.
Build-Depends: apr, apr-util
Supports: windows&!(uwp|arm|static)

View File

@ -0,0 +1,31 @@
vcpkg_fail_port_install(ON_TARGET "Linux" "OSX" "UWP" "arm" "arm64")
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
set(LOG4CXX_VERSION 0.10.0)
vcpkg_download_distfile(ARCHIVE
URLS "https://archive.apache.org/dist/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz"
FILENAME "apache-log4cxx-0.10.0.tar.gz"
SHA512 1c34d80983db5648bc4582ddcf6b4fdefdc6594c2769f95235f5441cd6d03cf279cc8f365e9a687085b113f79ebac9d7d33a54b6aa3b3b808c0e1a56a15ffa37
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${LOG4CXX_VERSION}
PATCHES
001_msvc.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

View File

@ -1010,6 +1010,12 @@ log4cplus:arm-uwp=fail
log4cplus:x64-uwp=fail
log4cpp:arm-uwp=fail
log4cpp:x64-uwp=fail
log4cxx:arm64-windows=fail
log4cxx:arm-uwp=fail
log4cxx:x64-linux=fail
log4cxx:x64-uwp=fail
log4cxx:x64-windows-static=fail
log4cxx:x64-osx=fail
lua:arm-uwp=fail
lua:x64-uwp=fail
luajit:arm64-windows = skip