Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 211 lines 4.4 kB view raw
1{ 2 lib, 3 SDL2, 4 callPackage, 5 fetchpatch2, 6 cmake, 7 espeak-ng, 8 ffmpeg, 9 file, 10 freetype, 11 glib, 12 gumbo, 13 harfbuzz, 14 jbig2dec, 15 leptonica, 16 libGL, 17 libX11, 18 libXau, 19 libXcomposite, 20 libXdmcp, 21 libXfixes, 22 libdrm, 23 libffi, 24 libjpeg, 25 libusb1, 26 libuvc, 27 libvlc, 28 libvncserver, 29 libxcb, 30 libxkbcommon, 31 makeWrapper, 32 libgbm, 33 mupdf, 34 openal, 35 openjpeg, 36 pcre2, 37 pkg-config, 38 ruby, 39 sqlite, 40 stdenv, 41 tesseract, 42 valgrind, 43 wayland, 44 wayland-protocols, 45 wayland-scanner, 46 xcbutil, 47 xcbutilwm, 48 xz, 49 # Boolean flags 50 buildManPages ? true, 51 useBuiltinLua ? true, 52 useEspeak ? !stdenv.hostPlatform.isDarwin, 53 useStaticLibuvc ? true, 54 useStaticOpenAL ? true, 55 useStaticSqlite ? true, 56 # For debugging only, disabled by upstream 57 useTracy ? false, 58 # Configurable options 59 sources ? callPackage ./sources.nix { }, 60}: 61 62stdenv.mkDerivation (finalAttrs: { 63 inherit (sources.letoram-arcan) pname version src; 64 65 patches = [ 66 # (encode) remove deprecated use of pts/channel-layout 67 (fetchpatch2 { 68 url = "https://github.com/letoram/arcan/commit/e717c1b5833bdc2dea7dc6f64eeaf39c683ebd26.patch?full_index=1"; 69 hash = "sha256-nUmOWfphGtGiLehUa78EJWqTlD7SvqJgl8lnn90vTFU="; 70 }) 71 ]; 72 73 nativeBuildInputs = [ 74 cmake 75 makeWrapper 76 pkg-config 77 wayland-scanner 78 ] 79 ++ lib.optionals buildManPages [ ruby ]; 80 81 buildInputs = [ 82 SDL2 83 ffmpeg 84 file 85 freetype 86 glib 87 gumbo 88 harfbuzz 89 jbig2dec 90 leptonica 91 libGL 92 libX11 93 libXau 94 libXcomposite 95 libXdmcp 96 libXfixes 97 libdrm 98 libffi 99 libjpeg 100 libusb1 101 libuvc 102 libvlc 103 libvncserver 104 libxcb 105 libxkbcommon 106 libgbm 107 mupdf 108 openal 109 openjpeg 110 pcre2 111 sqlite 112 tesseract 113 valgrind 114 wayland 115 wayland-protocols 116 xcbutil 117 xcbutilwm 118 xz 119 ] 120 ++ lib.optionals useEspeak [ espeak-ng ]; 121 122 cmakeFlags = [ 123 # The upstream project recommends tagging the distribution 124 (lib.cmakeFeature "DISTR_TAG" "Nixpkgs") 125 (lib.cmakeFeature "ENGINE_BUILDTAG" finalAttrs.src.rev) 126 (lib.cmakeFeature "BUILD_PRESET" "everything") 127 (lib.cmakeBool "BUILTIN_LUA" useBuiltinLua) 128 (lib.cmakeBool "DISABLE_JIT" useBuiltinLua) 129 (lib.cmakeBool "STATIC_LIBUVC" useStaticLibuvc) 130 (lib.cmakeBool "STATIC_SQLite3" useStaticSqlite) 131 (lib.cmakeBool "ENABLE_TRACY" useTracy) 132 "../src" 133 ]; 134 135 outputs = [ 136 "out" 137 "dev" 138 "lib" 139 "man" 140 ]; 141 142 hardeningDisable = [ "format" ]; 143 144 strictDeps = true; 145 146 # Emulate external/git/clone.sh 147 postUnpack = 148 let 149 inherit (sources) 150 letoram-openal 151 libuvc 152 luajit 153 tracy 154 ; 155 prepareSource = 156 flag: source: destination: 157 lib.optionalString flag '' 158 cp -va ${source}/ ${destination} 159 chmod --recursive 744 ${destination} 160 ''; 161 in 162 '' 163 pushd $sourceRoot/external/git/ 164 '' 165 + prepareSource useStaticOpenAL letoram-openal.src "openal" 166 + prepareSource useStaticLibuvc libuvc.src "libuvc" 167 + prepareSource useBuiltinLua luajit.src "luajit" 168 + prepareSource useTracy tracy.src "tracy" 169 + '' 170 popd 171 ''; 172 173 postPatch = '' 174 substituteInPlace ./src/platform/posix/paths.c \ 175 --replace-fail "/usr/bin" "$out/bin" \ 176 --replace-fail "/usr/share" "$out/share" 177 substituteInPlace ./src/CMakeLists.txt \ 178 --replace-fail "SETUID" "# SETUID" 179 ''; 180 181 # INFO: Arcan build scripts require the manpages to be generated *before* the 182 # `configure` phase 183 preConfigure = lib.optionalString buildManPages '' 184 pushd doc 185 ruby docgen.rb mangen 186 popd 187 ''; 188 189 passthru = { 190 inherit sources; 191 wrapper = callPackage ./wrapper.nix { }; 192 }; 193 194 meta = { 195 homepage = "https://arcan-fe.com/"; 196 description = "Combined Display Server, Multimedia Framework, Game Engine"; 197 longDescription = '' 198 Arcan is a portable and fast self-sufficient multimedia engine for 199 advanced visualization and analysis work in a wide range of applications 200 e.g. game development, real-time streaming video, monitoring and 201 surveillance, up to and including desktop compositors and window managers. 202 ''; 203 license = with lib.licenses; [ 204 bsd3 205 gpl2Plus 206 lgpl2Plus 207 ]; 208 maintainers = with lib.maintainers; [ ]; 209 platforms = lib.platforms.unix; 210 }; 211})