一、环境准备
1.操作系统 ubuntu 14.04.1 LTS
2.安装以下插件[需要联网]
$ sudo apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools
$ sudo apt-get install -y lua5.2 libtool automake autoconf autopoint make gettext
$ sudo apt-get install -y qt4-dev-tools qt5-default
$ sudo apt-get install -y git subversion cmake cvs wine-dev yasm
$ sudo apt-get install -y zip p7zip nsis bzip2
$ sudo apt-get build-dep vlc
3.执行以下脚本 move.sh,将部分dll移走备份
#!/bin/sh
# This script enforces statically linking of libgcc, libstdc++-6, and libpthread,
# without needing to rebuild gcc and mingw-w64 from scratch.
# -static-libgcc -static-libstdc++ flags can not be used in a libtool build system,
# as libtool removes flags that it doesn't understand.
move() {
[ -f $1 ] || return 1
mkdir -p old/
mv -v $* old/
return 0
}
for x in i686 x86_64
do
library_path_list=`$x-w64-mingw32-gcc -v /dev/null 2>&1 | grep ^LIBRARY_PATH|cut -d= -f2|sort|uniq`
IFS=':'
for i in $library_path_list
do
cd $i
move libstdc++-6.dll libstdc++.dll.a libgcc_s.a libgcc_s_sjlj-1.dll && ln -s libgcc_eh.a libgcc_s.a
move libpthread.dll.a libwinpthread.dll.a
move libwinpthread-1.dll
[ -d ../bin ] && cd ../bin && move libwinpthread-1.dll
done
done
exit 0
二、下载vlc2.1.2安装包
1.下载软件包
1)http://ftp.videolan.org/pub/videolan/contrib/i686-w64-mingw32/
找到vlc-contrib-i686-w64-mingw32-20150630.tar.bz2 下载
2)http://get.videolan.org/vlc/2.1.2/vlc-2.1.2.tar.xz
下载 vlc2.1.2版本
三、编译安装
1.将下载vlc-2.2.1.tar.xz的包放在/home目录下
2.执行命令
$ cd /home
$ tar xJvf vlc-2.2.1.tar.xz
$ cd vlc-2.2.1/
$ cd contrib/
$ mkdir win32; cd win32
3.将下载的vlc-contrib-i686-w64-mingw32-20150630.tar.bz2放在
/home/vlc-2.1.2/contrib/win32下面,执行命令
$mv vlc-contrib-i686-w64-mingw32-20150630.tar.bz2 vlc-contrib-i686-w64-mingw32-latest.tar.bz2
4.编译库
$ ../bootstrap --host=i686-w64-mingw32
$ make prebuilt
5.编译源码
$ cd ../../
$ ./bootstrap
6.指定pkg_config路径
$export PKG_CONFIG_LIBDIR=/home/vlc-2.1.2/contrib/i686-w64-mingw32/lib/pkgconfig
7.再执行一下命令
$ mkdir win32; cd win32
$ ../extras/package/win32/configure.sh --host=i686-w64-mingw32
8.修改Makefile文件
1)找到stamp-npapi-fetch修改如下
2)找到package-win-common: package-win-install,屏蔽对npapi-vlc的操作
这时候可以执行编译了
$make
9.打包
$ make package-win-common
10.执行完成后,当前目录下会生成vlc-2.2.1目录,里面包含有dll以及相关sdk目录.