Overview
Context
Changes
Added kitsh/build.sh version [daa9b2e9bc].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#! /bin/bash
if [ ! -f 'build.sh' ]; then
echo 'ERROR: This script must be run from the directory it is in' >&2
exit 1
fi
if [ -z "${TCLVERS}" ]; then
echo 'ERROR: The TCLVERS environment variable is not set' >&2
exit 1
fi
KITSHVERS="0.0"
BUILDDIR="$(pwd)/build/kitsh-${KITSHVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
OTHERPKGSDIR="$(pwd)/../"
export KITSHVERS BUILDDIR OUTDIR INSTDIR OTHERPKGSDIR
rm -rf 'build' 'out' 'inst'
mkdir 'out' 'inst' || exit 1
(
cp -r 'buildsrc' 'build'
cd "${BUILDDIR}" || exit 1
# Compile all objects...
## XXX
${CC:-cc} -I${TCLCONFIGDIR} -I${TCLCONFIGDIR}/../generic -o kit *.c $(find "${OTHERPKGSDIR}" -name '*.a' | grep '/inst/') -lz -lm -ldl -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
# Create VFS directory
mkdir "starpack.vfs"
mkdir "starpack.vfs/lib"
## Copy in all built directories
cp -r "${OTHERPKGSDIR}"/*/out/* 'starpack.vfs/'
## Rename the "vfs" package directory to what "boot.tcl" expects
mv 'starpack.vfs/lib'/vfs* 'starpack.vfs/lib/vfs'
## Install "boot.tcl"
cp 'boot.tcl' 'starpack.vfs/'
# Intall VFS onto kit
## Copy installed data for packages
mkdir "installed-pkgs"
cp -r "${OTHERPKGSDIR}"/*/inst/* 'installed-pkgs/'
## Call installer
${TCLCONFIGDIR}/tclsh installvfs.tcl kit starpack.vfs
) || exit 1
exit 0
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added kitsh/buildsrc/kitsh-0.0/boot.tcl version [22b7e78c5d].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
proc tclInit {} {
rename tclInit {}
global auto_path tcl_library tcl_libPath
global tcl_version tcl_rcFileName
set noe [info nameofexecutable]
# Resolve symlinks
set noe [file dirname [file normalize [file join $noe __dummy__]]]
set tcl_library [file join $noe lib tcl$tcl_version]
set tcl_libPath [list $tcl_library [file join $noe lib]]
# get rid of a build residue
unset -nocomplain ::tclDefaultLibrary
# the following code only gets executed once on startup
if {[info exists tcl_rcFileName]} {
load {} vfs
# lookup and emulate "source" of lib/vfs/{vfs*.tcl,mk4vfs.tcl}
# must use raw MetaKit calls because VFS is not yet in place
set d [mk::select exe.dirs parent 0 name lib]
set d [mk::select exe.dirs parent $d name vfs]
foreach x {vfsUtils vfslib mk4vfs} {
set n [mk::select exe.dirs!$d.files name $x.tcl]
set s [mk::get exe.dirs!$d.files!$n contents]
catch {set s [zlib decompress $s]}
uplevel #0 $s
}
# use on-the-fly decompression, if mk4vfs understands that
set mk4vfs::zstreamed 1
# mount the executable, i.e. make all runtime files available
vfs::filesystem mount $noe [list ::vfs::mk4::handler exe]
# alter path to find encodings
if {[info tclversion] eq "8.4"} {
load {} pwb
librarypath [info library]
} else {
encoding dirs [list [file join [info library] encoding]] ;# TIP 258
}
# fix system encoding, if it wasn't properly set up (200207.004 bug)
if {[encoding system] eq "identity"} {
switch $::tcl_platform(platform) {
windows { encoding system cp1252 }
macintosh { encoding system macRoman }
default { encoding system iso8859-1 }
}
}
# now remount the executable with the correct encoding
#vfs::filesystem unmount $noe
vfs::filesystem unmount [lindex [::vfs::filesystem info] 0]
set noe [info nameofexecutable]
# Resolve symlinks
set noe [file dirname [file normalize [file join $noe __dummy__]]]
set tcl_library [file join $noe lib tcl$tcl_version]
set tcl_libPath [list $tcl_library [file join $noe lib]]
vfs::filesystem mount $noe [list ::vfs::mk4::handler exe]
}
# load config settings file if present
namespace eval ::vfs { variable tclkit_version 1 }
catch { uplevel #0 [list source [file join $noe config.tcl]] }
uplevel #0 [list source [file join $tcl_library init.tcl]]
# reset auto_path, so that init.tcl's search outside of tclkit is cancelled
set auto_path $tcl_libPath
}
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added kitsh/buildsrc/kitsh-0.0/installvfs.tcl version [52a8d482f1].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#! /usr/bin/env tclsh
lappend auto_path [file join installed-pkgs lib]
package require vfs::mk4
if {[llength $argv] != 2} {
puts stderr "Usage: installvfs.tcl <kitfile> <vfsdir>"
exit 1
}
proc copy_file {srcfile destfile} {
switch -glob -- $srcfile {
"*.tcl" {
set ifd [open $srcfile r]
set ofd [open $destfile w]
fcopy $ifd $ofd
close $ofd
close $ifd
}
default {
file copy -- $srcfile $destfile
}
}
puts "Copied $srcfile to $destfile"
}
proc recursive_copy {srcdir destdir} {
foreach file [glob -nocomplain -directory $srcdir *] {
set filetail [file tail $file]
set destfile [file join $destdir $filetail]
if {[file isdirectory $file]} {
file mkdir $destfile
recursive_copy $file $destfile
continue
}
if {[catch {
copy_file $file $destfile
} err]} {
puts stderr "Failed to copy: $file: $err"
}
}
}
set kitfile [lindex $argv 0]
set vfsdir [lindex $argv 1]
set handle [vfs::mk4::Mount $kitfile /kit]
recursive_copy $vfsdir /kit
vfs::mk4::Unmount $handle /kit
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added kitsh/buildsrc/kitsh-0.0/kitInit.c version [56adb92a48].