File: build.tcl

package info (click to toggle)
tcllib 1.20%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 68,064 kB
  • sloc: tcl: 216,842; ansic: 14,250; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 107; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (119 lines) | stat: -rw-r--r-- 2,982 bytes parent folder | download | duplicates (4)
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
set srcdir [file dirname [file normalize [file join [pwd] [info script]]]]
set moddir [file dirname $srcdir]
source [file join $srcdir doctool.tcl]

::practcl::doctool create AutoDoc

set version 0.16.4
set tclversion 8.6
set module [file tail $moddir]
set filename $module

set fout [open [file join $moddir $filename.tcl] w]
fconfigure $fout -translation lf
dict set modmap %module% $module
dict set modmap %version% $version
dict set modmap %tclversion% $tclversion
#dict set modmap {    } {}
#dict set modmap "\t" {    }

puts $fout [string map $modmap {###
# Amalgamated package for %module%
# Do not edit directly, tweak the source in src/ and rerun
# build.tcl
###
package require Tcl %tclversion%
package provide %module% %version%
namespace eval ::%module% {}
}]

# Track what files we have included so far
set loaded {}
# These files must be loaded in a particular order

###
# Load other module code that this module will need
###
foreach {omod files} {
  httpwget wget.tcl
  clay {clay.tcl}
} {
  foreach fname $files {
    set file [file join $moddir .. $omod $fname]
    puts $fout "###\n# START: [file join $omod $fname]\n###"
    set content [::practcl::cat [file join $moddir .. $omod $fname]]
    #AutoDoc scan_text $content
    puts $fout [::practcl::docstrip $content]
    puts $fout "###\n# END: [file join $omod $fname]\n###"
  }
}

foreach {file} {
  setup.tcl
  doctool.tcl
  buildutil.tcl
  fileutil.tcl
  installutil.tcl
  makeutil.tcl
  {class metaclass.tcl}

  {class toolset baseclass.tcl}
  {class toolset gcc.tcl}
  {class toolset msvc.tcl}

  {class target.tcl}
  {class object.tcl}
  {class dynamic.tcl}
  {class product.tcl}
  {class module.tcl}

  {class project baseclass.tcl}
  {class project library.tcl}
  {class project tclkit.tcl}

  {class distro baseclass.tcl}
  {class distro snapshot.tcl}
  {class distro fossil.tcl}
  {class distro git.tcl}

  {class subproject baseclass.tcl}
  {class subproject binary.tcl}
  {class subproject core.tcl}

  {class tool.tcl}

} {
  lappend loaded $file
  puts $fout "###\n# START: [file join $file]\n###"
  set content [::practcl::cat [file join $srcdir {*}$file]]
  AutoDoc scan_text $content
  puts $fout [::practcl::docstrip $content]
  puts $fout "###\n# END: [file join $file]\n###"
}

# Provide some cleanup and our final package provide
puts $fout [string map $modmap {
namespace eval ::%module% {
  namespace export *
}
}]
close $fout

###
# Build our pkgIndex.tcl file
###
set fout [open [file join $moddir pkgIndex.tcl] w]
fconfigure $fout -translation lf
puts $fout [string map $modmap {###
if {![package vsatisfies [package provide Tcl] %tclversion%]} {return}
package ifneeded %module% %version% [list source [file join $dir %module%.tcl]]
}]
close $fout

set manout [open [file join $moddir $filename.man] w]
puts $manout [AutoDoc manpage map $modmap \
  header [::practcl::cat [file join $srcdir manual.txt]] \
  footer [::practcl::cat [file join $srcdir footer.txt]] \
]
close $manout