critcl(1)
π NAME π
critcl β CriTcl Application Reference πΈ
β¨ SYNOPSIS β¨
critcl ?option...? ?file...?
π¦ DESCRIPTION π¦
okay bestie, be welcome to the C Runtime In Tcl (short: CriTcl), the whole system for embedding and using C code from inside your Tcl scripts (peep http://core.tcl-lang.org/tcl). β¨
This document is the reference manpage for the critcl command, periodt. Who's it for? The people who have to build packages using critcl for deployment. π
π Writers of packages with embedded C code can literally ignore this document, no cap.
And if you need an overview of the whole system instead, please go read the Introduction To CriTcl. π
This application resides in the Application Layer of CriTcl, iykyk:
*================*
|Applications |
| critcl |
| critcl::app |
*================*
+----------------+
|Core Packages |
| critcl |
| critcl::util |
+----------------+
+----------------+
|Support Packages|
| stubs::* |
| md5, platform |
| ... |
+----------------+
The application supports the following general command line:
critcl ?option...? ?file...?
The exact set of options supported, their meaning, and interaction is detailed in section Application Options below π. For a larger set of examples please see section "Building CriTcl Packages" in the document about Using CriTcl. π
π APPLICATION OPTIONS π
The following options are understood:
-v,--versionβ Print the version tostdoutand exit. bye bestie π-Ipath β Arranges for the compiler to search path for headers. Uses of this option are cumulative (stack 'em up π₯).
π« Ignored when generating a TEA package (see option -tea below).
-Lpath β Arranges for the linker to search path. Uses of this option are cumulative too.
π« Ignored when generating a TEA package (see option -tea below).
-cachepath β Sets path as the directory to use as the result cache. The default is"~/.critcl/<platform>", or"~/.critcl/<pid>.<epoch>"when generating a package. See option-pkg, below. ποΈ
π« Ignored when generating a TEA package (see option -tea below).
-cleanβ Arranges for all files and directories in the result cache to be deleted before compilation begins. π§Ό
Ignored when generating a package because this mode starts out with a unique and empty result cache. See option -pkg, below.
π« Ignored when generating a TEA package (see option -tea below).
-configpath β Provides a custom configuration file. By default a configuration included in the system core is used. When specified multiple times the last value is used.
π« Ignored when generating a TEA package (see option -tea below).
-debugmode β Activates one of the following debugging modes:memoryβ Track and report memory allocations made by the Tcl core.symbolsβ Compile all".c"files with debugging symbols.allβ Bothmemoryandsymbols.
π« Ignored when generating a TEA package (see option -tea below). Uses of this option are cumulative.
-disablename β Sets the value of the custom build configuration option name to false. It is equivalent to"-with-name 0". π
Validated only if one of the input files for the CriTcl script actually defines and uses a custom build configuration option with that name.
π« Ignored when generating a TEA package (see option -tea below).
-enablename β Sets the value of the custom build configuration option name to true. It is equivalent to"-with-name 1". β
Validated only if one of the input files for the CriTcl script actually defines and uses a custom build configuration option with that name.
π« Ignored when generating a TEA package (see option -tea below).
-forceβ Forces compilation even if a shared library for the file already exists. Unlike cleaning the cache, this is lazy in the destruction of files and only affects relevant files. πͺ
Ignored when generating a package (see option -pkg, below), which starts out with a unique and empty result cache.
π« Ignored when generating a TEA package (see option -tea below).
-helpβ Prints a short description of command line syntax and options and then exits the application. π-keepβ Causes the system to cache compiled".c"files. Also prevents the deletion of the unique result cache used by the run when generating a package (see option-pkgbelow). Intended for debugging ofcritclitself, where it may be necessary to inspect the generated C code. π
π« Ignored when generating a TEA package (see option -tea below).
-libdirdirectory β Adds directory to the list of directories the linker searches for libraries in (like-L). With-pkg, generated packages are saved in directory. When specified multiple times the last value is used. The default is"lib", resolved relative to the current working directory. π-includedirdirectory β Adds directory to the list of directories the compiler searches for headers in. With-pkg, generated header files are saved in directory. Uses of this option are cumulative. The last value is used as the destination for generated header files. The default is the relative directory"include", resolved relative to the current working directory.
π« Ignored when generating a TEA package (see option -tea below).
-pkgβ Generates a package from the CriTcl script files. Input files are processed first as usual, but are then bundled into a single library, with additional generated files to form the library into a standard Tcl package. π¦
generation. If both options, i.e. -pkg and -tea are specified the last one specified wins.
Options -clean and -force are ignored. -libdir is relevant in both this and -tea mode.
The basename of the first file is the name of the package to generate. If its file extension indicates a shared library (".so", ".sl", ".dylib", and ".dll") it is also removed from the set of input files. Each CriTcl script file is kept as part of the input. A single file without a suffix is assumed to be a CriTcl script. A file without a suffix, but other input files following is treated like the name of a shared library proper, and removed from the set of input files. π€
Examples:
... -pkg ... foo
=> Package name is: foo
=> Input file is: foo.tcl
... -pkg ... foo bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
... -pkg ... foo.tcl
=> Package name is: foo
=> Input file is: foo.tcl
... -pkg ... foo.so bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
-showβ Prints the configuration of the chosen target tostdoutand then exits. Set-target, below. π-showallβ Prints the whole chosen configuration file tostdoutand then exits. See-config, above. π-targetname β Overrides the default choice of build target. Only the last occurrence of this option is used. The named target must exist in the chosen configuration file. Use-targets(see below) to get a list of the acceptable targets. Use-configto select the configuration file. π―
π« Ignored when generating a TEA package (see option -tea below).
-targetsβ Prints the list of all known targets from the chosen configuration file tostdoutand then exits. Use-configto select the configuration file. ποΈ-teaβ Like-pkg, except no binaries are generated. Creates a directory hierarchy containing the CriTcl script, its companion files, and a TEA-conformant build system with most of the needed support code, including copies of thecritclpackages. π΅
If both -pkg and -tea are specified the last occurrence wins.
-I, -L, -clean, -force, -cache, -includedir, -enable, -disable, and -with-FOO are ignored. In contrast, the option -libdir is relevant in both this and -pkg mode.
The basename of the first file is the name of the package to generate. If its file extension indicates a shared library (".so", ".sl", ".dylib", and ".dll") it is also removed from the set of input files. Each CriTcl script file is kept as part of the input. A single file without a suffix is assumed to be a CriTcl script. A file without a suffix, but other input files following is treated like the name of a shared library proper, and removed from the set of input files. π€
Examples:
... -tea ... foo
=> Package name is: foo
=> Input file is: foo.tcl
... -tea ... foo bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
... -tea ... foo.tcl
=> Package name is: foo
=> Input file is: foo.tcl
... -tea ... foo.so bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
-with-name value β This option sets the value of the custom build configuration option name to value.
The information is validated only if one of the ".critcl" input files actually defines and uses a custom build configuration option with that name.
π« Ignored when generating a TEA package (see option -tea below).
π PACKAGE STRUCTURE π
Okay bestie, so when critcl spits out a package, it doesn't just dump random files everywhere β it's got a whole little layout, and it's actually super organized. Here's the basic shape of what you get:
<TOP>
+- pkgIndex.tcl
+- critcl-rt.tcl
+- license.terms (optional)
|
+- tcl (optional)
| +- <tsources files>
|
+- <platform>
+- <shared library>
Notes β because obviously we're doing notes π
- The file
pkgIndex.tclis the standard package index file that Tcl's package management expects. It gets sourced during a search for packages, and it declares the package to Tcl along with its files and how to handle them. - The file
critcl-rt.tclis a helper file. It's holding the common code thatpkgIndex.tcluses to actually do its tasks. - The file
license.termsis optional β it only shows up if the.critclfile that the package was generated from used the commandcritcl::licenseto declare the package author and license. - Every file declared with the command
critcl::tsourcesgets dropped into the sub-directorytcl. - The shared library that critcl generates goes into a platform-specific sub-directory.
The whole structure β and especially that last point β is what lets us later merge the results (for the same package, and version) across multiple target platforms into one single directory structure, with zero conflict, just by copying the top directories over each other. The only files that could ever conflict live in the <TOP> and tcl directories, and for those we know they're identical across targets. So it's fine. It's giving "trust the process" energy β¨
And the result of a merge like that? It looks like this:
<TOP>
+- pkgIndex.tcl
+- critcl-rt.tcl
+- license.terms (optional)
|
+- tcl (optional)
| +- <tsources files>
|
+- <platform1>
| +- <shared library1>
+- <platform2>
| +- <shared library2>
...
+- <platformN>
+- <shared libraryN>
Look at that. Multi-platform. No conflict. Iconic. π₯
π AUTHORS π
The legends who made this happen:
- Jean Claude Wippler
- Steve Landers
- Andreas Kupries
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. It's software, bestie, we're all just doing our best π
So please, if you find something, report it here:
https://github.com/andreas-kupries/critcl/issues
And if you've got ideas for enhancements for either the package, the application, and/or the documentation β those are super welcome too, and they should go to the exact same place:
https://github.com/andreas-kupries/critcl/issues
One link. All the vibes. Drop your thoughts there. π«Ά
πΈ KEYWORDS πΈ
Just so you know what we're working with:
C code, Embedded C Code, calling C code from Tcl, code generator, compile & run, compiler, dynamic code generation, dynamic compilation, generate package, linker, on demand compilation, on-the-fly compilation
π CATEGORY π
Glueing/Embedded C code
β COPYRIGHT β
- Copyright (c) Jean-Claude Wippler
- Copyright (c) Steve Landers
- Copyright (c) 2011-2024 Andreas Kupries
And that's a wrap, bestie π This whole page is from the doc source, version 3.3.1, section critcl(1) β so if you're citing it or whatever, that's the receipts. Go compile something beautiful. Slay. π
π¦ where this page comes from
- debian trixie: critcl 3.3.1+dfsg-1 Β· BSD
- ubuntu questing: critcl 3.3.1+dfsg-1
- ubuntu resolute: critcl 3.3.1+dfsg-1build1 Β· BSD
- ubuntu stonking: critcl 3.3.1+dfsg-1.1 Β· BSD
- Copyright (c) 2011-2024 Andreas Kupries
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms