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.
23 gotmajor
=`echo $gotver|cut -d. -f1`
24 gotminor
=`echo $gotver|cut -d. -f2`
25 gotmicro
=`echo $gotver|cut -d. -f3`
26 [ -z "$gotmicro" ] && gotmicro
=0
27 needmajor
=`echo $3|cut -d. -f1`
28 needminor
=`echo $3|cut -d. -f2`
29 needmicro
=`echo $3|cut -d. -f3`
30 [ -z "$needmicro" ] && needmicro
=0
31 if [ "$needmajor" -ne "$gotmajor" \
32 -o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" \
33 -o "$needmajor" -eq "$gotmajor" -a "$needminor" -eq "$gotminor" -a "$needmicro" -gt "$gotmicro" ]
43 check_version_majmin
() {
45 gotmajor
=`echo $gotver|cut -d. -f1`
46 gotminor
=`echo $gotver|cut -d. -f2`
47 needmajor
=`echo $3|cut -d. -f1`
48 needminor
=`echo $3|cut -d. -f2`
49 if [ "$needmajor" -ne "$gotmajor" \
50 -o "$needminor" -ne "$gotminor" ]
52 echo "$1 not compatible"
61 if ! tar PcJ
/dev
/null
>/dev
/null
2>&1 && ! tar PcJf
/dev
/null
/dev
/null
2>&1
63 echo "tar doesn't support xz (J option)"
64 NEEDED
="$NEEDED tar xz"
72 trap "rm \"$tmp\" \"$tmp-e\" 2>/dev/null" EXIT
73 echo "test file for GNU sed" > $tmp
74 if ! sed -i -e 's/sed//' $tmp >/dev
/null
2>&1
76 echo "sed doesn't do in-place editing (-i option)"
84 if ! nasm
-v >/dev
/null
2>&1
89 # found, need to check version ?
93 gotver
=`nasm -v | cut -d ' ' -f 3`
94 check_version nasm
$gotver $1
100 if ! $1 --version >/dev
/null
2>&1 && ! $1 -version >/dev
/null
2>&1
105 # found, need to check version ?
109 gotver
=`$1 --version | head -1 | sed s/'.* '//`
110 check_version
$1 $gotver $2
116 if ! $1 --version >/dev
/null
2>&1 && ! $1 -version >/dev
/null
2>&1 && ! $1 --version 2>/dev
/null
121 # found, need to check version ?
125 gotver
=`$1 --version | head -1 | sed s/'.* '//`
126 check_version_majmin
$1 $gotver $2
140 check_majmin protoc
3.1.0
155 Linux|MINGW32
*|MINGW64
*|
*MSYS
*)
156 CPUS
=`getconf _NPROCESSORS_ONLN 2>&1`
158 Darwin|FreeBSD|NetBSD
)
159 CPUS
=`getconf NPROCESSORS_ONLN 2>&1`
162 CPUS
=`sysctl -n hw.ncpu 2>&1`
165 CPUS
=`psrinfo | wc -l 2>&1`
172 BOOTSTRAP_PATH
="$( cd "$
(dirname "$0")" ; pwd -P )"
174 cat > Makefile
<< EOF
175 TOOLS = $BOOTSTRAP_PATH
177 CMAKEFLAGS += --parallel=$CPUS
178 PREFIX=\$(abspath ./build)
179 PATH=\${PREFIX}/bin:$PATH
183 echo ".$t:" >> Makefile
187 echo .
$t: .build
$t >> Makefile
190 ;; # Dependency only, not build by default
192 PACKAGES
="$PACKAGES $t"
193 TARGETS
="$TARGETS .build$t"
198 [ -n "$PACKAGES" ] && mkdir
-p build
/bin
&& echo "To-be-built packages: $PACKAGES"
200 cat >> Makefile
<< EOF
202 @echo "You are ready to build VLC and its contribs"
204 include \$(TOOLS)/tools.mak