Chapter 3. Installation

Table of Contents
Requirements
Compiling and installing

Requirements

In order to be able to use mp32dao you must have, installed and working, on your system the following software:

Perl interpreter

I currently use:
[cowo@braveheart mp32dao]$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.18, archname=i686-linux
    uname='linux braveheart 2.2.18 #3 
      tue feb 6 08:32:20 cet 2001 i686 unknown '
    config_args=''
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef 
      useithreads=undef usemultiplicity=undef 
      useperlio=undef d_sfio=undef uselargefiles=undef 
      use64bitint=undef use64bitall=undef 
      uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O3 -fomit-frame-pointer 
      -mpentiumpro -march=pentiumpro -malign-functions=4 
      -funroll-loops -fexpensive-optimizations -malign-double 
      -fschedule-insns2 -mwide-multiply', 
      gccversion=2.95.3 19991030 (prerelease)
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccflags ='-fno-strict-aliasing -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, 
      longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, 
      Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -lpthread -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.1.92.so, so=so, useshrplib=true,
      libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, 
      ccdlflags='-rdynamic -Wl,-rpath,
      /usr/lib/perl5/5.6.0/i686-linux/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options:
  Built under linux
  Compiled at Feb  7 2001 14:50:21
  @INC:
    /usr/lib/perl5/5.6.0/i686-linux
    /usr/lib/perl5/5.6.0
    /usr/lib/perl5/site_perl/5.6.0/i686-linux
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl
    .
and it works for me. Please note I compiled Perl myself, disabling thread support. You may get into trouble if you want to use internal mp3 decoding coupled with a threaded Perl distribution. This will be made clear later.

MP3::Info Perl Module

It is used to access MP3 informations such as playing length, ID3 tags and more.

Audio::Wav Perl Module

It is used to access Wav file information such as length.

Audio::Tools::Time Perl Module

Almost the same as above.

mp3handler Perl Module

Contains the object I use for MP3 handling. You may find it useful yourself. You can find it along with mp32dao. If you plan to install mp32dao system-wide you must put it somewhere in the perl search path. Or leave it in the same directory where you unpacked mp32dao.

mp3dec Perl Module

This module will be used to handle mp3 decoding internally, using libmpeg3 and libsndfile. It is not absolutely necessary; an external decoding program can be used such as lame or madplay. It will be used only if available. You can create this module yourself by using SWIG, following these steps:

  1. compile mp3dec.c, for example using
    gcc -fPIC -D_REENTRANT -c mp3dec.c
    			
    You will obtain mp3dec.o. This is a stupid console program which exports a function used to decode mp3 files to wav files.

  2. generate perl wrapper using SWIG:
    swig -perl5 mp3dec.i
    You will obtain files mp3dec_wrap.c and mp3dec.pm. The first will be used by perl to access function exported by mp3dec.c, the second is the one to include in perl code.

    Note: If you are using threaded perl SWIG won't work! (at least for me). Please use a no-threads perl build.

  3. compile SWIG-generated wrapper:
    			gcc -fPIC -c -Dbool=char -I /usr/lib/perl5/5.6.0/i686-linux mp3dec_wrap.c
    		
    Of course the include option should match the right one for your system. On Redhat Linux systems it is usually /usr/lib/perl5/5.6.0/i386-linux on Intel machines.

  4. create the shared library that will be loaded by Dynaloader:
    			gcc -shared mp3dec_wrap.o mp3dec.o -o mp3dec.so -lm -lpthread -lmpeg3 -lsndfile
    		
    Ok, as you can see there are some external libraries needed; libmpeg3 and libsndfile which you'll find on freshmeat.net. libm and libpthread are standard on glibc2 systems, I don't have access to others, sorry. Then you must copy the resulting mp3dec.so somewhere in the perl search path.