]> git.sesse.net Git - vlc/blob - extras/tools/bootstrap
extras/tools: use another gas-pp fork fixing mp1/2/3 decoding on iOS on ARM
[vlc] / extras / tools / bootstrap
1 #!/bin/sh
2 # Copyright © 2011 Rafaël Carré
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17
18 export LC_ALL=
19 NEEDED=
20
21 if [ ! -f tools.mak ]
22 then
23         echo "You must run me in ./extras/tools !"
24         exit 1
25 fi
26
27 check_tar() {
28 if ! tar PcJ /dev/null >/dev/null 2>&1
29 then
30     echo "tar doesn't support xz (J option)"
31     NEEDED="$NEEDED .tar .xz"
32 fi
33 }
34
35 check() {
36 if ! $1 --version >/dev/null 2>&1
37 then
38     echo "$1 not found"
39     NEEDED="$NEEDED .$1"
40 else
41     # found, need to check version ?
42     [ -z "$2" ] && return # no
43     # we only check GNU tools, their version have the form MAJOR.MINOR
44     gotver=`$1 --version | head -1 | sed s/'.* '//`
45     gotmajor=`echo $gotver|cut -d. -f1`
46     gotminor=`echo $gotver|cut -d. -f2`
47     needmajor=`echo $2|cut -d. -f1`
48     needminor=`echo $2|cut -d. -f2`
49     if [ "$needmajor" -gt "$gotmajor" -o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" ]
50     then
51         echo "$1 too old"
52         NEEDED="$NEEDED .$1"
53     fi
54 fi
55 }
56
57 check autoconf 2.67
58 check automake 1.11
59 check m4
60 check libtool 2.2
61 check pkg-config
62 check cmake
63 check yasm
64 check_tar
65 check ragel
66
67 [ -n "$NEEDED" ] && mkdir -p build/
68
69 CPUS=
70 CC=
71 CXX=
72 case `uname` in
73     Linux)
74         CPUS=`grep -c ^processor /proc/cpuinfo`
75      ;;
76     Darwin)
77         CPUS=`sysctl hw.ncpu|cut -d: -f2`
78         gcc-4.2 --version >/dev/null 2>&1 && CC=CC=gcc-4.2
79         g++-4.2 --version >/dev/null 2>&1 && CXX=CXX=g++-4.2
80     ;;
81     *)
82         CPUS=1  # default
83      ;;
84 esac
85
86
87 cat > Makefile << EOF
88 MAKEFLAGS += -j$CPUS
89 $CC
90 $CXX
91 PREFIX=\$(abspath ./build)
92
93 all: $NEEDED
94         @echo "You are ready to build VLC and its contribs"
95
96 include tools.mak
97 EOF