aboutsummaryrefslogtreecommitdiff
path: root/system/xar
diff options
context:
space:
mode:
Diffstat (limited to 'system/xar')
-rw-r--r--system/xar/README21
-rw-r--r--system/xar/patches/xar-1.6.1-ext2.patch24
-rw-r--r--system/xar/patches/xar-1.8-arm-ppc.patch23
-rw-r--r--system/xar/patches/xar-1.8-openssl-1.1.patch45
-rw-r--r--system/xar/patches/xar-1.8-safe_dirname.patch16
-rw-r--r--system/xar/patches/xar-1.8.0.0.452-linux.patch104
-rw-r--r--system/xar/slack-desc19
-rw-r--r--system/xar/xar.SlackBuild122
-rw-r--r--system/xar/xar.info10
9 files changed, 384 insertions, 0 deletions
diff --git a/system/xar/README b/system/xar/README
new file mode 100644
index 000000000000..3bc8e854ed09
--- /dev/null
+++ b/system/xar/README
@@ -0,0 +1,21 @@
+xar (eXtensible ARchiver)
+
+The XAR project aims to provide an easily extensible archive
+format. Important design decisions include an easily extensible XML
+table of contents (TOC) for random access to archived files, storing
+the TOC at the beginning of the archive to allow for efficient
+handling of streamed archives, the ability to handle files of
+arbitrarily large sizes, the ability to choose independent encodings
+for individual files in the archive, the ability to store checksums
+for individual files in both compressed and uncompressed form, and the
+ability to query the table of content's rich meta-data.
+
+xar is used primarily for software install packages (.pkg files) for
+macOS X.
+
+To actually extract a .pkg file, do something like:
+
+$ xar -x -f filename.pkg
+$ zcat base.pkg/Payload | cpio -iv
+
+You'll end up with Applications/ Library/ Resources/, etc.
diff --git a/system/xar/patches/xar-1.6.1-ext2.patch b/system/xar/patches/xar-1.6.1-ext2.patch
new file mode 100644
index 000000000000..da413b03e522
--- /dev/null
+++ b/system/xar/patches/xar-1.6.1-ext2.patch
@@ -0,0 +1,24 @@
+--- a/lib/ext2.c.orig
++++ b/lib/ext2.c
+@@ -139,8 +139,10 @@
+ if(! (flags & ~EXT2_NOCOMPR_FL) )
+ x_addprop(f, "NoCompBlock");
+ #endif
++#ifdef EXT2_ECOMPR_FL
+ if(! (flags & ~EXT2_ECOMPR_FL) )
+ x_addprop(f, "CompError");
++#endif
+ if(! (flags & ~EXT2_BTREE_FL) )
+ x_addprop(f, "BTree");
+ if(! (flags & ~EXT2_INDEX_FL) )
+@@ -225,8 +227,10 @@
+ if( e2prop_get(f, "NoCompBlock", (char **)&tmp) == 0 )
+ flags |= EXT2_NOCOMPR_FL ;
+ #endif
++#ifdef EXT2_ECOMPR_FL
+ if( e2prop_get(f, "CompError", (char **)&tmp) == 0 )
+ flags |= EXT2_ECOMPR_FL ;
++#endif
+ if( e2prop_get(f, "BTree", (char **)&tmp) == 0 )
+ flags |= EXT2_BTREE_FL ;
+ if( e2prop_get(f, "HashIndexed", (char **)&tmp) == 0 )
diff --git a/system/xar/patches/xar-1.8-arm-ppc.patch b/system/xar/patches/xar-1.8-arm-ppc.patch
new file mode 100644
index 000000000000..b2eec5a96e81
--- /dev/null
+++ b/system/xar/patches/xar-1.8-arm-ppc.patch
@@ -0,0 +1,23 @@
+--- a/lib/archive.c
++++ b/lib/archive.c
+@@ -387,7 +387,8 @@
+ return NULL;
+ }
+
+- XAR(ret)->heap_offset = xar_get_heap_offset(ret) + offset;
++ XAR(ret)->heap_offset =
++ XAR(ret)->toc_count + sizeof(xar_header_t) + offset;
+ if( lseek(XAR(ret)->fd, XAR(ret)->heap_offset, SEEK_SET) == -1 ) {
+ xar_close(ret);
+ return NULL;
+--- a/src/xar.c
++++ a/src/xar.c
+@@ -783,7 +783,7 @@
+ int main(int argc, char *argv[]) {
+ int ret;
+ char *filename = NULL;
+- char command = 0, c;
++ signed char command = 0, c;
+ char **args;
+ const char *tocfile = NULL;
+ int arglen, i, err;
diff --git a/system/xar/patches/xar-1.8-openssl-1.1.patch b/system/xar/patches/xar-1.8-openssl-1.1.patch
new file mode 100644
index 000000000000..f811d99d07e5
--- /dev/null
+++ b/system/xar/patches/xar-1.8-openssl-1.1.patch
@@ -0,0 +1,45 @@
+lib/hash.c: fix compilation with OpenSSL-1.1+
+
+EVP_MD_CTX has become an anonymous struct now, so can't allocate size
+for it anymore.
+
+--- a/lib/hash.c 2015-06-09 03:22:07.000000000 +0000
++++ b/lib/hash.c 2019-01-01 14:37:01.487775958 +0000
+@@ -102,7 +102,7 @@
+ #ifdef __APPLE__
+ CCDigestRef digest;
+ #else
+- EVP_MD_CTX digest;
++ EVP_MD_CTX *digest;
+ const EVP_MD *type;
+ #endif
+ unsigned int length;
+@@ -123,7 +123,8 @@
+ #else
+ OpenSSL_add_all_digests();
+ HASH_CTX(hash)->type = EVP_get_digestbyname(digest_name);
+- EVP_DigestInit(&HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
++ HASH_CTX(hash)->digest = EVP_MD_CTX_create();
++ EVP_DigestInit(HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
+ #endif
+
+ HASH_CTX(hash)->digest_name = strdup(digest_name);
+@@ -143,7 +143,7 @@
+ #ifdef __APPLE__
+ CCDigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
+ #else
+- EVP_DigestUpdate(&HASH_CTX(hash)->digest, buffer, nbyte);
++ EVP_DigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
+ #endif
+ }
+
+@@ -160,7 +160,8 @@
+ CCDigestFinal(HASH_CTX(hash)->digest, buffer);
+ CCDigestDestroy(HASH_CTX(hash)->digest);
+ #else
+- EVP_DigestFinal(&HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
++ EVP_DigestFinal(HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
++ EVP_MD_CTX_destroy(HASH_CTX(hash)->digest);
+ #endif
+
+ *nbyte = HASH_CTX(hash)->length;
diff --git a/system/xar/patches/xar-1.8-safe_dirname.patch b/system/xar/patches/xar-1.8-safe_dirname.patch
new file mode 100644
index 000000000000..eb2f5f071bb2
--- /dev/null
+++ b/system/xar/patches/xar-1.8-safe_dirname.patch
@@ -0,0 +1,16 @@
+linuxattr: fix missing symbol safe_dirname
+
+This one was probably missed when they did a global rename to xar_
+prefixed variants.
+
+--- a/lib/linuxattr.c
++++ b/lib/linuxattr.c
+@@ -223,7 +223,7 @@
+ if( statfs(file, &sfs) != 0 ) {
+ char *tmp, *bname;
+ tmp = strdup(file);
+- bname = safe_dirname(tmp);
++ bname = xar_safe_dirname(tmp);
+ statfs(bname, &sfs);
+ free(tmp);
+ free(bname);
diff --git a/system/xar/patches/xar-1.8.0.0.452-linux.patch b/system/xar/patches/xar-1.8.0.0.452-linux.patch
new file mode 100644
index 000000000000..ccfc68369a43
--- /dev/null
+++ b/system/xar/patches/xar-1.8.0.0.452-linux.patch
@@ -0,0 +1,104 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -183,7 +183,7 @@
+
+ AC_TRY_COMPILE([#include <sys/types.h>
+ #include <sys/acl.h>], [acl_t a], [AC_DEFINE([HAVE_SYS_ACL_H],[1], [define if you have sys/acl.h and it has a working acl_t type])])
+-AC_CHECK_HEADERS(ext2fs/ext2_fs.h sys/statfs.h sys/xattr.h sys/param.h sys/extattr.h libutil.h)
++AC_CHECK_HEADERS(ext2fs/ext2_fs.h sys/statfs.h sys/vfs.h sys/xattr.h sys/param.h sys/extattr.h libutil.h)
+ AC_CHECK_FUNCS(lgetxattr)
+ AC_CHECK_FUNCS(lsetxattr)
+ AC_CHECK_FUNCS(getxattr)
+@@ -199,7 +199,22 @@
+
+ AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[#include <sys/types.h>
+ #include <sys/param.h>
+-#include <sys/mount.h>])
++#include <sys/mount.h>
++#ifdef HAVE_SYS_VFS_H
++#include <sys/vfs.h>
++#endif])
++AC_CHECK_MEMBERS([struct statfs.f_iosize],,,[#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/mount.h>
++#ifdef HAVE_SYS_VFS_H
++#include <sys/vfs.h>
++#endif])
++AC_CHECK_MEMBERS([struct statfs.f_bsize],,,[#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/mount.h>
++#ifdef HAVE_SYS_VFS_H
++#include <sys/vfs.h>
++#endif])
+ AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,,[#include <sys/statvfs.h>])
+ AC_CHECK_MEMBERS([struct stat.st_flags])
+
+--- a/lib/util.c
++++ b/lib/util.c
+@@ -35,6 +35,8 @@
+ * Christopher Ryan <ryanc@apple.com>
+ */
+
++#include "config.h"
++
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <sys/types.h>
+@@ -40,6 +40,9 @@
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/param.h>
++#ifdef HAVE_SYS_VFS_H
++# include <sys/vfs.h>
++#endif
+ #include <arpa/inet.h>
+ #include <string.h>
+ #include <unistd.h>
+@@ -467,6 +467,14 @@
+ return tmp;
+ }
+
++#ifndef HAVE_STRUCT_STATFS_F_IOSIZE
++# ifdef HAVE_STRUCT_STATFS_F_BSIZE
++# define f_iosize f_bsize
++# else
++# error need a field to get optimal transfer block size
++# endif
++#endif
++
+ size_t xar_optimal_io_size_at_path(const char *path)
+ {
+ // Start at 1MiB
+@@ -491,6 +491,7 @@
+ fs_iosize = optimal_rsize;
+ }
+
++#ifdef MNT_LOCAL
+ // If we're a remote filesystem, never let us go below the optimal size above of 1MiB
+ // NFS is horrible and lies that the optimal size is 512 bytes.
+ // Whereas SMB in my testing returns 7MiBs (far more practicle)
+@@ -503,6 +504,7 @@
+ }
+ }
+ else
++#endif
+ {
+ optimal_rsize = fs_iosize;
+ }
+--- a/include/config.h.in
++++ b/include/config.h.in
+@@ -1,4 +1,5 @@
+ #undef HAVE_SYS_STATFS_H
++#undef HAVE_SYS_VFS_H
+ #undef HAVE_SYS_XATTR_H
+ #undef HAVE_SYS_EXTATTR_H
+ #undef HAVE_SYS_PARAM_H
+@@ -15,6 +15,8 @@
+ #undef HAVE_STRUCT_STAT_ST_FLAGS
+ #undef HAVE_STRUCT_STATVFS_F_FSTYPENAME
+ #undef HAVE_STRUCT_STATFS_F_FSTYPENAME
++#undef HAVE_STRUCT_STATFS_F_IOSIZE
++#undef HAVE_STRUCT_STATFS_F_BSIZE
+ #undef HAVE_SYS_ACL_H
+ #undef HAVE_LIBUTIL_H
+ #undef HAVE_LIBPTHREAD
diff --git a/system/xar/slack-desc b/system/xar/slack-desc
new file mode 100644
index 000000000000..1e2dc082cb1e
--- /dev/null
+++ b/system/xar/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+xar: xar (eXtensible ARchiver)
+xar:
+xar: The XAR project aims to provide an easily extensible archive
+xar: format. Important design decisions include an easily extensible XML
+xar: table of contents (TOC) for random access to archived files, storing
+xar: the TOC at the beginning of the archive to allow for efficient
+xar: handling of streamed archives, the ability to handle files of
+xar: arbitrarily large sizes, the ability to choose independent encodings
+xar: for individual files in the archive, the ability to store checksums
+xar: for individual files in both compressed and uncompressed form, and the
+xar: ability to query the table of content's rich meta-data.
diff --git a/system/xar/xar.SlackBuild b/system/xar/xar.SlackBuild
new file mode 100644
index 000000000000..fd1196645564
--- /dev/null
+++ b/system/xar/xar.SlackBuild
@@ -0,0 +1,122 @@
+#!/bin/bash
+
+# Slackware build script for xar
+
+# Written by B. Watson (yalhcru@gmail.com)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+# Notes:
+
+# Man page says xar is no longer actively developed. I added this to
+# SBo in order to extract old archives I ran into, so this doesn't
+# bother me.
+
+# The original google code project is dead, and so is mackyle's github
+# project. The Apple project might be deprecated, but it was last
+# updated in 2020, so it's at least not ancient history.
+
+# For some reason, gentoo and other distros want to give this the
+# version number "1.8.0.0.452". Dunno where the extra zeroes come
+# from. "xar --version" reports "1.8dev", the tarball's version
+# number is the SVN revision, 452...
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=xar
+VERSION=${VERSION:-1.8dev+452}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+SRCVER="$( echo $VERSION | cut -d+ -f2 )"
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$SRCVER
+tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
+cd $PRGNAM-$SRCVER
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+cd $PRGNAM
+
+# patches came from gentoo:
+# https://gitweb.gentoo.org/repo/gentoo.git/tree/app-arch/xar
+for i in $CWD/patches/*.patch; do
+ patch -p1 < $i
+done
+
+# -I doesn't affect #include "blah.h".
+sed -i 's,"\(\(util\|filetree\)\.h\)",<\1>,' src/xar.c
+
+# xar executable, library, and includes. have to manually add
+# openssl's libs, and jigger the include path for <util.h> and
+# <filetree.h>.
+sh autogen.sh --noconfigure
+
+LIBS="$( pkg-config --libs openssl )" \
+CFLAGS="$SLKCFLAGS -Wl,-s -I$(pwd)/lib" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --disable-static \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+gzip $PKG/usr/man/man?/*
+rm -f $PKG/usr/lib*/*.la
+
+cd -
+
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
+cp -a README xar.txt xar/{ChangeLog,LICENSE,TODO} $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/system/xar/xar.info b/system/xar/xar.info
new file mode 100644
index 000000000000..a114df0df213
--- /dev/null
+++ b/system/xar/xar.info
@@ -0,0 +1,10 @@
+PRGNAM="xar"
+VERSION="1.8dev+452"
+HOMEPAGE="https://opensource.apple.com/source/xar/"
+DOWNLOAD="https://opensource.apple.com/tarballs/xar/xar-452.tar.gz"
+MD5SUM="79e673ca905a16674dae0ce54d7ead5b"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"