Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GCI) Added recipe for sys-fs/squashfs_tools #948

Merged
merged 1 commit into from
Dec 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions sys-fs/squashfs_tools/patches/squashfs_tools-4.3-gcc2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--- 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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
--- a/action.c
+++ b/action.c
@@ -39,6 +39,7 @@
#include <limits.h>
#include <errno.h>

+#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 <sys/sysctl.h>
+#include "haiku_macros.h"
#else
#include <endian.h>
#include <sys/sysinfo.h>
@@ -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 <sys/sysinfo.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -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);

107 changes: 107 additions & 0 deletions sys-fs/squashfs_tools/squashfs_tools-4.3.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
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="1"
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.debian.tar.xz"
SOURCE_URI_2="http://httpredir.debian.org/debian/pool/main/s/squashfs-tools/$SOURCE_FILENAME_2"
CHECKSUM_SHA256_2="1c296cc147e322e7124bf23a3c242ac83f6a986e6d6f64829ad2424b33914fc4"

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="x86_gcc2 x86 x86_64"
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change BUILD_PREREQUIRES to:

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 $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
}