nixpkgs/pkgs/tools/filesystems/sasquatch/default.nix
Sergei Trofimovich 8d77e899e8
sasquatch: drop blanket -Werror (fix gcc-11 build) (#139350)
Noticed build failure on gcc-11:

    $ nix-build -E 'with import ./.{}; sasquatch.override { stdenv = gcc11Stdenv; }'
    unsquashfs.c:1908:5:
      error: this 'if' clause does not guard... [-Werror=misleading-indentation]
     1908 |     if(swap)
          |     ^~

Let's defer warning squashing and code fixes to upstream.
2021-09-26 00:46:57 -04:00

70 lines
1.7 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, xz
, lzo
, zlib
, zstd
, lz4
, lz4Support ? false
}:
let
patch = fetchFromGitHub
{
# NOTE: This uses my personal fork for now, until
# https://github.com/devttys0/sasquatch/pull/40 is merged.
# I, cole-h, will keep this fork available until that happens.
owner = "cole-h";
repo = "sasquatch";
rev = "6edc54705454c6410469a9cb5bc58e412779731a";
sha256 = "x+PuPYGD4Pd0fcJtlLWByGy/nggsmZkxwSXxJfPvUgo=";
} + "/patches/patch0.txt";
in
stdenv.mkDerivation rec {
pname = "sasquatch";
version = "4.4";
src = fetchurl {
url = "mirror://sourceforge/squashfs/squashfs${version}.tar.gz";
sha256 = "qYGz8/IFS1ouZYhRo8BqJGCtBKmopkXgr+Bjpj/bsH4=";
};
buildInputs = [
xz
lzo
zlib
zstd
]
++ lib.optionals lz4Support [ lz4 ];
patches = [ patch ];
patchFlags = [ "-p0" ];
postPatch = ''
# Drop blanket -Werror to avoid build failure on fresh toolchains
# like gcc-11.
substituteInPlace squashfs-tools/Makefile --replace ' -Werror' ' '
cd squashfs-tools
'';
installFlags = [ "INSTALL_DIR=\${out}/bin" ];
makeFlags = [
"XZ_SUPPORT=1"
"CC=${stdenv.cc.targetPrefix}cc"
"CXX=${stdenv.cc.targetPrefix}c++"
"AR=${stdenv.cc.targetPrefix}ar"
]
++ lib.optional lz4Support "LZ4_SUPPORT=1";
meta = with lib; {
homepage = "https://github.com/devttys0/sasquatch";
description = "Set of patches to the standard unsquashfs utility (part of squashfs-tools) that attempts to add support for as many hacked-up vendor-specific SquashFS implementations as possible";
license = licenses.gpl2Plus;
maintainers = [ maintainers.pamplemousse ];
platforms = platforms.linux;
};
}