Win32 build: fix script options
[vlc.git] / extras / package / win32 / build.sh
blob272be1fc50ab65675a56bfb452b6805867608741
1 #!/bin/sh
3 set -e
4 set -x
6 info()
8 local green="\033[1;32m"
9 local normal="\033[0m"
10 echo "[${green}build${normal}] $1"
13 usage()
15 cat << EOF
16 usage: $0 [options]
18 Build vlc in the current directory
20 OPTIONS:
21 -h Show some help
22 -r Release mode (default is debug)
23 -a <arch> Use the specified arch (default: x86_64, possible i686)
24 -p Use a Prebuilt contrib package (speeds up compilation)
25 -c Create a Prebuilt contrib package (rarely used)
26 -l Enable translations (can be slow)
27 -i <n|r> Create an Installer (n: nightly, r: release)
28 EOF
31 ARCH="x86_64"
32 while getopts "hra:pcli:" OPTION
34 case $OPTION in
36 usage
37 exit 1
40 RELEASE="yes"
41 INSTALLER="r"
44 ARCH=$OPTARG
47 PREBUILT="yes"
50 PACKAGE="yes"
53 I18N="yes"
56 INSTALLER=$OPTARG
58 esac
59 done
60 shift $(($OPTIND - 1))
62 if [ "x$1" != "x" ]; then
63 usage
64 exit 1
67 case $ARCH in
68 x86_64)
69 SHORTARCH="win64"
71 i686)
72 SHORTARCH="win32"
75 usage
76 exit 1
77 esac
79 #####
81 JOBS=`nproc --all`
82 TRIPLET=$ARCH-w64-mingw32
84 info "Building extra tools"
85 cd extras/tools
86 ./bootstrap
87 make -j$JOBS
88 export PATH=$PWD/build/bin:$PATH
89 cd ../../
91 info "Building contribs"
92 export USE_FFMPEG=1
93 mkdir -p contrib/contrib-$SHORTARCH && cd contrib/contrib-$SHORTARCH
94 ../bootstrap --host=$TRIPLET
96 # Rebuild the contribs or use the prebuilt ones
97 if [ "$PREBUILT" != "yes" ]; then
98 make list
99 make -j$JOBS fetch
100 make -j$JOBS
101 if [ "$PACKAGE" == "yes" ]; then
102 make package
104 else
105 make prebuilt
106 make .luac
108 cd ../..
110 info "Bootstrapping"
111 export PKG_CONFIG_LIBDIR=$PWD/vlc/contrib/$TRIPLET/lib/pkgconfig
112 export PATH=$PWD/vlc/contrib/$TRIPLET/bin:$PATH
113 echo $PATH
115 ./bootstrap
117 info "Configuring VLC"
118 mkdir $SHORTARCH || true
119 cd $SHORTARCH
121 CONFIGFLAGS=""
122 if [ "$RELEASE" != "yes" ]; then
123 CONFIGFLAGS="$CONFIGFLAGS --enable-debug"
125 if [ "$I18N" != "yes" ]; then
126 CONFIGFLAGS="$CONFIGFLAGS --disable-nls"
128 ../extras/package/win32/configure.sh --host=$TRIPLET $CONFIGFLAGS
130 info "Compiling"
131 make -j$JOBS
133 if [ "$INSTALLER" == "n" ]; then
134 make package-win32-debug package-win32
135 elif [ "$INSTALLER" == "r" ]; then
136 make package-win32