1
0
Fork
You've already forked compila
0
📟 Compile, interpret and preprocess many programming languages with one command
  • Shell 98.5%
  • Makefile 1.2%
  • C 0.2%
2025年07月05日 22:27:09 +00:00
config feat: add support for the lisp filetype 2025年07月05日 22:27:09 +00:00
locale docs: update readme 2023年06月21日 21:35:14 +00:00
packaging docs: update brief descriptions 2025年07月02日 06:08:51 +00:00
spec test: add initial unit tests for the CLI 2025年06月12日 23:29:12 +00:00
test test: add initial unit tests for the CLI 2025年06月12日 23:29:12 +00:00
.gitignore test: add initial unit tests for the CLI 2025年06月12日 23:29:12 +00:00
.shellspec test: add initial unit tests for the CLI 2025年06月12日 23:29:12 +00:00
compila feat: add support for the lisp filetype 2025年07月05日 22:27:09 +00:00
LICENSE Initial commit 2022年03月07日 22:27:40 +00:00
make.sh build: add install script make.sh and wrapper Makefile 2023年06月21日 22:03:31 +00:00
Makefile build: add install script make.sh and wrapper Makefile 2023年06月21日 22:03:31 +00:00
README.md docs: update brief descriptions 2025年07月02日 06:08:51 +00:00
to-do.txt style: change comments to English, move to-do comments to a file, stash dead or commented out code 2023年06月21日 21:35:27 +00:00

Compila

Compile, interpret and preprocess many programming languages with one command

🚀 Installation

📦 From source
  • Dependencies:
  • Optional Dependencies:
    • The respective compilers/interpreters for each language. For example: gcc, python, rustc, luajit, etc.
git clone --filter=blob:none https://codeberg.org/tplasdio/compila.git
cd compila
INSTALL_CONFIGS=1 ./make.sh install # or
# make install INSTALL_CONFIGS=1

Run the make.sh as root for system-installation.

For uninstallation, run either ./make.sh uninstall or make uninstall.

Arch Linux or other pacman distros
curl -O https://codeberg.org/tplasdio/compila/raw/branch/main/packaging/PKGBUILD-git
PACMAN=yay makepkg -sip PKGBUILD-git # or your AUR helper

For uninstallation, run sudo pacman -Rsn compila-git.

Usage

compila file.c # Compile to binary
compila file.py # Compile to bytecode
compila -r file.c # Compile and run
compila -i file.py # Interpret
compila -ri file.py # Interpret or compile and run
compila -p file.m4.c # Preprocess a file
compila -pri file.m4.c # Preprocess and interpret or compile and run
compila -Tr file.c # Compile to a temporary autoremovable file and run
compila -t c file.cpp # Compile with a certain file type
compila -v file.c # Show command being run
compila -v file.c -- -O2 # Pass other arguments to the compiler/interpreter
compila -help # Show help

⚙ Configuration

This program basically just runs a source file with a given configuration script in $config/c/<filetype>.sh for compilers or $config/i/<filetype>.sh for interpreters. Also you can pass variables to those scripts from the $config/compilarc file.

For example to configure C compilation, you edit $config/c/c.sh:

#!/bin/sh
exec gcc "$FILE" -o "$BIN" $C_C_ARGS "$@" # ← you may change gcc for clang compiler

or the arguments in $config/compilarc:

export C_C_ARGS='-Ofast -std=c2x' # ← arguments passed to the compiler

Similarly, to configure a preprocessor like m4 you edit $config/p/m4.sh

#!/bin/sh
exec m4 "$IFILE" > "$OFILE"

The location of the $config directory is $XDG_CONFIG_HOME/compila or ~/.config/compila by default.

Note that for interpreters, if a shebang (e.g. #!/bin/sh) is found in the source file, then the file is given executable permission and run with said shebang instead of the configuration file.

💭 Similar

Managing multiple compilers or interpreters is a common capability of many IDEs or text editors, but I haven't found any standalone tool that decouples this and lets you run a simple command from the terminal, hence why I made this.

📝 License

GPLv3 or later