summaryrefslogtreecommitdiffstats
path: root/patches/source/file
diff options
context:
space:
mode:
Diffstat (limited to 'patches/source/file')
-rwxr-xr-xpatches/source/file/file.SlackBuild149
-rw-r--r--patches/source/file/file.crdaregbin.magic5
-rw-r--r--patches/source/file/file.etc.file.diff11
-rw-r--r--patches/source/file/file.quiet.diff14
-rw-r--r--patches/source/file/file.short.diff12
-rw-r--r--patches/source/file/file.xz.magic9
-rw-r--r--patches/source/file/file.zisofs.magic8
-rw-r--r--patches/source/file/slack-desc19
8 files changed, 227 insertions, 0 deletions
diff --git a/patches/source/file/file.SlackBuild b/patches/source/file/file.SlackBuild
new file mode 100755
index 000000000..c18da402f
--- /dev/null
+++ b/patches/source/file/file.SlackBuild
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+# Copyright 2005-2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+VERSION=${VERSION:-$(echo file-*.tar.?z* | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
+BUILD=${BUILD:-1_slack13.37}
+
+NUMJOBS=${NUMJOBS:--j7}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -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
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-file
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf file-$VERSION
+tar xvf $CWD/file-$VERSION.tar.?z* || exit 1
+cd file-$VERSION || exit 1
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Make the default data directory /etc/file like it has always been:
+zcat $CWD/file.etc.file.diff.gz | patch -p1 --verbose || exit 1
+# This is needed after the patch above:
+autoreconf || exit 1
+
+# Don't spew warnings about using the flat text files
+zcat $CWD/file.quiet.diff.gz | patch -p1 -E --verbose || exit 1
+# I don't know what this one does
+zcat $CWD/file.short.diff.gz | patch -p1 -E --verbose || exit 1
+
+# Add zisofs and crda regulatory bin detection
+zcat $CWD/file.zisofs.magic.gz >> magic/Magdir/compress
+zcat $CWD/file.crdaregbin.magic.gz >> magic/Magdir/crdaregbin
+
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --datadir=/etc \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ --docdir=/usr/doc/file-$VERSION \
+ --enable-fsect-man5 \
+ --disable-static \
+ --build=$ARCH-slackware-linux
+
+# The generated $TMP/file-$VERSION/libtool is buggy. I don't know if this is supposed
+# to work, but it certainly does, so... :-)
+cat $(which libtool) > libtool
+
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Seems --disable-static has been ignored lately:
+rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libmagic.a
+
+# Is file really this much of a processing bottleneck? Doubtful.
+#
+# NOTE: Benchmarked flat files vs. .mgc June 2009, found no measurable
+# difference on 3000+ files.
+#
+# If you really need these (let's say you're doing virus scanning
+# and this *would* speed things up quite a bit) you can create
+# the pre-parsed file yourself using file's -C option.
+rm -f $PKG/etc/file/magic.mgc
+mkdir -p $PKG/etc/file/magic
+cp -a magic/Magdir/* $PKG/etc/file/magic
+# After building, this works fine. /etc/file/magic/ takes up 1.2M,
+# while the magic.mgc file is 1.7M. Considering a difference of 500k,
+# and the potential speedup, I'm not sure it's worth the effort...
+# but it does make it easier for an admin to add a small chunk of
+# new magic.
+
+# IMHO, moving this sort of thing does not make sense.
+# We'll support both the traditional and new locations.
+# I hate to squat on a name as generic as "/etc/misc/",
+# but it wasn't my idea.
+( cd $PKG/etc ; ln -sf file misc )
+
+# Strip everything for good measure:
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+( cd $PKG/usr/man || exit 1
+ find . -type f -exec gzip -9 {} \;
+ for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
+)
+
+mkdir -p $PKG/usr/doc/file-$VERSION
+cp -a \
+ AUTHORS COPYING INSTALL MAINT NEWS README TODO \
+ $PKG/usr/doc/file-$VERSION
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build the package:
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/file-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/patches/source/file/file.crdaregbin.magic b/patches/source/file/file.crdaregbin.magic
new file mode 100644
index 000000000..bff01854f
--- /dev/null
+++ b/patches/source/file/file.crdaregbin.magic
@@ -0,0 +1,5 @@
+# CRDA Regulatory database file
+# http://git.kernel.org/?p=linux/kernel/git/mcgrof/crda.git;a=summary
+# (see regdb.h)
+0 belong 0x52474442 CRDA regulatory database file
+>4 belong 19 (Version 1)
diff --git a/patches/source/file/file.etc.file.diff b/patches/source/file/file.etc.file.diff
new file mode 100644
index 000000000..98e075486
--- /dev/null
+++ b/patches/source/file/file.etc.file.diff
@@ -0,0 +1,11 @@
+--- ./configure.ac.orig 2009-05-06 15:32:25.000000000 -0500
++++ ./configure.ac 2009-06-12 17:40:25.000000000 -0500
+@@ -47,7 +47,7 @@
+ fsect=4
+ ])
+
+-AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
++AC_SUBST([pkgdatadir], ['$(datadir)/file'])
+ AC_SUBST(fsect)
+ AM_CONDITIONAL(FSECT5, test x$fsect = x5)
+
diff --git a/patches/source/file/file.quiet.diff b/patches/source/file/file.quiet.diff
new file mode 100644
index 000000000..198f62df5
--- /dev/null
+++ b/patches/source/file/file.quiet.diff
@@ -0,0 +1,14 @@
+diff -Nur file-5.00.orig/src/apprentice.c file-5.00/src/apprentice.c
+--- file-5.00.orig/src/apprentice.c 2009-02-03 14:27:51.000000000 -0600
++++ file-5.00/src/apprentice.c 2009-02-08 22:19:19.215635230 -0600
+@@ -285,8 +285,8 @@
+
+ #ifndef COMPILE_ONLY
+ if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) {
+- if (ms->flags & MAGIC_CHECK)
+- file_magwarn(ms, "using regular magic file `%s'", fn);
++ /* if (ms->flags & MAGIC_CHECK)
++ file_magwarn(ms, "using regular magic file `%s'", fn); */
+ rv = apprentice_load(ms, &magic, &nmagic, fn, action);
+ if (rv != 0)
+ return -1;
diff --git a/patches/source/file/file.short.diff b/patches/source/file/file.short.diff
new file mode 100644
index 000000000..0f6a0e7b6
--- /dev/null
+++ b/patches/source/file/file.short.diff
@@ -0,0 +1,12 @@
+diff -Nur file-5.08.orig//src/readelf.h file-5.08/src/readelf.h
+--- file-5.08.orig//src/readelf.h 2011-08-03 09:45:16.000000000 -0500
++++ file-5.08/src/readelf.h 2011-08-23 21:10:04.228054614 -0500
+@@ -239,7 +239,7 @@
+ * word[2]: minor version
+ * word[3]: tiny version
+ */
+-#define NT_GNU_VERSION 1
++#define NT_GNU_VERSION 0
+
+ /* GNU OS tags */
+ #define GNU_OS_LINUX 0
diff --git a/patches/source/file/file.xz.magic b/patches/source/file/file.xz.magic
new file mode 100644
index 000000000..9aa36e45a
--- /dev/null
+++ b/patches/source/file/file.xz.magic
@@ -0,0 +1,9 @@
+
+# XZ (Lempel-Ziv-Markov chain-Algorithm) file format supported by:
+# - 7-Zip <http://7-zip.org/>
+# - LZMA SDK <http://7-zip.org/sdk.html>
+# - XZ Utils <http://tukaani.org/xz/>
+#
+0 ustring \xFD7zXZ\x00 xz compressed data,
+>6 ubyte&0x10 0x00 single-block stream
+>6 ubyte&0x10 0x10 multi-block stream
diff --git a/patches/source/file/file.zisofs.magic b/patches/source/file/file.zisofs.magic
new file mode 100644
index 000000000..9aeb61edd
--- /dev/null
+++ b/patches/source/file/file.zisofs.magic
@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# zisofs: file(1) magic for zisofs/RockRidge compressed files
+#
+# from H. Peter Anvin <hpa@zytor.com> May 4, 2001
+#
+0 string \x37\xE4\x53\x96\xC9\xDB\xD6\x07 zisofs/Rockridge compressed file
+>8 lelong x - %d bytes
diff --git a/patches/source/file/slack-desc b/patches/source/file/slack-desc
new file mode 100644
index 000000000..d405cb865
--- /dev/null
+++ b/patches/source/file/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 ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+file: file (a utility to determine file type)
+file:
+file: This is Ian F. Darwin's 'file' utility, used to identify files.
+file: Christos Zoulas has been file's maintainer since 1994.
+file:
+file: Home FTP site: ftp://ftp.astron.com/pub/file/
+file:
+file:
+file:
+file:
+file: