summaryrefslogblamecommitdiff
path: root/user/weechat/python.patch
blob: a6e194719545b458f5e30d6031704f3500fa0d3d (plain) (tree)




















































































                                                                                                                                                                      
--- weechat-2.5/cmake/FindPython.cmake	2019-06-06 18:43:20.000000000 +0000
+++ weechat-2.5/cmake/FindPython.cmake	2019-06-24 12:22:10.659972390 +0000
@@ -25,7 +25,6 @@
 #
 #  PYTHON_EXECUTABLE   = full path to the python binary
 #  PYTHON_INCLUDE_PATH = path to where python.h can be found
-#  PYTHON_LIBRARY = path to where libpython.so* can be found
 #  PYTHON_LFLAGS = python compiler options for linking
 
 if(PYTHON_FOUND)
@@ -38,11 +37,19 @@
     NAMES python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python3 python2.7 python2.6 python2.5 python
     PATHS /usr/bin /usr/local/bin /usr/pkg/bin
     )
+  find_program(PYTHON_CONFIG
+    NAMES python3-config
+    PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+    )
 else()
   find_program(PYTHON_EXECUTABLE
     NAMES python2.7 python2.6 python2.5 python
     PATHS /usr/bin /usr/local/bin /usr/pkg/bin
     )
+  find_program(PYTHON_CONFIG
+    NAMES python-config
+    PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+    )
 endif()
 
 if(PYTHON_EXECUTABLE)
@@ -52,32 +59,17 @@
     )
 
   execute_process(
-    COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import *; sys.stdout.write(get_config_var('LIBPL'))"
-    OUTPUT_VARIABLE PYTHON_POSSIBLE_LIB_PATH
-    )
-
-  execute_process(
-    COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import *; sys.stdout.write(get_config_var('LIBS') + ' ' + get_config_var('LINKFORSHARED'))"
+    COMMAND ${PYTHON_CONFIG} --libs
     OUTPUT_VARIABLE PYTHON_LFLAGS
+    OUTPUT_STRIP_TRAILING_WHITESPACE
     )
 
   find_path(PYTHON_INCLUDE_PATH
     NAMES Python.h
     HINTS ${PYTHON_INC_DIR}
     )
-  if(ENABLE_PYTHON3)
-    find_library(PYTHON_LIBRARY
-      NAMES python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python3 python2.7 python2.6 python2.5 python
-      HINTS ${PYTHON_POSSIBLE_LIB_PATH}
-      )
-  else()
-    find_library(PYTHON_LIBRARY
-      NAMES python2.7 python2.6 python2.5 python
-      HINTS ${PYTHON_POSSIBLE_LIB_PATH}
-      )
-  endif()
 
-  if(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+  if(PYTHON_LFLAGS AND PYTHON_INCLUDE_PATH)
     execute_process(
       COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.version[:3])"
       OUTPUT_VARIABLE PYTHON_VERSION
@@ -96,7 +88,6 @@
   mark_as_advanced(
     PYTHON_EXECUTABLE
     PYTHON_INCLUDE_PATH
-    PYTHON_LIBRARY
     PYTHON_LFLAGS
     )
 
--- weechat-2.5/src/plugins/python/CMakeLists.txt	2019-06-06 18:43:20.000000000 +0000
+++ weechat-2.5/src/plugins/python/CMakeLists.txt	2019-06-24 12:22:16.259972363 +0000
@@ -24,8 +24,7 @@
 
 if(PYTHON_FOUND)
   include_directories(${PYTHON_INCLUDE_PATH})
-  set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PYTHON_LFLAGS}")
-  target_link_libraries(python ${PYTHON_LIBRARY} weechat_plugins_scripts coverage_config)
+  target_link_libraries(python ${PYTHON_LFLAGS} weechat_plugins_scripts coverage_config)
 endif()
 
 install(TARGETS python LIBRARY DESTINATION ${WEECHAT_LIBDIR}/plugins)