mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-18 19:03:28 +00:00
_2ship2harkinian: reorganize
This commit is contained in:
parent
40ff23c50e
commit
c135117118
@ -1,33 +1,41 @@
|
||||
{
|
||||
stdenv,
|
||||
cmake,
|
||||
lsb-release,
|
||||
ninja,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
fetchurl,
|
||||
copyDesktopItems,
|
||||
makeDesktopItem,
|
||||
python3,
|
||||
stdenv,
|
||||
SDL2,
|
||||
pkg-config,
|
||||
libpulseaudio,
|
||||
libpng,
|
||||
imagemagick,
|
||||
zenity,
|
||||
makeWrapper,
|
||||
imgui,
|
||||
stormlib,
|
||||
libzip,
|
||||
nlohmann_json,
|
||||
tinyxml-2,
|
||||
spdlog,
|
||||
cmake,
|
||||
copyDesktopItems,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
fetchurl,
|
||||
imagemagick,
|
||||
imgui,
|
||||
libpng,
|
||||
libpulseaudio,
|
||||
libzip,
|
||||
lsb-release,
|
||||
makeDesktopItem,
|
||||
makeWrapper,
|
||||
ninja,
|
||||
nlohmann_json,
|
||||
pkg-config,
|
||||
python3,
|
||||
spdlog,
|
||||
stormlib,
|
||||
tinyxml-2,
|
||||
writeTextFile,
|
||||
zenity,
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
# This would get fetched at build time otherwise, see:
|
||||
# https://github.com/HarbourMasters/2ship2harkinian/blob/1.0.2/mm/CMakeLists.txt#L708
|
||||
gamecontrollerdb = fetchurl {
|
||||
name = "gamecontrollerdb.txt";
|
||||
url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/b1759cf84028aab89caa1c395e198c340b8dfd89/gamecontrollerdb.txt";
|
||||
hash = "sha256-7C5EkqBIhLGNJuhi3832y0ffW5Ep7iuTYXb1bL5h2Js=";
|
||||
};
|
||||
|
||||
# 2ship needs a specific imgui version
|
||||
imgui' = imgui.overrideAttrs rec {
|
||||
version = "1.90.6";
|
||||
@ -39,40 +47,6 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
# Apply 2ship's patch for stormlib
|
||||
stormlib' = stormlib.overrideAttrs (prev: rec {
|
||||
version = "9.25";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ladislav-zezula";
|
||||
repo = "StormLib";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-HTi2FKzKCbRaP13XERUmHkJgw8IfKaRJvsK3+YxFFdc=";
|
||||
};
|
||||
buildInputs = prev.buildInputs ++ [ pkg-config ];
|
||||
patches = (prev.patches or [ ]) ++ [
|
||||
(fetchpatch {
|
||||
name = "stormlib-optimizations.patch";
|
||||
url = "https://github.com/briaguya-ai/StormLib/commit/ff338b230544f8b2bb68d2fbe075175ed2fd758c.patch";
|
||||
hash = "sha256-Jbnsu5E6PkBifcx/yULMVC//ab7tszYgktS09Azs5+4=";
|
||||
})
|
||||
];
|
||||
});
|
||||
|
||||
# This would get fetched at build time otherwise, see:
|
||||
# https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/soh/CMakeLists.txt#L736
|
||||
gamecontrollerdb = fetchurl {
|
||||
name = "gamecontrollerdb.txt";
|
||||
url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/30cb02c07001234f021eadf64035ef07753c1263/gamecontrollerdb.txt";
|
||||
hash = "sha256-Q/OUrvoLY4fF/EJBmQC57y5b3D0Rmlyd9zAmB7U8SUU=";
|
||||
};
|
||||
|
||||
thread_pool = fetchFromGitHub {
|
||||
owner = "bshoshany";
|
||||
repo = "thread-pool";
|
||||
rev = "v4.1.0";
|
||||
hash = "sha256-zhRFEmPYNFLqQCfvdAaG5VBNle9Qm8FepIIIrT9sh88=";
|
||||
};
|
||||
|
||||
libgfxd = fetchFromGitHub {
|
||||
owner = "glankk";
|
||||
repo = "libgfxd";
|
||||
@ -93,6 +67,33 @@ let
|
||||
url = "https://raw.githubusercontent.com/nothings/stb/0bc88af4de5fb022db643c2d8e549a0927749354/stb_image.h";
|
||||
hash = "sha256-xUsVponmofMsdeLsI6+kQuPg436JS3PBl00IZ5sg3Vw=";
|
||||
};
|
||||
|
||||
# Apply 2ship's patch for stormlib
|
||||
stormlib' = stormlib.overrideAttrs (prev: rec {
|
||||
version = "9.25";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ladislav-zezula";
|
||||
repo = "StormLib";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-HTi2FKzKCbRaP13XERUmHkJgw8IfKaRJvsK3+YxFFdc=";
|
||||
};
|
||||
buildInputs = prev.buildInputs ++ [ pkg-config ];
|
||||
patches = (prev.patches or [ ]) ++ [
|
||||
(fetchpatch {
|
||||
name = "stormlib-optimizations.patch";
|
||||
url = "https://github.com/briaguya-ai/StormLib/commit/ff338b230544f8b2bb68d2fbe075175ed2fd758c.patch";
|
||||
hash = "sha256-Jbnsu5E6PkBifcx/yULMVC//ab7tszYgktS09Azs5+4=";
|
||||
})
|
||||
];
|
||||
});
|
||||
|
||||
thread_pool = fetchFromGitHub {
|
||||
owner = "bshoshany";
|
||||
repo = "thread-pool";
|
||||
rev = "v4.1.0";
|
||||
hash = "sha256-zhRFEmPYNFLqQCfvdAaG5VBNle9Qm8FepIIIrT9sh88=";
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "2ship2harkinian";
|
||||
@ -106,38 +107,43 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
patches = [
|
||||
# remove fetching stb as we will patch our own
|
||||
./0001-deps.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
copyDesktopItems
|
||||
imagemagick
|
||||
lsb-release
|
||||
makeWrapper
|
||||
ninja
|
||||
pkg-config
|
||||
lsb-release
|
||||
python3
|
||||
imagemagick
|
||||
copyDesktopItems
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
SDL2
|
||||
libpulseaudio
|
||||
libpng
|
||||
zenity
|
||||
imgui'
|
||||
stormlib'
|
||||
libpng
|
||||
libpulseaudio
|
||||
libzip
|
||||
nlohmann_json
|
||||
tinyxml-2
|
||||
spdlog
|
||||
stormlib'
|
||||
tinyxml-2
|
||||
zenity
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/2s2h"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_IMGUI=${imgui'.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_STORMLIB=${stormlib'}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_LIBGFXD=${libgfxd}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_THREADPOOL=${thread_pool}"
|
||||
(lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
|
||||
(lib.cmakeBool "NON_PORTABLE" true)
|
||||
(lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
|
||||
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/2s2h")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_IMGUI" "${imgui'.src}")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBGFXD" "${libgfxd}")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_STORMLIB" "${stormlib'}")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_THREADPOOL" "${thread_pool}")
|
||||
];
|
||||
|
||||
dontAddPrefix = true;
|
||||
@ -158,11 +164,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
--replace-fail "\''${STB_DIR}" "/build/source/stb"
|
||||
'';
|
||||
|
||||
patches = [
|
||||
# remove fetching stb as we will patch our own
|
||||
./0001-deps.patch
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
cp ${gamecontrollerdb} ${gamecontrollerdb.name}
|
||||
pushd ../OTRExporter
|
||||
@ -181,7 +182,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
install -Dm644 ../mm/linux/2s2hIcon.png $out/share/pixmaps/2s2h.png
|
||||
'';
|
||||
|
||||
fixupPhase = ''
|
||||
postFixup = ''
|
||||
wrapProgram $out/2s2h/2s2h.elf --prefix PATH ":" ${lib.makeBinPath [ zenity ]}
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user