#!/bin/sh # Heavily based on the Slackware 13.1 SlackBuild # Written by Loris Vincenzi # Last build from jimmy_page_89 ( jimmy_page_89@hotmail.it ) # Slackware build script for Mplayer # Official Site: http://mplayerhq.hu/ # 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. set -e ###Set some options ###Select language ("all" is usually the best option) #Options:"all bg cs de dk el en es fr hu it ja ko mk nb nl pl ro ru sk sv tr uk pt_BR zh_CN zh_TW" SB_LANGS=${SB_LANGS:-all} echo -n "Selected language: " echo ${SB_LANGS} sleep 5 ###Set to YES to enable GTK gui SB_GUI=${SB_GUI:-YES} ###Set to YES to use system ffmpeg (NO is better) SB_FFMPEG=${SB_FFMPEG:-NO} ###Set YES to use Win32 codecs SB_W32=${SB_W32:-YES} ###Set YES to use some patents codecs (may be illegal in some countries) SB_PATENTS=${SB_PATENTS:-NO} ###End user options PKGNAME=MPlayer NAME=mplayer DNAME=mplayer-checkout SKIN=Blue VERSION=`date +%Y%m%d` SKINVER=${SKINVER:-1.7} BUILD=${BUILD:-2sl} ARCH=${ARCH:-x86_64} MPSOURCE="http://www.mplayerhq.hu/MPlayer/releases/$DNAME-snapshot.tar.bz2" SKSOURCE="http://www.mplayerhq.hu/MPlayer/skins/$SKIN-$SKINVER.tar.bz2" if [ ! -e $DNAME-snapshot.tar.bz2 ];then wget $MPSOURCE fi if [ ! -e $SKIN-$SKINVER.tar.bz2 ];then wget $SKSOURCE fi CWD=$(pwd) TMP=${TMP:-/tmp/buildpkgs/$PKGNAME} PKG=$TMP/package-$PKGNAME OUTPUT=${OUTPUT:-$CWD} if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" LIBDIRSUFFIX="" elif [ "$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" SLKLDFLAGS="-L/usr/lib64" fi if [ "${SB_FFMPEG}" = "YES" ] ;then SB_FFMPEGOPTS='--disable-libavutil_a --disable-libavcodec_a --disable-libavformat_a --disable-libpostproc_a --disable-libswscale_a' SB_FFMPEGFIX="libswscale/rgb2rgb.o" fi if [ "${SB_W32}" = "YES" ] && [ "$ARCH" != "x86_64" ]; then SB_WIN32CODECSOPTS="--enable-win32dll --disable-mencoder" fi if [ "${SB_GUI}" = "YES" ]; then SB_GUIOPTS="--enable-gui --disable-mencoder" fi if [ "$SB_PATENTS" != "YES" ]; then SB_PATENTED="--disable-libdvdcss-internal \ --disable-mp3lame \ --disable-mp3lame-lavc \ --disable-faac \ --disable-faac-lavc" else DO_PATENTED="" fi rm -rf $TMP mkdir -p $TMP $PKG $OUTPUT cd $TMP tar xvf $CWD/$DNAME-snapshot.tar.bz2 cd $DNAME-* ### installazione patch (se presenti) #chown -R root:root . chmod -R u+w,go+r-w,a-s . ###Some corrections # Overwrite some of the details of the provided system menu entry sed -i -e '/^Exec=/s|=gmplayer$|=gmplayer %f|g; /^Icon=/s|\.xpm||g' \ etc/$NAME.desktop sed -i -e 's|-O4|-O3|g' configure sed -i -e 's|-lungif|-lgif|g' configure [ "${ARCH}" = "x86_64" ] && sed -i -e 's|-O3|-O3 -fPIC|g' configure # Avoid trims sed -i -e "/^EXTRALIBS =/s|$| ${SLKLDFLAGS} |g" configure ###Fixing libmpcdec configure bug if [ -e /usr/lib${LIBDIRSUFFIX}/libmpcdec-sv7.so ] ;then sed -i -e 's|-lmpcdec|-lmpcdec-sv7|g' configure fi rm -f version.h sed -i -e "s|-\$1|-${SLKDIST}-\$1|g" \ version.sh ###Starting configure CONFIG_FX() { ./configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --datadir=/usr/share/${NAME} \ --confdir=/etc/${NAME} \ --mandir=/usr/man \ --disable-bitmap-font \ --language="${SB_LANGS}" \ --enable-largefiles \ --enable-dynamic-plugins \ --codecsdir=/usr/lib${LIBDIRSUFFIX}/codecs \ --enable-real \ --disable-dvdread-internal \ --disable-tremor-internal \ --enable-faad \ --disable-faad-internal \ --disable-arts \ --enable-libcdio \ --extra-libs="$(pkg-config libcdio_paranoia libnemesi fribidi --libs) ${SB_FFMPEGFIX}" \ --enable-joystick \ --enable-menu \ --enable-smb \ --enable-xvmc \ --with-xvmclib=XvMCW \ --enable-fbdev \ --enable-runtime-cpudetection \ ${SB_FFMPEGOPTS} \ ${SB_WIN32CODECSOPTS} \ ${SB_PATENTED} \ ${SB_GUIOPTS} } if [ "${SB_GUI}" = "YES" ] ;then CONFIG_FX make -C libswscale rgb2rgb.o make mv -f mplayer gmplayer make distclean fi SB_GUIOPTS="" CONFIG_FX make -C libswscale rgb2rgb.o make # build HTML documentation from XML files ( cd DOCS/xml make html-chunked ) make install DESTDIR=$PKG STRIPBINARIES=no ### In this section you may remove some not needed files or move that file in other path cat TOOLS/midentify.sh | sed -e 's|midentify.sh|midentify|g' > \ ${PKG}/usr/bin/midentify || exit 1 chmod 0755 ${PKG}/usr/bin/midentify # GUI mplayer if [ "${SB_GUI}" = "YES" ] ;then install -pm 0755 g$NAME $PKG/usr/bin/ mkdir -p $PKG/usr/share/{applications,pixmaps} desktop-file-install --delete-original --vendor="" \ --dir ${PKG}/usr/share/applications --mode 0644 \ --remove-key="Encoding" \ --remove-category="Application" \ --add-mime-type="video/x-flv" \ etc/$NAME.desktop fi cp etc/mplayer.xpm $PKG/usr/share/pixmaps/mplayer.xpm # Better icons. mkdir -p $PKG/usr/share/pixmaps/ mkdir -p $PKG/usr/share/icons/hicolor/64x64/apps zcat $CWD/$NAME.png.gz > \ $PKG/usr/share/icons/hicolor/64x64/apps/$NAME.png cp $PKG/usr/share/icons/hicolor/64x64/apps/$NAME.png $PKG/usr/share/pixmaps/ ( cd $PKG/usr/share/icons/hicolor for res in 16 32 48 ; do dir=${res}x${res}/apps mkdir -p ${dir} convert 64x64/apps/${NAME}.png -depth 8 -filter Lanczos \ -resize ${res}x${res} ${dir}/$NAME.png done ) # Default config files mkdir -p $PKG/etc/$NAME install -pm 0644 etc/example.conf \ $PKG/etc/$NAME/$NAME.conf.new # use Nimbus Sans L font for OSD (via fontconfig) echo "fontconfig=yes" >> $PKG/etc/$NAME/$NAME.conf.new echo 'font="Sans"' >> $PKG/etc/$NAME/$NAME.conf.new for conf in {codecs,dvb-menu,input,menu}.conf ;do install -pm 0644 etc/${conf} $PKG/etc/$NAME/${conf}.new done rm -rf $PKG/usr/share/$NAME/font mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/codecs # Default skin mkdir -p $PKG/usr/share/$NAME/skins tar -xjC $PKG/usr/share/$NAME/skins/ --exclude=.svn -f $CWD/$SKIN-$SKINVER.tar.bz2 || exit 1 ln -s Blue $PKG/usr/share/${NAME}/skins/default # Clean up documentation mkdir doc cp -pR DOCS/* doc/ rm -r doc/man doc/xml doc/README mv doc/HTML/* doc/ rm -rf doc/HTML ### copy some documentation files mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION cp -a \ AUTHORS LICENSE README doc/en/ doc/tech/ etc/*.conf \ $PKG/usr/doc/$PKGNAME-$VERSION cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$VERSION/$PKGNAME.SlackBuild cat $CWD/slack-desc > $PKG/usr/doc/$PKGNAME-$VERSION/slack-desc ### compress man pages if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi ### popolate the install/ directory mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc ### now you must do 'strip' all binary files ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true ) ### reset owner and create slack-required file. cd $PKG chown -R root:root $PKG if [ -x "$(which depfinder 2>/dev/null)" ];then depfinder -f -s -a -p $PKG mv slack-required $CWD/ elif [ -x "$(which requiredbuilder 2>/dev/null)" ];then requiredbuilder -y -v -s $CWD $PKG else touch $CWD/slack-required fi ### finally make the package. /sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD.${PKGTYPE:-txz} if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi