1{ lib, stdenv, fetchurl, fetchpatch, cmake }:
2
3stdenv.mkDerivation rec {
4 pname = "libunarr";
5 version = "1.0.1";
6
7 src = fetchurl {
8 url = "https://github.com/selmf/unarr/releases/download/v${version}/unarr-${version}.tar.xz";
9 sha256 = "1db500k6w90qn6qb4j3zcczailmmv81q9lv4bwq516hbncg5p4sl";
10 };
11
12 nativeBuildInputs = [ cmake ];
13
14 # https://github.com/selmf/unarr/issues/23
15 postPatch = ''
16 substituteInPlace pkg-config.pc.cmake \
17 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
18 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
19 ''
20 # ld: unknown option: --no-undefined
21 + lib.optionalString stdenv.isDarwin ''
22 substituteInPlace CMakeLists.txt \
23 --replace '-Wl,--no-undefined -Wl,--as-needed' '-Wl,-undefined,error'
24 '';
25
26 meta = with lib; {
27 homepage = "https://github.com/selmf/unarr";
28 description = "A lightweight decompression library with support for rar, tar and zip archives";
29 license = licenses.lgpl3Plus;
30 };
31}