install_dc1394.sh

Thr script i used to build libdc1394 - Philippe FOUBERT, 2012-06-07 10:47 pm

Download (2.7 kB)

 
1
#!/bin/sh
2
echo " ======================================================================="
3
echo "  A simple script to compile/install the IIDC Camera Control Library"
4
echo "  (http://sourceforge.net/projects/libdc1394/)"
5
echo
6
echo "  Description:"
7
echo "    libdc1394 is a library that provides a high level programming interface"
8
echo "    for application developers who wish to control and capture streams from"
9
echo "    IEEE 1394 based cameras that conform to the 1394-based Digital Camera"
10
echo "    Specifications (also known as the IIDC or DCAM Specifications). libdc1394"
11
echo "    also supports some USB cameras that are IIDC compliant."
12
echo "    Besides capture and control, libdc1394 provides a full set of colour space"
13
echo "    conversion functions (including RAW decoding), vendor specific functions"
14
echo "    and direct camera register access."
15
echo
16
echo "  author: P. FOUBERT"
17
echo " ========================================================================"
18
echo
19
#
20
# Change this to the latest version
21
#
22
DC1394_VERSION=2.2.0
23
24
# =============================================================================================================
25
# Do not edit under this line
26
# =============================================================================================================
27
28
DC1394_DIR_SRC="libdc1394-$DC1394_VERSION"
29
DC1394_PREFIX=`pwd`"/libdc1394_build"
30
CMU1394_PREFIX=`pwd`"/../cmu1394/cmu1394_build"
31
DC1394_OPTIONS=""
32
33
# gcc -c -Q -march=native --help=target  => to see the target specific options
34
DC1394_COMPILATION_FLAGS="-O2 -march=native -fomit-frame-pointer"
35
36
OS_WIN=0
37
38
# Get the number of cpus
39
# ======================
40
num_cpus=4
41
if [ -r /proc/cpuinfo ]; then
42
  # Linux: /proc/cpuinfo is found and can be read
43
  OS_WIN=0
44
  num_cpus=`grep -c ^processor /proc/cpuinfo`
45
elif [ "$NUMBER_OF_PROCESSORS" != "" ]; then
46
  # Windows: NUMBER_OF_PROCESSORS environnement variable is defined
47
  OS_WIN=1
48
  num_cpus=$NUMBER_OF_PROCESSORS
49
fi
50
if [ "$num_cpus" -lt 4 ]; then
51
  num_cpus=4
52
fi
53
54
# ==============================
55
#         Compilation
56
# ==============================
57
if [ `which 2>/dev/null sudo` ]; then # if sudo is available
58
  cmd_sudo="sudo"
59
else
60
  cmd_sudo=
61
fi
62
cmd_make="make -j $num_cpus"
63
64
cd $DC1394_DIR_SRC
65
66
  if [ "$OS_WIN" -eq 0 ]; then
67
    chmod +x configure
68
  fi
69
70
  if [ -e ../libdc1394-$DC1394_VERSION.patch ]
71
  then
72
    patch -p0 < ../libdc1394-$DC1394_VERSION.patch
73
  fi
74
75
  autoreconf --force --install
76
  ./configure  --prefix=$DC1394_PREFIX \
77
              $DC1394_OPTIONS \
78
              CMU1394_PREFIX="$CMU1394_PREFIX" \
79
              CFLAGS="$DC1394_COMPILATION_FLAGS" \
80
              CXXFLAGS="$DC1394_COMPILATION_FLAGS" \
81
              1>$DC1394_PREFIX/libdc1394-$DC1394_VERSION.txt
82
  $cmd_make 1>/dev/null
83
  $cmd_sudo $cmd_make install 1>/dev/null
84
85
cd ..