vlc在windows下的編譯過程

因爲要修改VLC的源碼,在網上找了很多VLC的編譯方法,都沒有成功,這篇是自己驗證通過的,所以轉載過來, 原博客是:http://blog.chinaunix.net/uid-26807463-id-3147631.html

vlc的編譯過程確實是挺堅苦的,好在最後成功了。


關於編譯VLC,不同的平臺有不同的方法,參考http://wiki.videolan.org/Compile_VLC其中在windows下編譯VLC有兩種方式,MSYS+MinGW和CygWin。通過測試,最後決定採用MSYS+MinGW搭建VLC編譯環境(多次測試, 通過且不需要額外的修改)。

    具體步驟(參考http://wiki.videolan.org/Win32CompileMSYSNew<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

注:所有文本的編輯建議使用notepad2(以提供)替代windows原有的notepad,並在保存文件前選擇“文件->行末符號->Unix(換行)”

(所有的資料暫時沒提供,懶得上傳, 呵呵, 我給個快照, 照着下載就是了)



一  MSYS+MInGW環境搭建

1>  MinGW Setup

·                     運行tdm-gcc-<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><?xml:namespace prefix = st1 />4.5.2.exe(已提供) 然後

·                     Select "Create"

·                     install to C:\MinGW(默認是C:\ MinGW32 記得改成C:\ MinGW

·                     keep default settings

·                     afterwards check that C:\MinGW\bin is added to windows PATH (參考下圖 添加到末尾, 用分號分隔)

·                     

MinGW utils

解壓mingw-utils-0.3.tar(已提供), Extract contents to c:\MinGW

 2>  MSys Setup 運行MSYS-1.0.11.exe  然後:Go through the wizard and install to to default C:\Msys\1.0(默認是C:\msys\1.0, 記得改成C:\Msys\1.0

In the command window that opens, answer questions as follows:

Accept Post Install: [y]

MinGW Installed? :   [y]

path to MinGW:       [c:/MinGW]

接着安裝MSys Developer Toolkit   運行msysDTK-1.0.0.exe(已提供)然後Go through the wizard, keeping default values. (默認是C:\msys\1.0, 記得改成C:\Msys\1.0

3>  AutoTools and libcrypt(已提供)文件夾和Glib and PKG-CONFIG(已提供)件夾下面的所有包解壓到C:\Msys\1.0,添加set PKG_CONFIG_PATH=/win32/lib/pkgconfigC:\MSys\1.0\msys.bat第一行。

4>  Fix libtool search dirs

Open C:\MSys\1.0\bin\libtool and change line 9926 by appending ' /mingw/lib' to the end of 'compiler_lib_search_dirs'. The line should then read : ( 一定要用notepad2編輯文本,並保存爲unix格式)

compiler_lib_search_dirs="/usr/lib /usr/lib /bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1 /bin/../lib/gcc-lib /usr/lib/gcc-lib/i686-pc-msys/2.95.3-1 /bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/../../../../i686-pc-msys/lib /usr/lib/gcc-lib/i686-pc-msys/2.95.3-1/../../../../i686-pc-msys/lib /mingw/lib" 

5>  安裝lua

Download the lua tools package from http://www.lua.org/ftp/lua-5.1.4.tar.gz (已提供)

Uncompress it in your home folder (C:\MSys\1.0\home\Administrator)

run C:\MSys\1.0\msys.bat

type the following commands:

cd /home/ Administrator /lua-5.1.4 

make mingw

This should produce lua.exe, luac.exe and lua51.dll in the src directory. Put these in your /bin with the commands:

cd src 

cp *.exe /bin

cp *.dll /bin

cd ..

6>  安裝第三方庫(已提供最新版contrib-20110711-win32-bin-gcc-4.4.4-runtime-3.17-only.tar.bz2), 解壓, usr目錄下面的win32文件夾拷貝到C:\Msys\1.0

  VLC編譯

1>     解壓vlc-1.1.11.tar(已提供), 然後

2>     extract it to C:\MSys\1.0\home\ Administrator rename  the vlc-1.1.11 dir to vlc

3>     編輯configure-msys.sh文件(已提供),添加--disable-upnp,類似於下圖:
然後拷貝configure-msys.shconfigure-common.sh文件到C:\Msys\1.0\home\Administrator\vlc\extras\package\win32下。

4>     Create a new file containing the single line:echoAdministrator

and save it as C:\MSys\1.0\bin\whoami (without any extension)

Modify configure.ac so that it doesn't call 'hostname -f' as follows:

·                     open C:\MSys\1.0\home\Administrator\vlc\configure.ac

·                     goto search button:

·                     change it as follows:

old: AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2> /dev/null || hostname`", [host which ran configure])

new: AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])

5>Build VLC

The build is made exclusively from the command line, so if you closed the prompt at the LUA step, re-execute C:\MSys\1.0\msys.bat, then type the commands as mentioned

Bootstrap

cd vlccp -v /win32/share/aclocal/* m4/cp -v /share/aclocal/* m4/PATH=/win32/bin:$PATH ./bootstrap

Configure

sh extras/package/win32/configure-msys.sh

Make (compile)

PATH=/usr/win32/bin:$PATH make -j4 (如果是四核的電腦, 否則相應修改)

 make成功後如果想要生成sdk等文件夾, 可以輸入下面命令Create self-contained packages

Once the compilation is done, build self-contained VLC packages with one of the following "make" commands:

make package-win32-base

(This will create a subdirectory named vlc-x.x.x with all the binaries "stripped" without any debugging symbols).



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章