From f852b60b69996b0bca211ebdf04b0812dcfbc7d4 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 13 Mar 2021 23:12:50 +1300 Subject: [PATCH] pkg(gcc-10.2.0): Add c, c++ and D via gcc 10.2.0 --- packages/gcc/10.2.0/build.sh | 25 +++++++++++++++++++++++++ packages/gcc/10.2.0/compile | 25 +++++++++++++++++++++++++ packages/gcc/10.2.0/environment | 4 ++++ packages/gcc/10.2.0/metadata.json | 6 ++++++ packages/gcc/10.2.0/run | 6 ++++++ packages/gcc/10.2.0/test.c | 6 ++++++ packages/gcc/10.2.0/test.cpp | 6 ++++++ packages/gcc/10.2.0/test.d | 5 +++++ 8 files changed, 83 insertions(+) create mode 100755 packages/gcc/10.2.0/build.sh create mode 100644 packages/gcc/10.2.0/compile create mode 100644 packages/gcc/10.2.0/environment create mode 100644 packages/gcc/10.2.0/metadata.json create mode 100644 packages/gcc/10.2.0/run create mode 100644 packages/gcc/10.2.0/test.c create mode 100644 packages/gcc/10.2.0/test.cpp create mode 100644 packages/gcc/10.2.0/test.d diff --git a/packages/gcc/10.2.0/build.sh b/packages/gcc/10.2.0/build.sh new file mode 100755 index 0000000..942e4ac --- /dev/null +++ b/packages/gcc/10.2.0/build.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Put instructions to build your package in here +[[ -d "bin" ]] && exit 0 +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build obj + +cd build + +curl "https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz" -o gcc.tar.gz + +tar xzf gcc.tar.gz --strip-components=1 + +./contrib/download_prerequisites + +cd ../obj + +# === autoconf based === +../build/configure --prefix "$PREFIX" --enable-languages=c,c++,d --disable-multilib --disable-bootstrap + +make -j$(nproc) +make install -j$(nproc) +cd ../ +rm -rf build obj diff --git a/packages/gcc/10.2.0/compile b/packages/gcc/10.2.0/compile new file mode 100644 index 0000000..e83346d --- /dev/null +++ b/packages/gcc/10.2.0/compile @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Put instructions to compile source code, remove this file if the language does not require this stage + + +case "${PISTON_ALIAS}" in + gcc | c) + gcc -std=c11 $* -lm + ;; + g++ | c++ | cpp) + g++ -std=c++17 $* + ;; + gccgo | go) + gccgo $* + ;; + gdc | d) + gdc $* + ;; + *) + echo "How did you get here? (${PISTON_ALIAS})" + exit 1 + ;; +esac + +chmod +x a.out \ No newline at end of file diff --git a/packages/gcc/10.2.0/environment b/packages/gcc/10.2.0/environment new file mode 100644 index 0000000..780b668 --- /dev/null +++ b/packages/gcc/10.2.0/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH diff --git a/packages/gcc/10.2.0/metadata.json b/packages/gcc/10.2.0/metadata.json new file mode 100644 index 0000000..8f3e9b5 --- /dev/null +++ b/packages/gcc/10.2.0/metadata.json @@ -0,0 +1,6 @@ +{ + "language": "gcc", + "version": "10.2.0", + "aliases": ["c","g++","c++","cpp","gdc","d"], + "author": "Thomas Hobson " +} diff --git a/packages/gcc/10.2.0/run b/packages/gcc/10.2.0/run new file mode 100644 index 0000000..63e3443 --- /dev/null +++ b/packages/gcc/10.2.0/run @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime + +shift # Discard main filename +./a.out $* diff --git a/packages/gcc/10.2.0/test.c b/packages/gcc/10.2.0/test.c new file mode 100644 index 0000000..fafae75 --- /dev/null +++ b/packages/gcc/10.2.0/test.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("OK"); + return 0; +} \ No newline at end of file diff --git a/packages/gcc/10.2.0/test.cpp b/packages/gcc/10.2.0/test.cpp new file mode 100644 index 0000000..9d0499e --- /dev/null +++ b/packages/gcc/10.2.0/test.cpp @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("OK"); + return 0; +} \ No newline at end of file diff --git a/packages/gcc/10.2.0/test.d b/packages/gcc/10.2.0/test.d new file mode 100644 index 0000000..e74851d --- /dev/null +++ b/packages/gcc/10.2.0/test.d @@ -0,0 +1,5 @@ +import std.stdio; + +void main() { + writeln("OK"); +} \ No newline at end of file