From fe922d598c06b9c97a60f20f042ae7019dc370b9 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Sun, 7 Feb 2021 15:57:31 +0100 Subject: [PATCH] add squashfs-avm-be --- default.nix | 2 + pkgs/squashfs-avm-be/default.nix | 92 ++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 pkgs/squashfs-avm-be/default.nix diff --git a/default.nix b/default.nix index dfb6226..ff019bb 100644 --- a/default.nix +++ b/default.nix @@ -34,5 +34,7 @@ self: super: shinto-cli = super.callPackage ./pkgs/shinto-cli { }; + squashfs-avm-be = super.callPackage ./pkgs/squashfs-avm-be/default.nix { }; + ui = super.callPackage ./pkgs/nim-packages/ui.nix { }; } diff --git a/pkgs/squashfs-avm-be/default.nix b/pkgs/squashfs-avm-be/default.nix new file mode 100644 index 0000000..0e88ac8 --- /dev/null +++ b/pkgs/squashfs-avm-be/default.nix @@ -0,0 +1,92 @@ +{ stdenv +, lib +, fetchFromGitHub +, fetchurl +, squashfsTools +, xz +}: + +let freetz = fetchFromGitHub { + owner = "Freetz"; + repo = "freetz"; + rev = "e1358ac97af47d2b8faa7237a89b353724f573b7"; + sha256 = "1k3l5n5hpzysj0n3fn1jazvrj89cxdf3bbz9jfzqccfi01vnhlsc"; +}; + +in + +stdenv.mkDerivation rec { + pname = "squashfs-avm-be"; + version = "4.3"; + + src = fetchurl { + url = "mirror://sourceforge/squashfs/squashfs${version}.tar.gz"; + sha256 = "1xpklm0y43nd9i6jw43y2xh5zvlmj9ar2rvknh0bh7kv8c95aq0d"; + }; + + prePatch = '' + cd squashfs-tools + ''; + + patches = [ + "${freetz}/make/squashfs4-be/patches/001-de03266983ceb62e5365aac84fcd3b2fd4d16e6f.upstream.patch" + "${freetz}/make/squashfs4-be/patches/002-4f24381e7edc0a46cf10278e4597051ac697ec7c.upstream.patch" + "${freetz}/make/squashfs4-be/patches/010-fix_segfault_in_tracing_code.patch" + "${freetz}/make/squashfs4-be/patches/050-freetz_specific_xz_paths.patch" + "${freetz}/make/squashfs4-be/patches/060-link_compression_libs_statically.patch" + "${freetz}/make/squashfs4-be/patches/100-TARGET_FORMAT.patch" + "${freetz}/make/squashfs4-be/patches/101-TARGET_FORMAT__AVM_BE_AVM_LE_symbols_only.patch" + "${freetz}/make/squashfs4-be/patches/200-help_comment_typos.patch" + "${freetz}/make/squashfs4-be/patches/210-mksquashfs__uclibc_get_physical_memory.patch" + "${freetz}/make/squashfs4-be/patches/220-mksquashfs__default_block_size.patch" + "${freetz}/make/squashfs4-be/patches/230-mksquashfs__disable_xattrs_support.patch" + "${freetz}/make/squashfs4-be/patches/240-mksquashfs__remove_append_mode_support.patch" + "${freetz}/make/squashfs4-be/patches/250-mksquashfs__AVM_BE.patch" + "${freetz}/make/squashfs4-be/patches/350-unsquashfs__AVM_BE.patch" + "${freetz}/make/squashfs4-be/patches/400-unsquashfs123_lzma1_header_less.patch" + "${freetz}/make/squashfs4-be/patches/410-unsquashfs123_optional.patch" + "${freetz}/make/squashfs4-be/patches/450-unsquashfs__exit_on_error.patch" + "${freetz}/make/squashfs4-be/patches/550-mkfs_time__AVM_BE_AVM_LE.patch" + "${freetz}/make/squashfs4-be/patches/610-unsquashfs_superblock_offset.patch" + "${freetz}/make/squashfs4-be/patches/611-unsquashfs_nmi_vector_gap.patch" + "${freetz}/make/squashfs4-be/patches/612-ti_checksum.patch" + "${freetz}/make/squashfs4-be/patches/900-sys_types__no__sys_sysmacros__include.patch" + "${freetz}/make/squashfs4-be/patches/910-gcc10_fix_multiple_definitions_error.patch" + ]; + + buildInputs = [ xz ]; + + NIX_LDFLAGS = "-lgcc_s"; + + preBuild = '' + makeFlagsArray+=( + EXTRA_CFLAGS="-DTARGET_FORMAT=AVM_BE -ffunction-sections -fdata-sections" + GZIP_SUPPORT="0" + LZMA_XZ_SUPPORT="0" + XZ_SUPPORT="1" + COMP_DEFAULT="xz" + XATTR_SUPPORT="0" + XATTR_DEFAULT="0" + ) + ''; + + installFlags = "INSTALL_DIR=\${out}/bin"; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp mksquashfs $out/bin/mksquashfs-avm-be + cp unsquashfs $out/bin/unsquashfs-avm-be + + runHook postInstall + ''; + + meta = { + homepage = "http://squashfs.sourceforge.net/"; + description = "Tool for creating and unpacking squashfs filesystems"; + platforms = lib.platforms.unix; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ royneary ]; + }; +}