squashfs_tools: update to version 4.7.2.

This commit is contained in:
Oscar Lesta
2025-08-19 23:54:03 -03:00
committed by OscarL
parent 3562c50ef2
commit 2fa0901d15
2 changed files with 80 additions and 57 deletions

View File

@@ -1,4 +1,4 @@
From ab99a3f89407d5946a420e7b693a9437bc68ecde Mon Sep 17 00:00:00 2001
From 4eefd6ddcde271f0f29777928584227b4f4c9885 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Fri, 29 Mar 2024 18:46:59 -0300
Subject: Initial Haiku patch.
@@ -6,10 +6,10 @@ Subject: Initial Haiku patch.
Based on original patch by @dshynkev (Dmytro Shynkevych).
diff --git a/squashfs-tools/Makefile b/squashfs-tools/Makefile
index 9aa4381..02fa546 100755
index f894328..37d25c5 100644
--- a/squashfs-tools/Makefile
+++ b/squashfs-tools/Makefile
@@ -219,7 +219,7 @@ CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
@@ -268,7 +268,7 @@ CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"$(COMP_DEFAULT)\" \
-Wall
@@ -19,14 +19,15 @@ index 9aa4381..02fa546 100755
CFLAGS += -DGZIP_SUPPORT
MKSQUASHFS_OBJS += gzip_wrapper.o
diff --git a/squashfs-tools/endian_compat.h b/squashfs-tools/endian_compat.h
index c416f7f..0aa4815 100644
index 65787e2..053a80b 100644
--- a/squashfs-tools/endian_compat.h
+++ b/squashfs-tools/endian_compat.h
@@ -23,7 +23,7 @@
@@ -23,8 +23,7 @@
*
* endian_compat.h
*/
-#ifndef linux
-#include <sys/types.h>
+#if !defined(linux) && ! defined(__HAIKU__)
#define __BYTE_ORDER BYTE_ORDER
#define __BIG_ENDIAN BIG_ENDIAN
@@ -47,73 +48,93 @@ index 0000000..a643394
+
+#endif /* HAIKU_MACROS_H */
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index ba28d65..20e2aee 100644
index 263343c..f02bcb0 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -53,6 +53,9 @@
#include <sys/sysinfo.h>
@@ -49,8 +49,10 @@
#include <limits.h>
#include <ctype.h>
-#ifdef __linux__
+#if defined(__linux__)
#include <sys/sysmacros.h>
#include <sched.h>
+#elif __HAIKU__
+#include <OS.h>
+#elif defined(__HAIKU__)
+#include "haiku_macros.h"
#else
#include <sys/sysctl.h>
#endif
@@ -5257,6 +5260,12 @@ static void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq,
processors = sysconf(_SC_NPROCESSORS_ONLN);
else
processors = CPU_COUNT(&cpu_set);
+#elif __HAIKU__
+ system_info sysinfo;
+ if (get_system_info(&sysinfo) == B_OK)
+ processors = sysinfo.cpu_count;
+ else
+ processors = 1;
#else
int mib[2];
size_t len = sizeof(processors);
@@ -5664,8 +5673,13 @@ static void write_recovery_data(struct squashfs_super_block *sBlk)
#include "squashfs_fs.h"
@@ -5724,8 +5726,13 @@ static void write_recovery_data(struct squashfs_super_block *sBlk)
BAD_ERROR("Could not read $HOME, use -recovery-path or -no-recovery options\n");
}
+#if __HAIKU__
+ res = asprintf(&recovery_file, "%s/squashfs_recovery_%s_%" B_PRId32, recovery_pathname,
+#ifdef B_HAIKU_32_BIT
+ ASPRINTF(&recovery_file, "%s/squashfs_recovery_%s_%ld", recovery_pathname,
+ getbase(destination_file), pid);
+#else
res = asprintf(&recovery_file, "%s/squashfs_recovery_%s_%d", recovery_pathname,
ASPRINTF(&recovery_file, "%s/squashfs_recovery_%s_%d", recovery_pathname,
getbase(destination_file), pid);
+#endif
if(res == -1)
MEM_ERROR();
metadata = MALLOC(bytes);
res = read_fs_bytes(fd, sBlk->inode_table_start, bytes, metadata);
if(res == 0) {
diff --git a/squashfs-tools/nprocessors_compat.c b/squashfs-tools/nprocessors_compat.c
index 4aa1282..0ade3d8 100644
--- a/squashfs-tools/nprocessors_compat.c
+++ b/squashfs-tools/nprocessors_compat.c
@@ -23,7 +23,8 @@
static int processors = -1;
-#ifdef __linux__
+#if defined(__linux__)
+
#include <sched.h>
#include <unistd.h>
@@ -41,7 +42,22 @@ int get_nprocessors(void)
else
return processors = sysconf(_SC_NPROCESSORS_ONLN);
}
+
+#elif defined(__HAIKU__)
+
+#include <OS.h>
+
+int get_nprocessors(void)
+{
+ system_info sysinfo;
+ if (get_system_info(&sysinfo) == B_OK)
+ return sysinfo.cpu_count;
+
+ return 1;
+}
+
#else
+
#include <sys/sysctl.h>
#include "error.h"
@@ -67,4 +83,5 @@ int get_nprocessors(void)
return processors;
}
+
#endif
diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
index 0ac6356..227ad52 100644
index bde1460..b2fed82 100644
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -36,6 +36,9 @@
#include <sched.h>
#include <sys/sysinfo.h>
@@ -44,6 +44,10 @@
#include <sys/sysmacros.h>
+#elif __HAIKU__
+#include <OS.h>
+#include "haiku_macros.h"
#else
#include <sys/sysctl.h>
#endif
@@ -2775,6 +2778,12 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size, int cat_
processors = sysconf(_SC_NPROCESSORS_ONLN);
else
processors = CPU_COUNT(&cpu_set);
+#elif __HAIKU__
+ system_info sysinfo;
+ if (get_system_info(&sysinfo) == B_OK)
+ processors = sysinfo.cpu_count;
+ else
+ processors = 1;
#else
int mib[2];
size_t len = sizeof(processors);
+#ifdef __HAIKU__
+#include "haiku_macros.h"
+#endif
+
#include <sys/types.h>
#include <sys/time.h>
#include <limits.h>
--
2.43.2
2.50.1

View File

@@ -9,9 +9,9 @@ systems) where low overhead is needed."
HOMEPAGE="https://github.com/plougher/squashfs-tools"
COPYRIGHT="2002-2023 Phillip Lougher"
LICENSE="GNU GPL v2"
REVISION="2"
REVISION="1"
SOURCE_URI="https://github.com/plougher/squashfs-tools/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="94201754b36121a9f022a190c75f718441df15402df32c2b520ca331a107511c"
CHECKSUM_SHA256="4672b5c47d9418d3a5ae5b243defc6d9eae8275b9771022247c6a6082c815914"
SOURCE_DIR="squashfs-tools-$portVersion"
PATCHES="squashfs_tools-$portVersion.patchset"
@@ -56,9 +56,11 @@ BUILD_REQUIRES="
devel:libzstd$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:echo # /bin/echo needed by "install-manpages.sh"
cmd:help2man
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:which # (otherwise fails to find cmd:echo)
"
MAKE_ARGS="