| 67 | variant python requires python27 description {Compatibility variant, requires +python27} {} |
| 68 | |
| 69 | variant python27 description "Bindings for python 2.7 plugins" conflicts python34 python35 { |
| 70 | configure.args-replace -DENABLE_PYTHON=OFF -DENABLE_PYTHON=ON |
| 71 | configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 |
| 72 | configure.args-append -DPYTHON_INCLUDE_PATH=${frameworks_dir}/Python.framework/Versions/2.7/Headers |
| 73 | configure.args-append -DPYTHON_LIBRARY=${frameworks_dir}/Python.framework/Versions/2.7/Python |
| 74 | depends_lib-append port:python27 |
| 75 | } |
| 76 | |
| 77 | variant python34 description "Bindings for python 3.4 plugins" conflicts python27 python35 { |
| 78 | configure.args-replace -DENABLE_PYTHON=OFF -DENABLE_PYTHON=ON |
| 79 | configure.args-replace -DENABLE_PYTHON3=OFF -DENABLE_PYTHON3=ON |
| 80 | configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python3.4 |
| 81 | configure.args-append -DPYTHON_INCLUDE_PATH=${frameworks_dir}/Python.framework/Versions/3.4/Headers |
| 82 | configure.args-append -DPYTHON_LIBRARY=${frameworks_dir}/Python.framework/Versions/3.4/Python |
| 83 | depends_lib-append port:python34 |
| 84 | |
| 85 | # From http://weechat.org/files/doc/stable/weechat_user.en.html#dependencies |
| 86 | ui_warn "Recommended Python version is 2.7 (all scripts run fine with version 2.7, but not with versions ≤ 2.6 or ≥ 3.0)." |
| 87 | } |
| 88 | |
| 89 | variant python35 description "Bindings for python 3.5 plugins" conflicts python27 python34 { |
| 90 | configure.args-replace -DENABLE_PYTHON=OFF -DENABLE_PYTHON=ON |
| 91 | configure.args-replace -DENABLE_PYTHON3=OFF -DENABLE_PYTHON3=ON |
| 92 | configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python3.5 |
| 93 | configure.args-append -DPYTHON_INCLUDE_PATH=${frameworks_dir}/Python.framework/Versions/3.5/Headers |
| 94 | configure.args-append -DPYTHON_LIBRARY=${frameworks_dir}/Python.framework/Versions/3.5/Python |
| 95 | depends_lib-append port:python35 |
| 96 | |
| 97 | # From http://weechat.org/files/doc/stable/weechat_user.en.html#dependencies |
| 98 | ui_warn "Recommended Python version is 2.7 (all scripts run fine with version 2.7, but not with versions ≤ 2.6 or ≥ 3.0)." |
| 99 | } |
| 100 | |
| 101 | post-configure { |
| 102 | if {[variant_isset python27] || [variant_isset python34] || [variant_isset python35]} { |
| 103 | set patchfile ${configure.dir}/src/plugins/python/CMakeFiles/python.dir/link.txt |
| 104 | |
| 105 | reinplace -E "s| \(Python.framework\)| ${frameworks_dir}/\\1|g" ${patchfile} |
| 106 | |
| 107 | if {[variant_isset python34] || [variant_isset python35]} { |
| 108 | reinplace -E "s|-Wl,-stack_size,1000000||" ${patchfile} |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |