source: npl/overig/mpg123/mpg123.SlackBuild.orig

Last change on this file was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 5.2 KB
Line 
1#!/bin/sh
2# Copyright 2006-2016  Patrick J. Volkerding, Sebeka, MN, USA
3# All rights reserved.
4#
5# Redistribution and use of this script, with or without modification, is
6# permitted provided that the following conditions are met:
7#
8# 1. Redistributions of this script must retain the above copyright
9#    notice, this list of conditions and the following disclaimer.
10#
11#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
12#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
14#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
19#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
20#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
22
23PKGNAM=mpg123
24VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
25BUILD=${BUILD:-3}
26
27NUMJOBS=${NUMJOBS:-" -j7 "}
28
29# Automatically determine the architecture we're building on:
30if [ -z "$ARCH" ]; then
31  case "$( uname -m )" in
32    i?86) export ARCH=i586 ;;
33    arm*) export ARCH=arm ;;
34    # Unless $ARCH is already set, use uname -m for all other archs:
35       *) export ARCH=$( uname -m ) ;;
36  esac
37fi
38
39CWD=$(pwd)
40TMP=${TMP:-/tmp}
41PKG=$TMP/package-${PKGNAM}
42
43if [ "$ARCH" = "i586" ]; then
44  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
45  LIBDIRSUFFIX=""
46  TARGET="x86"
47elif [ "$ARCH" = "s390" ]; then
48  SLKCFLAGS="-O2"
49  LIBDIRSUFFIX=""
50  TARGET=""
51elif [ "$ARCH" = "x86_64" ]; then
52  SLKCFLAGS="-O2 -fPIC"
53  LIBDIRSUFFIX="64"
54  TARGET="x86-64"
55elif [ "$ARCH" = "arm" ]; then
56  SLKCFLAGS="-O2"
57  LIBDIRSUFFIX=""
58  TARGET="arm_nofpu"
59else
60  SLKCFLAGS="-O2"
61  LIBDIRSUFFIX=""
62  TARGET=""
63fi
64
65# configure --help shows the following re TARGET:
66# --with-cpu=i386_fpu           Use code optimized for i386 processors with floating point arithmetic
67# --with-cpu=i386_nofpu         Use code optimized for i386 processors with fixed point arithmetic (experimental)
68# --with-cpu=i486               Use code optimized for i486 processors (only usable alone!)
69# --with-cpu=i586               Use code optimized for i586 processors
70# --with-cpu=i586_dither        Use code optimized for i586 processors with dithering (noise shaping), adds 256K to binary size
71# --with-cpu=3dnow              Use code optimized for 3DNow processors
72# --with-cpu=3dnowext           Use code optimized for 3DNowExt processors (K6-3+, Athlon)
73# --with-cpu=3dnowext_alone     Really only 3DNowExt decoder, without 3DNow fallback for flexible rate
74# --with-cpu=mmx                Use code optimized for MMX processors
75# --with-cpu=mmx_alone          Really only MMX decoder, without i586 fallback for flexible rate
76# --with-cpu=sse                Use code optimized for SSE processors
77# --with-cpu=sse_alone          Really only SSE decoder, without i586 fallback for flexible rate
78# --with-cpu=x86                Pack all x86 opts into one binary (excluding i486, including dither)
79# --with-cpu=x86-64             Use code optimized for x86-64 processors (AMD64 and Intel64, including dithered generic)
80# --with-cpu=arm_nofpu          Use code optimized for ARM processors with fixed point arithmetic (experimental)
81
82rm -rf $PKG
83mkdir -p $PKG $TMP
84cd $TMP
85rm -rf ${PKGNAM}-${VERSION}
86tar xvf $CWD/${PKGNAM}-$VERSION.tar.?z* || exit 1
87cd ${PKGNAM}-$VERSION || exit 1
88
89# Make sure ownerships and permissions are sane:
90chown -R root:root .
91find . \
92  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
93  -exec chmod 755 {} \; -o \
94  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
95  -exec chmod 644 {} \;
96
97# Configure:
98CFLAGS="$SLKCFLAGS" \
99./configure \
100  --prefix=/usr \
101  --libdir=/usr/lib${LIBDIRSUFFIX} \
102  --sysconfdir=/etc \
103  --mandir=/usr/man \
104  --docdir=/usr/doc/${PKGNAM}-$VERSION \
105  --with-cpu=$TARGET \
106  --with-optimization=2 \
107  --build=$ARCH-slackware-linux || exit 1
108
109# Build and install:
110make $NUMJOBS || make || exit 1
111make install DESTDIR=$PKG || exit 1
112
113# Add compat symlinks for mpg321:
114( cd $PKG/usr/bin ; ln -s mpg123 mpg321 )
115( cd $PKG/usr/man/man1 ; ln -sf mpg123.1 mpg321.1 )
116
117# Strip binaries:
118find $PKG | xargs file | grep -e "executable" -e "shared object" \
119  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
120
121# Compress and link manpages, if any:
122if [ -d $PKG/usr/man ]; then
123  ( cd $PKG/usr/man
124    for manpagedir in $(find . -type d -name "man*") ; do
125      ( cd $manpagedir
126        for eachpage in $( find . -type l -maxdepth 1) ; do
127          ln -s $( readlink $eachpage ).gz $eachpage.gz
128          rm $eachpage
129        done
130        gzip -9 *.*
131      )
132    done
133  )
134fi
135
136# Compress info files, if any:
137if [ -d $PKG/usr/info ]; then
138  ( cd $PKG/usr/info
139    rm -f dir
140    gzip -9 *
141  )
142fi
143
144# Add a documentation directory:
145mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
146cp -a \
147  AUTHORS COPYING* ChangeLog INSTALL NEWS* README* TODO doc \
148  $PKG/usr/doc/${PKGNAM}-$VERSION
149#                  ^^^^^^^^^
150# The ChangeLog is only a (small) pointer to an online ChangeLog...
151
152mkdir -p $PKG/install
153cat $CWD/slack-desc > $PKG/install/slack-desc
154
155cd $PKG
156/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
157
Note: See TracBrowser for help on using the repository browser.