1 | #!/bin/sh
|
2 | echo " ======================================================================="
|
3 | echo " A simple script to compile/install the CMU 1394 Digital Camera Driver "
|
4 | echo " (http://www.cs.cmu.edu/~iwan/1394/)"
|
5 | echo " author: P. FOUBERT"
|
6 | echo " ========================================================================"
|
7 | echo
|
8 |
|
9 | os=`uname`
|
10 | if [ "$os" == "Linux" ]
|
11 | then
|
12 | echo "### The CMU 1394 Digital Camera Driver is only for MS Windows ###"
|
13 | echo
|
14 | return
|
15 | fi
|
16 |
|
17 | #
|
18 | # Change this to the latest version
|
19 | #
|
20 | CMU1394_VERSION=6.4.6
|
21 |
|
22 | # =============================================================================================================
|
23 | # Do not edit under this line
|
24 | # =============================================================================================================
|
25 | PROD_DIR=`pwd`"/../../../PROD"
|
26 | CMU1394_DIR_SRC="cmu1394_$CMU1394_VERSION"
|
27 |
|
28 | # Get the number of cpus
|
29 | # ======================
|
30 | num_cpus=4
|
31 | if [ -r /proc/cpuinfo ]; then
|
32 | # Linux: /proc/cpuinfo is found and can be read
|
33 | num_cpus=`grep -c ^processor /proc/cpuinfo`
|
34 | elif [ "$NUMBER_OF_PROCESSORS" != "" ]; then
|
35 | # Windows: NUMBER_OF_PROCESSORS environnement variable is defined
|
36 | num_cpus=$NUMBER_OF_PROCESSORS
|
37 | fi
|
38 | if [ "$num_cpus" -lt 4 ]; then
|
39 | num_cpus=4
|
40 | fi
|
41 |
|
42 | # ==============================
|
43 | # Compilation
|
44 | # ==============================
|
45 | if [ `which 2>/dev/null sudo` ]; then # if sudo is available
|
46 | cmd_sudo="sudo"
|
47 | else
|
48 | cmd_sudo=
|
49 | fi
|
50 | cmd_make="make -j $num_cpus"
|
51 |
|
52 | cd $CMU1394_DIR_SRC
|
53 | $cmd_make -f $PROD_DIR/makefile mrproper 1>/dev/null
|
54 | $cmd_make -f $PROD_DIR/makefile lib 1>/dev/null
|
55 | $cmd_make -f $PROD_DIR/makefile install 1>/dev/null
|
56 | cd ..
|