Skip to content

Commit

Permalink
[proxywrapper] Add new port (microsoft#8916)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
yuvalg-MSFT authored and vicroms committed Dec 3, 2019
1 parent 227d055 commit e9267ac
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 7 deletions.
8 changes: 6 additions & 2 deletions ports/libmodman/CONTROL
Original file line number Diff line number Diff line change
@@ -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
Description: a simple library for managing modules

Feature: tests
Description: Build libmodman tests
Build-Depends: zlib
7 changes: 6 additions & 1 deletion ports/libmodman/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -24,6 +28,7 @@ vcpkg_extract_source_archive_ex(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
)

vcpkg_install_cmake()
Expand Down
22 changes: 20 additions & 2 deletions ports/libproxy/CONTROL
Original file line number Diff line number Diff line change
@@ -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
Description: build tools

Feature: tests
Description: Build libproxy tests
13 changes: 13 additions & 0 deletions ports/libproxy/fix-module-lib-name.patch
Original file line number Diff line number Diff line change
@@ -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@)
11 changes: 9 additions & 2 deletions ports/libproxy/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions ports/proxywrapper/CONTROL
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions ports/proxywrapper/fix-find-libproxy.patch
Original file line number Diff line number Diff line change
@@ -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})

15 changes: 15 additions & 0 deletions ports/proxywrapper/fix-macos-build.patch
Original file line number Diff line number Diff line change
@@ -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)

23 changes: 23 additions & 0 deletions ports/proxywrapper/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e9267ac

Please sign in to comment.