Blame view

tools/extras/install_ffv.sh 1.37 KB
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  #!/bin/bash
  
  # Make sure we are in the tools/ directory.
  if [ `basename $PWD` == extras ]; then
    cd ..
  fi
  
  ! [ `basename $PWD` == tools ] && \
     echo "You must call this script from the tools/ directory" && exit 1;
  
  mkdir -p pitch_trackers
  cd pitch_trackers
  
  echo "Installing a package for FFV feature extraction."
  
  if [ -s ffv-1.0.1.tar.gz ]; then
    echo "*ffv-1.0.1.tar.gz already exists, not getting it."
  else
    ! wget -t 2 http://www.cs.cmu.edu/~kornel/software/ffv-1.0.1.tar.gz && \
      echo "Error wgetting ffv-1.0.1.tar.gz" && exit 1;
  fi
  
  if [ -d ffv-1.0.1 ]; then
    echo "*It looks like ffv-1.0.1.tar.gz has already been unpacked, not unpacking it."
  else 
    ! tar -zxvf ffv-1.0.1.tar.gz && \
    echo "Error unpacking  ffv-1.0.1.tar.gz [e.g. unpack not installed?]" && exit 1;
  fi
  cd ffv-1.0.1
  
  if [ -f Makefile ]; then
    echo "Makefile already exists, no creating it."
  else
    echo "Makefile does not exist, creating it."
    cat<<'EOF' > ./Makefile
    CC     = gcc
    # CFLAGS = -c -O3 -Wall -pedantic -std=c99 
    CFLAGS = -c -g -Wall -pedantic -std=c99
    LIBS   = -lm
  
    LIBOBJECTS = \
    	\
  	windowpair.o \
  	filterbank.o \
  	dcorrxform.o \
  	ffv.o \
  	mutils.o \
  	sutils.o
  
    all : ffv 
  
    ffv : ffv_main.o ${LIBOBJECTS}
  	${CC} -o $@ $^ ${LIBS}
  
    %.o : %.c
  	${CC} ${CFLAGS} $<
  
    clean :
      rm -f *.o ffv
  EOF
  chmod +x Makefile 
  fi
  make; 
  cd ..
  
  echo "Installing ffv package is done."
  exit 0;