diff --git a/packages/nasm/2.15.5/build.sh b/packages/nasm/2.15.5/build.sh new file mode 100755 index 0000000..1e1f4c3 --- /dev/null +++ b/packages/nasm/2.15.5/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Put instructions to build your package in here +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl -L "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.gz" -o nasm.tar.gz + +tar xzf nasm.tar.gz --strip-components=1 + +# === autoconf based === +./configure --prefix "$PREFIX" + +make -j$(nproc) +make install -j$(nproc) +cd ../ +rm -rf build diff --git a/packages/nasm/2.15.5/compile b/packages/nasm/2.15.5/compile new file mode 100644 index 0000000..a8fe6da --- /dev/null +++ b/packages/nasm/2.15.5/compile @@ -0,0 +1,21 @@ +#!/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 + nasm) + nasm -f elf32 -o binary.o $* + ld -m elf_i386 binary.o -o binary + ;; + nasm64) + nasm -f elf64 -o binary.o $* + ld -m elf_x86_64 binary.o -o binary + ;; + *) + echo "How did you get here? (${PISTON_ALIAS})" + exit 1 + ;; +esac + +chmod +x ./binary \ No newline at end of file diff --git a/packages/nasm/2.15.5/environment b/packages/nasm/2.15.5/environment new file mode 100644 index 0000000..780b668 --- /dev/null +++ b/packages/nasm/2.15.5/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/nasm/2.15.5/metadata.json b/packages/nasm/2.15.5/metadata.json new file mode 100644 index 0000000..e9d1507 --- /dev/null +++ b/packages/nasm/2.15.5/metadata.json @@ -0,0 +1,6 @@ +{ + "language": "nasm", + "version": "2.15.5", + "aliases": ["nasm64"], + "author": "Thomas Hobson " +} diff --git a/packages/nasm/2.15.5/run b/packages/nasm/2.15.5/run new file mode 100644 index 0000000..53a6099 --- /dev/null +++ b/packages/nasm/2.15.5/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +shift +./binary $* diff --git a/packages/nasm/2.15.5/test.nasm.asm b/packages/nasm/2.15.5/test.nasm.asm new file mode 100644 index 0000000..d1e5a57 --- /dev/null +++ b/packages/nasm/2.15.5/test.nasm.asm @@ -0,0 +1,16 @@ +SECTION .DATA +good: db 'OK',10 +txtlen: equ $-good + +SECTION .TEXT +GLOBAL _start + +_start: +mov eax,4 +mov ebx,1 +mov ecx,good +mov edx,txtlen +int 80h +mov eax,1 +mov ebx,0 +int 80h \ No newline at end of file diff --git a/packages/nasm/2.15.5/test.nasm64.asm b/packages/nasm/2.15.5/test.nasm64.asm new file mode 100644 index 0000000..20ea316 --- /dev/null +++ b/packages/nasm/2.15.5/test.nasm64.asm @@ -0,0 +1,18 @@ +SECTION .data + good: db "OK", 0x0 + txtlen: equ $ - good + +SECTION .text +GLOBAL _start + +_start: + ;sys_write + mov rax, 1 + mov rdi, 1 + mov rsi, good + mov rdx, txtlen + syscall + ;sys_exit + mov rax, 60 + mov rdi, 0 + syscall \ No newline at end of file