summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrakuco <rakuco@FreeBSD.org>2017-03-27 10:49:43 +0000
committerrakuco <rakuco@FreeBSD.org>2017-03-27 10:49:43 +0000
commit96cde9b83aa68e017ff590e3b87b1bb11a4e6292 (patch)
treefa68fefe0465b875f37f73bbe1097bbda6b88665
parentc3d2b8393e8d54b5a0e89818e0437ea26f5e621d (diff)
downloadFreeBSD-ports-96cde9b83aa68e017ff590e3b87b1bb11a4e6292.zip
FreeBSD-ports-96cde9b83aa68e017ff590e3b87b1bb11a4e6292.tar.gz
Ressurrect patch-cmake_modules_PythonMacros.cmake.
It was deleted in the kdelibs4 update from r436971, but it contained some FreeBSD-specific code to build and install .pyo files. This should unbreak Python-based ports that use kdelibs4, such as devel/py-pykde.
-rw-r--r--x11/kdelibs4/Makefile1
-rw-r--r--x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake47
2 files changed, 48 insertions, 0 deletions
diff --git a/x11/kdelibs4/Makefile b/x11/kdelibs4/Makefile
index 4556f7d..3f09ce2 100644
--- a/x11/kdelibs4/Makefile
+++ b/x11/kdelibs4/Makefile
@@ -3,6 +3,7 @@
PORTNAME= kdelibs
PORTVERSION= ${KDE4_KDELIBS_VERSION}
+PORTREVISION= 1
CATEGORIES= x11 kde kde-applications
MAINTAINER= kde@FreeBSD.org
diff --git a/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake b/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake
new file mode 100644
index 0000000..af1f52f
--- /dev/null
+++ b/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake
@@ -0,0 +1,47 @@
+The pyo-related changes are (at least for now) FreeBSD-specific and are present
+in order to install .pyo files in addition to .pyc files when installing Python
+modules.
+--- cmake/modules/PythonMacros.cmake
++++ cmake/modules/PythonMacros.cmake
+@@ -41,16 +41,18 @@ macro(PYTHON_INSTALL SOURCE_FILE DESTINATION_DIR)
+ if(PYTHON_VERSION_STRING VERSION_GREATER 3.1)
+ # To get the right version for suffix
+ set(_bin_pyc "${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/__pycache__/${_filenamebase}.cpython-${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.pyc")
++ set(_bin_pyo "${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/__pycache__/${_filenamebase}.cpython-${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.pyo")
+ set(_py_install_dir "${DESTINATION_DIR}/__pycache__/")
+ else()
+ set(_bin_pyc "${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc")
++ set(_bin_pyo "${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyo")
+ set(_py_install_dir "${DESTINATION_DIR}")
+ endif()
+
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath})
+
+ # Setting because it will be displayed later, in compile_python_files
+- set(_message "Byte-compiling ${_bin_py} to ${_bin_pyc}")
++ set(_message "Byte-compiling ${_bin_py} to ${_bin_pyc} and ${_bin_pyo}")
+
+ string(REPLACE "/" "_" _rule_name "${_basepath}/${_bin_pyc}")
+ add_custom_target("${_rule_name}" ALL)
+@@ -61,6 +63,7 @@ macro(PYTHON_INSTALL SOURCE_FILE DESTINATION_DIR)
+ TARGET "${_rule_name}"
+ COMMAND "${CMAKE_COMMAND}" -E echo "${_message}"
+ COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
++ COMMAND "${PYTHON_EXECUTABLE}" -O "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
+ DEPENDS "${_absfilename}"
+ )
+ else()
+@@ -69,11 +72,12 @@ macro(PYTHON_INSTALL SOURCE_FILE DESTINATION_DIR)
+ COMMAND "${CMAKE_COMMAND}" -E echo "${_message}"
+ COMMAND "${CMAKE_COMMAND}" -E copy "${_absfilename}" "${_bin_py}"
+ COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
++ COMMAND "${PYTHON_EXECUTABLE}" -O "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
+ DEPENDS "${_absfilename}"
+ )
+ endif()
+
+- install(FILES ${_bin_pyc} DESTINATION "${_py_install_dir}")
++ install(FILES ${_bin_pyc} ${_bin_pyo} DESTINATION "${_py_install_dir}")
+ unset(_py_install_dir)
+ unset(_message)
+
OpenPOWER on IntegriCloud