# Copyright: 2016-2023 Paul Obermeier (obermeier@tcl3d.org) # Distributed under BSD license. # # BuildType: Copy / Tcl proc Init_critcl { libName libVersion } { SetScriptAuthor $libName "Paul Obermeier" "obermeier@tcl3d.org" SetLibHomepage $libName "https://andreas-kupries.github.io/critcl/" SetLibDependencies $libName "Tcl" SetPlatforms $libName "All" } proc Build_critcl { libName libVersion buildDir instDir devDir distDir } { set instDirMSys [MSysPath $instDir] set instDirLibMSys [MSysPath [file join $instDir "lib"]] set have32OrNewer [expr [VersionCompare "3.2" $libVersion] <= 0] if { [UseStage "Extract" $libName] } { ExtractLibrary $libName $buildDir } if { [UseStage "Compile" $libName] } { # critcl needs package cmdline for building. A version of # cmdline is contained in the critcl distribution. # We need to copy this version into the development Tcl # folder to have access to it. # # As package cmdline is normally part of tcllib, # we remove the copied local version after building. # # Note, that we cannot make critcl dependent on tcllib, # as tcllib needs critcl for building the C based versions # of some tcllib modules. if { ! $have32OrNewer } { MultiFileCopy "$buildDir/lib/cmdline" "$devDir/[GetTclLibDir]/cmdline" "*" true } set cmd "" if { $have32OrNewer } { append cmd "[GetTclshPath] ./build.tcl install --exec-prefix $instDirMSys" } else { append cmd "[GetTclshPath] ./build.tcl install $instDirLibMSys" } MSysRun $libName "${libName}_Compile" $buildDir "$cmd" if { ! $have32OrNewer } { DirDelete "$devDir/[GetTclLibDir]/cmdline" } } if { [UseStage "Distribute" $libName] } { StripLibraries "$instDir" LibFileCopy "$instDir" "$devDir/[GetTclDir]" "*" true LibFileCopy "$instDir" "$distDir/[GetTclDir]" "*" true # Name of program was "critcl" in version 3.1.15. # In 3.1.17 it is "critcl.tcl". set progName [FindFile "$instDir/bin" "${libName}*"] SingleFileCopy "$instDir/bin/$progName" "$distDir/[GetTclBinDir]" $libName SingleFileCopy "$instDir/bin/$progName" "$devDir/[GetTclBinDir]" $libName if { ! [UseTclPkgVersion] } { # critcl consists of several packages with different version numbers. # So no removal of version numbers is possible. } } return true }