git: 33c6ac9ae8a5 - main - emulators/tic-80: fantasy game console

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Thu, 11 May 2023 23:26:35 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=33c6ac9ae8a51f177940f5e15c2d8ebedc594b06

commit 33c6ac9ae8a51f177940f5e15c2d8ebedc594b06
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-05-09 19:47:54 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-05-11 23:23:29 +0000

    emulators/tic-80: fantasy game console
    
    TIC-80 is a free and open source fantasy computer for making, playing
    and sharing tiny games.
    
    With TIC-80 you get built-in tools for development: code, sprites, maps,
    sound editors and the command line, which is enough to create a mini
    retro game.
    
    Games are packaged into a cartridge file, which can be easily
    distributed. TIC-80 works on all popular platforms.  This means your
    cartridge can be played in any device.
    
    To make a retro styled game, the whole process of creation and execution
    takes place under some technical limitations: 240x136 pixel display,
    16 color palette, 256 8x8 color sprites, 4 channel sound, etc.
    
    WWW: https://tic-80.com
---
 emulators/Makefile                          |   1 +
 emulators/tic-80/Makefile                   |  64 +++++
 emulators/tic-80/distinfo                   |  21 ++
 emulators/tic-80/files/patch-CMakeLists.txt | 404 ++++++++++++++++++++++++++++
 emulators/tic-80/pkg-descr                  |  14 +
 emulators/tic-80/pkg-plist                  |   4 +
 6 files changed, 508 insertions(+)

diff --git a/emulators/Makefile b/emulators/Makefile
index e92d780dab21..199e93be0199 100644
--- a/emulators/Makefile
+++ b/emulators/Makefile
@@ -134,6 +134,7 @@
     SUBDIR += stella
     SUBDIR += stonx
     SUBDIR += teo
+    SUBDIR += tic-80
     SUBDIR += tiemu3
     SUBDIR += tilem
     SUBDIR += tme
diff --git a/emulators/tic-80/Makefile b/emulators/tic-80/Makefile
new file mode 100644
index 000000000000..aef7b6644073
--- /dev/null
+++ b/emulators/tic-80/Makefile
@@ -0,0 +1,64 @@
+PORTNAME=	TIC-80
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.0.2164
+CATEGORIES=	emulators games
+
+MAINTAINER=	fuz@FreeBSD.org
+COMMENT=	Fantasy game console
+WWW=		https://tic80.com
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libasound.so:audio/alsa-lib \
+		libdbus-1.so:devel/dbus \
+		libduktape.so:lang/duktape-lib \
+		libgif.so:graphics/giflib \
+		libhttp_parser.so:www/http-parser \
+		libinotify.so:devel/libinotify \
+		libpng16.so:graphics/png \
+		libsquirrel.so:lang/squirrel \
+		libunwind.so:devel/libunwind \
+		libuv.so:devel/libuv
+
+USES=		cmake desktop-file-utils gl localbase:ldflags lua:53 pkgconfig sdl
+USE_GITHUB=	yes
+GH_ACCOUNT=	nesbox
+GH_TUPLE=	nesbox:blip-buf:330226d9b55ecbeea644e17b5e0f096a165ca07e:blip_buf/vendor/blip-buf \
+		tronkko:dirent:c885633e126a3a949ec0497273ec13e2c03e862c:dirent/vendor/dirent \
+		wren-lang:wren:4a18fc489f9ea3d253b20dd40f4cdad0d6bb40eb:wren/vendor/wren \
+		kuba--:zip:d7df626f3aa457e01669f65e61bf8f484e352941:zip/vendor/zip \
+		nesbox:moonscript:17179283012b392bff972ad66231d73bfeec6e90:moonscript/vendor/moonscript \
+		cofyc:argparse:0d5f5d0745df14a3f373f7eed85bf524714f4524:argparse/vendor/argparse \
+		wasm3:wasm3:a3abb3f2d320994be59dfbe2cdafa8d0b6a8253e:wasm3/vendor/wasm3 \
+		nesbox:lpeg:73d8614a8dea404cf7bfe25a6e4cea7183dc9fb7:lpeg/vendor/lpeg
+USE_GL=		gl glu glut
+USE_SDL=	sdl2
+
+# unbundled succesfully
+#		albertodemichelis:squirrel:9dcf74f99097898dd5a111c4a55b89d1c4d606c0:squirrel/vendor/squirrel
+#		svaarala:duktape-releases:28f915a5381ca3a7dfa22130d08fbc5a16ae5d2f:duktape/vendor/duktape
+#		lua:lua:75ea9ccbea7c4886f30da147fb67b693b2624c26:lua/vendor/lua
+#		madler:zlib:cacf7f1d4e3d44d871b605da3b647f07d718623f:zlib/vendor/zlib
+#		nesbox:giflib:1aa11b06d0025eda77b56aec8254130654d4397b:giflib/vendor/giflib
+#		libuv:libuv:9c3d692b3941a2a4171629fb52af2e1029c415e8:libuv/vendor/libuv
+#		nodejs:http-parser:ec8b5ee63f0e51191ea43bb0c6eac7bfbff3141d:http_parser/vendor/http-parser
+#		glennrp:libpng:dbe3e0c43e549a1602286144d94b0666549b18e6:libpng/vendor/libpng
+#		libsdl-org:SDL:b424665e0899769b200231ba943353a5fee1b6b6:sdl2/vendor/sdl2
+
+# not actually needed
+#		smuehlst:circle-stdlib:fdb3c4a948421d47fddab8042a92f980cba43915:circle_stdlib/vendor/circle-stdlib
+#		floooh:sokol:487822d82ca79dba7b67718d962e1ba6beef01b2:sokol/vendor/sokol
+#		grimfang4:sdl-gpu:e3d350b325a0e0d0b3007f69ede62313df46c6ef:sdl_gpu/vendor/sdl-gpu
+#		mruby:mruby:0f45836b5954accf508f333f932741b925214471:mruby/vendor/mruby
+
+# the demo carts are built, but don't seem to end up being installed
+# mruby: to be decided later; not essential
+CMAKE_OFF=	BUILD_DEMO_CARTS BUILD_WITH_MRUBY BUILD_LIBRETRO
+CMAKE_ARGS=	-DLPEG_LIBRARY:STRING=${LUA_REFMODLIBDIR}/lpeg.so
+
+OPTIONS_DEFINE=	PRO
+PRO_DESC=	Build PRO Version
+PRO_CMAKE_BOOL=	BUILD_PRO
+
+.include <bsd.port.mk>
diff --git a/emulators/tic-80/distinfo b/emulators/tic-80/distinfo
new file mode 100644
index 000000000000..e098f685e1b6
--- /dev/null
+++ b/emulators/tic-80/distinfo
@@ -0,0 +1,21 @@
+TIMESTAMP = 1683662963
+SHA256 (nesbox-TIC-80-v1.0.2164_GH0.tar.gz) = 26d0bbb45f190179f37169a7c2a32382844bafaf9b927d63c951bdf2f68f3414
+SIZE (nesbox-TIC-80-v1.0.2164_GH0.tar.gz) = 829743
+SHA256 (nesbox-blip-buf-330226d9b55ecbeea644e17b5e0f096a165ca07e_GH0.tar.gz) = e86870ecb4b7c3feac6afbf5ddd0aff809e14b2d16d9bde251b712fd4ecd6d99
+SIZE (nesbox-blip-buf-330226d9b55ecbeea644e17b5e0f096a165ca07e_GH0.tar.gz) = 51181
+SHA256 (tronkko-dirent-c885633e126a3a949ec0497273ec13e2c03e862c_GH0.tar.gz) = aab1f1d02c3148a3d49a18b8de878603263e62e4a48622121efec92e5b40710b
+SIZE (tronkko-dirent-c885633e126a3a949ec0497273ec13e2c03e862c_GH0.tar.gz) = 21182
+SHA256 (nesbox-giflib-1aa11b06d0025eda77b56aec8254130654d4397b_GH0.tar.gz) = 0061d8b362e1edce6d47c2cf6df218c3d7d4494bacae98d2f0552b8bb1ebc319
+SIZE (nesbox-giflib-1aa11b06d0025eda77b56aec8254130654d4397b_GH0.tar.gz) = 411816
+SHA256 (nesbox-lpeg-73d8614a8dea404cf7bfe25a6e4cea7183dc9fb7_GH0.tar.gz) = 600d8644b51e5cb4d628627cd430d7beccf1d5af72a2844270983c85563de3a4
+SIZE (nesbox-lpeg-73d8614a8dea404cf7bfe25a6e4cea7183dc9fb7_GH0.tar.gz) = 71088
+SHA256 (wren-lang-wren-4a18fc489f9ea3d253b20dd40f4cdad0d6bb40eb_GH0.tar.gz) = fb885f12767ea8b1101145b9d86735995e28c5298b712c1c3f71ed9bbf17f567
+SIZE (wren-lang-wren-4a18fc489f9ea3d253b20dd40f4cdad0d6bb40eb_GH0.tar.gz) = 1810731
+SHA256 (kuba---zip-d7df626f3aa457e01669f65e61bf8f484e352941_GH0.tar.gz) = f121ff9a6df3414afe958c341c0e3f05d638e43e3be735a9dad8d05ce9322c49
+SIZE (kuba---zip-d7df626f3aa457e01669f65e61bf8f484e352941_GH0.tar.gz) = 114635
+SHA256 (nesbox-moonscript-17179283012b392bff972ad66231d73bfeec6e90_GH0.tar.gz) = 10f0ebf82ae92a1389d353b349bef25deea594aebb3a65d09f36cd1193d7de18
+SIZE (nesbox-moonscript-17179283012b392bff972ad66231d73bfeec6e90_GH0.tar.gz) = 192909
+SHA256 (cofyc-argparse-0d5f5d0745df14a3f373f7eed85bf524714f4524_GH0.tar.gz) = b14cfe4b95a4cd1cf148eeecf0dba94ebf5b4312de12f5f5254e7040017477f1
+SIZE (cofyc-argparse-0d5f5d0745df14a3f373f7eed85bf524714f4524_GH0.tar.gz) = 10152
+SHA256 (wasm3-wasm3-a3abb3f2d320994be59dfbe2cdafa8d0b6a8253e_GH0.tar.gz) = 6a6d988a60f37caa24b997a6510229c4e89fce07aa666413da6ed9814ac0463f
+SIZE (wasm3-wasm3-a3abb3f2d320994be59dfbe2cdafa8d0b6a8253e_GH0.tar.gz) = 2575346
diff --git a/emulators/tic-80/files/patch-CMakeLists.txt b/emulators/tic-80/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..edf75cac6331
--- /dev/null
+++ b/emulators/tic-80/files/patch-CMakeLists.txt
@@ -0,0 +1,404 @@
+--- CMakeLists.txt.orig	2022-05-02 07:31:14 UTC
++++ CMakeLists.txt
+@@ -14,7 +14,6 @@ if(CMAKE_BUILD_TYPE)
+     string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC)
+ endif()
+ 
+-find_package(Git)
+ if(Git_FOUND)
+     execute_process(
+         COMMAND ${GIT_EXECUTABLE} status
+@@ -155,51 +154,13 @@ set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/vendor)
+ 
+ include(ExternalProject)
+ 
++find_package(PkgConfig)
+ ################################
+ # LUA
+ ################################
+ 
+-set(LUA_DIR ${THIRDPARTY_DIR}/lua)
+-set(LUA_SRC
+-    ${LUA_DIR}/lapi.c
+-    ${LUA_DIR}/lcode.c
+-    ${LUA_DIR}/lctype.c
+-    ${LUA_DIR}/ldebug.c
+-    ${LUA_DIR}/ldo.c
+-    ${LUA_DIR}/ldump.c
+-    ${LUA_DIR}/lfunc.c
+-    ${LUA_DIR}/lgc.c
+-    ${LUA_DIR}/llex.c
+-    ${LUA_DIR}/lmem.c
+-    ${LUA_DIR}/lobject.c
+-    ${LUA_DIR}/lopcodes.c
+-    ${LUA_DIR}/lparser.c
+-    ${LUA_DIR}/lstate.c
+-    ${LUA_DIR}/lstring.c
+-    ${LUA_DIR}/ltable.c
+-    ${LUA_DIR}/ltm.c
+-    ${LUA_DIR}/lundump.c
+-    ${LUA_DIR}/lvm.c
+-    ${LUA_DIR}/lzio.c
+-    ${LUA_DIR}/lauxlib.c
+-    ${LUA_DIR}/lbaselib.c
+-    ${LUA_DIR}/lcorolib.c
+-    ${LUA_DIR}/ldblib.c
+-    ${LUA_DIR}/liolib.c
+-    ${LUA_DIR}/lmathlib.c
+-    ${LUA_DIR}/loslib.c
+-    ${LUA_DIR}/lstrlib.c
+-    ${LUA_DIR}/ltablib.c
+-    ${LUA_DIR}/lutf8lib.c
+-    ${LUA_DIR}/loadlib.c
+-    ${LUA_DIR}/linit.c
+-)
++pkg_check_modules(LUA REQUIRED lua-5.3 IMPORTED_TARGET GLOBAL)
+ 
+-add_library(lua STATIC ${LUA_SRC})
+-
+-target_compile_definitions(lua PRIVATE LUA_COMPAT_5_2)
+-target_include_directories(lua INTERFACE ${THIRDPARTY_DIR}/lua)
+-
+ if(N3DS)
+     target_compile_definitions(lua PUBLIC LUA_32BITS)
+ endif()
+@@ -218,7 +179,7 @@ set(LPEG_SRC
+ )
+ 
+ add_library(lpeg STATIC ${LPEG_SRC})
+-target_include_directories(lpeg PRIVATE ${LUA_DIR})
++target_include_directories(lpeg PRIVATE ${LUA_INCLUDE_DIRS})
+ 
+ ################################
+ # WREN
+@@ -335,59 +296,11 @@ target_include_directories(wasm PUBLIC ${THIRDPARTY_DI
+ #target_include_directories(wasm PRIVATE ${THIRDPARTY_DIR}/wasm3/src/optional)
+ #target_include_directories(wasm PRIVATE ${THIRDPARTY_DIR}/wasm3/src/vm)
+ 
+-
+ ################################
+-# SQUIRREL
+-################################
+-
+-set(SQUIRREL_DIR ${THIRDPARTY_DIR}/squirrel)
+-set(SQUIRREL_SRC
+-    ${SQUIRREL_DIR}/squirrel/sqapi.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqbaselib.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqclass.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqcompiler.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqdebug.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqfuncstate.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqlexer.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqmem.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqobject.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqstate.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqtable.cpp
+-    ${SQUIRREL_DIR}/squirrel/sqvm.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdaux.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdblob.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdio.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdmath.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdrex.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdstream.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdstring.cpp
+-    ${SQUIRREL_DIR}/sqstdlib/sqstdsystem.cpp
+-)
+-
+-add_library(squirrel STATIC ${SQUIRREL_SRC})
+-set_target_properties(squirrel PROPERTIES LINKER_LANGUAGE CXX)
+-target_include_directories(squirrel PUBLIC ${SQUIRREL_DIR}/include)
+-target_include_directories(squirrel PRIVATE ${SQUIRREL_DIR}/squirrel)
+-target_include_directories(squirrel PRIVATE ${SQUIRREL_DIR}/sqstdlib)
+-
+-################################
+ # GIFLIB
+ ################################
+ 
+-set(GIFLIB_DIR ${THIRDPARTY_DIR}/giflib)
+-set(GIFLIB_SRC
+-    ${GIFLIB_DIR}/dgif_lib.c
+-    ${GIFLIB_DIR}/egif_lib.c
+-    ${GIFLIB_DIR}/gif_err.c
+-    ${GIFLIB_DIR}/gif_font.c
+-    ${GIFLIB_DIR}/gif_hash.c
+-    ${GIFLIB_DIR}/gifalloc.c
+-    ${GIFLIB_DIR}/openbsd-reallocarray.c
+-)
+-add_library(giflib STATIC ${GIFLIB_SRC})
+-target_include_directories(giflib
+-    PRIVATE ${GIFLIB_DIR}
+-    INTERFACE ${THIRDPARTY_DIR}/giflib)
++find_package(GIF REQUIRED)
+ 
+ ################################
+ # Blipbuf
+@@ -397,13 +310,6 @@ add_library(blipbuf STATIC ${THIRDPARTY_DIR}/blip-buf/
+ target_include_directories(blipbuf INTERFACE ${THIRDPARTY_DIR}/blip-buf)
+ 
+ ################################
+-# Duktape
+-################################
+-
+-add_library(duktape STATIC ${THIRDPARTY_DIR}/duktape/src/duktape.c)
+-target_include_directories(duktape INTERFACE ${THIRDPARTY_DIR}/duktape/src)
+-
+-################################
+ # TIC-80 core
+ ################################
+ 
+@@ -440,19 +346,21 @@ macro(MACRO_CORE SCRIPT DEFINE BUILD_DEPRECATED)
+         PRIVATE
+             ${THIRDPARTY_DIR}/moonscript
+             ${THIRDPARTY_DIR}/fennel
++            ${LUA_INCLUDE_DIRS}
+         PUBLIC
+             ${CMAKE_SOURCE_DIR}/include
+             ${CMAKE_SOURCE_DIR}/src)
+ 
+     target_link_libraries(tic80core${SCRIPT}
+-        lua 
+         lpeg 
++        ${LUA_LIBRARIES} 
+         wren 
+         wasm 
++        sqstdlib 
+         squirrel 
+         duktape 
+         blipbuf 
+-        zlib
++        z
+     )
+ 
+     if(BUILD_WITH_MRUBY)
+@@ -461,7 +369,7 @@ macro(MACRO_CORE SCRIPT DEFINE BUILD_DEPRECATED)
+ 
+     if(${BUILD_DEPRECATED})
+         target_compile_definitions(tic80core${SCRIPT} PRIVATE BUILD_DEPRECATED)
+-        target_link_libraries(tic80core${SCRIPT} giflib)
++        target_link_libraries(tic80core${SCRIPT} ${GIF_LIBRARIES})
+     endif()
+ 
+     if(LINUX)
+@@ -498,6 +406,8 @@ endif()
+ ################################
+ if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI)
+ 
++    find_package(SDL2 REQUIRED)
++
+     if(WIN32)
+         set(HAVE_LIBC TRUE)
+     endif()
+@@ -507,10 +417,6 @@ if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI)
+         set(SDL_STATIC_PIC ON CACHE BOOL "" FORCE)
+     endif()
+ 
+-    set(SDL_SHARED OFF CACHE BOOL "" FORCE)
+-
+-    add_subdirectory(${THIRDPARTY_DIR}/sdl2)
+-
+ endif()
+ 
+ ################################
+@@ -531,7 +437,7 @@ if(BUILD_SDL AND BUILD_PLAYER AND NOT RPI)
+         target_link_options(player-sdl PRIVATE -static)
+     endif()
+ 
+-    target_link_libraries(player-sdl tic80core SDL2-static SDL2main)
++    target_link_libraries(player-sdl tic80core ${SDL2_LIBRARIES})
+ endif()
+ 
+ ################################
+@@ -657,34 +563,8 @@ endif()
+ # ZLIB
+ ################################
+ 
+-if (NOT N3DS)
++find_package(ZLIB)
+ 
+-set(ZLIB_DIR ${THIRDPARTY_DIR}/zlib)
+-set(ZLIB_SRC
+-    ${ZLIB_DIR}/adler32.c
+-    ${ZLIB_DIR}/compress.c
+-    ${ZLIB_DIR}/crc32.c
+-    ${ZLIB_DIR}/deflate.c
+-    ${ZLIB_DIR}/inflate.c
+-    ${ZLIB_DIR}/infback.c
+-    ${ZLIB_DIR}/inftrees.c
+-    ${ZLIB_DIR}/inffast.c
+-    ${ZLIB_DIR}/trees.c
+-    ${ZLIB_DIR}/uncompr.c
+-    ${ZLIB_DIR}/zutil.c
+-)
+-
+-add_library(zlib STATIC ${ZLIB_SRC})
+-target_include_directories(zlib INTERFACE ${THIRDPARTY_DIR}/zlib)
+-
+-else ()
+-
+-add_library(zlib STATIC IMPORTED)
+-set_target_properties( zlib PROPERTIES IMPORTED_LOCATION ${DEVKITPRO}/portlibs/3ds/lib/libz.a )
+-target_include_directories(zlib INTERFACE ${DEVKITPRO}/portlibs/3ds/include)
+-
+-endif ()
+-
+ ################################
+ # ZIP
+ ################################
+@@ -693,6 +573,12 @@ set(CMAKE_DISABLE_TESTING ON CACHE BOOL "" FORCE)
+ add_subdirectory(${THIRDPARTY_DIR}/zip)
+ 
+ ################################
++# PNG
++################################
++
++find_package(PNG REQUIRED)
++
++################################
+ # bin2txt cart2prj prj2cart xplode wasmp2cart
+ ################################
+ 
+@@ -713,7 +599,7 @@ if(BUILD_DEMO_CARTS)
+     target_link_libraries(wasmp2cart tic80core)
+ 
+     add_executable(bin2txt ${TOOLS_DIR}/bin2txt.c)
+-    target_link_libraries(bin2txt zlib)
++    target_link_libraries(bin2txt z)
+ 
+     add_executable(xplode
+         ${TOOLS_DIR}/xplode.c
+@@ -722,7 +608,7 @@ if(BUILD_DEMO_CARTS)
+         ${CMAKE_SOURCE_DIR}/src/studio/project.c)
+ 
+     target_include_directories(xplode PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include)
+-    target_link_libraries(xplode tic80core png giflib)
++    target_link_libraries(xplode tic80core PNG::PNG ${GIF_LIBRARIES})
+ 
+     if(LINUX)
+         target_link_libraries(xplode m)
+@@ -803,54 +689,9 @@ target_include_directories(argparse INTERFACE ${THIRDP
+ # libuv
+ ################################
+ 
+-if(USE_LIBUV)
+-    add_subdirectory(${THIRDPARTY_DIR}/libuv)
+-endif()
++pkg_check_modules(LIBUV REQUIRED libuv)
+ 
+ ################################
+-# HTTP parser
+-################################
+-
+-if(USE_LIBUV)
+-    add_library(http_parser STATIC ${THIRDPARTY_DIR}/http-parser/http_parser.c)
+-    target_include_directories(http_parser INTERFACE ${THIRDPARTY_DIR}/http-parser)
+-endif()
+-
+-################################
+-# PNG
+-################################
+-
+-set(LIBPNG_DIR ${THIRDPARTY_DIR}/libpng)
+-set(LIBPNG_SRC
+-    ${LIBPNG_DIR}/png.c
+-    ${LIBPNG_DIR}/pngerror.c
+-    ${LIBPNG_DIR}/pngget.c
+-    ${LIBPNG_DIR}/pngmem.c
+-    ${LIBPNG_DIR}/pngpread.c
+-    ${LIBPNG_DIR}/pngread.c
+-    ${LIBPNG_DIR}/pngrio.c
+-    ${LIBPNG_DIR}/pngrtran.c
+-    ${LIBPNG_DIR}/pngrutil.c
+-    ${LIBPNG_DIR}/pngset.c
+-    ${LIBPNG_DIR}/pngtrans.c
+-    ${LIBPNG_DIR}/pngwio.c
+-    ${LIBPNG_DIR}/pngwrite.c
+-    ${LIBPNG_DIR}/pngwtran.c
+-    ${LIBPNG_DIR}/pngwutil.c
+-)
+-
+-configure_file(${LIBPNG_DIR}/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
+-
+-add_library(png STATIC ${LIBPNG_SRC})
+-
+-target_compile_definitions(png PRIVATE PNG_ARM_NEON_OPT=0)
+-
+-target_include_directories(png
+-    PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
+-    PRIVATE ${THIRDPARTY_DIR}/zlib
+-    INTERFACE ${THIRDPARTY_DIR}/libpng)
+-
+-################################
+ # TIC-80 studio
+ ################################
+ 
+@@ -894,13 +735,13 @@ if(WIN32)
+     target_include_directories(tic80studio PRIVATE ${THIRDPARTY_DIR}/dirent/include)
+ endif()
+ 
+-target_include_directories(tic80studio PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
++target_include_directories(tic80studio PUBLIC ${CMAKE_CURRENT_BINARY_DIR} PRIVATE ${LUA_INCLUDE_DIRS})
+ 
+-target_link_libraries(tic80studio tic80core zip wave_writer argparse giflib png)
++target_link_libraries(tic80studio tic80core zip wave_writer argparse ${GIF_LIBRARIES} PNG::PNG)
+ 
+ if(USE_LIBUV)
+     target_compile_definitions(tic80studio PRIVATE USE_LIBUV)
+-    target_link_libraries(tic80studio uv_a http_parser)
++    target_link_libraries(tic80studio ${LIBUV_LIBRARIES} http_parser)
+ endif()
+ 
+ if(BUILD_PRO)
+@@ -982,7 +823,7 @@ if(ANDROID)
+ endif()
+ 
+ if(NOT EMSCRIPTEN)
+-    target_link_libraries(sdlgpu SDL2-static)
++    target_link_libraries(sdlgpu ${SDL2_LIBRARIES})
+ endif()
+ 
+ endif()
+@@ -1028,7 +869,7 @@ if(BUILD_SDL)
+         endif()
+ 
+     elseif(NOT ANDROID)
+-        target_link_libraries(tic80 SDL2main)
++        target_link_libraries(tic80 ${SDL2_LIBRARIES})
+     endif()
+ 
+     target_link_libraries(tic80 tic80studio)
+@@ -1050,7 +891,7 @@ if(BUILD_SDL)
+         elseif(RPI)
+             target_link_libraries(tic80 libSDL2.a bcm_host)
+         else()
+-            target_link_libraries(tic80 SDL2-static)
++            target_link_libraries(tic80 ${SDL2_LIBRARIES})
+         endif()
+     endif()
+ 
+@@ -1121,7 +962,7 @@ if(N3DS)
+         ${CMAKE_SOURCE_DIR}/src)
+ 
+     target_link_directories(tic80_n3ds PRIVATE ${DEVKITPRO}/libctru/lib ${DEVKITPRO}/portlibs/3ds/lib)
+-    target_link_libraries(tic80_n3ds tic80studio png citro3d)
++    target_link_libraries(tic80_n3ds tic80studio PNG::PNG citro3d)
+ 
+     add_custom_command(TARGET tic80_n3ds
+            POST_BUILD
+@@ -1181,7 +1022,7 @@ if(BUILD_STUB)
+             endif()
+ 
+         else()
+-            target_link_libraries(tic80${SCRIPT} SDL2main)
++            target_link_libraries(tic80${SCRIPT} ${SDL2_LIBRARIES})
+         endif()
+ 
+         target_link_libraries(tic80${SCRIPT} tic80core${SCRIPT} argparse)
+@@ -1199,7 +1040,7 @@ if(BUILD_STUB)
+             elseif(RPI)
+                 target_link_libraries(tic80${SCRIPT} libSDL2.a bcm_host pthread dl)
+             else()
+-                target_link_libraries(tic80${SCRIPT} SDL2-static)
++                target_link_libraries(tic80${SCRIPT} ${SDL2_LIBRARIES})
+             endif()
+         endif()
+ 
diff --git a/emulators/tic-80/pkg-descr b/emulators/tic-80/pkg-descr
new file mode 100644
index 000000000000..ba60ea3549a2
--- /dev/null
+++ b/emulators/tic-80/pkg-descr
@@ -0,0 +1,14 @@
+TIC-80 is a free and open source fantasy computer for making, playing
+and sharing tiny games.
+
+With TIC-80 you get built-in tools for development: code, sprites, maps,
+sound editors and the command line, which is enough to create a mini
+retro game.
+
+Games are packaged into a cartridge file, which can be easily
+distributed. TIC-80 works on all popular platforms.  This means your
+cartridge can be played in any device.
+
+To make a retro styled game, the whole process of creation and execution
+takes place under some technical limitations: 240x136 pixel display,
+16 color palette, 256 8x8 color sprites, 4 channel sound, etc.
diff --git a/emulators/tic-80/pkg-plist b/emulators/tic-80/pkg-plist
new file mode 100644
index 000000000000..152ac4681cac
--- /dev/null
+++ b/emulators/tic-80/pkg-plist
@@ -0,0 +1,4 @@
+bin/tic80
+share/applications/tic80.desktop
+share/applications/tic80.xml
+share/icons/tic80.png