aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Teterin <mi@FreeBSD.org>2023-08-22 06:10:19 +0000
committerMikhail Teterin <mi@FreeBSD.org>2023-08-22 06:10:19 +0000
commit79ebd9b2cddf24f710e378d28e7aa4d38c32d4ab (patch)
tree6912b84e4ce48468d190dec936fa23649f1cc6a8
parent01c420e177547c1d3711df6351eb071d0072271a (diff)
downloadports-79ebd9b2cddf24f710e378d28e7aa4d38c32d4ab.tar.gz
ports-79ebd9b2cddf24f710e378d28e7aa4d38c32d4ab.zip
archivers/lz4json: add new port
OpenBSD has had it for years, and so have various Linux distributions.
-rw-r--r--archivers/Makefile1
-rw-r--r--archivers/lz4json/Makefile18
-rw-r--r--archivers/lz4json/distinfo3
-rw-r--r--archivers/lz4json/files/BSDmakefile11
-rw-r--r--archivers/lz4json/files/patch-warnings50
-rw-r--r--archivers/lz4json/pkg-descr6
6 files changed, 89 insertions, 0 deletions
diff --git a/archivers/Makefile b/archivers/Makefile
index 22e73d5ae510..aa9aa1032174 100644
--- a/archivers/Makefile
+++ b/archivers/Makefile
@@ -78,6 +78,7 @@
SUBDIR += lua-lzlib
SUBDIR += lua-zlib
SUBDIR += lxqt-archiver
+ SUBDIR += lz4json
SUBDIR += lzfse
SUBDIR += lzip
SUBDIR += lziprecover
diff --git a/archivers/lz4json/Makefile b/archivers/lz4json/Makefile
new file mode 100644
index 000000000000..9792d938eb59
--- /dev/null
+++ b/archivers/lz4json/Makefile
@@ -0,0 +1,18 @@
+PORTNAME= lz4json
+PORTVERSION= 20191229
+CATEGORIES= archivers www
+
+MAINTAINER= mi@aldan.algebra.com
+COMMENT= Unpack Mozilla lz4json files, such as bookmarks and session restore
+WWW= https://github.com/andikleen/lz4json
+
+USES= uidfix
+
+USE_GITHUB= yes
+GH_ACCOUNT= andikleen
+GH_TAGNAME= c44c5100
+PLIST_FILES= bin/lz4jsoncat man/man1/lz4jsoncat.1${COMPRESS_EXT}
+
+MAKEFILE= ${FILESDIR}/BSDmakefile
+
+.include <bsd.port.mk>
diff --git a/archivers/lz4json/distinfo b/archivers/lz4json/distinfo
new file mode 100644
index 000000000000..cd6261539be4
--- /dev/null
+++ b/archivers/lz4json/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1692684009
+SHA256 (andikleen-lz4json-20191229-c44c5100_GH0.tar.gz) = 0aabebdad1963c9f04c2692993e71bf3cadb7007474e617a4435d424e449eca3
+SIZE (andikleen-lz4json-20191229-c44c5100_GH0.tar.gz) = 2036
diff --git a/archivers/lz4json/files/BSDmakefile b/archivers/lz4json/files/BSDmakefile
new file mode 100644
index 000000000000..002b0e285465
--- /dev/null
+++ b/archivers/lz4json/files/BSDmakefile
@@ -0,0 +1,11 @@
+PROG= lz4jsoncat
+
+BINDIR= ${LOCALBASE}/bin
+MANDIR= ${LOCALBASE}/man/man
+
+WARNS= 3
+
+CFLAGS+=-isystem ${PREFIX}/include
+LDADD= -L${PREFIX}/lib -llz4
+
+.include <bsd.prog.mk>
diff --git a/archivers/lz4json/files/patch-warnings b/archivers/lz4json/files/patch-warnings
new file mode 100644
index 000000000000..13c4f68607a7
--- /dev/null
+++ b/archivers/lz4json/files/patch-warnings
@@ -0,0 +1,50 @@
+--- lz4jsoncat.c 2019-12-29 00:44:09.000000000 -0500
++++ lz4jsoncat.c 2023-08-22 01:48:00.646059000 -0400
+@@ -1,3 +1,3 @@
+-/*
++/*
+ * Dump mozilla style lz4json files.
+ *
+@@ -30,15 +30,19 @@
+ #include <stdint.h>
+ #ifndef __APPLE__
++# if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFlyBSD__)
++#include <sys/endian.h>
++# else
+ #include <endian.h>
++# endif
+ #else
+ #define htole32(x) x /* assume apple targets are little endian */
+ #endif
+
+-#include "lz4.h"
++#include <lz4.h>
+
+ int main(int ac, char **av)
+ {
+- while (*++av) {
+- int fd = open(*av, O_RDONLY);
++ while (--ac) {
++ int fd = open(*++av, O_RDONLY);
+ if (fd < 0) {
+ perror(*av);
+@@ -56,5 +60,5 @@
+
+ char *map = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+- if (map == (char *)-1) {
++ if (map == MAP_FAILED) {
+ perror(*av);
+ exit(1);
+@@ -64,5 +68,5 @@
+ exit(1);
+ }
+- size_t outsz = htole32(*(uint32_t *) (map + 8));
++ ssize_t outsz = htole32(*(uint32_t *) (map + 8));
+ char *out = malloc(outsz);
+ if (!out) {
+@@ -88,5 +92,2 @@
+ return 0;
+ }
+-
+-
+-
diff --git a/archivers/lz4json/pkg-descr b/archivers/lz4json/pkg-descr
new file mode 100644
index 000000000000..501d1483c774
--- /dev/null
+++ b/archivers/lz4json/pkg-descr
@@ -0,0 +1,6 @@
+A little utility to unpack lz4json files as generated by Firefox's
+bookmark backups and session restore. This is a different format
+from what the normal lz4 utility expects.
+
+The input must be regular file(s) (accessible via mmap()). The
+output is dumped to stdout.