spacepaste

  1.  
  2. From 517565281f22474ef77d8d7dc4a6f9be719c443b Mon Sep 17 00:00:00 2001
  3. From: Christophe Giboudeaux <christophe@krop.fr>
  4. Date: Tue, 27 Nov 2018 23:37:13 +0100
  5. Subject: [PATCH 1/2] Add FindTIRPC.cmake
  6. Taken from https://phabricator.kde.org/D12761
  7. ---
  8. cmake/FindTIRPC.cmake | 60 +++++++++++++++++++++++++++++++++++++++++++
  9. 1 file changed, 60 insertions(+)
  10. create mode 100644 cmake/FindTIRPC.cmake
  11. diff --git a/cmake/FindTIRPC.cmake b/cmake/FindTIRPC.cmake
  12. new file mode 100644
  13. index 00000000..20e78f9f
  14. --- /dev/null
  15. +++ b/cmake/FindTIRPC.cmake
  16. @@ -0,0 +1,60 @@
  17. +# - Try to find TI-RPC
  18. +#
  19. +# The following variables will be available once found :
  20. +#
  21. +# TIRPC_INCLUDE_DIRS - The TI-RPC headers location
  22. +# TIRPC_LIBRARIES - Link these to use TI-RPC
  23. +# TIRPC_VERSION - The TIRPC version
  24. +#
  25. +#=============================================================================
  26. +# Copyright (c) 2017 Christophe Giboudeaux <christophe@krop.fr>
  27. +#
  28. +#
  29. +# Redistribution and use in source and binary forms, with or without
  30. +# modification, are permitted provided that the following conditions
  31. +# are met:
  32. +#
  33. +# 1. Redistributions of source code must retain the copyright
  34. +# notice, this list of conditions and the following disclaimer.
  35. +# 2. Redistributions in binary form must reproduce the copyright
  36. +# notice, this list of conditions and the following disclaimer in the
  37. +# documentation and/or other materials provided with the distribution.
  38. +# 3. The name of the author may not be used to endorse or promote products
  39. +# derived from this software without specific prior written permission.
  40. +#
  41. +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  42. +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  43. +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  44. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  45. +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  46. +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  47. +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  48. +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  49. +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  50. +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  51. +#=============================================================================
  52. +
  53. +find_package(PkgConfig QUIET)
  54. +pkg_check_modules(PC_TIRPC libtirpc)
  55. +
  56. +find_path(TIRPC_INCLUDE_DIRS
  57. + NAMES netconfig.h
  58. + PATH_SUFFIXES tirpc
  59. + HINTS ${PC_TIRPC_INCLUDE_DIRS}
  60. +)
  61. +
  62. +find_library(TIRPC_LIBRARIES
  63. + NAMES tirpc
  64. + HINTS ${PC_TIRPC_LIBRARY_DIRS}
  65. +)
  66. +
  67. +set(TIRPC_VERSION ${PC_TIRPC_VERSION})
  68. +
  69. +include(FindPackageHandleStandardArgs)
  70. +
  71. +find_package_handle_standard_args(TIRPC
  72. + REQUIRED_VARS TIRPC_LIBRARIES TIRPC_INCLUDE_DIRS
  73. + VERSION_VAR TIRPC_VERSION
  74. +)
  75. +
  76. +mark_as_advanced(TIRPC_INCLUDE_DIRS TIRPC_LIBRARIES)
  77. --
  78. 2.19.2
  79. From 95a8cefbf97b67e08e2f8665ff8ae44d54184a43 Mon Sep 17 00:00:00 2001
  80. From: Andreas Sturmlechner <asturm@gentoo.org>
  81. Date: Tue, 27 Nov 2018 23:43:18 +0100
  82. Subject: [PATCH 2/2] Use FindTIRPC and make kio_nfs optional that way
  83. Switch to CheckSymbolExists.
  84. ---
  85. CMakeLists.txt | 9 ++++++---
  86. nfs/CMakeLists.txt | 15 +++++++++------
  87. 2 files changed, 15 insertions(+), 9 deletions(-)
  88. diff --git a/CMakeLists.txt b/CMakeLists.txt
  89. index d78458ed..099a67a1 100644
  90. --- a/CMakeLists.txt
  91. +++ b/CMakeLists.txt
  92. @@ -132,6 +132,11 @@ if(UNIX)
  93. set_package_properties(KF5KHtml PROPERTIES TYPE OPTIONAL
  94. PURPOSE "Needed to build the man kioslave"
  95. )
  96. +
  97. + find_package(TIRPC)
  98. + set_package_properties(TIRPC PROPERTIES TYPE OPTIONAL
  99. + PURPOSE "Needed to build the NFS kioslave"
  100. + )
  101. else()
  102. # FIXME: on windows we ignore support until trash gets integrated
  103. endif()
  104. @@ -174,9 +179,7 @@ if(NOT WIN32)
  105. if(Gperf_FOUND AND KF5KHtml_FOUND)
  106. add_subdirectory( man )
  107. endif()
  108. - check_include_files(rpc/rpc.h HAVE_RPC_RPC_H)
  109. - add_feature_info("NFS kioslave" HAVE_RPC_RPC_H "The RPC library is needed to build the NFS kioslave")
  110. - if(HAVE_RPC_RPC_H)
  111. + if(TIRPC_FOUND)
  112. add_subdirectory( nfs )
  113. endif()
  114. endif()
  115. diff --git a/nfs/CMakeLists.txt b/nfs/CMakeLists.txt
  116. index 3dce1c1e..4d8951fb 100644
  117. --- a/nfs/CMakeLists.txt
  118. +++ b/nfs/CMakeLists.txt
  119. @@ -1,10 +1,12 @@
  120. ## Check for XDR functions
  121. -include(CheckFunctionExists)
  122. +include(CheckSymbolExists)
  123. -CHECK_FUNCTION_EXISTS(xdr_u_int64_t HAVE_XDR_U_INT64_T)
  124. -CHECK_FUNCTION_EXISTS(xdr_uint64_t HAVE_XDR_UINT64_T)
  125. -CHECK_FUNCTION_EXISTS(xdr_u_hyper HAVE_XDR_U_HYPER)
  126. -CHECK_FUNCTION_EXISTS(xdr_u_longlong_t HAVE_XDR_U_LONGLONG_T)
  127. +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${TIRPC_LIBRARIES})
  128. +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${TIRPC_INCLUDE_DIRS})
  129. +check_symbol_exists(xdr_u_int64_t "rpc/xdr.h" HAVE_XDR_U_INT64_T)
  130. +check_symbol_exists(xdr_uint64_t "rpc/xdr.h" HAVE_XDR_UINT64_T)
  131. +check_symbol_exists(xdr_u_hyper "rpc/xdr.h" HAVE_XDR_U_HYPER)
  132. +check_symbol_exists(xdr_u_longlong_t "rpc/xdr.h" HAVE_XDR_U_LONGLONG_T)
  133. if (NOT HAVE_XDR_U_INT64_T AND NOT HAVE_XDR_UINT64_T AND NOT HAVE_XDR_U_HYPER AND NOT HAVE_XDR_U_LONGLONG_T)
  134. message(FATAL_ERROR "Could not find 64-bit XDR datatype functions!")
  135. @@ -24,9 +26,10 @@ if (HAVE_XDR_U_LONGLONG_T)
  136. endif (HAVE_XDR_U_LONGLONG_T)
  137. add_definitions(-DTRANSLATION_DOMAIN=\"kio5_nfs\")
  138. +include_directories(${TIRPC_INCLUDE_DIRS})
  139. add_library(kio_nfs MODULE kio_nfs.cpp nfsv2.cpp nfsv3.cpp rpc_nfs3_prot_xdr.c rpc_nfs2_prot_xdr.c)
  140. -target_link_libraries(kio_nfs KF5::KIOCore KF5::I18n Qt5::Network)
  141. +target_link_libraries(kio_nfs KF5::KIOCore KF5::I18n Qt5::Network ${TIRPC_LIBRARIES})
  142. set_target_properties(kio_nfs PROPERTIES OUTPUT_NAME "nfs")
  143. install(TARGETS kio_nfs DESTINATION ${PLUGIN_INSTALL_DIR}/kf5/kio)
  144. --
  145. 2.19.2
  146.