tcl-hacks

Check-in [601b5ddac7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:install hack for starpacks to use modules
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:601b5ddac71b0453d53cd543f55b5af446b7f5db
User & Date: aspect 2019-03-02 13:06:31
Context
2019-04-26
14:22
Fix tclish symlink resolution check-in: 3eaba8d90c user: aspect tags: trunk
2019-03-02
13:06
install hack for starpacks to use modules check-in: 601b5ddac7 user: aspect tags: trunk
2019-03-01
14:25
minhttpd: remove colliding close method, avoid port contention and print url on startup check-in: 1adc0b6492 user: aspect tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to hacks/cuppa/tpc.tcl.

537
538
539
540
541
542
543
544
545
546





547
548
549

550
551
552
553

554


555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577

    set tclexe [info nameofexe]
    set tclver [info patch]
    regexp {^(\d+).(\d+)} $tclver -> majver minver

    log "Creating Tcl environment in $dir for $tclexe ($tclver)"
    file mkdir $dir
    file mkdir $dir/bin $dir/lib $dir/modules

    set dir [file normalize $dir]






    createfile $dir/bin/activate [dedent [subst -noc {
        # source this file to initialize your env:

        PATH="$dir/bin:\$PATH"
        # FIXME: what if these are already set?
        TCLLIBPATH="$dir/lib"
        TCL${majver}_${minver}_TM_PATH="$dir/modules"

        export PATH TCLLIBPATH TCL${majver}_${minver}_TM_PATH


    }]]

    createfile $dir/bin/tclsh [dedent [subst -noc {
        #!/bin/sh
        . "$dir/bin/activate"
        exec "$tclexe" "\$@"
    }]] -permissions 0755

    createfile $dir/tclenv.txt [dedent [subst {
        # Tcl environment initialised at [clock format [clock seconds]]
        tcl_version $tclver
        platform    [platform::identify]

        bindir      [list bin]
        libdir      [list lib]
        tmdir       [list modules]

    }]]
}

proc install {dir name args} {
    set fd [open $dir/tclenv.txt r+]
    finally close $fd







|


>
>
>
>
>



>




>

>
>













|
|
|







537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586

    set tclexe [info nameofexe]
    set tclver [info patch]
    regexp {^(\d+).(\d+)} $tclver -> majver minver

    log "Creating Tcl environment in $dir for $tclexe ($tclver)"
    file mkdir $dir
    file mkdir $dir/bin $dir/lib $dir/modules $dir/lib/_modules

    set dir [file normalize $dir]

    createfile $dir/lib/_modules/pkgIndex.tcl [dedent [subst -noc {
        # helper for starpacks to initialise the .tm path
        tcl::tm::path add [file dirname [file dirname $dir]]/modules
    }]]

    createfile $dir/bin/activate [dedent [subst -noc {
        # source this file to initialize your env:

        PATH="$dir/bin:\$PATH"
        # FIXME: what if these are already set?
        TCLLIBPATH="$dir/lib"
        TCL${majver}_${minver}_TM_PATH="$dir/modules"

        export PATH TCLLIBPATH TCL${majver}_${minver}_TM_PATH

        # FIXME: provide deactivate() function
    }]]

    createfile $dir/bin/tclsh [dedent [subst -noc {
        #!/bin/sh
        . "$dir/bin/activate"
        exec "$tclexe" "\$@"
    }]] -permissions 0755

    createfile $dir/tclenv.txt [dedent [subst {
        # Tcl environment initialised at [clock format [clock seconds]]
        tcl_version $tclver
        platform    [platform::identify]

        bindir      bin
        libdir      lib
        tmdir       modules

    }]]
}

proc install {dir name args} {
    set fd [open $dir/tclenv.txt r+]
    finally close $fd