@datkt/konanc-config
v5.3.3
Published
Command line utility to read '*.kc' konanc config files to print compiler flags
Downloads
67
Readme
konanc-config
Command line utility to read *.kc
konanc config files to print compiler flags.
Installation
$ npm install @datkt/konanc-config -g
Latest Release
Prebuilt binaries for konanc-config
are available for download for Linux,
Windows, and macOS. They can be downloaded from the latest
release page.
Usage
usage: konanc-config: [-hDV] [options] <configs>
where options can be:
-h, --help Print this message
-D, --debug Enable debug output
-V, --version Print program version
-c, --cflags Print compiler flags
-r, --repos, --repositories Print repositories
-l, --libs, --libraries Print libraries
-p, --prefix=<path> Set repositories path prefix (default: 'node_modules/')
Enable debug output by using the '-D, --debug' flag or set the
'DEBUG=konanc-config' environment variable.
Report bugs to <https://github.com/datkt/konanc-config/issues>.
Example
$ konanc-config . --libraries --repos --cflags
-opt -r /home/werle/repos/datkt/konanc-config/node_modules/@datkt -l sodium/sodium -l tape/tape
where .
contains a file called package.kc
:
repo[] = "node_modules/@datkt"
cflags[] = -opt
require[] = sodium/sodium
library[] = sodium/sodium
library[] = tape/tape
Writing A Config File package.kc
Configuration files for the konanc-config
command are in INI or JSON
format. Any property can be defined, but currently, the command only
supports printing libraries, repositories, and compiler flags. The
konanc-config
command will recognize package.kc
files found in
directories by default.
Adding Libraries
A library that should be linked against can be expressed by defining the
library
variable. This intuitively maps to the -library
flag for the
konanc
command.
library = sodium
or multiple libraries
library[] = sodium
library[] = tape
Adding Repositories
A repository that should be used for searching library (.klib
) files
can be expressed by defining the repo
variable. This intuitively maps
to the -repo
flag for the konanc
command.
repo = "node_modules/@datkt/sodium"
or multiple repositories
repo[] = "node_modules/@datkt/sodium"
repo[] = "node_modules/@datkt/tape"
Adding Compiler Flags
Arbitrary compiler flags can be expressed by defining the cflags
variable.
cflags = -opt -verbose
or multiple compiler flags
cflags[] = -opt
cflags[] = -verbose
Requiring Dependency Configuration
Requiring a dependency configuration can be expressed by defining the
require
variable. Dependencies can be a fully qualified path or
relative to a repository.
require = "sodium/sodium"
repo = "./node_modules/@datkt"
or with multiple cependencies
require[] = "sodium/sodium"
require[] = "uint64be/uint64be"
Environment & Global Rariables
Every configuration file gets access to current environment variables
exposes to the program. Special __dirname
and __filename
free floating
variables give access to the directory name and file name of the
configuration file.
Printing konanc
flags
To print flags suitable for the konanc
command useful for
shell interpolation, invoke the konanc-config
command with any
combination of the supported flags found in the usage help. Short flags
can be used for brevity, like konanc-config -clr library.kc
, in place
of konanc-config library.kc --cflags --libraries --repos
.
Printing Library Flags
To print library flags, use -l
, --libs
, or --libraries
flags.
$ konanc-config library.kc --libs
Printing Repository Flags
To print repository flags, use -r
, --repos
, or --repositories
flags.
$ konanc-config library.kc --repos
Printing Compiler Flags
To print compiler flags, use -c
or --cflags
flags.
$ konanc-config library.kc --cflags
See Also
- https://github.com/pkgconf/pkgconf
- https://github.com/Distrotech/pkg-config
License
MIT