MFH: r568538

- Update to version 4.4 and unforbid
- Add LZ4 and ZSTD compression support
- Improve or drop option descriptions
- Convert to option helpers while here

PR:		ports/254316
Security:	317487c6-85ca-11eb-80fa-14dae938ec40
This commit is contained in:
Chris Rees 2021-03-21 22:07:33 +00:00
parent 444522b8cc
commit e7031205f2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2021Q1/; revision=568936
5 changed files with 106 additions and 42 deletions

View File

@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= squashfs-tools
PORTVERSION= 4.3
PORTREVISION= 1
PORTVERSION= 4.4
CATEGORIES= sysutils
MASTER_SITES= SF/squashfs/squashfs/${DISTNAME}/
DISTNAME= squashfs${PORTVERSION}
@ -20,11 +19,10 @@ USES= alias cpe gmake
PLIST_FILES= bin/mksquashfs \
bin/unsquashfs
OPTIONS_DEFINE= XZ LZO LZMA DOCS
OPTIONS_DEFAULT= XZ LZO LZMA
XZ_DESC= Build with XZ support
LZO_DESC= Build with LZO support
LZMA_DESC= Build with LZMA support
OPTIONS_DEFINE= DOCS LZ4 LZMA LZO XZ ZSTD
OPTIONS_DEFAULT= LZ4 LZMA LZO XZ ZSTD
LZMA_DESC= LZMA1 compression support (obsolete)
XZ_DESC= XZ (LZMA2) compression support
WRKSRC= ${WRKDIR}/${DISTNAME}/squashfs-tools
@ -36,29 +34,23 @@ USE_CSTD= gnu89
# Fix build with clang11
CFLAGS+= -fcommon
.include <bsd.port.options.mk>
PORTDOCS= ACKNOWLEDGEMENTS CHANGES README-${PORTVERSION} USAGE \
pseudo-file.example
PORTDOCS= ACKNOWLEDGEMENTS CHANGES COPYING \
PERFORMANCE.README README README-${PORTVERSION}
LZ4_LIB_DEPENDS= liblz4.so:archivers/liblz4
LZ4_MAKE_ARGS= LZ4_SUPPORT=1
.if ${PORT_OPTIONS:MXZ}
MAKE_ARGS+= XZ_SUPPORT=1
.endif
LZMA_MASTER_SITES= SF/sevenzip/LZMA%20SDK/:lzma
LZMA_DISTFILES= lzma922.tar.bz2:lzma
LZMA_MAKE_ARGS= LZMA_SUPPORT=1 LZMA_DIR=${WRKDIR} EXTRA_CFLAGS=-D_7ZIP_ST
.if ${PORT_OPTIONS:MLZO}
MAKE_ARGS+= LZO_SUPPORT=1 LZO_DIR=${LOCALBASE}
LIB_DEPENDS+= liblzo2.so:archivers/lzo2
.endif
LZO_LIB_DEPENDS= liblzo2.so:archivers/lzo2
LZO_MAKE_ARGS= LZO_SUPPORT=1 LZO_LIBDIR=-L${LOCALBASE}/lib
.if ${PORT_OPTIONS:MLZMA}
MASTER_SITES+= SF/sevenzip/LZMA%20SDK/:lzma
DISTFILES+= lzma922.tar.bz2:lzma
MAKE_ARGS+= LZMA_SUPPORT=1 LZMA_DIR=${WRKDIR} EXTRA_CFLAGS="-D_7ZIP_ST"
.endif
XZ_MAKE_ARGS= XZ_SUPPORT=1
post-patch:
@${REINPLACE_CMD} -e "s|^\(XATTR\)|# \1|g" \
${WRKSRC}/Makefile
ZSTD_LIB_DEPENDS= libzstd.so:archivers/zstd
ZSTD_MAKE_ARGS= ZSTD_SUPPORT=1
post-install:
@${MKDIR} ${STAGEDIR}${DOCSDIR}

View File

@ -1,5 +1,5 @@
TIMESTAMP = 1467029943
SHA256 (squashfs4.3.tar.gz) = 0d605512437b1eb800b4736791559295ee5f60177e102e4d4ccd0ee241a5f3f6
SIZE (squashfs4.3.tar.gz) = 182550
TIMESTAMP = 1567045250
SHA256 (squashfs4.4.tar.gz) = a981b3f3f2054b5a2e658851a3c06a2460ad04a9a8a645e0afe063a63fdbb07e
SIZE (squashfs4.4.tar.gz) = 190797
SHA256 (lzma922.tar.bz2) = 9aade84f229fb25f7aef39d8866b375fe6d35a9e18098d7cd86a99e294902944
SIZE (lzma922.tar.bz2) = 546148

View File

@ -1,15 +1,24 @@
--- Makefile.orig 2014-05-11 18:56:00 UTC
--- Makefile.orig 2019-08-29 01:58:04 UTC
+++ Makefile
@@ -38,7 +38,7 @@ GZIP_SUPPORT = 1
# installation prefix.
@@ -97,7 +97,7 @@ COMP_DEFAULT = gzip
# If your C library or build/target environment doesn't support XATTRs then
# comment out the next line to build Mksquashfs and Unsquashfs without XATTR
# support
-XATTR_SUPPORT = 1
+# XATTR_SUPPORT = 1
# Select whether you wish xattrs to be stored by Mksquashfs and extracted
# by Unsquashfs by default. If selected users can disable xattr support by
@@ -105,7 +105,7 @@ XATTR_SUPPORT = 1
#
#LZO_SUPPORT = 1
-#LZO_DIR = /usr/local
+#LZO_DIR = $(LOCALBASE)
# If unselected, Mksquashfs/Unsquashfs won't store and extract xattrs by
# default. Users can enable xattrs by using the -xattrs option.
-XATTR_DEFAULT = 1
+# XATTR_DEFAULT = 1
########### Building LZ4 support #############
@@ -119,7 +119,7 @@ UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2
###############################################
@@ -160,7 +160,7 @@ UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2
CFLAGS ?= -O2
CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
@ -18,7 +27,37 @@
-Wall
LIBS = -lpthread -lm
@@ -300,6 +300,6 @@ clean:
@@ -200,6 +200,7 @@ endif
ifeq ($(LZO_SUPPORT),1)
CFLAGS += -DLZO_SUPPORT
+INCLUDEDIR += -I$(LOCALBASE)/include
MKSQUASHFS_OBJS += lzo_wrapper.o
UNSQUASHFS_OBJS += lzo_wrapper.o
LIBS += $(LZO_LIBDIR) -llzo2
@@ -208,17 +209,19 @@ endif
ifeq ($(LZ4_SUPPORT),1)
CFLAGS += -DLZ4_SUPPORT
+INCLUDEDIR += -I$(LOCALBASE)/include
MKSQUASHFS_OBJS += lz4_wrapper.o
UNSQUASHFS_OBJS += lz4_wrapper.o
-LIBS += -llz4
+LIBS += -L$(LOCALBASE)/lib -llz4
COMPRESSORS += lz4
endif
ifeq ($(ZSTD_SUPPORT),1)
CFLAGS += -DZSTD_SUPPORT
+INCLUDEDIR += -I$(LOCALBASE)/include
MKSQUASHFS_OBJS += zstd_wrapper.o
UNSQUASHFS_OBJS += zstd_wrapper.o
-LIBS += -lzstd
+LIBS += -L$(LOCALBASE)/lib -lzstd
COMPRESSORS += zstd
endif
@@ -360,6 +363,6 @@ clean:
.PHONY: install
install: mksquashfs unsquashfs

View File

@ -0,0 +1,34 @@
--- mksquashfs.c.orig 2019-08-29 01:58:04 UTC
+++ mksquashfs.c
@@ -35,7 +35,6 @@
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/sysmacros.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
@@ -50,7 +49,6 @@
#include <sys/wait.h>
#include <limits.h>
#include <ctype.h>
-#include <sys/sysinfo.h>
#ifndef linux
#define __BYTE_ORDER BYTE_ORDER
@@ -5195,6 +5193,7 @@ int get_physical_memory()
long long page_size = sysconf(_SC_PAGESIZE);
int phys_mem;
+#ifdef __linux__
if(num_pages == -1 || page_size == -1) {
struct sysinfo sys;
int res = sysinfo(&sys);
@@ -5205,6 +5204,7 @@ int get_physical_memory()
num_pages = sys.totalram;
page_size = sys.mem_unit;
}
+#endif
phys_mem = num_pages * page_size >> 20;

View File

@ -1,17 +1,16 @@
--- unsquashfs.c.orig 2014-05-12 22:18:35 UTC
--- unsquashfs.c.orig 2019-08-29 01:58:04 UTC
+++ unsquashfs.c
@@ -31,7 +31,14 @@
#include "unsquashfs_info.h"
@@ -32,8 +32,13 @@
#include "stdarg.h"
#include "fnmatch_compat.h"
+#ifdef __linux__
#include <sys/sysinfo.h>
#include <sys/sysmacros.h>
+#endif
+
+#ifdef __FreeBSD__
+#include <sys/sysctl.h>
+#endif
+
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>