#!/bin/sh ############################# ## Build script for: mplayer ## Creator: kaneda@bohater.net ## Date: 25 Jul 04 ## Builds package: Yes ## Source location: http://mplayerhq.hu ## Downloads Source: Yes ## Build script version: 1.0 ## Requirements: None ## ## Notes: Any special notes the person may need to edit this file. ## ## Include the slackware-pkg conf file if [ -a /etc/slack-package.conf ]; then . /etc/slack-package.conf else echo "Sorry you need to have the slack-package.conf file to run these" echo "please install the slackbuilds package from LinuxPackages.net" exit fi ## Lets set the name of the program here so we can use it later. NAME=MPlayer ## Set the versions for packages here, these must match the source file version. PROGRAM_VER=1.0pre6a ## Set the BUILD the $MYIN comes from the global config file in /etc BUILD=1$MYIN ## Location to download the source SRC_LOC="http://www1.mplayerhq.hu/MPlayer/releases/$NAME-$PROGRAM_VER.tar.bz2" ## Set initial variables these should be standard in most packages: PKG=$TMP/package-$NAME ## Now we go grab the source for the user. Again global config has the wget line ## We will check if it is here and if not then download if [ -a $CWD/$NAME-$PROGRAM_VER.tar.bz2 ]; then echo "Source present not downloading" else $WGET $SRC_LOC || true fi ## Ok time to make sure the area is clean and unarchive the file rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$PROGRAM_VER tar xvjf $CWD/$NAME-$PROGRAM_VER.tar.bz2 ## Now from this point on we do all the package prep and building. I like to organize them in sections ## like compile, prepare, description, build like below as an example compile() { cd $TMP/$NAME-$PROGRAM_VER chown -R root.root . export CFLAGS=$SLKCFLAGS ./configure --prefix=/usr --enable-gui --enable-menu --confdir=/etc/mplayer make make install DESTDIR=$PKG } ## The next area I use for getting the documents set and maybe config files. prepare() { mkdir -p $PKG/usr/doc/$NAME-$PROGRAM_VER cp -f AUTHORS Copyright ChangeLog LICENSE README $PKG/usr/doc/$NAME-$PROGRAM_VER/ cp -fr DOCS/* $PKG/usr/doc/$NAME-$PROGRAM_VER/ cp -f etc/codecs.conf $PKG/etc/mplayer/codecs.conf-example cp -f etc/dvb-menu.conf $PKG/etc/mplayer/dvb-menu.conf-example cp -f etc/example.conf $PKG/etc/mplayer/mplayer.conf-example cp -f etc/input.conf $PKG/etc/mplayer/input.conf-example cp -f etc/menu.conf $PKG/etc/mplayer/menu.conf-example #delete obsolete option grep -vE "cache_min|cache_prefil" $PKG/etc/mplayer/mplayer.conf-example >> tmp.$$ mv -f tmp.$$ $PKG/etc/mplayer/mplayer.conf-example echo "vo=xv" >> $PKG/etc/mplayer/mplayer.conf-example #Skin support wget http://www1.mplayerhq.hu/MPlayer/Skin/Blue-1.4.tar.bz2 tar -jxvf Blue-1.4.tar.bz2 cp -rf Blue $PKG/usr/share/mplayer/Skin/ #Font support for file in font-arial-cp1250 font-arial-iso-8859-1 font-arial-iso-8859-2 font-arial-iso-8859-7 ; do wget http://www1.mplayerhq.hu/MPlayer/releases/fonts/$file.tar.bz2 tar -jxvf $file.tar.bz2 cp -rf $file $PKG/usr/share/mplayer/font/ done cd $PKG/usr/share/mplayer/font/ ln -s ./font-arial-iso-8859-2/font-arial-24-iso-8859-2/* . ##Some functions from the global config to help with the cleanup ( cd $PKG strip_bin # Strips the libs files reduces the size and removes unneeded cruft strip_lib ) # Every good package should gzip those man pages gzip_man $PKG # Set group ownership for the bin directory bin_perms $PKG # Set group ownership for the sbin directory #sbin_perms $PKG } ## The next area is for the description. You can use this method or just cat a slack-desc file into ## the install area. I will use apache here as a sample description() { mkdir -p $PKG/install cat > $PKG/install/doinst.sh << END if [ ! -f etc/mplayer/codecs.conf ]; then cp -a etc/mplayer/codecs.conf-example etc/mplayer/codecs.conf fi if [ ! -f etc/mplayer/mplayer.conf ]; then cp -a etc/mplayer/mplayer.conf-example etc/mplayer/mplayer.conf fi ( cd usr/share/mplayer/Skin ;ln -s Blue default ) END cat > $PKG/install/slack-desc << END |-----handy-ruler------------------------------------------------------| mplayer: $NAME $PROGRAM_VER (movie player) mplayer: MPlayer is a movie player for Linux (runs on many other Unices, and mplayer: non-x86 CPUs, see the documentation). It plays most MPEG, VOB, AVI, mplayer: Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, mplayer: YUV4MPEG, FILM, RoQ, PVA files, supported by many native, XAnim, and mplayer: Win32 DLL codecs. You can watch VideoCD, SVCD, DVD, 3ivx, DivX 3/4/5 mplayer: and even WMV movies, too (without the avifile library). mplayer: mplayer: mplayer: mplayer: My other Slack packages: http://kaneda.bohater.net/slackware END } ## The last part is the build build() { # Build the package: cd $PKG makepkg -l y -c n $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz mv $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz $PKG_DIR/`echo "$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz"|tr "[A-Z]" "[a-z]"` echo "Your $NAME package is complete, make sure you open it up before installing it." echo "It is located in $PKG_DIR thanks for your support The Linuxpackages.net Folks" } ### Now we call all those functions in order compile prepare description build