#!/bin/bash # Mplayer.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for ARMedslack. # # Copyright 2006, 2007, 2008, 2010, 2011 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for # any purpose with or without fee is hereby granted, provided that # the above copyright notice and this permission notice appear in all # copies. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR # CONTRIBUTORS 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. ### #/etc/mplayer/mplayer.conf: # vo=x11 # ao=alsa ### # Record toolchain & other info for the build log: slackbuildinfo # Versions from the original MPlayer.SlackBuild: PKGNAM=MPlayer BRANCH=${BRANCH:-1.1} PKGVERSION=${BRANCH}_${VERSION} # so the package becomes MPlayer-1.1_blah-arm-1.tgz # FFMpeg version: FFMPEG=${FFMPEG:-20130505} # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # MPlayer build Logs etc are written here: OUTPUT=$TMPBUILD/logs-out mkdir -vpm755 $OUTPUT DOCS="AUTHORS Changelog Copyright LICENSE README VERSION DOCS/HTML DOCS/tech" DEFSKIN=${DEFSKIN:-"Blue"} # Download more skins at the following url: SKINVER=${SKINVER:-"1.8"} # http://www.mplayerhq.hu/design7/dload.html # Available languages: all cs de en es fr hu it pl ru zh_CN LANGUAGES="en,de,es,fr" # Doesn't work on ARM: EXTRACONFIGUREOPTIONS="--disable-runtime-cpudetection" # Where the WIN32 codecs are expectedfor instance CODECSDIR=/usr/lib${LIBDIRSUFFIX}/codecs USE_PATENTS=${USE_PATENTS:-"NO"} # MPlayer will try to use one of the TrueType fonts present on the target # system for it's On Screen Display (OSD) font. # Slackware 11.0 ships with the Vera and DejaVu fonts, you may want to add # more fonts to this list. The first font found will be used by creating a # symbolic link "/usr/share/mplayer/subfont.ttf" to it. # The use of bitmapped fonts is considered deprecated, but you can still use # those if you want. Read http://www.mplayerhq.hu/DOCS/HTML/en/fonts-osd.html # if you want to know more about OSD font configuration. OSDFONTS="LiberationSans-Regular.ttf \ Arialuni.ttf arial.ttf \ DejaVuSans.ttf Vera.ttf" # We will work with a stripped-down source tarball, not containing libdvdcss: [ "$USE_PATENTS" != "YES" ] && EXTRA="_nolibdvdcss" || EXTRA="" # Where do we look for sources? SRCDIR=$CWD SOURCE[0]="$SRCDIR/${PKGNAM}${EXTRA}-${VERSION}.tar.xz" SRCURL[0]="" # The default skin to use (we need to add at least one) SOURCE[1]="$SRCDIR/${DEFSKIN}-${SKINVER}.tar.bz2" SRCURL[1]="http://www.mplayerhq.hu/MPlayer/skins/${DEFSKIN}-${SKINVER}.tar.bz2" # Ffmpeg needs to be checked out separately now: SOURCE[2]="$SRCDIR/ffmpeg-${FFMPEG}.tar.xz" SRCURL[2]="" # Extract source: echo "Extracting the source archive(s) for $PKGNAM..." tar -xvf ${SOURCE[0]} # Extract the ffmpeg source inside the MPlayer directory: ( cd ${PKGNAM}-${VERSION} && tar -xvf ${SOURCE[2]} ) slackhousekeeping cd ${PKGNAM}-${VERSION} || exit 1 # Determine what X we're running (the modular X returns the prefix # in the next command, while older versions stay silent): XPREF=$(pkg-config --variable=prefix x11) || true [ "$XPREF" == "" ] && XPREF='/usr/X11R6' # Remove support for patent encumbered and possibly illegal code: if [ "$USE_PATENTS" != "YES" ]; then DO_PATENTED="--disable-libdvdcss-internal \ --disable-mp3lame --disable-mp3lame-lavc \ --disable-libopencore_amrnb \ --disable-libopencore_amrwb" else DO_PATENTED="" fi # Patch to only use pld instruction on CPUs that support it. # ARMedslack patch by Jim Hawkins. #patch --verbose -p1 < $PORTCWD/sources/disable_arm_pld_instruction.diff || failpatch # Apply patch to fix subtitles: zcat $SRCDIR/subreader-fix-srt-parsing.patch.gz | patch -p1 --verbose || exit 1 echo "Building ..." # MPlayer wants to automatically determine compiler flags, # so we don't provide CFLAGS: ./configure \ --prefix=/usr \ --mandir=/usr/man \ --confdir=/etc/mplayer \ --enable-gui \ --enable-menu \ --disable-arts \ --disable-bitmap-font \ --codecsdir=${CODECSDIR} \ --language="${LANGUAGES}" \ ${EXTRACONFIGUREOPTIONS} \ ${DO_PATENTED} \ 2>&1 | tee $OUTPUT/configure-${PKGNAM}.log # So that MPlayer does not report "UNKNOWN" as it's version: echo $VERSION > VERSION make 2>&1 | tee $OUTPUT/make-${PKGNAM}.log make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install-${PKGNAM}.log # Build the html documentation (not all languages are available): if [ "$LANGUAGES" = "all" ]; then # make html-chunked make html-single else for i in $(echo $LANGUAGES | tr , ' ') ; do # make html-chunked-$i ; make html-single-$i ; done fi # Prepare the configfile: mkdir -p $PKG/etc/mplayer cp etc/example.conf $PKG/etc/mplayer/mplayer.conf.new # Install our default skin: cd $PKG/usr/share/mplayer/skins tar -xvf ${SOURCE[1]} chown -R root:root * chmod -R u+w,go+r-w,a+X-s * ln -s ${DEFSKIN} default cd - # Add this to the doinst.sh: mkdir -p $PKG/install cat <> $PKG/install/doinst.sh # Handle the incoming configuration files: config() { for infile in \$1; do NEW="\$infile" OLD="\`dirname \$NEW\`/\`basename \$NEW .new\`" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\`cat \$OLD | md5sum\`" = "\`cat \$NEW | md5sum\`" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... done } # Installing a bitmap font is considered deprecated; use a TTF font instead. # We try to link to an installed TTF font at install time. # Configure a default TrueType font to use for the OSD : if [ ! -f usr/share/mplayer/subfont.ttf ]; then for font in ${OSDFONTS}; do if [ -f .${XPREF}/lib${LIBDIRSUFFIX}/X11/fonts/TTF/\${font} ]; then ( cd usr/share/mplayer/ ln -sf ${XPREF}/lib${LIBDIRSUFFIX}/X11/fonts/TTF/\${font} subfont.ttf ) break fi done fi # Prepare the new configuration file config etc/mplayer/mplayer.conf.new # Update the desktop database: if [ -x usr/bin/update-desktop-database ]; then chroot . /usr/bin/update-desktop-database usr/share/applications 1> /dev/null 2> /dev/null fi # Update hicolor theme cache: if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then if [ -x usr/bin/gtk-update-icon-cache ]; then chroot . /usr/bin/gtk-update-icon-cache /usr/share/icons/hicolor >/dev/null 2>&1 fi fi # Update the mime database: if [ -x usr/bin/update-mime-database ]; then chroot . /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1 fi EOINS # Add documentation: mkdir -p $PKG/usr/doc/$PKGNAM-$PKGVERSION cp -a $DOCS $PKG/usr/doc/$PKGNAM-$PKGVERSION || true cp -a $SRCDIR/$(basename $0) $PKG/usr/doc/$PKGNAM-$PKGVERSION/$PKGNAM.SlackBuild mv $PKG/usr/doc/$PKGNAM-$PKGVERSION/HTML $PKG/usr/doc/$PKGNAM-$PKGVERSION/html # Save a sample of all configuration files: for i in etc/*.conf ; do cp $i $PKG/usr/doc/$PKGNAM-$PKGVERSION/$(basename $i)-sample done # Save a transcript of all configured options for this specific build: if [ -n $OUTPUT/configure-${PKGNAM}.log ]; then cat $OUTPUT/configure-${PKGNAM}.log \ | sed -n "/^Config files successfully generated/,/^'config.h' and 'config.mak' contain your configuration options./p" \ > $PKG/usr/doc/$PKGNAM-$PKGVERSION/${PKGNAM}.configuration fi find $PKG/usr/doc -type f -exec chmod 644 {} \; # Add a package description: mkdir -p $PKG/install cat $SRCDIR/slack-desc > $PKG/install/slack-desc if [ -f $SRCDIR/doinst.sh ]; then cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh fi # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs export VERSION=$PKGVERSION export SLACKPACKAGE=$PKGNAM-$VERSION-$ARCH-$BUILD.tgz slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links