2021-04-25 03:57:28 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, xz
|
2021-04-25 03:57:28 +00:00
|
|
|
, lzo
|
2020-04-24 23:36:52 +00:00
|
|
|
, zlib
|
2021-04-25 03:57:28 +00:00
|
|
|
, zstd
|
|
|
|
, lz4
|
|
|
|
, lz4Support ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-04-25 03:57:28 +00:00
|
|
|
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";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sasquatch";
|
2021-04-25 03:57:28 +00:00
|
|
|
version = "4.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-04-25 03:57:28 +00:00
|
|
|
url = "mirror://sourceforge/squashfs/squashfs${version}.tar.gz";
|
|
|
|
sha256 = "qYGz8/IFS1ouZYhRo8BqJGCtBKmopkXgr+Bjpj/bsH4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
buildInputs = [
|
|
|
|
xz
|
|
|
|
lzo
|
|
|
|
zlib
|
|
|
|
zstd
|
|
|
|
]
|
|
|
|
++ lib.optionals lz4Support [ lz4 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
patches = [ patch ];
|
|
|
|
patchFlags = [ "-p0" ];
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-09-26 12:46:18 +00:00
|
|
|
# Drop blanket -Werror to avoid build failure on fresh toolchains
|
|
|
|
# like gcc-11.
|
|
|
|
substituteInPlace squashfs-tools/Makefile --replace ' -Werror' ' '
|
2020-04-24 23:36:52 +00:00
|
|
|
cd squashfs-tools
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# Workaround build failure on -fno-common toolchains like upstream
|
|
|
|
# gcc-10. Otherwise build fails as:
|
|
|
|
# ld: unsquashfs_xattr.o:/build/squashfs4.4/squashfs-tools/error.h:34: multiple definition of
|
|
|
|
# `verbose'; unsquashfs.o:/build/squashfs4.4/squashfs-tools/error.h:34: first defined here
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installFlags = [ "INSTALL_DIR=\${out}/bin" ];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
makeFlags = [
|
|
|
|
"XZ_SUPPORT=1"
|
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"CXX=${stdenv.cc.targetPrefix}c++"
|
|
|
|
"AR=${stdenv.cc.targetPrefix}ar"
|
|
|
|
]
|
2021-01-15 22:18:51 +00:00
|
|
|
++ lib.optional lz4Support "LZ4_SUPPORT=1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "sasquatch";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|