| 67 | variant python requires python27 description {Compatibility variant, requires +python27} {} |
| 68 | |
| 69 | set pythons_suffixes {27 34 35} |
| 70 | |
| 71 | set pythons_ports {} |
| 72 | foreach s ${pythons_suffixes} { |
| 73 | lappend pythons_ports python${s} |
| 74 | } |
| 75 | |
| 76 | foreach s ${pythons_suffixes} { |
| 77 | set p python${s} |
| 78 | set v [string index ${s} 0].[string index ${s} 1] |
| 79 | set i [lsearch -exact ${pythons_ports} ${p}] |
| 80 | set c [lreplace ${pythons_ports} ${i} ${i}] |
| 81 | # set ${t} to '3' if ${s} ends with '3'; t must be set beforehand, though... |
| 82 | set t "" |
| 83 | regexp {(3$)} ${s} t |
| 84 | eval [subst { |
| 85 | variant ${p} description "Bindings for python ${v} plugins" conflicts ${c} { |
| 86 | configure.args-delete -DENABLE_PYTHON=OFF |
| 87 | configure.args-delete -DENABLE_PYTHON${t}=OFF |
| 88 | configure.args-append -DENABLE_PYTHON=ON |
| 89 | configure.args-append -DENABLE_PYTHON${t}=ON |
| 90 | configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python${v} |
| 91 | configure.args-append -DPYTHON_INCLUDE_PATH=${frameworks_dir}/Python.framework/Versions/${v}/Headers |
| 92 | configure.args-append -DPYTHON_LIBRARY=${frameworks_dir}/Python.framework/Versions/${v}/Python |
| 93 | depends_lib-append port:${p} |
| 94 | } |
| 95 | }] |
| 96 | } |
| 97 | |
| 98 | # TODO: Ideally this should go inside its corresponding python variant. |
| 99 | post-configure { |
| 100 | set patchfile ${configure.dir}/src/plugins/python/CMakeFiles/python.dir/link.txt |
| 101 | |
| 102 | if {[file exists ${patchfile}]} { |
| 103 | reinplace -E "s| \(Python.framework\)| ${frameworks_dir}/\\1|g" ${patchfile} |
| 104 | reinplace -E "s|-Wl,-stack_size,1000000||" ${patchfile} |
| 105 | } |
| 106 | } |
| 107 | |