Merge pull request #169005 from SuperSandro2000/devilutionX

This commit is contained in:
Sandro 2022-04-20 22:00:07 +02:00 committed by GitHub
commit eb004259d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 20 deletions

View file

@ -160,5 +160,5 @@ stdenvNoCC.mkDerivation {
'';
inherit meta;
inherit passthru;
passthru = { inherit url; } // passthru;
}

View file

@ -0,0 +1,53 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, SDL2
, pkg-config
}:
stdenv.mkDerivation rec {
pname = "SDL_audiolib";
version = "unstable-2022-04-17";
src = fetchFromGitHub {
owner = "realnc";
repo = "SDL_audiolib";
rev = "908214606387ef8e49aeacf89ce848fb36f694fc";
sha256 = "sha256-11KkwIhG1rX7yDFSj92NJRO9L2e7XZGq2gOJ54+sN/A=";
};
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
SDL2
];
cmakeFlags = [
"-DUSE_RESAMP_SRC=OFF"
"-DUSE_RESAMP_SOXR=OFF"
"-DUSE_DEC_DRFLAC=OFF"
"-DUSE_DEC_OPENMPT=OFF"
"-DUSE_DEC_XMP=OFF"
"-DUSE_DEC_MODPLUG=OFF"
"-DUSE_DEC_MPG123=OFF"
"-DUSE_DEC_SNDFILE=OFF"
"-DUSE_DEC_LIBVORBIS=OFF"
"-DUSE_DEC_LIBOPUSFILE=OFF"
"-DUSE_DEC_MUSEPACK=OFF"
"-DUSE_DEC_FLUIDSYNTH=OFF"
"-DUSE_DEC_BASSMIDI=OFF"
"-DUSE_DEC_WILDMIDI=OFF"
"-DUSE_DEC_ADLMIDI=OFF"
];
meta = with lib; {
description = "Audio decoding, resampling and mixing library for SDL";
homepage = "https://github.com/realnc/SDL_audiolib";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View file

@ -3,11 +3,13 @@
, fetchFromGitHub
, fetchpatch
, fetchurl
, fetchzip
, bzip2
, cmake
, pkg-config
, gettext
, libsodium
, SDL2
, SDL_audiolib
, SDL2_image
, fmt
, libpng
@ -16,40 +18,56 @@
let
# TODO: submit a PR upstream to allow system copies of these libraries where possible
# fork with patches, far behind upstream
asio = fetchurl {
url = "https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz";
sha256 = "0vhb4cig40mm0a98i74grpmfkcmby8zxg6vqa38dpryxpgvp5fw8";
};
SDL_audiolib = fetchurl {
url = "https://github.com/realnc/SDL_audiolib/archive/aa79660eba4467a44f9dcaecf26b0f0a000abfd7.tar.gz";
sha256 = "0z4rizncp6gqsy72b3709zc9fr915wgcwnlx1fhhy7mrczsly630";
# fork with patches, upstream seems to be dead
libmpq = fetchurl {
url = "https://github.com/diasurgical/libmpq/archive/0f10bd1600f406b13932bf5351ba713361262184.tar.gz";
sha256 = "sha256-7hc/Xtsg8WJIJljLydS7hLZA9lEEHWhsCteyrxK68qE=";
};
simpleini = fetchzip {
url = "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip";
sha256 = "07kf1jjbc9v04hsysa6v2wh1m9csf5qz0b1wmlkf9sj00kf47zj7";
# not "real" package with pkg-config or cmake file, just collection of source files
libsmackerdec = fetchurl {
url = "https://github.com/diasurgical/libsmackerdec/archive/2997ee0e41e91bb723003bc09234be553b190e38.tar.gz";
sha256 = "sha256-QMDcIZQ94i4VPVanmSxiGkKgxWx82DP4uE+Q5I2nU+o=";
};
# fork with patches, far behind upstream
libzt = fetchFromGitHub {
owner = "diasurgical";
repo = "libzt";
fetchSubmodules = true;
rev = "a34ba7f1cc2e41b05badd25d1b01fdc5fd2f4e02";
sha256 = "sha256-tyIPt+7OTi5W+5X/ixQP1puOKdhrqRZtpwXlWFBFpc8=";
};
# missing pkg-config and/or cmake file
simpleini = fetchurl {
url = "https://github.com/brofield/simpleini/archive/9b3ed7ec815997bc8c5b9edf140d6bde653e1458.tar.gz";
sha256 = "sha256-93kuyp8/ew7okW/6ThJMtLMZsR1YSeFcXu9Y65ELBFE==";
};
in
stdenv.mkDerivation rec {
pname = "devilutionx";
version = "1.3.0";
version = "1.4.0";
src = fetchFromGitHub {
owner = "diasurgical";
repo = "devilutionX";
rev = version;
sha256 = "0acrkqi0pr3cbr5i1a1vfrnxv1n3xmql5d86bm2gywvpdb94xads";
sha256 = "sha256-uuIPTdgGpHA8j1M8b+kfnBuiJ5mdS9rckvEfn2h7lmo=";
};
patches = [
# allow building with system SDL2_image instead of vendored version
# this patch can be removed on the next release of devilutionx
# see https://github.com/diasurgical/devilutionX/pull/3386
(fetchpatch {
url = "https://github.com/diasurgical/devilutionX/commit/41ff03e94c02477bffb2d62764e8624c0e06854d.patch";
sha256 = "1lrnb9d0dcdyd78rix5rl4p8kkwbnl91llr9fgb86ysm3q58qkvj";
url = "https://github.com/diasurgical/devilutionX/commit/03b22352fc9e1ecb88b20a053c90c04a50717267.patch";
sha256 = "sha256-5aAwi1NV8P+nLLbEEnlwLGNQCQBb0nQkIVe5tR5Shsw=";
})
];
@ -57,16 +75,18 @@ stdenv.mkDerivation rec {
substituteInPlace Source/init.cpp --replace "/usr/share/diasurgical/devilutionx/" "${placeholder "out"}/share/diasurgical/devilutionx/"
# download dependencies ahead of time
substituteInPlace 3rdParty/asio/CMakeLists.txt --replace "https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz" "${asio}"
substituteInPlace 3rdParty/SDL_audiolib/CMakeLists.txt --replace "https://github.com/realnc/SDL_audiolib/archive/aa79660eba4467a44f9dcaecf26b0f0a000abfd7.tar.gz" "${SDL_audiolib}"
substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip" "${simpleini}"
substituteInPlace 3rdParty/asio/CMakeLists.txt --replace "${asio.url}" "${asio}"
substituteInPlace 3rdParty/libmpq/CMakeLists.txt --replace "${libmpq.url}" "${libmpq}"
substituteInPlace 3rdParty/libsmackerdec/CMakeLists.txt --replace "${libsmackerdec.url}" "${libsmackerdec}"
substituteInPlace 3rdParty/libzt/CMakeLists.txt \
--replace "GIT_REPOSITORY https://github.com/diasurgical/libzt.git" "" \
--replace "GIT_TAG ${libzt.rev}" "SOURCE_DIR ${libzt}"
substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace "${simpleini.url}" "${simpleini}"
'';
cmakeFlags = [
"-DBINARY_RELEASE=ON"
"-DVERSION_NUM=${version}"
"-DPACKET_ENCRYPTION=OFF" # FIXME: build with libsodium
"-DDISABLE_ZERO_TIER=ON" # FIXME: build with libzt
];
nativeBuildInputs = [
@ -77,9 +97,12 @@ stdenv.mkDerivation rec {
];
buildInputs = [
bzip2
fmt
libpng
libsodium
SDL2
SDL_audiolib
SDL2_image
];

View file

@ -20272,6 +20272,8 @@ with pkgs;
libGLU = null;
});
SDL_audiolib = callPackage ../development/libraries/SDL_audiolib { };
SDL_sixel = callPackage ../development/libraries/SDL_sixel { };
SDL_gfx = callPackage ../development/libraries/SDL_gfx { };