1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
|
###
# A subordinate project
###
::clay::define ::practcl::subproject {
superclass ::practcl::module
method _MorphPatterns {} {
return {{::practcl::subproject.@name@} {::practcl::@name@} {@name@} {::practcl::subproject}}
}
method BuildDir {PWD} {
return [my define get srcdir]
}
method child which {
switch $which {
delegate -
organs {
# A library can be a project, it can be a module. Any
# subordinate modules will indicate their existance
return [list project [self] module [self]]
}
}
}
method compile {} {}
method go {} {
::practcl::distribution select [self]
set name [my define get name]
my define set builddir [my BuildDir [my define get masterpath]]
my define set builddir [my BuildDir [my define get masterpath]]
my sources
}
# Install project into the local build system
method install args {}
method linktype {} {
return {subordinate package}
}
method linker-products {configdict} {}
method linker-external {configdict} {
if {[dict exists $configdict PRACTCL_PKG_LIBS]} {
return [dict get $configdict PRACTCL_PKG_LIBS]
}
if {[dict exists $configdict LIBS]} {
return [dict get $configdict LIBS]
}
}
method linker-extra {configdict} {
if {[dict exists $configdict PRACTCL_LINKER_EXTRA]} {
return [dict get $configdict PRACTCL_LINKER_EXTRA]
}
return {}
}
###
# Methods for packages/tools that can be downloaded
# possibly built and used internally by this Practcl
# process
###
###
# Load the facility into the interpreter
###
method env-bootstrap {} {
set pkg [my define get pkg_name [my define get name]]
package require $pkg
}
###
# Return a file path that exec can call
###
method env-exec {} {}
###
# Install the tool into the local environment
###
method env-install {} {
my unpack
}
###
# Do whatever is necessary to get the tool
# into the local environment
###
method env-load {} {
my variable loaded
if {[info exists loaded]} {
return 0
}
if {![my env-present]} {
my env-install
}
my env-bootstrap
set loaded 1
}
###
# Check if tool is available for load/already loaded
###
method env-present {} {
set pkg [my define get pkg_name [my define get name]]
if {[catch [list package require $pkg]]} {
return 0
}
return 1
}
method sources {} {}
method update {} {
my ScmUpdate
}
method unpack {} {
cd $::CWD
::practcl::distribution select [self]
my Unpack
::practcl::toolset select [self]
cd $::CWD
}
}
###
# Trivial implementations
###
###
# A project which the kit compiles and integrates
# the source for itself
###
::clay::define ::practcl::subproject.source {
superclass ::practcl::subproject ::practcl::library
method env-bootstrap {} {
set LibraryRoot [file join [my define get srcdir] [my define get module_root modules]]
if {[file exists $LibraryRoot] && $LibraryRoot ni $::auto_path} {
set ::auto_path [linsert $::auto_path 0 $LibraryRoot]
}
}
method env-present {} {
set path [my define get srcdir]
return [file exists $path]
}
method linktype {} {
return {subordinate package source}
}
}
# a copy from the teapot
::clay::define ::practcl::subproject.teapot {
superclass ::practcl::subproject
method env-bootstrap {} {
set pkg [my define get pkg_name [my define get name]]
package require $pkg
}
method env-install {} {
set pkg [my define get pkg_name [my define get name]]
set download [my <project> define get download]
my unpack
set prefix [string trimleft [my <project> define get prefix] /]
::practcl::tcllib_require zipfile::decode
::zipfile::decode::unzipfile [file join $download $pkg.zip] [file join $prefix lib $pkg]
}
method env-present {} {
set pkg [my define get pkg_name [my define get name]]
if {[catch [list package require $pkg]]} {
return 0
}
return 1
}
method install DEST {
set pkg [my define get pkg_name [my define get name]]
set download [my <project> define get download]
my unpack
set prefix [string trimleft [my <project> define get prefix] /]
::practcl::tcllib_require zipfile::decode
::zipfile::decode::unzipfile [file join $download $pkg.zip] [file join $DEST $prefix lib $pkg]
}
}
::clay::define ::practcl::subproject.kettle {
superclass ::practcl::subproject
method kettle {path args} {
my variable kettle
if {![info exists kettle]} {
::practcl::LOCAL tool kettle env-load
set kettle [file join [::practcl::LOCAL tool kettle define get srcdir] kettle]
}
set srcdir [my SourceRoot]
::practcl::dotclexec $kettle -f [file join $srcdir build.tcl] {*}$args
}
method install DEST {
my kettle reinstall --prefix $DEST
}
}
::clay::define ::practcl::subproject.critcl {
superclass ::practcl::subproject
method install DEST {
my critcl -pkg [my define get name]
set srcdir [my SourceRoot]
::practcl::copyDir [file join $srcdir [my define get name]] [file join $DEST lib [my define get name]]
}
}
::clay::define ::practcl::subproject.sak {
superclass ::practcl::subproject
method env-bootstrap {} {
set LibraryRoot [file join [my define get srcdir] [my define get module_root modules]]
if {[file exists $LibraryRoot] && $LibraryRoot ni $::auto_path} {
set ::auto_path [linsert $::auto_path 0 $LibraryRoot]
}
}
method env-install {} {
###
# Handle teapot installs
###
set pkg [my define get pkg_name [my define get name]]
my unpack
set prefix [my <project> define get prefix [file normalize [file join ~ tcl]]]
set srcdir [my define get srcdir]
::practcl::dotclexec [file join $srcdir installer.tcl] \
-apps -app-path [file join $prefix apps] \
-html -html-path [file join $prefix doc html $pkg] \
-pkg-path [file join $prefix lib $pkg] \
-no-nroff -no-wait -no-gui
}
method env-present {} {
set path [my define get srcdir]
return [file exists $path]
}
method install DEST {
###
# Handle teapot installs
###
set pkg [my define get pkg_name [my define get name]]
my unpack
set prefix [string trimleft [my <project> define get prefix] /]
set srcdir [my define get srcdir]
::practcl::dotclexec [file join $srcdir installer.tcl] \
-pkg-path [file join $DEST $prefix lib $pkg] \
-no-examples -no-html -no-nroff \
-no-wait -no-gui -no-apps
}
method install-module {DEST args} {
set srcdir [my define get srcdir]
if {[llength $args]==1 && [lindex $args 0] in {* all}} {
set pkg [my define get pkg_name [my define get name]]
::practcl::dotclexec [file join $srcdir installer.tcl] \
-pkg-path [file join $DEST $pkg] \
-no-examples -no-html -no-nroff \
-no-wait -no-gui -no-apps
} else {
foreach module $args {
::practcl::installModule [file join $srcdir modules $module] [file join $DEST $module]
}
}
}
}
::clay::define ::practcl::subproject.practcl {
superclass ::practcl::subproject
method env-bootstrap {} {
set LibraryRoot [file join [my define get srcdir] [my define get module_root modules]]
if {[file exists $LibraryRoot] && $LibraryRoot ni $::auto_path} {
set ::auto_path [linsert $::auto_path 0 $LibraryRoot]
}
}
method env-install {} {
###
# Handle teapot installs
###
set pkg [my define get pkg_name [my define get name]]
my unpack
set prefix [my <project> define get prefix [file normalize [file join ~ tcl]]]
set srcdir [my define get srcdir]
::practcl::dotclexec [file join $srcdir make.tcl] install [file join $prefix lib $pkg]
}
method install DEST {
###
# Handle teapot installs
###
set pkg [my define get pkg_name [my define get name]]
my unpack
set prefix [string trimleft [my <project> define get prefix] /]
set srcdir [my define get srcdir]
puts [list INSTALLING [my define get name] to [file join $DEST $prefix lib $pkg]]
::practcl::dotclexec [file join $srcdir make.tcl] install [file join $DEST $prefix lib $pkg]
}
method install-module {DEST args} {
set pkg [my define get pkg_name [my define get name]]
set srcdir [my define get srcdir]
::practcl::dotclexec [file join $srcdir make.tcl] install-module $DEST {*}$args
}
}
|