1: #!/usr/bin/zsh
   2: #
   3: # This is a Zsh script for downloading, building, and
   4: # installing SDL-Perl 1.17.4.  I wrote it for a friend who
   5: # was having a hard time installing SDL-Perl, and I
   6: # figured there might be someone on here who would find it
   7: # useful.  I didn't want all this work to go to waste,
   8: # afterall.  
   9: #
  10: # Think of it as a poor man's qx(apt-get install libsdl-perl), 
  11: # and get it while it's hot, because it only works for
  12: # SDL-Perl 1.17.4.  You won't want to use it after Dave
  13: # releases a newer version.  (At least not without modifications).
  14: 
  15: # -------------------------------------------------------
  16: #
  17: # In order for this script to work, you must have the
  18: # following things installed:
  19: #
  20: # [ debian packages ]
  21: #   - sudo
  22: #   - wget
  23: #   - libsdl1.2-dev
  24: #   - libsdl1.2-debian
  25: #   - zsh
  26: #   - and the rest of the usual suspects
  27: #     like g++, autoconf, patch, etc.
  28: 
  29: # After you have all that set up, just run this script and
  30: # it will download and install a pretty decent SDL-Perl
  31: # for you.  
  32: 
  33: # You might not like the way it does certain things, but I
  34: # think this script is layed out simply enough that you
  35: # can make certain tweaks to it that will make it just
  36: # right for your system.
  37: 
  38: # [ extra libs ]
  39: #   x SDL_gfx-2.0.3.tar.gz
  40: #   x SDL_image-1.2.2.tar.gz
  41: #   x SDL_mixer-1.2.3.tar.gz
  42: #   x SDL_net-1.2.4.tar.gz
  43: #   x SDL_ttf-2.0.5.tar.gz
  44: #   o smpeg-0.4.4.tar.gz	:-( c++ was uncooperative )
  45: # 
  46: # [ gl from sgi ]
  47: #   o ogl-sample.20000807.tgz	mesa is good enough for now
  48: 
  49: alias p print
  50: 
  51: url="http://www.sdlperl.org/downloads"
  52: 
  53: sdl_src=SDL_perl-1.17.4.tar.gz
  54: 
  55: src=(
  56:     SDL_gfx-2.0.3.tar.gz
  57:     SDL_image-1.2.2.tar.gz
  58:     SDL_mixer-1.2.3.tar.gz
  59:     SDL_net-1.2.4.tar.gz
  60:     SDL_ttf-2.0.5.tar.gz
  61: )
  62: 
  63: deb=(
  64:     wget
  65:     patch
  66:     mikmod
  67:     timidity
  68:     vorbis-tools
  69:     libfreetype6-dev
  70:     libjpeg62-dev
  71:     libpng2-dev
  72:     libtiff3g-dev
  73:     libungif4-dev
  74:     xlibmesa-dev
  75: )
  76: 
  77: typeset -A cfg
  78: cfg[SDL_gfx]=""
  79: cfg[SDL_image]="--enable-tif --enable-xcf"
  80: cfg[SDL_mixer]=""
  81: cfg[SDL_net]="--disable-gui"
  82: cfg[SDL_ttf]=""
  83: 
  84: p install debian packages
  85: [ -e /etc/alternatives ] && sudo apt-get install $deb
  86: 
  87: p get sources
  88: for i in $src ; do 
  89:     [ -e $i ] || wget $url/utils/$i
  90: done
  91: [ -e $sdl_src ] || wget $url/$sdl_src
  92: 
  93: p untar sources
  94: for i in $src $sdl_src ; do 
  95:     pkg=${i/.tar.gz/}
  96:     if [ -d $pkg ] ; then
  97: 	pushd $pkg && make clean
  98: 	popd
  99:     else
 100: 	tar zxvf $i
 101:     fi
 102: done
 103: 
 104: p build auxiliary packages
 105: for i in $src ; do
 106:     # pkg
 107:     pkg=${i/.tar.gz/}
 108: 
 109:     # prefix
 110:     prefix=/opt/$pkg
 111: 
 112:     # build
 113:     pushd $pkg
 114:     echo $pkg ./configure ${cfg[${pkg/-*/}]}
 115:     sleep 3
 116:     ./configure ${cfg[${pkg/-*/}]}
 117:     make
 118:     
 119:     # install (normal)
 120:     sudo make install
 121:     
 122:     # install (symlink tree from /opt to /usr/local)
 123:     # [note] google knows how to find "lncp"
 124:     #sudo make install prefix=$prefix
 125:     #cd /opt
 126:     #sudo lncp $pkg /usr/local
 127:     popd
 128: done 
 129: 
 130: p build sdlperl
 131: cd SDL_perl*(/)
 132: 
 133: #
 134: # LOOK!  Perl code, below!  ;-)  I'm not entirely off-topic.
 135: #
 136: ( echo '37a38;' ;
 137:   echo '> $inc_flags .= join(" ", map { "-I$_" } @dirs);' ) \
 138:   | patch Makefile.linux
 139: 
 140: perl Makefile.linux
 141: make
 142: sudo make install
 143: 

Replies are listed 'Best First'.
Re: SDL-Perl Installation Script
by abstracts (Hermit) on May 22, 2002 at 04:39 UTC
    Hmmmm, `Zsh' you say? To install a perl module you use Zsh? Shame on you :-)
      Actually I read a linux-mag article about some of the nifty things zsh brings to the table. I've been meaning to make the switch from bash ever since. I wonder who the author of that article was... ;-)

      -Blake

        Guilty as charged.

        zsh is the shit, though. Just put autoload compinit; compinit in your .zshrc, and hit TAB a lot. You'll never go back to bash after this experience. I just wanted to get the word out, because it was tragic that something as nice as zsh could go unnoticed for so long.

        Also, if you look at the list of contributors to zsh, you'll recognize some long-time perl hackers which means that Perl and zsh can get along just fine.

        Peace and Blessings,
        beppu