nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

tic-80: update to git HEAD and fix build (#414270)

authored by

Aleksana and committed by
GitHub
1a133b44 19359fcb

+36 -77
+36 -77
pkgs/by-name/ti/tic-80/package.nix
··· 9 9 fetchFromGitHub, 10 10 libGL, 11 11 libGLU, 12 - alsa-lib, 13 12 libX11, 14 - libICE, 15 - libXi, 16 - libXScrnSaver, 17 - libXcursor, 18 - libXinerama, 19 - libXext, 20 - libXxf86vm, 21 - libXrandr, 22 - libxkbcommon, 23 - wayland, 24 - wayland-protocols, 25 - wayland-scanner, 26 - dbus, 27 - udev, 28 - libdecor, 29 - pipewire, 30 - libpulseaudio, 13 + janet, 14 + lua5_3, 15 + quickjs, 16 + SDL2, 31 17 # Whether to build TIC-80's "Pro" version, which is an incentive to support the project financially, 32 18 # that enables some additional features. It is, however, fully open source. 33 19 withPro ? false, 34 20 }: 35 21 let 36 - major = "1"; 37 - minor = "1"; 38 - revision = "2837"; 39 - year = "2023"; 22 + # git rev-list HEAD --count 23 + revision = "3016"; 24 + year = "2025"; 40 25 in 41 26 42 - stdenv.mkDerivation rec { 27 + stdenv.mkDerivation { 43 28 pname = "tic-80"; 44 - version = "${major}.${minor}.${revision}"; 29 + # use an untagged version until upstream tags a new version. We want 30 + # 'PREFER_SYSTEM_LIBRARIES', and without it tic-80 won't build 31 + version = "1.1-unstable-2025-05-26"; 45 32 46 33 src = fetchFromGitHub { 47 34 owner = "nesbox"; 48 35 repo = "TIC-80"; 49 - rev = "v" + version; 50 - hash = "sha256-p7OyuD/4KxAzylQDlXW681TvEZwKYDD4zq2KDRkcv48="; 51 - # TIC-80 vendors its dependencies as submodules, so to use its current build system, 52 - # we need to fetch them. Managing the dependencies ourselves would require a lot of 53 - # changes in the build system, which doesn't seem worth it right now. In future versions, 54 - # TIC-80 is switching to more modular CMake files, at which point we can reconsider. 36 + rev = "663d43924abf6fd7620de6bf25c009ce5b30ab83"; 37 + hash = "sha256-UjBnXxYZ5gfk58sI1qek5fkKpJ7LzOVmrxdjVgONcXc="; 38 + # TIC-80 vendors its dependencies as submodules. For the following dependencies, 39 + # there are no (or no compatible) packages in nixpkgs yet, so we use the vendored 40 + # ones as a fill-in: kubazip, wasm, squirrel, pocketpy, argparse, naett, 41 + # sdlgpu, mruby. 55 42 fetchSubmodules = true; 56 43 }; 57 44 ··· 48 61 # To avoid the awkward copyright range of "2017-1980", which would be caused by the 49 62 # sandbox environment, hardcode the year of the release. 50 63 postPatch = '' 51 - substituteInPlace CMakeLists.txt \ 64 + substituteInPlace cmake/version.cmake \ 52 65 --replace-fail 'set(VERSION_REVISION 0)' 'set(VERSION_REVISION ${revision})' \ 53 66 --replace-fail 'string(TIMESTAMP VERSION_YEAR "%Y")' 'set(VERSION_YEAR "${year}")' 54 67 ''; ··· 59 72 unset LD 60 73 ''; 61 74 62 - cmakeFlags = lib.optionals withPro [ "-DBUILD_PRO=On" ] ++ [ "-DBUILD_SDLGPU=On" ]; 75 + cmakeFlags = 76 + let 77 + enableCmakeBool = (lib.flip lib.cmakeBool) true; 78 + in 79 + [ 80 + (lib.cmakeBool "BUILD_PRO" withPro) 81 + ] 82 + ++ (map enableCmakeBool [ 83 + "BUILD_STATIC" 84 + "PREFER_SYSTEM_LIBRARIES" 85 + "BUILD_SDLGPU" 86 + "BUILD_WITH_ALL" 87 + ]); 88 + 63 89 nativeBuildInputs = [ 64 90 cmake 65 91 curl ··· 81 81 rake 82 82 ]; 83 83 buildInputs = [ 84 - alsa-lib 85 - dbus 86 - libdecor 87 84 libGL 88 85 libGLU 89 - libICE 90 - libpulseaudio 91 86 libX11 92 - libXcursor 93 - libXext 94 - libXi 95 - libXinerama 96 - libxkbcommon 97 - libXrandr 98 - libXScrnSaver 99 - libXxf86vm 100 - pipewire 101 - udev 102 - wayland 103 - wayland-protocols 104 - wayland-scanner 87 + janet 88 + (lua5_3.withPackages (ps: [ ps.fennel ])) 89 + quickjs 90 + SDL2 105 91 ]; 106 - 107 - # This package borrows heavily from pkgs/development/libraries/SDL2/default.nix 108 - # because TIC-80 vendors SDL2, which means we need to take care and implement 109 - # a similar environment in TIC-80's vendored copy of SDL2. 110 - # 111 - # SDL is weird in that instead of just dynamically linking with 112 - # libraries when you `--enable-*` (or when `configure` finds) them 113 - # it `dlopen`s them at runtime. In principle, this means it can 114 - # ignore any missing optional dependencies like alsa, pulseaudio, 115 - # some x11 libs, wayland, etc if they are missing on the system 116 - # and/or work with wide array of versions of said libraries. In 117 - # nixpkgs, however, we don't need any of that. Moreover, since we 118 - # don't have a global ld-cache we have to stuff all the propagated 119 - # libraries into rpath by hand or else some applications that use 120 - # SDL API that requires said libraries will fail to start. 121 - # 122 - # You can grep SDL sources with `grep -rE 'SDL_(NAME|.*_SYM)'` to 123 - # list the symbols used in this way. 124 - postFixup = 125 - let 126 - rpath = lib.makeLibraryPath buildInputs; 127 - in 128 - '' 129 - patchelf --set-rpath "$(patchelf --print-rpath $out/bin/tic80):${rpath}" "$out/bin/tic80" 130 - ''; 131 92 132 93 meta = with lib; { 133 94 description = "Free and open source fantasy computer for making, playing and sharing tiny games"; ··· 112 151 platforms = platforms.linux; 113 152 mainProgram = "tic80"; 114 153 maintainers = with maintainers; [ blinry ]; 115 - # /build/source/vendor/sdl2/src/audio/pipewire/SDL_pipewire.c:623:37: error: passing argument 1 of 'pw_node_enum_params' from incompatible pointer type [-Wincompatible-pointer-types] 116 - broken = true; 117 154 }; 118 155 }