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