Home | History | Annotate | Download | only in build_scripts
      1 #!/bin/bash
      2 
      3 # Builds lame for MMX/SSE testing
      4 
      5 # Copyright (C) 2003-2006 IBM
      6 #
      7 # This program is free software; you can redistribute it and/or
      8 # modify it under the terms of the GNU General Public License as
      9 # published by the Free Software Foundation; either version 2 of the
     10 # License, or (at your option) any later version.
     11 #
     12 # This program is distributed in the hope that it will be useful, but
     13 # WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 # General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with this program; if not, write to the Free Software
     19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     20 # 02111-1307, USA.
     21 
     22 source "$POUNDER_HOME/libpounder.sh"
     23 
     24 # Is it already installed?
     25 PROG=`which lame`
     26 if [ ! -z "$PROG" ]; then
     27 	exit 0
     28 fi
     29 
     30 # If we can't find nasm...
     31 NASM=`which nasm`
     32 if [ -z "$NASM" ]; then
     33 	# Build it so we can test MMX/SSE.
     34 	NASM_PKG=nasm-0.98.38
     35 	NASM_TAR="$NASM_PKG.tar.gz"
     36 
     37 	# Retrieve tarball
     38 	cd "$POUNDER_OPTDIR"
     39 	if [ ! -f "$NASM_TAR" ]; then
     40         	if [ $USE_CACHE -eq 1 ]; then
     41                 	wget "${POUNDER_CACHE}${NASM_TAR}"
     42         	fi
     43         	if [ ! -f "$NASM_TAR" ]; then
     44                 	get_from_sourceforge nasm $NASM_TAR
     45         	fi
     46 	fi
     47 
     48 	# Unpack if necessary
     49 	if [ ! -d "NASM_PKG" ]; then
     50         	tar -xzf "$NASM_TAR"
     51 	fi
     52 
     53 	# Build
     54 	cd "$NASM_PKG"
     55 	./configure
     56 	make $*
     57 
     58 	export PATH=`/bin/ls -d $POUNDER_OPTDIR/nasm*/`:$PATH
     59 
     60 fi
     61 
     62 # Retrieve binary for lame, if necessary
     63 PKGNAME=lame-3.96.1
     64 TARNAME="$PKGNAME.tar.gz"
     65 PROGNAME=lame
     66 
     67 cd "$POUNDER_OPTDIR"
     68 if [ ! -f "$TARNAME" ]; then
     69 	if [ $USE_CACHE -eq 1 ]; then
     70 		wget "${POUNDER_CACHE}${TARNAME}"
     71 	fi
     72 	if [ ! -f "$TARNAME" ]; then
     73 		get_from_sourceforge $PROGNAME $TARNAME
     74 	fi
     75 fi
     76 
     77 # Unpack if necessary
     78 if [ ! -d "PKGNAME" ]; then
     79 	tar -xzf "$TARNAME"
     80 fi
     81 
     82 # Build with MMX/SSE/3dnow/whatever support
     83 cd "$PKGNAME"
     84 ./configure --enable-nasm
     85 make $*
     86 
     87 # Now build schedutils for CPU affinity assignments
     88 _PKGNAME=schedutils-1.4.0
     89 S_TARNAME="$S_PKGNAME.tar.gz"
     90 S_PROGNAME=taskset
     91 
     92 # Is it already installed?
     93 S_PROG=`which $S_PROGNAME`
     94 if [ ! -z "$S_PROG" ]; then
     95         exit 0
     96 fi
     97 
     98 # Does this OS support taskset?
     99 grep sched_setaffinity /usr/include/sched.h > /dev/null 2>&1
    100 if [ $? -ne 0 ]; then
    101         # Can't find the sched_setaffinity syscall; abort.
    102         # Probably we want to remove the schedutils dir in case
    103         # this install was leftover from another distro.
    104         cd "$POUNDER_OPTDIR"
    105         rm -rf "$S_PKGNAME"
    106         exit 0
    107 fi
    108 
    109 # Retrieve tarball, if necessary
    110 cd "$POUNDER_OPTDIR"
    111 if [ ! -f "$S_TARNAME" ]; then
    112         if [ $USE_CACHE -eq 1 ]; then
    113                 wget "${POUNDER_CACHE}${S_TARNAME}"
    114         fi
    115         if [ ! -f "$S_TARNAME" ]; then
    116                 wget "http://tech9.net/rml/schedutils/packages/$VERSION/$S_TARNAME"
    117         fi
    118 fi
    119 
    120 # Unpack if necessary
    121 if [ ! -d "S_PKGNAME" ]; then
    122         tar -xzf "$S_TARNAME"
    123 fi
    124 
    125 # Build
    126 cd "$S_PKGNAME"
    127 make $*
    128