summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/uxn')
-rw-r--r--app-emulation/uxn/Manifest1
-rw-r--r--app-emulation/uxn/files/uxn-0_p20230609-build.sh.patch20
-rw-r--r--app-emulation/uxn/metadata.xml18
-rw-r--r--app-emulation/uxn/uxn-0_p20240304.ebuild72
-rw-r--r--app-emulation/uxn/uxn-9999.ebuild72
5 files changed, 183 insertions, 0 deletions
diff --git a/app-emulation/uxn/Manifest b/app-emulation/uxn/Manifest
new file mode 100644
index 000000000000..4d0cba24998c
--- /dev/null
+++ b/app-emulation/uxn/Manifest
@@ -0,0 +1 @@
+DIST uxn-0_p20240304.tar.gz 307083 BLAKE2B 2b3a556c5094fd777d82d75c87f721d1a9ea136334cdbc8553662281ae498beb79514e9e567e79b84a625b2fe60b486aa7f6892594cbd08abbbfeb4c9a50b2e9 SHA512 048e24e33de04913e03fbf1b242837dd1ad190f52ede16c302cf436399f0ee478afca545236dd438e03d8dfc29252478c2d79c9b6d3e8d34bb83c99f1930d026
diff --git a/app-emulation/uxn/files/uxn-0_p20230609-build.sh.patch b/app-emulation/uxn/files/uxn-0_p20230609-build.sh.patch
new file mode 100644
index 000000000000..a8b75458da43
--- /dev/null
+++ b/app-emulation/uxn/files/uxn-0_p20230609-build.sh.patch
@@ -0,0 +1,20 @@
+--- a/build.sh
++++ b/build.sh
+@@ -52,7 +52,7 @@ fi
+
+ mkdir -p bin
+ CC="${CC:-cc}"
+-CFLAGS="${CFLAGS:--std=c89 -Wall -Wno-unknown-pragmas}"
++CFLAGS="${CFLAGS} --std=c89 "
+ case "$(uname -s 2>/dev/null)" in
+ MSYS_NT*|MINGW*) # MSYS2 on Windows
+ FILE_LDFLAGS="-liberty"
+@@ -77,7 +77,7 @@ then
+ echo "[debug]"
+ CFLAGS="${CFLAGS} -DDEBUG -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined"
+ else
+- CFLAGS="${CFLAGS} -DNDEBUG -O2 -g0 -s"
++ CFLAGS="${CFLAGS} -DNDEBUG "
+ fi
+
+ ${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
diff --git a/app-emulation/uxn/metadata.xml b/app-emulation/uxn/metadata.xml
new file mode 100644
index 000000000000..825e9e0f54aa
--- /dev/null
+++ b/app-emulation/uxn/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+
+<pkgmetadata>
+ <maintainer type="person">
+ <email>xgqt@gentoo.org</email>
+ <name>Maciej Barć</name>
+ </maintainer>
+ <longdescription>
+ Uxn is a virtual machine with 32 instructions. This one-page computer is
+ capable of hosting small applications, programmable in a unique language.
+ It was designed with an implementation-first mindset with a focus on
+ creating portable tools and games.
+ </longdescription>
+ <upstream>
+ <remote-id type="sourcehut">~rabbits/uxn</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/uxn/uxn-0_p20240304.ebuild b/app-emulation/uxn/uxn-0_p20240304.ebuild
new file mode 100644
index 000000000000..8e63625c852d
--- /dev/null
+++ b/app-emulation/uxn/uxn-0_p20240304.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="An assembler and emulator for the Uxn stack-machine, written in ANSI C"
+HOMEPAGE="https://wiki.xxiivv.com/site/uxn.html
+ https://git.sr.ht/~rabbits/uxn/"
+
+if [[ "${PV}" == *9999* ]] ; then
+ inherit git-r3
+
+ EGIT_REPO_URI="https://git.sr.ht/~rabbits/${PN}"
+elif [[ "${PV}" == *_p20240304 ]] ; then
+ COMMIT=e7c25fad05850f0e577fc83a140405ca6ccd93c2
+ SRC_URI="https://git.sr.ht/~rabbits/${PN}/archive/${COMMIT}.tar.gz
+ -> ${P}.tar.gz"
+ S="${WORKDIR}/uxn-${COMMIT}"
+
+ KEYWORDS="amd64 ~x86"
+else
+ die "wrong package version (PV), please update the ebuild, given: ${PV}"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+
+RDEPEND="
+ media-libs/libsdl2:=
+"
+DEPEND="
+ ${RDEPEND}
+"
+
+PATCHES=(
+ "${FILESDIR}/uxn-0_p20230609-build.sh.patch"
+)
+
+src_compile() {
+ CC="$(tc-getCC)" CFLAGS="${CFLAGS} ${LDFLAGS}" \
+ ./build.sh --no-run \
+ || die "building with \"build.sh\" failed"
+
+ # Fails to assemble via following loop.
+ # Possibly not mean to be assembled by hand.
+ rm -rf ./projects/library ./projects/software/{asma,launcher}.tal || die
+
+ local tal_file
+ local tal_file_base
+
+ while read -r tal_file ; do
+ tal_file_base="$(basename "${tal_file}" .tal)"
+
+ ebegin "Assembling ROM ${tal_file_base}"
+ bin/uxnasm "${tal_file}" "$(dirname "${tal_file}")/${tal_file_base}.rom"
+ eend ${?} || die "failed to assemble ${tal_file}"
+ done \
+ < <(find projects -type f -name "*.tal")
+}
+
+src_install() {
+ insinto /usr/bin
+ doins bin/uxn{asm,cli,emu}
+ fperms 0755 /usr/bin/uxn{asm,cli,emu}
+
+ insinto /usr/share/uxn
+ doins -r projects
+
+ einstalldocs
+}
diff --git a/app-emulation/uxn/uxn-9999.ebuild b/app-emulation/uxn/uxn-9999.ebuild
new file mode 100644
index 000000000000..ef6e9fc2dafe
--- /dev/null
+++ b/app-emulation/uxn/uxn-9999.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="An assembler and emulator for the Uxn stack-machine, written in ANSI C"
+HOMEPAGE="https://wiki.xxiivv.com/site/uxn.html
+ https://git.sr.ht/~rabbits/uxn/"
+
+if [[ "${PV}" == *9999* ]] ; then
+ inherit git-r3
+
+ EGIT_REPO_URI="https://git.sr.ht/~rabbits/${PN}"
+elif [[ "${PV}" == *_p20240304 ]] ; then
+ COMMIT=e7c25fad05850f0e577fc83a140405ca6ccd93c2
+ SRC_URI="https://git.sr.ht/~rabbits/${PN}/archive/${COMMIT}.tar.gz
+ -> ${P}.tar.gz"
+ S="${WORKDIR}/uxn-${COMMIT}"
+
+ KEYWORDS="~amd64 ~x86"
+else
+ die "wrong package version (PV), please update the ebuild, given: ${PV}"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+
+RDEPEND="
+ media-libs/libsdl2:=
+"
+DEPEND="
+ ${RDEPEND}
+"
+
+PATCHES=(
+ "${FILESDIR}/uxn-0_p20230609-build.sh.patch"
+)
+
+src_compile() {
+ CC="$(tc-getCC)" CFLAGS="${CFLAGS} ${LDFLAGS}" \
+ ./build.sh --no-run \
+ || die "building with \"build.sh\" failed"
+
+ # Fails to assemble via following loop.
+ # Possibly not mean to be assembled by hand.
+ rm -rf ./projects/library ./projects/software/{asma,launcher}.tal || die
+
+ local tal_file
+ local tal_file_base
+
+ while read -r tal_file ; do
+ tal_file_base="$(basename "${tal_file}" .tal)"
+
+ ebegin "Assembling ROM ${tal_file_base}"
+ bin/uxnasm "${tal_file}" "$(dirname "${tal_file}")/${tal_file_base}.rom"
+ eend ${?} || die "failed to assemble ${tal_file}"
+ done \
+ < <(find projects -type f -name "*.tal")
+}
+
+src_install() {
+ insinto /usr/bin
+ doins bin/uxn*
+ fperms 0755 /usr/bin/uxn*
+
+ insinto /usr/share/uxn
+ doins -r projects
+
+ einstalldocs
+}