diff --git a/sys-fs/squashfs_tools/patches/squashfs_tools-4.3-gcc2.patch b/sys-fs/squashfs_tools/patches/squashfs_tools-4.3-gcc2.patch deleted file mode 100644 index 586d5794b..000000000 --- a/sys-fs/squashfs_tools/patches/squashfs_tools-4.3-gcc2.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/unsquash-2.c -+++ b/unsquash-2.c -@@ -118,11 +118,11 @@ int read_fragment_table_2(long long *directory_table_end) - void read_fragment_2(unsigned int fragment, long long *start_block, int *size) - { - TRACE("read_fragment: reading fragment %d\n", fragment); -- -+{ - squashfs_fragment_entry_2 *fragment_entry = &fragment_table[fragment]; - *start_block = fragment_entry->start_block; - *size = fragment_entry->size; --} -+}} - - - struct inode *read_inode_2(unsigned int start_block, unsigned int offset) ---- a/unsquash-3.c -+++ b/unsquash-3.c -@@ -105,11 +105,11 @@ int read_fragment_table_3(long long *directory_table_end) - void read_fragment_3(unsigned int fragment, long long *start_block, int *size) - { - TRACE("read_fragment: reading fragment %d\n", fragment); -- -+{ - squashfs_fragment_entry_3 *fragment_entry = &fragment_table[fragment]; - *start_block = fragment_entry->start_block; - *size = fragment_entry->size; --} -+}} - - - struct inode *read_inode_3(unsigned int start_block, unsigned int offset) ---- a/unsquash-4.c -+++ b/unsquash-4.c -@@ -85,13 +85,13 @@ int read_fragment_table_4(long long *directory_table_end) - void read_fragment_4(unsigned int fragment, long long *start_block, int *size) - { - TRACE("read_fragment: reading fragment %d\n", fragment); -- -+{ - struct squashfs_fragment_entry *fragment_entry; - - fragment_entry = &fragment_table[fragment]; - *start_block = fragment_entry->start_block; - *size = fragment_entry->size; --} -+}} - - - struct inode *read_inode_4(unsigned int start_block, unsigned int offset) diff --git a/sys-fs/squashfs_tools/patches/squashfs_tools-4.3-haiku-compat.patch b/sys-fs/squashfs_tools/patches/squashfs_tools-4.3-haiku-compat.patch deleted file mode 100644 index f983a9918..000000000 --- a/sys-fs/squashfs_tools/patches/squashfs_tools-4.3-haiku-compat.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/action.c -+++ b/action.c -@@ -39,6 +39,7 @@ - #include - #include - -+#include "haiku_macros.h" - #include "squashfs_fs.h" - #include "mksquashfs.h" - #include "action.h" -@@ -1953,9 +1957,12 @@ static char *get_start(char *s, int n) - - static int subpathname_fn(struct atom *atom, struct action_data *action_data) - { -- return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath), -- count_components(atom->argv[0])), -- FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0; -+ char *dup = strdup(action_data->subpath); -+ int ret = fnmatch(atom->argv[0], get_start(dup, -+ count_components(atom->argv[0])), -+ FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0; -+ free(dup); -+ return ret; - } - - TEST_VAR_FN(filesize, ACTION_REG, action_data->buf->st_size) ---- /dev/null -+++ b/haiku_macros.h -@@ -0,0 +1,14 @@ -+#ifndef HAIKU_MACROS_H -+#define HAIKU_MACROS_H -+ -+/* Haiku does not provide these */ -+#define major(x) ((int)(0x00ff & ((x) >> 8))) -+#define minor(x) ((int)(0xffff00ff & (x))) -+#define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min))) -+ -+/* Mirroring a patch accepted to upstream after the release */ -+#ifndef FNM_EXTMATCH -+#define FNM_EXTMATCH 0 -+#endif -+ -+#endif /* HAIKU_MACROS_H */ ---- a/mksquashfs.c -+++ b/mksquashfs.c -@@ -55,7 +55,7 @@ - #define __BYTE_ORDER BYTE_ORDER - #define __BIG_ENDIAN BIG_ENDIAN - #define __LITTLE_ENDIAN LITTLE_ENDIAN --#include -+#include "haiku_macros.h" - #else - #include - #include -@@ -4105,7 +4109,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq, - BAD_ERROR("Failed to set signal mask in intialise_threads\n"); - - if(processors == -1) { --#ifndef linux -+#if !defined(linux) && !defined(__HAIKU__) - int mib[2]; - size_t len = sizeof(processors); - ---- a/unsquashfs.c -+++ b/unsquashfs.c -@@ -31,7 +31,7 @@ - #include "unsquashfs_info.h" - #include "stdarg.h" -+#include "haiku_macros.h" - --#include - #include - #include - #include -@@ -2190,7 +2193,7 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size) - "\n"); - - if(processors == -1) { --#ifndef linux -+#if !defined(linux) && !defined(__HAIKU__) - int mib[2]; - size_t len = sizeof(processors); - diff --git a/sys-fs/squashfs_tools/patches/squashfs_tools-4.6.1.patchset b/sys-fs/squashfs_tools/patches/squashfs_tools-4.6.1.patchset new file mode 100644 index 000000000..f6e5cb0fc --- /dev/null +++ b/sys-fs/squashfs_tools/patches/squashfs_tools-4.6.1.patchset @@ -0,0 +1,119 @@ +From ab99a3f89407d5946a420e7b693a9437bc68ecde Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Fri, 29 Mar 2024 18:46:59 -0300 +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 +--- a/squashfs-tools/Makefile ++++ b/squashfs-tools/Makefile +@@ -219,7 +219,7 @@ CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \ + -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"$(COMP_DEFAULT)\" \ + -Wall + +-LIBS = -lpthread -lm ++LIBS = -lpthread -lm -lbsd -lgnu + ifeq ($(GZIP_SUPPORT),1) + 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 +--- a/squashfs-tools/endian_compat.h ++++ b/squashfs-tools/endian_compat.h +@@ -23,7 +23,7 @@ + * + * endian_compat.h + */ +-#ifndef linux ++#if !defined(linux) && ! defined(__HAIKU__) + #define __BYTE_ORDER BYTE_ORDER + #define __BIG_ENDIAN BIG_ENDIAN + #define __LITTLE_ENDIAN LITTLE_ENDIAN +diff --git a/squashfs-tools/haiku_macros.h b/squashfs-tools/haiku_macros.h +new file mode 100644 +index 0000000..a643394 +--- /dev/null ++++ b/squashfs-tools/haiku_macros.h +@@ -0,0 +1,9 @@ ++#ifndef HAIKU_MACROS_H ++#define HAIKU_MACROS_H ++ ++/* Haiku does not provide these */ ++#define major(x) ((int)(0x00ff & ((x) >> 8))) ++#define minor(x) ((int)(0xffff00ff & (x))) ++#define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min))) ++ ++#endif /* HAIKU_MACROS_H */ +diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c +index ba28d65..20e2aee 100644 +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -53,6 +53,9 @@ + #include + #include + #include ++#elif __HAIKU__ ++#include ++#include "haiku_macros.h" + #else + #include + #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) + 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, ++ getbase(destination_file), pid); ++#else + res = asprintf(&recovery_file, "%s/squashfs_recovery_%s_%d", recovery_pathname, + getbase(destination_file), pid); ++#endif + if(res == -1) + MEM_ERROR(); + +diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c +index 0ac6356..227ad52 100644 +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -36,6 +36,9 @@ + #include + #include + #include ++#elif __HAIKU__ ++#include ++#include "haiku_macros.h" + #else + #include + #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); +-- +2.43.2 + diff --git a/sys-fs/squashfs_tools/squashfs_tools-4.3.recipe b/sys-fs/squashfs_tools/squashfs_tools-4.3.recipe deleted file mode 100644 index 316ccbf78..000000000 --- a/sys-fs/squashfs_tools/squashfs_tools-4.3.recipe +++ /dev/null @@ -1,110 +0,0 @@ -SUMMARY="Provides tools for creating and manipulating squashfs filesystems" -DESCRIPTION="squashfs-tools provides tools for creating and appending to \ -(mksquashfs) and extracting (unsquashfs) squashfs filesystems. - -Squashfs is a compressed read-only filesystem. It is intended for general \ -read-only filesystem use, archival use (i.e. in cases where a .tar.gz file \ -may be used, and in constrained block device/memory systems (e.g. embedded \ -systems) where low overhead is needed." -HOMEPAGE="http://squashfs.sourceforge.net/" -COPYRIGHT="2002-2014 Philip Lougher" -LICENSE="GNU GPL v2" -REVISION="3" -SOURCE_URI="https://downloads.sf.net/squashfs/squashfs$portVersion.tar.gz" -CHECKSUM_SHA256="0d605512437b1eb800b4736791559295ee5f60177e102e4d4ccd0ee241a5f3f6" -SOURCE_DIR="squashfs$portVersion/squashfs-tools" - -debianRevision="3" -SOURCE_FILENAME_2="squashfs-tools_$portVersion-$debianRevision+deb9u1.debian.tar.xz" -SOURCE_URI_2="http://httpredir.debian.org/debian/pool/main/s/squashfs-tools/$SOURCE_FILENAME_2" -CHECKSUM_SHA256_2="760fa5221778a851883b0843c9ee50662af0b33e6674909b79b8ab1312c6446a" - -commit="dceb729f0369d72f1d7820705fd12510b71446d2" -patchsetBaseUri="https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/squashfs-tools/files" -SOURCE_FILENAME_3="squashfs-tools-$portVersion-2gb.patch" -SOURCE_FILENAME_4="squashfs-tools-$portVersion-aligned-data.patch" -SOURCE_FILENAME_5="squashfs-tools-$portVersion-local-cve-fix.patch" -SOURCE_FILENAME_6="squashfs-tools-$portVersion-mem-overflow.patch" -SOURCE_URI_3="$patchsetBaseUri/$SOURCE_FILENAME_3?id=$commit#noarchive" -SOURCE_URI_4="$patchsetBaseUri/$SOURCE_FILENAME_4?id=$commit#noarchive" -SOURCE_URI_5="$patchsetBaseUri/$SOURCE_FILENAME_5?id=$commit#noarchive" -SOURCE_URI_6="$patchsetBaseUri/$SOURCE_FILENAME_6?id=$commit#noarchive" -CHECKSUM_SHA256_3="cdb9c85c2f733c0db879275d0ee2480f528aa3191f236bbf1ff681c75b14a024" -CHECKSUM_SHA256_4="3030ddfa5ba9d0baea7f5e4761b33dea67fbc4d49c86e475830fc1bfbfddb145" -CHECKSUM_SHA256_5="7edceedead4f5a57dc009afecd0f414d60a3878dc43f8de5224bff391ed32c76" -CHECKSUM_SHA256_6="a94f9df3439bef373da31a734e6dad42f5fc5a6d91f2b9d15d30b02f1aac73b3" - -PATCHES=" - squashfs_tools-$portVersion-haiku-compat.patch - squashfs_tools-$portVersion-gcc2.patch - " - -ARCHITECTURES="all" -SECONDARY_ARCHITECTURES="x86_gcc2 x86" - -if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then - HAVE_XZ=1 -else - HAVE_XZ= -fi - -PROVIDES=" - squashfs_tools$secondaryArchSuffix = $portVersion - cmd:mksquashfs$secondaryArchSuffix = $portVersion - cmd:unsquashfs$secondaryArchSuffix = $portVersion - " -REQUIRES=" - haiku$secondaryArchSuffix - lib:liblz4$secondaryArchSuffix - ${HAVE_XZ:+lib:liblzma$secondaryArchSuffix} - lib:liblzo2$secondaryArchSuffix - lib:libz$secondaryArchSuffix - " - -BUILD_REQUIRES=" - haiku${secondaryArchSuffix}_devel - devel:liblz4$secondaryArchSuffix - ${HAVE_XZ:+devel:liblzma$secondaryArchSuffix} - devel:liblzo2$secondaryArchSuffix - devel:libz$secondaryArchSuffix - " -BUILD_PREREQUIRES=" - cmd:gcc$secondaryArchSuffix - cmd:make - " - -MAKE_ARGS=" - LZ4_SUPPORT=1 - LZMA_XZ_SUPPORT=${HAVE_XZ:+1} - LZO_SUPPORT=1 - XATTR_SUPPORT=0 - XZ_SUPPORT=${HAVE_XZ:+1} - " - -PATCH() -{ - patch -p2 -i $sourceDir2/debian/patches/0002-*.patch - patch -p2 -i $sourceDir2/debian/patches/0003-*.patch - patch -p2 -i $sourceDir2/debian/patches/0004-*.patch - patch -p2 -i $sourceDir2/debian/patches/0006-*.patch - # previously applied) patch detected? - # patch -p2 -i $sourceDir2/debian/patches/0007-*.patch - patch -p2 -i $sourceDir3/$SOURCE_FILENAME_3 - patch -p2 -i $sourceDir4/$SOURCE_FILENAME_4 - patch -p2 -i $sourceDir6/$SOURCE_FILENAME_6 - # This one patch requires -p1 - patch -p1 -i $sourceDir5/$SOURCE_FILENAME_5 -} - -BUILD() -{ - make $MAKE_ARGS $jobArgs -} - -INSTALL() -{ - make install $MAKE_ARGS INSTALL_DIR=$binDir - - install -d -m 755 $manDir/man1 - install -m 444 -t $manDir/man1 $sourceDir2/debian/manpages/*.1 -} diff --git a/sys-fs/squashfs_tools/squashfs_tools-4.6.1.recipe b/sys-fs/squashfs_tools/squashfs_tools-4.6.1.recipe new file mode 100644 index 000000000..98c1141b3 --- /dev/null +++ b/sys-fs/squashfs_tools/squashfs_tools-4.6.1.recipe @@ -0,0 +1,80 @@ +SUMMARY="Provides tools for creating and manipulating squashfs filesystems" +DESCRIPTION="squashfs-tools provides tools for creating and appending to \ +(mksquashfs) and extracting (unsquashfs) squashfs filesystems. + +Squashfs is a compressed read-only filesystem. It is intended for general \ +read-only filesystem use, archival use (i.e. in cases where a .tar.gz file \ +may be used, and in constrained block device/memory systems (e.g. embedded \ +systems) where low overhead is needed." +HOMEPAGE="https://github.com/plougher/squashfs-tools" +COPYRIGHT="2002-2023 Phillip Lougher" +LICENSE="GNU GPL v2" +REVISION="1" +SOURCE_URI="https://github.com/plougher/squashfs-tools/archive/refs/tags/$portVersion.tar.gz" +CHECKSUM_SHA256="94201754b36121a9f022a190c75f718441df15402df32c2b520ca331a107511c" +SOURCE_DIR="squashfs-tools-$portVersion" + +PATCHES="squashfs_tools-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +commandBinDir=$binDir +commandSuffix=$secondaryArchSuffix +if [ "$targetArchitecture" = x86_gcc2 ]; then + commandBinDir=$prefix/bin + commandSuffix= +fi + +PROVIDES=" + squashfs_tools$secondaryArchSuffix = $portVersion + cmd:mksquashfs$commandSuffix = $portVersion + cmd:unsquashfs$commandSuffix = $portVersion + cmd:sqfscat$commandSuffix = $portVersion + cmd:sqfstar$commandSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:liblz4$secondaryArchSuffix + lib:liblzma$secondaryArchSuffix + lib:liblzo2$secondaryArchSuffix + lib:libz$secondaryArchSuffix + lib:libzstd$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:liblz4$secondaryArchSuffix + devel:liblzma$secondaryArchSuffix + devel:liblzo2$secondaryArchSuffix + devel:libz$secondaryArchSuffix + devel:libzstd$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:help2man + cmd:gcc$secondaryArchSuffix + cmd:make + " + +MAKE_ARGS=" + CONFIG=1 + GZIP_SUPPORT=1 + XZ_SUPPORT=1 + LZO_SUPPORT=1 + LZ4_SUPPORT=1 + ZSTD_SUPPORT=1 + XATTR_SUPPORT=1 + COMP_DEFAULT=gzip + " + +BUILD() +{ + cd squashfs-tools + make $MAKE_ARGS $jobArgs +} + +INSTALL() +{ + cd squashfs-tools + make install $MAKE_ARGS INSTALL_DIR=$commandBinDir INSTALL_MANPAGES_DIR=$manDir/man1 +}