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 echo "You must run me in ./extras/tools !"
28 if ! tar PcJ
/dev
/null
>/dev
/null
2>&1
30 echo "tar doesn't support xz (J option)"
31 NEEDED
="$NEEDED .tar .xz"
37 trap "rm \"$tmp\" \"$tmp-e\" 2>/dev/null" EXIT
38 echo "test file for GNU sed" > $tmp
39 if ! sed -i -e 's/sed//' $tmp >/dev
/null
2>&1
41 echo "sed doesn't do in-place editing (-i option)"
47 if ! $1 --version >/dev
/null
2>&1 && ! $1 -version >/dev
/null
2>&1
52 # found, need to check version ?
53 [ -z "$2" ] && return # no
54 gotver
=`$1 --version | head -1 | sed s/'.* '//`
55 gotmajor
=`echo $gotver|cut -d. -f1`
56 gotminor
=`echo $gotver|cut -d. -f2`
57 gotmicro
=`echo $gotver|cut -d. -f3`
58 [ -z "$gotmicro" ] && gotmicro
=0
59 needmajor
=`echo $2|cut -d. -f1`
60 needminor
=`echo $2|cut -d. -f2`
61 needmicro
=`echo $2|cut -d. -f3`
62 [ -z "$needmicro" ] && needmicro
=0
63 if [ "$needmajor" -ne "$gotmajor" \
64 -o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" \
65 -o "$needmajor" -eq "$gotmajor" -a "$needminor" -eq "$gotminor" -a "$needmicro" -gt "$gotmicro" ]
88 [ -n "$NEEDED" ] && mkdir
-p build
/ && echo "To-be-built packages: `echo $NEEDED | sed 's/\.//g'`"
92 Linux|MINGW32
*|MINGW64
*)
93 CPUS
=`grep -c ^processor /proc/cpuinfo`
96 CPUS
=`sysctl hw.ncpu|cut -d" " -f2`
99 CPUS
=`/usr/bin/kstat -p :::state | grep 'on-line$' | wc -l | sed 's/ //g'`
107 cat > Makefile
<< EOF
109 CMAKEFLAGS += --parallel=$CPUS
110 PREFIX=\$(abspath ./build)
113 @echo "You are ready to build VLC and its contribs"