From c2f495399001aa95185ccedac04b90a7103e20d0 Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Fri, 24 Aug 2018 22:43:41 +0200 Subject: [PATCH] [new port] wangle init (#4133) * wangle init * [wangle] Simplification * [wangle] Fix finding gflags --- ports/wangle/CONTROL | 4 +++ ports/wangle/build.patch | 54 +++++++++++++++++++++++++++++++++++++ ports/wangle/gflags.patch | 31 +++++++++++++++++++++ ports/wangle/portfile.cmake | 35 ++++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 ports/wangle/CONTROL create mode 100644 ports/wangle/build.patch create mode 100644 ports/wangle/gflags.patch create mode 100644 ports/wangle/portfile.cmake diff --git a/ports/wangle/CONTROL b/ports/wangle/CONTROL new file mode 100644 index 0000000000..9397b3d61f --- /dev/null +++ b/ports/wangle/CONTROL @@ -0,0 +1,4 @@ +Source: wangle +Version: v2018.07.30.00-1 +Build-Depends: folly, openssl, gtest, glog, libevent, double-conversion +Description: Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way. \ No newline at end of file diff --git a/ports/wangle/build.patch b/ports/wangle/build.patch new file mode 100644 index 0000000000..fce998fedd --- /dev/null +++ b/ports/wangle/build.patch @@ -0,0 +1,54 @@ +diff --git a/wangle/CMakeLists.txt b/wangle/CMakeLists.txt +index 0302249..3bf1e6c 100644 +--- a/wangle/CMakeLists.txt ++++ b/wangle/CMakeLists.txt +@@ -38,9 +38,9 @@ endif() + + find_package(Boost REQUIRED COMPONENTS system thread filesystem regex context) + find_package(OpenSSL REQUIRED) +-find_package(Glog REQUIRED) +-find_package(Gflags REQUIRED) +-find_package(Libevent REQUIRED) ++find_package(Glog CONFIG REQUIRED) ++find_package(Gflags CONFIG REQUIRED) ++find_package(Libevent CONFIG REQUIRED) + find_package(DoubleConversion REQUIRED) + find_package(Threads REQUIRED) + if (UNIX AND NOT APPLE) +@@ -116,11 +116,9 @@ if (BUILD_SHARED_LIBS) + PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1) + endif() + +-target_include_directories( +- wangle +- PUBLIC +- $ +- $ ++include_directories( ++ "${CMAKE_SOURCE_DIR}/.." ++ ${INCLUDE_INSTALL_DIR} + ${FOLLY_INCLUDE_DIR} + ${Boost_INCLUDE_DIR} + ${OPENSSL_INCLUDE_DIR} +@@ -143,15 +141,19 @@ target_link_libraries(wangle PUBLIC + install( + TARGETS wangle + EXPORT wangle-exports +- DESTINATION ${LIB_INSTALL_DIR} ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib + ) + # We unfortunately cannot install wangle's headers with the install() + # statement above. install(TARGETS) appears to only support installing + # PUBLIC_HEADER in a flat include directory, and not a deeper tree. ++if(NOT DISABLE_INSTALL_HEADERS) + foreach(dir ${WANGLE_HEADER_DIRS}) +- install(DIRECTORY ${dir} DESTINATION "${INCLUDE_INSTALL_DIR}/wangle" ++ install(DIRECTORY ${dir} DESTINATION "include/wangle" + FILES_MATCHING PATTERN "*.h") + endforeach() ++endif() + + # Install CMake package configuration files for wangle + include(CMakePackageConfigHelpers) diff --git a/ports/wangle/gflags.patch b/ports/wangle/gflags.patch new file mode 100644 index 0000000000..20921c72ca --- /dev/null +++ b/ports/wangle/gflags.patch @@ -0,0 +1,31 @@ +diff --git a/wangle/cmake/FindGflags.cmake b/wangle/cmake/FindGflags.cmake +index 0243aa3..be3780f 100644 +--- a/wangle/cmake/FindGflags.cmake ++++ b/wangle/cmake/FindGflags.cmake +@@ -7,19 +7,11 @@ + + include(FindPackageHandleStandardArgs) + +-find_library(GFLAGS_LIBRARY gflags +- PATHS ${GFLAGS_LIBRARYDIR}) ++find_package(gflags CONFIG REQUIRED) + +-find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h +- PATHS ${GFLAGS_INCLUDEDIR}) +- +-find_package_handle_standard_args(gflags DEFAULT_MSG +- GFLAGS_LIBRARY +- GFLAGS_INCLUDE_DIR) +- +-mark_as_advanced( +- GFLAGS_LIBRARY +- GFLAGS_INCLUDE_DIR) +- +-set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY}) +-set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR}) ++if(TARGET gflags_static) ++ set(GFLAGS_LIBRARIES gflags_static) ++else() ++ set(GFLAGS_LIBRARIES gflags_shared) ++endif() ++set(GFLAGS_INCLUDE_DIRS) diff --git a/ports/wangle/portfile.cmake b/ports/wangle/portfile.cmake new file mode 100644 index 0000000000..8bd8e8c63c --- /dev/null +++ b/ports/wangle/portfile.cmake @@ -0,0 +1,35 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO facebook/wangle + REF v2018.07.30.00 + SHA512 f83378a8751b47fac2c862e07ffeb2750fd681735e66d778657d7624fe3e839b2e2bfcb049ecd3a3516c206d93f9c168144599ded823720967e44037b536ba5d + HEAD_REF master + PATCHES + build.patch + gflags.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH "${SOURCE_PATH}/wangle" + PREFER_NINJA + OPTIONS + -DBUILD_TESTS=OFF + OPTIONS_DEBUG + -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/wangle") +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/include/wangle/util/test + ${CURRENT_PACKAGES_DIR}/include/wangle/ssl/test/certs + ${CURRENT_PACKAGES_DIR}/include/wangle/service/test + ${CURRENT_PACKAGES_DIR}/include/wangle/deprecated/rx/test +) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/wangle RENAME copyright)