]> git.sesse.net Git - vlc/blob - extras/package/macosx/build.sh
macosx: change main window and playlist shortcuts from cmd+shift+* to cmd+alt+*
[vlc] / extras / package / macosx / build.sh
1 #!/bin/sh
2 set -e
3 set -x
4
5 info()
6 {
7     local green="\033[1;32m"
8     local normal="\033[0m"
9     echo "[${green}build${normal}] $1"
10 }
11
12 ARCH="x86_64"
13 SDK="10.6"
14
15 usage()
16 {
17 cat << EOF
18 usage: $0 [options]
19
20 Build vlc in the current directory
21
22 OPTIONS:
23    -h            Show some help
24    -q            Be quiet
25    -k <sdk>      Use the specified sdk (default: $SDK)
26    -a <arch>     Use the specified arch (default: $ARCH)
27 EOF
28
29 }
30
31 spushd()
32 {
33     pushd "$1" > /dev/null
34 }
35
36 spopd()
37 {
38     popd > /dev/null
39 }
40
41 while getopts "hvk:a:" OPTION
42 do
43      case $OPTION in
44          h)
45              usage
46              exit 1
47              ;;
48          q)
49              set +x
50              QUIET="yes"
51          ;;
52          a)
53              ARCH=$OPTARG
54          ;;
55          k)
56              SDK=$OPTARG
57          ;;
58      esac
59 done
60 shift $(($OPTIND - 1))
61
62 if [ "x$1" != "x" ]; then
63     usage
64     exit 1
65 fi
66
67 #
68 # Various initialization
69 #
70
71 out="/dev/stdout"
72 if [ "$QUIET" = "yes" ]; then
73     out="/dev/null"
74 fi
75
76 info "Building VLC for the Mac OS X"
77
78 spushd `dirname $0`/../../..
79 vlcroot=`pwd`
80 spopd
81
82 builddir=`pwd`
83
84 info "Building in \"$builddir\""
85
86 export CC=/Developer/usr/bin/clang
87 export CXX="/Developer/usr/bin/clang++"
88 export OBJC=/Developer/usr/bin/clang
89 export OSX_VERSION=$SDK
90 export PATH="${vlcroot}/extras/tools/build/bin:$PATH"
91
92 TRIPLET=$ARCH-apple-darwin10
93
94
95 #
96 # vlc/extras/tools
97 #
98
99 info "Building building tools"
100 spushd "${vlcroot}/extras/tools"
101 ./bootstrap > $out
102 make > $out
103 spopd
104
105
106 #
107 # vlc/contribs
108 #
109
110 info "Building contribs"
111 spushd "${vlcroot}/contrib"
112 mkdir -p build && cd build
113 ../bootstrap --build=$TRIPLET --host=$TRIPLET > $out
114 if [ ! -e "../$TRIPLET" ]; then
115     make prebuilt > $out
116 fi
117 spopd
118
119
120 #
121 # vlc/bootstrap
122 #
123
124 info "Bootstrap-ing configure"
125 spushd "${vlcroot}"
126 if ! [ -e "${vlcroot}/configure" ]; then
127     ${vlcroot}/bootstrap > $out
128 fi
129 spopd
130
131
132 #
133 # vlc/configure
134 #
135
136 if [ "${vlcroot}/configure" -nt Makefile ]; then
137
138   ${vlcroot}/extras/package/macosx/configure.sh \
139       --build=$TRIPLET \
140       --host=$TRIPLET \
141       --with-macosx-version-min=$OSX_VERSION \
142       --with-macosx-sdk=/Developer/SDKs/MacOSX$OSX_VERSION.sdk > $out
143 fi
144
145
146 #
147 # make
148 #
149
150 core_count=`sysctl -n machdep.cpu.core_count`
151 let jobs=$core_count+1
152
153 info "Running make -j$jobs"
154 make -j$jobs