-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeDist.tcl
120 lines (100 loc) · 3.56 KB
/
makeDist.tcl
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
# Copyright: 2007-2015 Paul Obermeier (obermeier@poSoft.de)
# Distributed under BSD license.
if { $argc == 0 } {
set distDir [file join [pwd] ".." "CawtDistribution"]
} else {
set distDir [lindex $argv 0]
}
set zipProg [auto_execok 7z.exe]
if { $zipProg eq "" } {
set zipProg [file join "C:/" "opt" "7-Zip" "7z.exe"]
if { ! [file exists $zipProg] } {
set zipProg [file join "C:/" "Program Files" "7-Zip" "7z.exe"]
}
}
if { $zipProg eq "" } {
puts "No Zip program found. Exiting."
exit 1
}
set cawtDir [pwd]
set docDir [file join $cawtDir "Documentation"]
set finalDir [file join $docDir "Final"]
set testDir [file join $cawtDir "TestPrograms"]
set starkitDir [file join $cawtDir "Starkit"]
set auto_path [linsert $auto_path 0 $cawtDir [file join $cawtDir "Externals"]]
set retVal [catch {package require cawt} cawtVersion]
if { $tcl_platform(pointerSize) == 4 } {
set winPlatform "win32"
} else {
set winPlatform "win64"
}
set distUserName "Cawt-$cawtVersion-User"
set distUserDir [file join $distDir $distUserName]
set distDevName "Cawt-$cawtVersion-Dev"
set distDevDir [file join $distDir $distDevName]
puts "Generating Cawt $cawtVersion distribution in $distDir"
file delete -force $distDir
file mkdir $distDir
puts "Cleaning test outputs and intermediate doc files ..."
cd $finalDir
file delete -force "CawtFigures"
cd $testDir
file delete -force "testOut"
cd $starkitDir
foreach winPlatform { "win32" "win64" } {
set starkitName "CawtKit-$cawtVersion-$winPlatform.kit"
puts "Copying Starkit $starkitName to directory $distDir"
file copy -force $starkitName $distDir
set starpackName "Cawt-$cawtVersion-$winPlatform.exe"
puts "Copying Starpack $starpackName to directory $distDir"
file copy -force $starpackName $distDir
}
puts "Generating user distribution in directory $distUserDir"
file delete -force $distUserDir
file mkdir $distUserDir
cd $cawtDir
foreach dir { "CawtCore" "CawtEarth" "CawtExcel" "CawtExplorer" "CawtMatlab" \
"CawtOcr" "CawtPpt" "CawtOutlook" "CawtWord" "TestPrograms" } {
puts " Copying CAWT package $dir ..."
file copy [file join $cawtDir $dir] $distUserDir
}
file mkdir [file join $distUserDir "Externals"]
foreach dir { "base64" "Img" "tablelist" "twapi"} {
puts " Copying external package $dir ..."
file copy [file join $cawtDir "Externals" $dir] [file join $distUserDir "Externals"]
}
file copy pkgIndex.tcl $distUserDir
file copy Readme.txt $distUserDir
file copy $finalDir $distUserDir
cd $distUserDir
file rename "Final" "Documentation"
proc PackDir { dir zipName } {
puts " Generating $zipName from directory $dir ..."
file delete -force $zipName
exec $::zipProg a -tzip ${dir}.zip $dir -mx5
file rename -force ${dir}.zip $zipName
}
cd $distDir
PackDir $distUserName "$distUserName.zip"
puts "Generating developer distribution in directory $distDevDir"
file delete -force $distDevDir
file copy [file join $cawtDir] $distDir
cd $distDir
file rename "Cawt" $distDevName
# Remove obsolete files and directories
cd $distDevName
file delete -force "_FOSSIL_"
file delete -force ".svn"
file delete -force "ToDo.txt"
cd "Starkit"
foreach winPlatform { "win32" "win64" } {
set starkitName "CawtKit-$cawtVersion-$winPlatform.kit"
set starpackName "Cawt-$cawtVersion-$winPlatform.exe"
file delete -force $starkitName
file delete -force $starpackName
file delete -force "CawtKit-$cawtVersion-$winPlatform.bat"
file delete -force "CawtKit-$cawtVersion-$winPlatform.vfs"
}
cd $distDir
PackDir $distDevName "$distDevName.zip"
puts "Done"