Merge pull request #326400 from qubitnano/2ship102

_2ship2harkinian: 1.0.1 -> 1.0.2, reorganize

authored by tomberek and committed by GitHub c59f78b1 222fc10b

+68 -67
+68 -67
pkgs/by-name/_2/_2ship2harkinian/package.nix
··· 1 1 { 2 + lib, 2 3 stdenv, 4 + SDL2, 3 5 cmake, 4 - lsb-release, 5 - ninja, 6 - lib, 6 + copyDesktopItems, 7 7 fetchFromGitHub, 8 + fetchpatch, 8 9 fetchurl, 9 - copyDesktopItems, 10 - makeDesktopItem, 11 - python3, 12 - SDL2, 13 - pkg-config, 14 - libpulseaudio, 15 - libpng, 16 10 imagemagick, 17 - zenity, 18 - makeWrapper, 19 11 imgui, 20 - stormlib, 12 + libpng, 13 + libpulseaudio, 21 14 libzip, 15 + lsb-release, 16 + makeDesktopItem, 17 + makeWrapper, 18 + ninja, 22 19 nlohmann_json, 20 + pkg-config, 21 + python3, 22 + spdlog, 23 + stormlib, 23 24 tinyxml-2, 24 - spdlog, 25 - fetchpatch, 26 25 writeTextFile, 26 + zenity, 27 27 }: 28 28 29 29 let 30 30 31 + # This would get fetched at build time otherwise, see: 32 + # https://github.com/HarbourMasters/2ship2harkinian/blob/1.0.2/mm/CMakeLists.txt#L708 33 + gamecontrollerdb = fetchurl { 34 + name = "gamecontrollerdb.txt"; 35 + url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/b1759cf84028aab89caa1c395e198c340b8dfd89/gamecontrollerdb.txt"; 36 + hash = "sha256-7C5EkqBIhLGNJuhi3832y0ffW5Ep7iuTYXb1bL5h2Js="; 37 + }; 38 + 31 39 # 2ship needs a specific imgui version 32 40 imgui' = imgui.overrideAttrs rec { 33 41 version = "1.90.6"; ··· 39 47 }; 40 48 }; 41 49 50 + libgfxd = fetchFromGitHub { 51 + owner = "glankk"; 52 + repo = "libgfxd"; 53 + rev = "008f73dca8ebc9151b205959b17773a19c5bd0da"; 54 + hash = "sha256-AmHAa3/cQdh7KAMFOtz5TQpcM6FqO9SppmDpKPTjTt8="; 55 + }; 56 + 57 + stb_impl = writeTextFile { 58 + name = "stb_impl.c"; 59 + text = '' 60 + #define STB_IMAGE_IMPLEMENTATION 61 + #include "stb_image.h" 62 + ''; 63 + }; 64 + 65 + stb' = fetchurl { 66 + name = "stb_image.h"; 67 + url = "https://raw.githubusercontent.com/nothings/stb/0bc88af4de5fb022db643c2d8e549a0927749354/stb_image.h"; 68 + hash = "sha256-xUsVponmofMsdeLsI6+kQuPg436JS3PBl00IZ5sg3Vw="; 69 + }; 70 + 42 71 # Apply 2ship's patch for stormlib 43 72 stormlib' = stormlib.overrideAttrs (prev: rec { 44 73 version = "9.25"; ··· 58 87 ]; 59 88 }); 60 89 61 - # This would get fetched at build time otherwise, see: 62 - # https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/soh/CMakeLists.txt#L736 63 - gamecontrollerdb = fetchurl { 64 - name = "gamecontrollerdb.txt"; 65 - url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/30cb02c07001234f021eadf64035ef07753c1263/gamecontrollerdb.txt"; 66 - hash = "sha256-Q/OUrvoLY4fF/EJBmQC57y5b3D0Rmlyd9zAmB7U8SUU="; 67 - }; 68 - 69 90 thread_pool = fetchFromGitHub { 70 91 owner = "bshoshany"; 71 92 repo = "thread-pool"; ··· 73 94 hash = "sha256-zhRFEmPYNFLqQCfvdAaG5VBNle9Qm8FepIIIrT9sh88="; 74 95 }; 75 96 76 - libgfxd = fetchFromGitHub { 77 - owner = "glankk"; 78 - repo = "libgfxd"; 79 - rev = "008f73dca8ebc9151b205959b17773a19c5bd0da"; 80 - hash = "sha256-AmHAa3/cQdh7KAMFOtz5TQpcM6FqO9SppmDpKPTjTt8="; 81 - }; 82 - 83 - stb_impl = writeTextFile { 84 - name = "stb_impl.c"; 85 - text = '' 86 - #define STB_IMAGE_IMPLEMENTATION 87 - #include "stb_image.h" 88 - ''; 89 - }; 90 - 91 - stb' = fetchurl { 92 - name = "stb_image.h"; 93 - url = "https://raw.githubusercontent.com/nothings/stb/0bc88af4de5fb022db643c2d8e549a0927749354/stb_image.h"; 94 - hash = "sha256-xUsVponmofMsdeLsI6+kQuPg436JS3PBl00IZ5sg3Vw="; 95 - }; 96 97 in 97 98 stdenv.mkDerivation (finalAttrs: { 98 99 pname = "2ship2harkinian"; 99 - version = "1.0.1"; 100 + version = "1.0.2"; 100 101 101 102 src = fetchFromGitHub { 102 103 owner = "HarbourMasters"; 103 104 repo = "2ship2harkinian"; 104 - rev = finalAttrs.version; 105 - hash = "sha256-czPAmqlXfhOjOYYssDuKt2YDlMlkruNx8EDXo1ksb14="; 105 + rev = "refs/tags/${finalAttrs.version}"; 106 + hash = "sha256-1iSFzroKxwFpsIGNMetSlQKTKRWCy7QtgCTepFdSeY8="; 106 107 fetchSubmodules = true; 107 108 }; 108 109 110 + patches = [ 111 + # remove fetching stb as we will patch our own 112 + ./0001-deps.patch 113 + ]; 114 + 109 115 nativeBuildInputs = [ 110 116 cmake 117 + copyDesktopItems 118 + imagemagick 119 + lsb-release 120 + makeWrapper 111 121 ninja 112 122 pkg-config 113 - lsb-release 114 123 python3 115 - imagemagick 116 - copyDesktopItems 117 - makeWrapper 118 124 ]; 119 125 120 126 buildInputs = [ 121 127 SDL2 122 - libpulseaudio 128 + imgui' 123 129 libpng 124 - zenity 125 - imgui' 126 - stormlib' 130 + libpulseaudio 127 131 libzip 128 132 nlohmann_json 129 - tinyxml-2 130 133 spdlog 134 + stormlib' 135 + tinyxml-2 136 + zenity 131 137 ]; 132 138 133 139 cmakeFlags = [ 134 - "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/2s2h" 135 - "-DFETCHCONTENT_SOURCE_DIR_IMGUI=${imgui'.src}" 136 - "-DFETCHCONTENT_SOURCE_DIR_STORMLIB=${stormlib'}" 137 - "-DFETCHCONTENT_SOURCE_DIR_LIBGFXD=${libgfxd}" 138 - "-DFETCHCONTENT_SOURCE_DIR_THREADPOOL=${thread_pool}" 140 + (lib.cmakeBool "NON_PORTABLE" true) 139 141 (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release") 140 - (lib.cmakeBool "NON_PORTABLE" true) 142 + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/2s2h") 143 + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_IMGUI" "${imgui'.src}") 144 + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBGFXD" "${libgfxd}") 145 + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_STORMLIB" "${stormlib'}") 146 + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_THREADPOOL" "${thread_pool}") 141 147 ]; 142 148 143 149 dontAddPrefix = true; ··· 158 164 --replace-fail "\''${STB_DIR}" "/build/source/stb" 159 165 ''; 160 166 161 - patches = [ 162 - # remove fetching stb as we will patch our own 163 - ./0001-deps.patch 164 - ]; 165 - 166 167 postBuild = '' 167 168 cp ${gamecontrollerdb} ${gamecontrollerdb.name} 168 169 pushd ../OTRExporter ··· 181 182 install -Dm644 ../mm/linux/2s2hIcon.png $out/share/pixmaps/2s2h.png 182 183 ''; 183 184 184 - fixupPhase = '' 185 + postFixup = '' 185 186 wrapProgram $out/2s2h/2s2h.elf --prefix PATH ":" ${lib.makeBinPath [ zenity ]} 186 187 ''; 187 188