From e9267ac7c40d990c8368861189031bcd5eb77189 Mon Sep 17 00:00:00 2001 From: Yuval Gross <52262536+yuvalg-MSFT@users.noreply.github.com> Date: Tue, 3 Dec 2019 11:18:49 -0800 Subject: [PATCH] [proxywrapper] Add new port (#8916) * adding proxywrapper package * resolving review comments * restrict Linux only * [proxywrapper] Only static library * [libmodman] Move building of tests to a non-default feature * [libproxy] Move tests to a non-default feature * [libproxy] Add features for language bindings * [proxywrapper] Require C++ 11 standard --- ports/libmodman/CONTROL | 8 ++++++-- ports/libmodman/portfile.cmake | 7 ++++++- ports/libproxy/CONTROL | 22 +++++++++++++++++++-- ports/libproxy/fix-module-lib-name.patch | 13 ++++++++++++ ports/libproxy/portfile.cmake | 11 +++++++++-- ports/proxywrapper/CONTROL | 5 +++++ ports/proxywrapper/fix-find-libproxy.patch | 20 +++++++++++++++++++ ports/proxywrapper/fix-macos-build.patch | 15 ++++++++++++++ ports/proxywrapper/portfile.cmake | 23 ++++++++++++++++++++++ 9 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 ports/libproxy/fix-module-lib-name.patch create mode 100644 ports/proxywrapper/CONTROL create mode 100644 ports/proxywrapper/fix-find-libproxy.patch create mode 100644 ports/proxywrapper/fix-macos-build.patch create mode 100644 ports/proxywrapper/portfile.cmake diff --git a/ports/libmodman/CONTROL b/ports/libmodman/CONTROL index 70cb9d8116..c1fd4cd49c 100644 --- a/ports/libmodman/CONTROL +++ b/ports/libmodman/CONTROL @@ -1,4 +1,8 @@ Source: libmodman -Version: 2.0.1 +Version: 2.0.1-1 Homepage: https://code.google.com/p/libmodman -Description: a simple library for managing modules \ No newline at end of file +Description: a simple library for managing modules + +Feature: tests +Description: Build libmodman tests +Build-Depends: zlib diff --git a/ports/libmodman/portfile.cmake b/ports/libmodman/portfile.cmake index b2f32cb0cb..35bedf9079 100644 --- a/ports/libmodman/portfile.cmake +++ b/ports/libmodman/portfile.cmake @@ -2,7 +2,7 @@ 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") + vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) endif() set(LIBMODMAN_VER 2.0.1) @@ -13,6 +13,10 @@ vcpkg_download_distfile(ARCHIVE SHA512 1fecc0fa3637c4aa86d114f5bc991605172d39183fa0f39d8c7858ef5d0d894152025bd426de4dd017a41372d800bf73f53b2328c57b77352a508e12792729fa ) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + tests BUILD_TESTING +) + vcpkg_extract_source_archive_ex( ARCHIVE ${ARCHIVE} OUT_SOURCE_PATH SOURCE_PATH @@ -24,6 +28,7 @@ vcpkg_extract_source_archive_ex( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + OPTIONS ${FEATURE_OPTIONS} ) vcpkg_install_cmake() diff --git a/ports/libproxy/CONTROL b/ports/libproxy/CONTROL index 395f19ecde..051420c855 100644 --- a/ports/libproxy/CONTROL +++ b/ports/libproxy/CONTROL @@ -1,8 +1,26 @@ Source: libproxy -Version: 0.4.15 +Version: 0.4.15-1 Homepage: https://github.com/libproxy/libproxy Description: libproxy is a library that provides automatic proxy configuration management. Build-Depends: libmodman +Feature: bindings-csharp +Description: Install C# bindings + +Feature: bindings-python +Description: Install Python bindings + +Feature: bindings-perl +Description: Install PERL bindings + +Feature: bindings-ruby +Description: Install Ruby bindings + +Feature: bindings-vala +Description: Install Vala bindings + Feature: tools -Description: build tools \ No newline at end of file +Description: build tools + +Feature: tests +Description: Build libproxy tests diff --git a/ports/libproxy/fix-module-lib-name.patch b/ports/libproxy/fix-module-lib-name.patch new file mode 100644 index 0000000000..a4d8cb29b5 --- /dev/null +++ b/ports/libproxy/fix-module-lib-name.patch @@ -0,0 +1,13 @@ +diff --git a/libproxy/Findlibproxy.cmake.in b/libproxy/Findlibproxy.cmake.in +index ef44489..c0bd2ae 100644 +--- a/libproxy/Findlibproxy.cmake.in ++++ b/libproxy/Findlibproxy.cmake.in +@@ -12,7 +12,7 @@ + + # Find proxy.h and the corresponding library (libproxy.so) + FIND_PATH(LIBPROXY_INCLUDE_DIR proxy.h ) +-FIND_LIBRARY(LIBPROXY_LIBRARIES NAMES proxy ) ++FIND_LIBRARY(LIBPROXY_LIBRARIES NAMES proxy libproxy) + + # Set library version + SET(LIBPROXY_VERSION @PROJECT_VERSION@) diff --git a/ports/libproxy/portfile.cmake b/ports/libproxy/portfile.cmake index 0c872a6cd6..214e946753 100644 --- a/ports/libproxy/portfile.cmake +++ b/ports/libproxy/portfile.cmake @@ -2,7 +2,7 @@ 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") + vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) endif() vcpkg_from_github( @@ -17,10 +17,17 @@ vcpkg_from_github( fix-dependency-libmodman.patch fix-install-py.patch fix-arm-build.patch + fix-module-lib-name.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - tools BUILD_TOOLS + bindings-csharp WITH_DOTNET + bindings-python WITH_PYTHON2 + bindings-python WITH_PYTHON3 + bindings-perl WITH_PERL + bindings-vala WITH_VALA + tools BUILD_TOOLS + tests BUILD_TESTING ) vcpkg_configure_cmake( diff --git a/ports/proxywrapper/CONTROL b/ports/proxywrapper/CONTROL new file mode 100644 index 0000000000..c982b2c5b7 --- /dev/null +++ b/ports/proxywrapper/CONTROL @@ -0,0 +1,5 @@ +Source: proxywrapper +Version: 1.0.0 +Description: Provides a standalone wrapper around the libproxy library. +Homepage: https://github.com/microsoft/proxy-wrapper +Build-Depends: libproxy diff --git a/ports/proxywrapper/fix-find-libproxy.patch b/ports/proxywrapper/fix-find-libproxy.patch new file mode 100644 index 0000000000..aeb45b98de --- /dev/null +++ b/ports/proxywrapper/fix-find-libproxy.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5a867a4..3ba85fa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,11 +5,12 @@ project(proxywrapper) + + include(GNUInstallDirs) + +-find_library(proxy REQUIRED) ++find_package(libproxy REQUIRED) + +-add_library(proxywrapper SHARED ProxyWrapper.cpp) ++add_library(proxywrapper ProxyWrapper.cpp) + +-target_link_libraries(proxywrapper proxy) ++target_link_libraries(proxywrapper PRIVATE ${LIBPROXY_LIBRARIES}) ++target_include_directories(proxywrapper PRIVATE ${LIBPROXY_INCLUDE_DIR}) + + install(TARGETS proxywrapper EXPORT proxywrapper DESTINATION ${CMAKE_INSTALL_LIBDIR}) + diff --git a/ports/proxywrapper/fix-macos-build.patch b/ports/proxywrapper/fix-macos-build.patch new file mode 100644 index 0000000000..8bdaeac567 --- /dev/null +++ b/ports/proxywrapper/fix-macos-build.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3ba85fa..f18fd1e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,9 @@ + + cmake_minimum_required(VERSION 3.8) + +-project(proxywrapper) ++project(proxywrapper C CXX) ++ ++set(CMAKE_CXX_STANDARD 11) + + include(GNUInstallDirs) + diff --git a/ports/proxywrapper/portfile.cmake b/ports/proxywrapper/portfile.cmake new file mode 100644 index 0000000000..048a9f995d --- /dev/null +++ b/ports/proxywrapper/portfile.cmake @@ -0,0 +1,23 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO microsoft/proxy-wrapper + REF b113aa0a284508ce0c2878febf9073d1f03b59dc + SHA512 9793ec8b9cc0467c88d850ea51a96a0fdc3c3027cc5b7fd9f5d0362d7fd559e909f19a4eaca6554a9316d6e3a86bb5f541034ca9ce2fb8797fb2e5bdff42b0de + HEAD_REF master + PATCHES + fix-find-libproxy.patch + fix-macos-build.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +