aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-06-13 18:28:40 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-06-13 18:28:40 +0300
commit1e0dac984294a514353f7b300b563ee810eb64c4 (patch)
tree62274434c0e6b972432efdb96c54505b440476c1
parenttrimbom8 -> trimbom (diff)
downloadlinux-home-1e0dac984294a514353f7b300b563ee810eb64c4.tar.gz
linux-home-1e0dac984294a514353f7b300b563ee810eb64c4.zip
add runc/runcpp functions
Diffstat (limited to '')
-rw-r--r--.bashrc38
1 files changed, 38 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
index 03ff1b3..97cc528 100644
--- a/.bashrc
+++ b/.bashrc
@@ -322,3 +322,41 @@ update_checksums_distr() {
verify_checksums() {
sha1sum --check "$checksums_path"
}
+
+runc() (
+ set -o errexit
+
+ local -a src_files
+ local src_file
+
+ for src_file in "$@"; do
+ src_files+=("$( realpath "$src_file" )")
+ done
+
+ local build_dir="$( mktemp -d )"
+ pushd "$build_dir" > /dev/null
+
+ set +o errexit
+
+ gcc -Wall -Wextra "${src_files[@]}" && ./a.exe
+ popd > /dev/null && rm -rf "$build_dir"
+)
+
+runcpp() (
+ set -o errexit
+
+ local -a src_files
+ local src_file
+
+ for src_file in "$@"; do
+ src_files+=("$( realpath "$src_file" )")
+ done
+
+ local build_dir="$( mktemp -d )"
+ pushd "$build_dir" > /dev/null
+
+ set +o errexit
+
+ g++ -std=c++14 -Wall -Wextra "${src_files[@]}" && ./a.exe
+ popd > /dev/null && rm -rf "$build_dir"
+)