Skip to content

Commit

Permalink
Merge pull request conan-io#1729 from yipdw/feature/libuv-1.38.0
Browse files Browse the repository at this point in the history
Add libuv/1.38.0
  • Loading branch information
SSE4 authored May 27, 2020
2 parents e764df8 + 965ebbd commit 3d94e48
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recipes/libuv/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ sources:
"1.34.2":
url: "https://github.com/libuv/libuv/archive/v1.34.2.zip"
sha256: "e1a663bcbfbeb18e447f79a39645ca555db47153d29ed81a1cb289373f357035"
"1.38.0":
url: "https://github.com/libuv/libuv/archive/v1.38.0.zip"
sha256: "6502ee75e1007325ba2e15e06d3d7b94ac911704793b2fe6f7bb933e1748db72"
patches:
"1.34.2":
- base_path: "source_subfolder"
patch_file: "patches/1.34.2/fix-cmake.patch"
"1.38.0":
- base_path: "source_subfolder"
patch_file: "patches/1.38.0/fix-cmake.patch"
3 changes: 3 additions & 0 deletions recipes/libuv/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _source_subfolder_name(self):

def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions["LIBUV_BUILD_TESTS"] = False
cmake.configure()
return cmake

Expand Down Expand Up @@ -63,6 +64,8 @@ def package(self):

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.options.shared:
self.cpp_info.defines = ["USING_UV_SHARED=1"]
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["dl", "pthread", "rt"]
if self.settings.os == "Windows":
Expand Down
78 changes: 78 additions & 0 deletions recipes/libuv/all/patches/1.38.0/fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0496d36a..90615d57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -298,13 +298,17 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
list(APPEND uv_test_libraries util)
endif()

-add_library(uv SHARED ${uv_sources})
-target_compile_definitions(uv
- INTERFACE
- USING_UV_SHARED=1
- PRIVATE
- BUILDING_UV_SHARED=1
- ${uv_defines})
+add_library(uv ${uv_sources})
+get_target_property(target_type uv TYPE)
+if (target_type STREQUAL "SHARED_LIBRARY")
+ target_compile_definitions(uv
+ INTERFACE
+ USING_UV_SHARED=1
+ PRIVATE
+ BUILDING_UV_SHARED=1
+ )
+endif()
+target_compile_definitions(uv PRIVATE ${uv_defines})
target_compile_options(uv PRIVATE ${uv_cflags})
target_include_directories(uv
PUBLIC
@@ -314,17 +318,6 @@ target_include_directories(uv
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
target_link_libraries(uv ${uv_libraries})

-add_library(uv_a STATIC ${uv_sources})
-target_compile_definitions(uv_a PRIVATE ${uv_defines})
-target_compile_options(uv_a PRIVATE ${uv_cflags})
-target_include_directories(uv_a
- PUBLIC
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
- PRIVATE
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
-target_link_libraries(uv_a ${uv_libraries})
-
if(LIBUV_BUILD_TESTS)
# Small hack: use ${uv_test_sources} now to get the runner skeleton,
# before the actual tests are added.
@@ -558,22 +551,20 @@ if(UNIX)
set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(prefix ${CMAKE_INSTALL_PREFIX})
- configure_file(libuv.pc.in libuv.pc @ONLY)

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
- install(FILES ${PROJECT_BINARY_DIR}/libuv.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
- install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses)
+ install(TARGETS uv
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

if(WIN32)
install(DIRECTORY include/ DESTINATION include)
- install(FILES LICENSE DESTINATION .)
- install(TARGETS uv uv_a
- RUNTIME DESTINATION lib/$<CONFIG>
- ARCHIVE DESTINATION lib/$<CONFIG>)
+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses)
+ install(TARGETS uv
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib)
endif()

message(STATUS "summary of build options:
2 changes: 2 additions & 0 deletions recipes/libuv/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.34.2":
folder: all
"1.38.0":
folder: all

0 comments on commit 3d94e48

Please sign in to comment.