66 | | configure.compiler gcc-4.2 |
| 71 | configure.compiler gcc-4.2 |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | configure.args-delete -DCMAKE_BUILD_TYPE=Release |
| 76 | # force cmake to use the compiler flags passed through CFLAGS, CXXFLAGS etc. in the environment |
| 77 | configure.args-append -DCMAKE_BUILD_TYPE:STRING=MacPorts \ |
| 78 | -DCMAKE_STRIP:FILEPATH=/bin/echo \ |
| 79 | -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON |
| 80 | |
| 81 | # Install the kdelibs headerfiles in their own directory to prevent clashes with KF5 headers |
| 82 | set kde4.include_prefix KDE4 |
| 83 | set kde4.include_dirs ${prefix}/include/${kde4.include_prefix} |
| 84 | set kde4.legacy_prefix ${prefix}/libexec/kde4-legacy |
| 85 | set kde4.cmake_module_dir \ |
| 86 | ${prefix}/lib/cmake/${kde4.include_prefix} |
| 87 | |
| 88 | # Certain ports will need to be installed in "KF5 compatibility mode" if they are to co-exist |
| 89 | # with their KF5 counterparts. Call `kde4.use_legacy_prefix` to activate this mode, *before* |
| 90 | # the configure step is executed and taking care not to undo the effects. |
| 91 | # If a legacy prefix is used, the global variable kde4.legacy_prefix_restored will be defined |
| 92 | # and set to 'no'; it is set to 'yes' by kde4.restore_from_legacy_prefix . |
| 93 | # An optional boolean argument deactivates the automatic calling of kde4.restore_from_legacy_prefix . |
| 94 | proc kde4.use_legacy_prefix {{autorestore 1}} { |
| 95 | upvar #0 kde4.legacy_prefix_restored restored |
| 96 | upvar #0 kde4.legacy_prefix_autorestore dorestore |
| 97 | global prefix |
| 98 | global kde4.legacy_prefix |
| 99 | global kde4.include_dirs |
| 100 | configure.pre_args-replace \ |
| 101 | -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_INSTALL_PREFIX=${kde4.legacy_prefix} |
| 102 | configure.args-replace \ |
| 103 | -DCMAKE_INSTALL_RPATH=${prefix}/lib -DCMAKE_INSTALL_RPATH="${prefix}/lib\;${kde4.legacy_prefix}/lib" |
| 104 | # changing the install prefix will override the KDE4_INCLUDE_INSTALL_DIR path normally set |
| 105 | # to ${kde4.include_dirs} by kdelibs4's cmake modules. Make sure to override it back to that setting. |
| 106 | configure.args-append \ |
| 107 | -DINCLUDE_INSTALL_DIR=${kde4.include_dirs} |
| 108 | set restored no |
| 109 | if {(${autorestore} eq 1) || (${autorestore} eq yes)} { |
| 110 | set dorestore yes |
| 111 | } else { |
| 112 | set dorestore no |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | # kde4.restore_from_legacy_prefix is called from the post-destroot phase of a port that uses |
| 117 | # KF5 compatibility mode. That mode is very indiscriminate, installing everything into the |
| 118 | # legacy_prefix initially. Most things will actually have to be moved back out into the |
| 119 | # regular prefix. This procedure automates what can be automated, but may also overshoot |
| 120 | # its goal. |
| 121 | # See the post-destroot block at the end of this file. |
| 122 | # After completion, the global variable kde4.legacy_prefix_restored will be set to 'yes'. |
| 123 | # This procedure is called automatically after calling kde4.use_legacy_prefix ; it can be |
| 124 | # avoided by calling `kde4.use_legacy_prefix no` |
| 125 | # This procedure is bound to evolve. |
| 126 | proc kde4.restore_from_legacy_prefix {} { |
| 127 | global destroot |
| 128 | global prefix |
| 129 | global kde4.legacy_prefix |
| 130 | global kde4.cmake_module_dir |
| 131 | upvar #0 kde4.legacy_prefix_restored restored |
| 132 | if {[info exists restored] && (${restored} eq yes)} { |
| 133 | ui_debug "kde4.restore_from_legacy_prefix already called" |
| 134 | return |
| 135 | } |
| 136 | if {[file exists ${destroot}${kde4.legacy_prefix}/lib/kde4]} { |
| 137 | # move back the kparts, libexec etc. to where they should be |
| 138 | file rename ${destroot}${kde4.legacy_prefix}/lib/kde4 ${destroot}${prefix}/lib/kde4 |
| 139 | } |
| 140 | if {[file exists ${destroot}${kde4.legacy_prefix}/include]} { |
| 141 | ui_msg "WARNING: include directory \"${destroot}${kde4.legacy_prefix}/include\" exists!" |
| 142 | # # move back the include directory to where it should be; |
| 143 | # # first delete the include directory that was created for us and should be empty: |
| 144 | # file delete -force ${destroot}${prefix}/include |
| 145 | # file rename ${destroot}${kde4.legacy_prefix}/include ${destroot}${prefix}/include |
| 146 | } |
| 147 | if {[file exists ${destroot}${kde4.legacy_prefix}/share]} { |
| 148 | # move back the share directory to where it should be; |
| 149 | foreach J [glob -nocomplain ${destroot}${kde4.legacy_prefix}/share/*] { |
| 150 | set d [file tail ${J}] |
| 151 | file rename ${J} ${destroot}${prefix}/share/${d} |
| 152 | } |
| 153 | } |
| 154 | if {[file exists ${destroot}${kde4.legacy_prefix}/lib/cmake]} { |
| 155 | # move back the cmake modules to where they should be |
| 156 | # file rename ${destroot}${kde4.legacy_prefix}/lib/cmake ${destroot}${prefix}/lib/cmake |
| 157 | xinstall -m 755 -d [file dirname ${destroot}${kde4.cmake_module_dir}] |
| 158 | file rename ${destroot}${kde4.legacy_prefix}/lib/cmake ${destroot}${kde4.cmake_module_dir} |
136 | | notes " |
| 243 | if {[info exist ::env(MACPORTS_COMPRESS_WORKDIR)] && $::env(MACPORTS_COMPRESS_WORKDIR)} { |
| 244 | post-build { |
| 245 | if {[file exists ${prefix}/bin/afsctool]} { |
| 246 | ui_msg "---> Compressing build directory ..." |
| 247 | if {[catch {system "${prefix}/bin/afsctool -cfvv -8 -J${build.jobs} ${build.dir} 2>&1"} result context]} { |
| 248 | ui_msg "Compression failed: ${result}, ${context}; port:afsctool is probably installed without support for parallel compression" |
| 249 | } else { |
| 250 | ui_debug "Compressing ${build.dir}: ${result}" |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | post-destroot { |
| 257 | if {[info exists kde4.legacy_prefix_autorestore]} { |
| 258 | # check if we need to do automatic restoring (the default). We do that here because this post-destroot |
| 259 | # block should be the first such block. In other words, the calling Portfile should not yet have had |
| 260 | # a chance to modify the destroot in ways that kde4.restore_from_legacy_prefix might overwrite. |
| 261 | # kde4.restore_from_legacy_prefix checks itself if it already completed once. |
| 262 | if {(${kde4.legacy_prefix_autorestore} eq yes) || (${kde4.legacy_prefix_autorestore} eq 1)} { |
| 263 | ui_debug "doing requested auto kde4.restore_from_legacy_prefix (${kde4.legacy_prefix_autorestore})" |
| 264 | kde4.restore_from_legacy_prefix |
| 265 | } |
| 266 | } |
| 267 | if {![info exists kde4.legacy_prefix_restored] || ${kde4.legacy_prefix_restored} eq no} { |
| 268 | # move the port's cmake modules to ${kde4.cmake_module_dir}. This is an operation that might |
| 269 | # be overwritten if the Portfile calls kde4.restore_from_legacy_prefix afterwards, hence the |
| 270 | # call to that function just above. |
| 271 | if {[file exists ${destroot}${prefix}/lib/cmake]} { |
| 272 | # avoid a loop construct here (and a direct rename may not work, e.g. lib/cmake -> lib/cmake/KDE4 won't) |
| 273 | # move the directory out of the way |
| 274 | file rename ${destroot}${prefix}/lib/cmake ${destroot}/cmake_temp_dir |
| 275 | # create the parent for ${kde4.cmake_module_dir} |
| 276 | xinstall -m 755 -d [file dirname ${destroot}${kde4.cmake_module_dir}] |
| 277 | # move the temp dir into place |
| 278 | file rename ${destroot}/cmake_temp_dir ${destroot}${kde4.cmake_module_dir} |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | post-activate { |
| 284 | if {[file exists ${prefix}/bin/kbuildsycoca4]} { |
| 285 | ui_msg "---> Updating KDE's global desktop file system configuration cache ..." |
| 286 | system "${prefix}/bin/kbuildsycoca4 --global" |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | notes-append " |