diff --git a/packages/init b/packages/init new file mode 100755 index 0000000..2bf65cc --- /dev/null +++ b/packages/init @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +if [[ $# -lt 3 ]]; then + echo "Usage: $0 [name] [version] [source]" + echo "" + echo "Initializes an empty package" + exit 1 +fi + +NAME=$1 +VERSION=$2 +AUTHOR="$(git config user.name) <$(git config user.email)>" +SOURCE=$3 + +DIR=$NAME/$VERSION + +mkdir -p $DIR + +build_instructions(){ + echo 'PREFIX=$(realpath $(dirname $0))' + echo + echo 'mkdir -p build' + echo + echo 'cd build' + echo + echo "curl \"$SOURCE\" -o $NAME.tar.gz" + echo + echo "tar xzf $NAME.tar.gz --strip-components=1" + echo + + echo "# === autoconf based ===" + echo './configure --prefix "$PREFIX"' + echo + echo 'make -j$(nproc)' + echo 'make install -j$(nproc)' + + echo 'cd ../' + echo 'rm -rf build' + +} + +cd $DIR + +for name in build.sh environment run compile; do + echo "#!/usr/bin/env bash" > "$name" + echo "" >> "$name" +done + +echo "# Put instructions to build your package in here" >> build.sh +echo "" +build_instructions >> build.sh + +echo "# Put 'export' statements here for environment variables" >> environment +echo "export PATH=\$PWD/bin:\$PATH" >> environment + +echo "# Put instructions to run the runtime" >> run +echo "$NAME-$VERSION \$*" >> run + +echo "# Put instructions to compile source code, remove this file if the language does not require this stage" >> compile + +jq '.language = "'$NAME'" | .version = "'$VERSION'" | .aliases = [] | .author = "'"$AUTHOR"'"' <<< "{}" > metadata.json + +cd - > /dev/null + +echo $DIR \ No newline at end of file diff --git a/packages/java/15.0.2/build.sh b/packages/java/15.0.2/build.sh new file mode 100755 index 0000000..3d56ee0 --- /dev/null +++ b/packages/java/15.0.2/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Put instructions to build your package in here + +curl "https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz" -o java.tar.gz + +tar xzf java.tar.gz --strip-components=1 +rm java.tar.gz diff --git a/packages/java/15.0.2/environment b/packages/java/15.0.2/environment new file mode 100644 index 0000000..780b668 --- /dev/null +++ b/packages/java/15.0.2/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/java/15.0.2/metadata.json b/packages/java/15.0.2/metadata.json new file mode 100644 index 0000000..2f24706 --- /dev/null +++ b/packages/java/15.0.2/metadata.json @@ -0,0 +1,6 @@ +{ + "language": "java", + "version": "15.0.2", + "aliases": [], + "author": "Thomas Hobson " +} diff --git a/packages/java/15.0.2/run b/packages/java/15.0.2/run new file mode 100644 index 0000000..2215edd --- /dev/null +++ b/packages/java/15.0.2/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +java $* diff --git a/packages/java/15.0.2/test.java b/packages/java/15.0.2/test.java new file mode 100644 index 0000000..2dc0eaa --- /dev/null +++ b/packages/java/15.0.2/test.java @@ -0,0 +1,5 @@ +public class HelloWorld { + public static void main(String[] args) { + System.out.println("OK"); + } +} \ No newline at end of file