compilescript allows you to execute files from compiled languages as scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.3KB

compilescript allows you to execute files from compiled languages as scripts. By default it uses g++.

It compiles the source file, stores the binary in ${XDG_CACHE_HOME}/compilescript/ and executes it. If the binary in cache is newer than the source file, the compilation is skipped.

Usage

Use #!/usr/bin/env compilescript as shebang and write the compiler arguments in the second line with the prefix: //compilescript:.

You can delete old cache files with --cleanup.

Example

#!/usr/bin/env compilescript
//compilescript: -Wall -pedantic -Wextra

#include <iostream>

using std::cout;

int main(int argc, char *argv[])
{
    cout << "Hello world!\n";
    cout << argv[1] << '\n';
}

Configuration

The configuration file is in ${XDG_CONFIG_HOME}/compilescript.cfg. It will be generated on first run.

Example config

compiler = "g++";
clean_after_hours = 720;
cache_dir = "/home/user/.cache/compilescript";

Install

Gentoo

Gentoo ebuilds are available via my repository.

From source

Dependencies

Get sourcecode

Download the current release and copy xdgcfg into xdgcfg/.

If you clone from git, be sure to git submodule init and git submodule update afterwards. See the submodules article in the git book for further info.

Compile

mkdir build
cd build
cmake ..
make
make install

Contributing

Contributions are always welcome. You can submit them as pull requests or via email to tastytea@tastytea.de.

License & Copyright

Copyright © 2018 tastytea <tastytea@tastytea.de>.
License GPLv3: GNU GPL version 3 <https://www.gnu.org/licenses/gpl-3.0.html>.
This program comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.