diff --git a/ports/libopensp/opensp_1.5.2-13.diff b/ports/libopensp/opensp_1.5.2-13.diff new file mode 100644 index 00000000000000..92781232fd4861 --- /dev/null +++ b/ports/libopensp/opensp_1.5.2-13.diff @@ -0,0 +1,37 @@ +--- opensp-1.5.2.orig/sx/XmlOutputEventHandler.cxx ++++ opensp-1.5.2/sx/XmlOutputEventHandler.cxx +@@ -1199,12 +1199,22 @@ + // Check to make sure we haven't passed outside of the + // output directory + char *dirs = strdup (filePath); ++#ifdef MAXPATHLEN + char realDirs[MAXPATHLEN]; + char realOutputDir[MAXPATHLEN]; ++#else ++ char *realDirs; ++ char *realOutputDir; ++#endif + char *outputDir = strdup(outputDir_); + ++#ifdef MAXPATHLEN + realpath((const char *)dirname(dirs), realDirs); + realpath((const char *)dirname(outputDir), realOutputDir); ++#else ++ realDirs = realpath((const char *)dirname(dirs), NULL); ++ realOutputDir = realpath((const char *)dirname(outputDir), NULL); ++#endif + + if (strncmp(realDirs, realOutputDir, strlen (realOutputDir)) != 0) { + app_->message(XmlOutputMessages::pathOutsideOutputDirectory, +@@ -1214,6 +1224,11 @@ + } + } + ++#ifndef MAXPATHLEN ++ free(realDirs); ++ free(realOutputDir); ++#endif ++ + // Make the necessary directories + maybeCreateDirectories(dirname(dirs)); + diff --git a/ports/libopensp/portfile.cmake b/ports/libopensp/portfile.cmake new file mode 100644 index 00000000000000..aa7fdadfffb46d --- /dev/null +++ b/ports/libopensp/portfile.cmake @@ -0,0 +1,56 @@ +set(OPENSP_VERSION 1.5.2) + +set(PATCHES opensp_1.5.2-13.diff) # http://deb.debian.org/debian/pool/main/o/opensp/opensp_1.5.2-13.diff.gz +if (VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) + list(APPEND PATCHES windows_cmake_build.diff) # https://invent.kde.org/packaging/craft-blueprints-kde/-/tree/master/libs/libopensp +endif() +if (VCPKG_TARGET_IS_UWP) + list(APPEND PATCHES uwp_getenv_fix.diff) +endif() + +vcpkg_download_distfile(ARCHIVE + URLS "https://downloads.sourceforge.net/project/openjade/opensp/${OPENSP_VERSION}/OpenSP-${OPENSP_VERSION}.tar.gz" + FILENAME "OpenSP-${OPENSP_VERSION}.tar.gz" + SHA512 a7dcc246ba7f58969ecd6d107c7b82dede811e65f375b7aa3e683621f2c6ff3e7dccefdd79098fcadad6cca8bb94c2933c63f4701be2c002f9a56f1bbe6b047e +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE "${ARCHIVE}" + REF ${OPENSP_VERSION} + PATCHES ${PATCHES} +) + +if (VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) + vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + ) + + vcpkg_cmake_install() +else() + set(EXTRA_OPTS "") + if(VCPKG_TARGET_IS_OSX) + list(APPEND EXTRA_OPTS "LDFLAGS=-framework CoreFoundation \$LDFLAGS") # libintl links to it + endif() + + vcpkg_configure_make( + AUTOCONFIG + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + --disable-doc-build + ${EXTRA_OPTS} + ) + + vcpkg_install_make() +endif() + +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/libopensp/uwp_getenv_fix.diff b/ports/libopensp/uwp_getenv_fix.diff new file mode 100644 index 00000000000000..806ac1ba86e76e --- /dev/null +++ b/ports/libopensp/uwp_getenv_fix.diff @@ -0,0 +1,13 @@ +diff --git a/config.h b/config.h +index 6a2b097..7db8a93 100644 +--- a/config.h ++++ b/config.h +@@ -64,6 +64,8 @@ + #pragma warning ( disable : 4251 ) // __declspec(dllexport) + #pragma warning ( disable : 4275 ) + #pragma warning ( disable : 4237 ) // future reserved keyword ++#pragma warning ( disable : 4996 ) // 'getenv': This function or variable may be unsafe (on UWP) ++#pragma warning ( disable : 4703 ) // potentially uninitialized local pointer variable 'declaredValue' + #define huge verybig + #if _MSC_VER == 900 + #define SP_DECLARE_PLACEMENT_OPERATOR_NEW diff --git a/ports/libopensp/vcpkg.json b/ports/libopensp/vcpkg.json new file mode 100644 index 00000000000000..b61ba7152520df --- /dev/null +++ b/ports/libopensp/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "libopensp", + "version": "1.5.2", + "description": "SGML parser algorithm", + "homepage": "http://openjade.sourceforge.net", + "dependencies": [ + { + "name": "gettext", + "platform": "!(windows | uwp)" + }, + { + "name": "vcpkg-cmake", + "host": true, + "platform": "windows" + }, + { + "name": "vcpkg-cmake-config", + "host": true, + "platform": "windows" + } + ] +} diff --git a/ports/libopensp/windows_cmake_build.diff b/ports/libopensp/windows_cmake_build.diff new file mode 100644 index 00000000000000..2c9e8253732993 --- /dev/null +++ b/ports/libopensp/windows_cmake_build.diff @@ -0,0 +1,142 @@ +diff -Nru -x '*~' OpenSP-1.5.2.orig/CMakeLists.txt OpenSP-1.5.2/CMakeLists.txt +--- OpenSP-1.5.2.orig/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200 ++++ OpenSP-1.5.2/CMakeLists.txt 2014-08-24 17:23:19.941495700 +0300 +@@ -0,0 +1,24 @@ ++project(opensp) ++ ++set (VERSION_MAJOR 1) ++set (VERSION_MINOR 5) ++set (VERSION_PATH 2) ++ ++cmake_minimum_required(VERSION 2.6) ++ ++include_directories( ++ . ++ include ++ generic ++) ++ ++file(GLOB SRC_SOURCES lib/*.cxx) ++file(GLOB libopensp_HEADERS config.h generic/*.h include/*.h) ++ ++add_library(opensp ${SRC_SOURCES}) ++set_target_properties(opensp PROPERTIES OUTPUT_NAME "osp") ++target_link_libraries(opensp) ++ ++install(TARGETS opensp RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) ++install(FILES ${libopensp_HEADERS} DESTINATION include/opensp) ++ +diff -Nru -x '*~' OpenSP-1.5.2.orig/config.h OpenSP-1.5.2/config.h +--- OpenSP-1.5.2.orig/config.h 2005-12-23 16:16:30.000000000 +0200 ++++ OpenSP-1.5.2/config.h 2014-08-24 17:26:33.724698900 +0300 +@@ -26,6 +26,12 @@ + #endif + #endif /* __GNUG__ */ + ++#ifdef __MINGW32__ ++#define SP_HAVE_BOOL ++#define SP_HAVE_TYPENAME ++#define SP_DEFINE_TEMPLATES ++#endif /* __MINGW32__ */ ++ + #if defined(sun) || defined(__sun) + // struct stat has st_blksize member + #define SP_STAT_BLKSIZE +@@ -80,6 +86,11 @@ + #define SP_HAVE_TYPENAME + #endif + ++#if _MSC_VER >=1800 ++// Visual Studio 2013 ++#define SP_ANSI_FOR_SCOPE ++#endif ++ + #define SP_HAVE_SETMODE + #define SP_DLLEXPORT __declspec(dllexport) + #define SP_DLLIMPORT __declspec(dllimport) +@@ -301,15 +312,8 @@ + #define PATH_SEPARATOR ':' + #endif + +- +-/* new stuff */ +- +-#ifndef HAVE_MUTABLE +-#define mutable +-#endif +- + // NOTE: This is processed as a Makefile, not as a header by autoconf. +-#define SP_PACKAGE "OpenSP" +-#define SP_VERSION "1.5.2" ++#define SP_PACKAGE "@PACKAGE@" ++#define SP_VERSION "@VERSION@" + + #endif /* not config_INCLUDED */ +diff -Nru -x '*~' OpenSP-1.5.2.orig/generic/SGMLApplication.h OpenSP-1.5.2/generic/SGMLApplication.h +--- OpenSP-1.5.2.orig/generic/SGMLApplication.h 2005-05-14 12:17:41.000000000 +0300 ++++ OpenSP-1.5.2/generic/SGMLApplication.h 2014-08-24 17:23:19.957120700 +0300 +@@ -269,6 +269,7 @@ + unsigned count_; + friend class OpenEntityPtr; + }; ++ SGMLApplication(); + virtual ~SGMLApplication(); + virtual void appinfo(const AppinfoEvent &); + virtual void startDtd(const StartDtdEvent &); +diff -Nru -x '*~' OpenSP-1.5.2.orig/include/OutputCharStream.h OpenSP-1.5.2/include/OutputCharStream.h +--- OpenSP-1.5.2.orig/include/OutputCharStream.h 2005-07-21 17:04:39.000000000 +0300 ++++ OpenSP-1.5.2/include/OutputCharStream.h 2014-08-24 17:23:19.957120700 +0300 +@@ -31,6 +31,7 @@ + OutputCharStream &operator<<(const char *); + OutputCharStream &operator<<(const StringC &); + OutputCharStream &operator<<(unsigned long); ++ OutputCharStream &operator<<(unsigned long long); + OutputCharStream &operator<<(int); + OutputCharStream &operator<<(Newline); + private: +diff -Nru -x '*~' OpenSP-1.5.2.orig/lib/MessageReporter.cxx OpenSP-1.5.2/lib/MessageReporter.cxx +--- OpenSP-1.5.2.orig/lib/MessageReporter.cxx 2005-07-21 17:05:17.000000000 +0300 ++++ OpenSP-1.5.2/lib/MessageReporter.cxx 2014-08-24 17:23:19.957120700 +0300 +@@ -123,7 +123,11 @@ + os() << ':'; + } + if (options_ & messageNumbers) ++#ifdef _WIN64 ++ os() << (unsigned long long)message.type->module() << "." ++#else + os() << (unsigned long)message.type->module() << "." ++#endif + << (unsigned long)message.type->number() << ":"; + switch (message.type->severity()) { + case MessageType::info: +diff -Nru -x '*~' OpenSP-1.5.2.orig/lib/OutputCharStream.cxx OpenSP-1.5.2/lib/OutputCharStream.cxx +--- OpenSP-1.5.2.orig/lib/OutputCharStream.cxx 2005-07-21 17:05:17.000000000 +0300 ++++ OpenSP-1.5.2/lib/OutputCharStream.cxx 2014-08-24 17:23:19.957120700 +0300 +@@ -61,6 +61,13 @@ + return *this << buf; + } + ++OutputCharStream &OutputCharStream::operator<<(unsigned long long n) ++{ ++ char buf[sizeof(unsigned long long)*3 + 1]; ++ sprintf(buf, "%I64u", n); ++ return *this << buf; ++} ++ + OutputCharStream &OutputCharStream::operator<<(int n) + { + char buf[sizeof(int)*3 + 2]; +diff -Nru -x '*~' OpenSP-1.5.2.orig/lib/SGMLApplication.cxx OpenSP-1.5.2/lib/SGMLApplication.cxx +--- OpenSP-1.5.2.orig/lib/SGMLApplication.cxx 2005-07-21 17:05:18.000000000 +0300 ++++ OpenSP-1.5.2/lib/SGMLApplication.cxx 2014-08-24 17:23:19.972745700 +0300 +@@ -9,6 +9,10 @@ + #include "Boolean.h" + #include "SGMLApplication.h" + ++SGMLApplication::SGMLApplication() ++{ ++} ++ + SGMLApplication::~SGMLApplication() + { + } diff --git a/versions/baseline.json b/versions/baseline.json index f334952134f54d..59cb5e6f637d61 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3660,6 +3660,10 @@ "baseline": "2017-01-28-cf2390140", "port-version": 2 }, + "libopensp": { + "baseline": "1.5.2", + "port-version": 0 + }, "libopusenc": { "baseline": "0.2.1", "port-version": 1 diff --git a/versions/l-/libopensp.json b/versions/l-/libopensp.json new file mode 100644 index 00000000000000..168ab8b2513a97 --- /dev/null +++ b/versions/l-/libopensp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "c52391221569480b2e639b0e07a9e809e7711320", + "version": "1.5.2", + "port-version": 0 + } + ] +}