2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
|
|
|
}:
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "imagelol";
|
|
|
|
version = "0.2";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MCRedstoner2004";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0978zdrfj41jsqm78afyyd1l64iki9nwjvhd8ynii1b553nn4dmd";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
patches = [
|
|
|
|
# upstream gcc-12 compatibility fix
|
|
|
|
(fetchpatch {
|
|
|
|
name = "gcc-12.patch";
|
|
|
|
url = "https://github.com/MCredstoner2004/ImageLOL/commit/013fb1f901d88f5fd21a896bfab47c7fff0737d7.patch";
|
|
|
|
hash = "sha256-RVaG2xbUqE4CxqI2lhvug2qihT6A8vN+pIfK58CXLDw=";
|
|
|
|
includes = [ "imagelol/ImageLOL.inl" ];
|
|
|
|
# change lib/ for imagelol
|
|
|
|
stripLen = 2;
|
|
|
|
extraPrefix = "imagelol/";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
# fix for case-sensitive filesystems
|
|
|
|
# https://github.com/MCredstoner2004/ImageLOL/issues/1
|
|
|
|
postPatch = ''
|
|
|
|
mv imagelol src
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace 'add_subdirectory("imagelol")' 'add_subdirectory("src")'
|
|
|
|
'';
|
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp ./ImageLOL $out/bin
|
|
|
|
'';
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
cmakeFlags = [ (lib.cmakeFeature "CMAKE_C_FLAGS" "-std=gnu90") ] ++ lib.optional (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) "-DPNG_ARM_NEON=off";
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/MCredstoner2004/ImageLOL";
|
|
|
|
description = "Simple program to store a file into a PNG image";
|
|
|
|
license = licenses.mit;
|
2024-07-01 15:47:52 +00:00
|
|
|
maintainers = [ ];
|
2021-05-03 20:48:10 +00:00
|
|
|
platforms = platforms.unix;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "ImageLOL";
|
2021-05-03 20:48:10 +00:00
|
|
|
};
|
|
|
|
}
|