source: npl/overig/file/file.SlackBuild.orig @ 6a847ef

perl-5.22
Last change on this file since 6a847ef was 072d3d5, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

updated file-command from 5.22 to 5.31 (errors detecting certain jpegs with amavis)

  • Property mode set to 100755
File size: 5.2 KB
Line 
1#!/bin/sh
2
3# Copyright 2005-2008, 2009, 2010, 2013, 2015  Patrick J. Volkerding, Sebeka, MN, USA
4# All rights reserved.
5#
6# Redistribution and use of this script, with or without modification, is
7# permitted provided that the following conditions are met:
8#
9# 1. Redistributions of this script must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11#
12#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
13#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
15#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
18#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
19#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
20#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23VERSION=${VERSION:-$(echo file-*.tar.?z* | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
24BUILD=${BUILD:-1}
25
26NUMJOBS=${NUMJOBS:--j7}
27
28# Automatically determine the architecture we're building on:
29if [ -z "$ARCH" ]; then
30  case "$( uname -m )" in
31    i?86) export ARCH=i586 ;;
32    arm*) export ARCH=arm ;;
33    # Unless $ARCH is already set, use uname -m for all other archs:
34       *) export ARCH=$( uname -m ) ;;
35  esac
36fi
37
38if [ "$ARCH" = "i586" ]; then
39  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
40  LIBDIRSUFFIX=""
41elif [ "$ARCH" = "i686" ]; then
42  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
43  LIBDIRSUFFIX=""
44elif [ "$ARCH" = "x86_64" ]; then
45  SLKCFLAGS="-O2 -fPIC"
46  LIBDIRSUFFIX="64"
47else
48  SLKCFLAGS="-O2"
49  LIBDIRSUFFIX=""
50fi
51
52CWD=$(pwd)
53TMP=${TMP:-/tmp}
54PKG=$TMP/package-file
55
56rm -rf $PKG
57mkdir -p $TMP $PKG
58cd $TMP
59rm -rf file-$VERSION
60tar xvf $CWD/file-$VERSION.tar.?z* || exit 1
61cd file-$VERSION || exit 1
62chown -R root:root .
63find . \
64  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
65  -exec chmod 755 {} \; -o \
66  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
67  -exec chmod 644 {} \;
68
69# Make the default data directory /etc/file like it has always been:
70zcat $CWD/file.etc.file.diff.gz | patch -p1 --verbose || exit 1
71# This is needed after the patch above:
72autoreconf || exit 1
73
74# Since we're going to include the compiled magic database now (otherwise
75# there seem to be libmagic related crashes), this patch probably doesn't
76# need to be applied.
77#
78## Don't spew warnings about using the flat text files
79#zcat $CWD/file.quiet.diff.gz | patch -p1 -E --verbose || exit 1
80
81# Keep the output format for ELF binaries the same as it was in earlier
82# versions of file to avoid breaking existing scripts:
83zcat $CWD/file.short.diff.gz | patch -p1 -E --verbose || exit 1
84
85# Add zisofs and crda regulatory bin detection
86zcat $CWD/file.zisofs.magic.gz >> magic/Magdir/compress
87zcat $CWD/file.crdaregbin.magic.gz >> magic/Magdir/crdaregbin
88
89CFLAGS="$SLKCFLAGS" \
90./configure \
91  --prefix=/usr \
92  --libdir=/usr/lib${LIBDIRSUFFIX} \
93  --sysconfdir=/etc \
94  --datadir=/etc \
95  --mandir=/usr/man \
96  --infodir=/usr/info \
97  --docdir=/usr/doc/file-$VERSION \
98  --enable-fsect-man5 \
99  --disable-static \
100  --build=$ARCH-slackware-linux || exit 1
101
102# The generated $TMP/file-$VERSION/libtool is buggy.  I don't know if this is supposed
103# to work, but it certainly does, so... :-)
104cat $(which libtool) > libtool
105
106make $NUMJOBS || make || exit 1
107make install DESTDIR=$PKG || exit 1
108
109# Ignore for now - still labeled as experimental
110# Actually, let's ignore it until something needs it  :)  <volkerdi>
111#cd python/
112#  python setup.py build
113#  python setup.py install --root=$PKG
114#cd ..
115
116# Seems --disable-static has been ignored lately:
117rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libmagic.a
118
119# Install the flat files.
120# We'll generate /etc/file/magic.mgc in the doinst.sh.
121rm -f $PKG/etc/file/magic.mgc
122mkdir -p $PKG/etc/file/magic
123cp -a magic/Magdir/* $PKG/etc/file/magic
124
125# Add a script to recompile the flat files in the obvious location.
126# The package install script will compile the flat files initially.
127cp -a $CWD/recompile_magic.mgc.sh.gz $PKG/etc/file
128gzip -d $PKG/etc/file/recompile_magic.mgc.sh.gz
129chown root:root $PKG/etc/file/recompile_magic.mgc.sh
130chmod 755 $PKG/etc/file/recompile_magic.mgc.sh
131
132# IMHO, moving this sort of thing does not make sense.
133# We'll support both the traditional and new locations.
134# I hate to squat on a name as generic as "/etc/misc/",
135# but it wasn't my idea.
136( cd $PKG/etc ; ln -sf file misc )
137
138# Strip everything for good measure:
139find $PKG | xargs file | grep -e "executable" -e "shared object" \
140  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
141
142( cd $PKG/usr/man || exit 1
143  find . -type f -exec gzip -9 {} \;
144  for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
145)
146
147mkdir -p $PKG/usr/doc/file-$VERSION
148cp -a \
149  AUTHORS COPYING* INSTALL MAINT NEWS README* TODO \
150    $PKG/usr/doc/file-$VERSION
151
152mkdir -p $PKG/install
153cat $CWD/slack-desc > $PKG/install/slack-desc
154zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
155
156# Build the package:
157cd $PKG
158/sbin/makepkg -l y -c n $TMP/file-$VERSION-$ARCH-$BUILD.txz
159
Note: See TracBrowser for help on using the repository browser.