2 # Copyright © 2011 Rafaël Carré
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.
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.
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.
24 echo "You must run me in ./extras/tools !"
30 gotmajor
=`echo $gotver|cut -d. -f1`
31 gotminor
=`echo $gotver|cut -d. -f2`
32 gotmicro
=`echo $gotver|cut -d. -f3`
33 [ -z "$gotmicro" ] && gotmicro
=0
34 needmajor
=`echo $3|cut -d. -f1`
35 needminor
=`echo $3|cut -d. -f2`
36 needmicro
=`echo $3|cut -d. -f3`
37 [ -z "$needmicro" ] && needmicro
=0
38 if [ "$needmajor" -ne "$gotmajor" \
39 -o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" \
40 -o "$needmajor" -eq "$gotmajor" -a "$needminor" -eq "$gotminor" -a "$needmicro" -gt "$gotmicro" ]
50 check_version_majmin
() {
52 gotmajor
=`echo $gotver|cut -d. -f1`
53 gotminor
=`echo $gotver|cut -d. -f2`
54 needmajor
=`echo $3|cut -d. -f1`
55 needminor
=`echo $3|cut -d. -f2`
56 if [ "$needmajor" -ne "$gotmajor" \
57 -o "$needminor" -ne "$gotminor" ]
59 echo "$1 not compatible"
68 if ! tar PcJ
/dev
/null
>/dev
/null
2>&1 && ! tar PcJf
/dev
/null
/dev
/null
2>&1
70 echo "tar doesn't support xz (J option)"
71 NEEDED
="$NEEDED tar xz"
79 trap "rm \"$tmp\" \"$tmp-e\" 2>/dev/null" EXIT
80 echo "test file for GNU sed" > $tmp
81 if ! sed -i -e 's/sed//' $tmp >/dev
/null
2>&1
83 echo "sed doesn't do in-place editing (-i option)"
91 if ! nasm
-v >/dev
/null
2>&1
96 # found, need to check version ?
97 [ -z "$1" ] && return # no
98 gotver
=`nasm -v | cut -d ' ' -f 3`
99 check_version nasm
$gotver $1
104 if ! $1 --version >/dev
/null
2>&1 && ! $1 -version >/dev
/null
2>&1
109 # found, need to check version ?
110 [ -z "$2" ] && return # no
111 gotver
=`$1 --version | head -1 | sed s/'.* '//`
112 check_version
$1 $gotver $2
117 if ! $1 --version >/dev
/null
2>&1 && ! $1 -version >/dev
/null
2>&1 && ! $1 --version 2>/dev
/null
122 # found, need to check version ?
123 [ -z "$2" ] && return # no
124 gotver
=`$1 --version | head -1 | sed s/'.* '//`
125 check_version_majmin
$1 $gotver $2
139 check_majmin protoc
3.1.0
152 Linux|MINGW32
*|MINGW64
*)
153 CPUS
=`getconf _NPROCESSORS_ONLN 2>&1`
155 Darwin|FreeBSD|NetBSD
)
156 CPUS
=`getconf NPROCESSORS_ONLN 2>&1`
159 CPUS
=`sysctl -n hw.ncpu 2>&1`
162 CPUS
=`psrinfo | wc -l 2>&1`
170 cat > Makefile
<< EOF
172 CMAKEFLAGS += --parallel=$CPUS
173 PREFIX=\$(abspath ./build)
177 echo ".$t:" >> Makefile
181 echo .
$t: .build
$t >> Makefile
184 ;; # Dependency only, not build by default
186 PACKAGES
="$PACKAGES $t"
187 TARGETS
="$TARGETS .build$t"
192 [ -n "$PACKAGES" ] && mkdir
-p build
/ && echo "To-be-built packages: $PACKAGES"
194 cat >> Makefile
<< EOF
196 @echo "You are ready to build VLC and its contribs"