diff --git a/ports/libmodman/CONTROL b/ports/libmodman/CONTROL new file mode 100644 index 00000000000..70cb9d81164 --- /dev/null +++ b/ports/libmodman/CONTROL @@ -0,0 +1,4 @@ +Source: libmodman +Version: 2.0.1 +Homepage: https://code.google.com/p/libmodman +Description: a simple library for managing modules \ No newline at end of file diff --git a/ports/libmodman/fix-install-path.patch b/ports/libmodman/fix-install-path.patch new file mode 100644 index 00000000000..066813b4089 --- /dev/null +++ b/ports/libmodman/fix-install-path.patch @@ -0,0 +1,39 @@ +diff --git a/libmodman/CMakeLists.txt b/libmodman/CMakeLists.txt +index 0aff593..9e419ce 100644 +--- a/libmodman/CMakeLists.txt ++++ b/libmodman/CMakeLists.txt +@@ -30,15 +30,15 @@ if(NOT WIN32 AND NOT APPLE) + configure_file(libmodman-2.0.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libmodman-2.0.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmodman-2.0.pc +- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) ++ DESTINATION lib/pkgconfig) + endif() + + # CMake Find helper +-if (NOT WIN32 AND NOT APPLE) ++if (1) + configure_file(Findlibmodman.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Findlibmodman.cmake @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Findlibmodman.cmake +- DESTINATION ${SHARE_INSTALL_DIR}/cmake/Modules) ++ DESTINATION share/${PROJECT_NAME}) + endif() + + # Define the library itself +@@ -50,8 +50,13 @@ if(NOT WIN32) + target_link_libraries(modman dl) + endif() + set_target_properties(modman PROPERTIES PREFIX "lib" VERSION 1.0.0 SOVERSION 1) +-install(TARGETS modman DESTINATION ${LIB_INSTALL_DIR}) +-install(FILES module_manager.hpp module.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) ++install( ++ TARGETS modman ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++install(FILES module_manager.hpp module.hpp DESTINATION include/${PROJECT_NAME}) + + ### Tests + add_testdirectory(test) diff --git a/ports/libmodman/fix-undefined-typeid.patch b/ports/libmodman/fix-undefined-typeid.patch new file mode 100644 index 00000000000..93db675875b --- /dev/null +++ b/ports/libmodman/fix-undefined-typeid.patch @@ -0,0 +1,12 @@ +diff --git a/libmodman/test/main.hpp b/libmodman/test/main.hpp +index 90ca87f..f4f8844 100644 +--- a/libmodman/test/main.hpp ++++ b/libmodman/test/main.hpp +@@ -20,6 +20,7 @@ + #ifndef MAIN_HPP_ + #define MAIN_HPP_ + ++#include + #include "../module_manager.hpp" + + using namespace std; diff --git a/ports/libmodman/portfile.cmake b/ports/libmodman/portfile.cmake new file mode 100644 index 00000000000..b2f32cb0cba --- /dev/null +++ b/ports/libmodman/portfile.cmake @@ -0,0 +1,38 @@ +vcpkg_fail_port_install(ON_TARGET "UWP") + +# Enable static build in UNIX +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_fail_port_install(ON_LIBRARY_LINKAGE "static") +endif() + +set(LIBMODMAN_VER 2.0.1) + +vcpkg_download_distfile(ARCHIVE + URLS "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libmodman/libmodman-${LIBMODMAN_VER}.zip" + FILENAME "libmodman-${LIBMODMAN_VER}.zip" + SHA512 1fecc0fa3637c4aa86d114f5bc991605172d39183fa0f39d8c7858ef5d0d894152025bd426de4dd017a41372d800bf73f53b2328c57b77352a508e12792729fa +) + +vcpkg_extract_source_archive_ex( + ARCHIVE ${ARCHIVE} + OUT_SOURCE_PATH SOURCE_PATH + PATCHES + fix-install-path.patch + fix-undefined-typeid.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH share/libmodman) +vcpkg_copy_pdbs() + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake + ${CMAKE_CURRENT_LIST_DIR}/usage + DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/libmodman/usage b/ports/libmodman/usage new file mode 100644 index 00000000000..220de42e063 --- /dev/null +++ b/ports/libmodman/usage @@ -0,0 +1,5 @@ +The package libmodman provides CMake targets: + + find_package(libmodman CONFIG REQUIRED) + target_include_directories(main PRIVATE ${LIBMODMAN_INCLUDE_DIR}) + target_link_libraries(main PRIVATE ${LIBMODMAN_LIBRARIES}) diff --git a/ports/libmodman/vcpkg-cmake-wrapper.cmake b/ports/libmodman/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..6d67806f51b --- /dev/null +++ b/ports/libmodman/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,8 @@ +set(LIBMODMAN_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +if(NOT LIBMODMAN_LIBRARIES) + _find_package(${ARGS}) +endif() + +set(CMAKE_MODULE_PATH ${LIBMODMAN_PREV_MODULE_PATH}) diff --git a/ports/libproxy/CONTROL b/ports/libproxy/CONTROL new file mode 100644 index 00000000000..395f19ecde9 --- /dev/null +++ b/ports/libproxy/CONTROL @@ -0,0 +1,8 @@ +Source: libproxy +Version: 0.4.15 +Homepage: https://github.com/libproxy/libproxy +Description: libproxy is a library that provides automatic proxy configuration management. +Build-Depends: libmodman + +Feature: tools +Description: build tools \ No newline at end of file diff --git a/ports/libproxy/fix-arm-build.patch b/ports/libproxy/fix-arm-build.patch new file mode 100644 index 00000000000..ad898c83556 --- /dev/null +++ b/ports/libproxy/fix-arm-build.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 51b0e5e..aa94b87 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,6 +51,10 @@ else() + endif() + endif() + ++if (WIN32) ++ link_libraries(Advapi32) ++endif() ++ + # Conditionally build bindings + if(NOT WIN32) + add_subdirectory(bindings) diff --git a/ports/libproxy/fix-dependency-libmodman.patch b/ports/libproxy/fix-dependency-libmodman.patch new file mode 100644 index 00000000000..c84b86d01b4 --- /dev/null +++ b/ports/libproxy/fix-dependency-libmodman.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 451e7a6..b6782fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,13 +32,15 @@ option(WITH_WEBKIT3 "Build against gtk-3 version of webkitgtk" OFF) + ### Subdirectories + # Conditionally build bundled libmodman + option(FORCE_SYSTEM_LIBMODMAN "Force using system libmodman" OFF) +-find_package(libmodman QUIET) ++find_package(libmodman REQUIRED) + if(LIBMODMAN_FOUND) + if("${LIBMODMAN_VERSION_MAJOR}" STREQUAL "2") + message(STATUS "Building with system libmodman") + else() + message(FATAL_ERROR "Found incompatible libmodman on your system (libmodman 2.X is needed)") + endif() ++ include_directories(${LIBMODMAN_INCLUDE_DIR}) ++ link_libraries(${LIBMODMAN_LIBRARIES}) + else() + if(FORCE_SYSTEM_LIBMODMAN) + message(FATAL_ERROR "Libmodman could not be found on your system") diff --git a/ports/libproxy/fix-install-py.patch b/ports/libproxy/fix-install-py.patch new file mode 100644 index 00000000000..c429be74b0f --- /dev/null +++ b/ports/libproxy/fix-install-py.patch @@ -0,0 +1,36 @@ +diff --git a/bindings/python/python3/CMakeLists.txt b/bindings/python/python3/CMakeLists.txt +index bf87dfc..9f94c2d 100644 +--- a/bindings/python/python3/CMakeLists.txt ++++ b/bindings/python/python3/CMakeLists.txt +@@ -21,5 +21,4 @@ if(PYTHON3INTERP_FOUND) + + message(STATUS "Using PYTHON3_SITEPKG_DIR=${PYTHON3_SITEPKG_DIR}") + +- install(FILES ../libproxy.py DESTINATION ${PYTHON3_SITEPKG_DIR}) + endif() +diff --git a/bindings/python/python2/CMakeLists.txt b/bindings/python/python2/CMakeLists.txt +index 00df551..15d78f9 100644 +--- a/bindings/python/python2/CMakeLists.txt ++++ b/bindings/python/python2/CMakeLists.txt +@@ -21,5 +21,4 @@ if(PYTHON2INTERP_FOUND) + + message(STATUS "Using PYTHON2_SITEPKG_DIR=${PYTHON2_SITEPKG_DIR}") + +- install(FILES ../libproxy.py DESTINATION ${PYTHON2_SITEPKG_DIR}) + endif() +diff --git a/bindings/perl/lib/CMakeLists.txt b/bindings/perl/lib/CMakeLists.txt +index 9856627..f54c138 100644 +--- a/bindings/perl/lib/CMakeLists.txt ++++ b/bindings/perl/lib/CMakeLists.txt +@@ -1,2 +1 @@ + add_custom_target(PMlibproxy ALL ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Libproxy.pm ${CMAKE_BINARY_DIR}/perl/blib/lib/Libproxy.pm) +-install( FILES Libproxy.pm DESTINATION ${PX_PERL_ARCH}/Net ) +diff --git a/bindings/perl/src/CMakeLists.txt b/bindings/perl/src/CMakeLists.txt +index 05176c4..9ca532f 100644 +--- a/bindings/perl/src/CMakeLists.txt ++++ b/bindings/perl/src/CMakeLists.txt +@@ -21,4 +21,3 @@ target_link_libraries(PLlibproxy ${PLlibproxy_LIB_DEPENDENCIES}) + set_target_properties(PLlibproxy PROPERTIES OUTPUT_NAME "Libproxy") + set_target_properties(PLlibproxy PROPERTIES PREFIX "") + +-install( TARGETS PLlibproxy DESTINATION ${PX_PERL_ARCH}/auto/Net/Libproxy ) diff --git a/ports/libproxy/fix-tools-path.patch b/ports/libproxy/fix-tools-path.patch new file mode 100644 index 00000000000..ba506117077 --- /dev/null +++ b/ports/libproxy/fix-tools-path.patch @@ -0,0 +1,27 @@ +diff --git a/libproxy/cmake/pxmodule.cmk b/libproxy/cmake/pxmodule.cmk +index bbbd989..956948a 100644 +--- a/libproxy/cmake/pxmodule.cmk ++++ b/libproxy/cmake/pxmodule.cmk +@@ -20,7 +20,7 @@ function(px_module name build builtin) + add_library(${name} MODULE modules/${name}.cpp) + target_link_libraries(${name} libproxy) + set_target_properties(${name} PROPERTIES PREFIX "") +- install(TARGETS ${name} LIBRARY DESTINATION ${MODULE_INSTALL_DIR}) ++ install(TARGETS ${name} LIBRARY DESTINATION tools) + if(${ARGC} GREATER 3) + target_link_libraries(${name} ${ARGN}) + endif() +diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt +index 52010c6..0a3f4b5 100644 +--- a/utils/CMakeLists.txt ++++ b/utils/CMakeLists.txt +@@ -1,5 +1,7 @@ + include_directories("../libproxy") + ++if (BUILD_TOOLS) + add_executable(proxy proxy.c) + target_link_libraries(proxy libproxy) +-install(TARGETS proxy RUNTIME DESTINATION ${BIN_INSTALL_DIR}) ++install(TARGETS proxy RUNTIME DESTINATION tools) ++endif() +\ No newline at end of file diff --git a/ports/libproxy/portfile.cmake b/ports/libproxy/portfile.cmake new file mode 100644 index 00000000000..0c872a6cd6a --- /dev/null +++ b/ports/libproxy/portfile.cmake @@ -0,0 +1,43 @@ +vcpkg_fail_port_install(ON_TARGET "UWP") + +# Enable static build in UNIX +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_fail_port_install(ON_LIBRARY_LINKAGE "static") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libproxy/libproxy + REF 5924d4223e2b7238607749d977c0a878fe33cdbc #0.4.15 + SHA512 3c3be46e1ccd7e25a9b6e5fd71bfac5c1075bc9230a9a7ca94ee5e82bdbf090ab08dd53d8c6946db1353024409b234b35822d22f95a02cfb48bb54705b07d478 + HEAD_REF master + PATCHES + fix-tools-path.patch + support-windows.patch + fix-dependency-libmodman.patch + fix-install-py.patch + fix-arm-build.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + tools BUILD_TOOLS +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS ${FEATURE_OPTIONS} + -DWITH_WEBKIT3=OFF + -DFORCE_SYSTEM_LIBMODMAN=ON +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/Modules) +vcpkg_copy_pdbs() + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake + ${CMAKE_CURRENT_LIST_DIR}/usage + DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(REMOVE_RECURSE ${LIBPROXY_TOOLS} ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/libproxy/support-windows.patch b/ports/libproxy/support-windows.patch new file mode 100644 index 00000000000..fdbe801a0b7 --- /dev/null +++ b/ports/libproxy/support-windows.patch @@ -0,0 +1,83 @@ +diff --git a/cmake/paths.cmk b/cmake/paths.cmk +index 593ebc1..bbf8754 100644 +--- a/cmake/paths.cmk ++++ b/cmake/paths.cmk +@@ -1,4 +1,4 @@ +-if(WIN32 AND NOT MINGW) ++if(0) + set(CMAKE_INSTALL_PREFIX "" CACHE PATH "Install prefix") + set(BIN_INSTALL_DIR . CACHE PATH "Binary install dir") + set(LIB_INSTALL_DIR . CACHE PATH "Library install dir") +diff --git a/libproxy/cmake/devfiles.cmk b/libproxy/cmake/devfiles.cmk +index 0301dce..0eb5f83 100644 +--- a/libproxy/cmake/devfiles.cmk ++++ b/libproxy/cmake/devfiles.cmk +@@ -1,4 +1,4 @@ +-if(NOT WIN32 OR MINGW) ++if(1) + # PkgConfig file + set (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) + +diff --git a/libproxy/cmake/libproxy.cmk b/libproxy/cmake/libproxy.cmk +index aab7593..465685f 100644 +--- a/libproxy/cmake/libproxy.cmk ++++ b/libproxy/cmake/libproxy.cmk +@@ -21,5 +21,5 @@ set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/proxy.cpp + set_target_properties(libproxy PROPERTIES PREFIX "" VERSION 1.0.0 SOVERSION 1) + set_target_properties(libproxy PROPERTIES INTERFACE_LINK_LIBRARIES "") + set_target_properties(libproxy PROPERTIES LINK_INTERFACE_LIBRARIES "") +-install(TARGETS libproxy DESTINATION ${LIB_INSTALL_DIR}) ++install(TARGETS libproxy RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(FILES proxy.h DESTINATION ${INCLUDE_INSTALL_DIR}) +diff --git a/libproxy/modules/config_kde.cpp b/libproxy/modules/config_kde.cpp +index b9bd241..73b978e 100644 +--- a/libproxy/modules/config_kde.cpp ++++ b/libproxy/modules/config_kde.cpp +@@ -19,7 +19,9 @@ + ******************************************************************************/ + + #include ++#if !defined(WIN32) + #include ++#endif + + #include + #include +@@ -137,7 +139,11 @@ private: + string command_output(const string &cmdline) throw (runtime_error) { + // Capture stderr as well + const string command = "(" + cmdline + ")2>&1"; ++#if !defined(WIN32) + FILE *pipe = popen(command.c_str(), "r"); ++#else ++ FILE *pipe = _popen(command.c_str(), "r"); ++#endif + if (!pipe) + throw runtime_error("Unable to run command"); + +@@ -148,7 +154,11 @@ private: + result += buffer; // TODO: If this throws bad_alloc, pipe is leaked + } + ++#if !defined(WIN32) + if(pclose(pipe) != 0) ++#else ++ if(_pclose(pipe) != 0) ++#endif + throw runtime_error("Command failed"); + + // Trim newlines and whitespace at end +diff --git a/libproxy/url.cpp b/libproxy/url.cpp +index b61a9bc..021763e 100644 +--- a/libproxy/url.cpp ++++ b/libproxy/url.cpp +@@ -33,7 +33,9 @@ + #include // For atoi() + #include // For stat() + #include // For transform() ++#if !defined(WIN32) + #include // For read() close() ++#endif + + #ifdef WIN32 + #include diff --git a/ports/libproxy/usage b/ports/libproxy/usage new file mode 100644 index 00000000000..a37b13c5ada --- /dev/null +++ b/ports/libproxy/usage @@ -0,0 +1,5 @@ +The package libproxy provides CMake targets: + + find_package(libproxy CONFIG REQUIRED) + target_include_directories(main PRIVATE ${LIBPROXY_INCLUDE_DIR}) + target_link_libraries(main PRIVATE ${LIBPROXY_LIBRARIES}) diff --git a/ports/libproxy/vcpkg-cmake-wrapper.cmake b/ports/libproxy/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..31c99f39f07 --- /dev/null +++ b/ports/libproxy/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,8 @@ +set(LIBPROXY_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +if(NOT LIBPROXY_LIBRARIES) + _find_package(${ARGS}) +endif() + +set(CMAKE_MODULE_PATH ${LIBPROXY_PREV_MODULE_PATH})