1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Added windows/bootstrap.sh which downloads and compiles all qtox dependencies

Fixed install_libfilteraudio.sh to work on windows
bootstrap.bat now invokes sh bootstrap.sh (for convenience)
Updated INSTALL.md to reflect simplified bootstrapping procedure
This commit is contained in:
novist 2015-01-05 13:25:32 +02:00
parent 313f666a2b
commit 9266dc55f5
5 changed files with 143 additions and 40 deletions

View File

@ -230,45 +230,18 @@ The following steps assume that MinGW is installed at "C:\MinGW". If you decided
###Setting up Path ###Setting up Path
Add MinGW/MSYS binaries to the system path to make them globally accessible. Add MinGW/MSYS/CMake binaries to the system path to make them globally accessible.
Open Control Panel -> System and Security -> System -> Advanced system settings -> Environment Variables... Open Control Panel -> System and Security -> System -> Advanced system settings -> Environment Variables...
In the second box search for the PATH variable and press Edit... In the second box search for the PATH variable and press Edit...
The input box "Variable value:" should already contain some directories. Each directory is separated with a semicolon. The input box "Variable value:" should already contain some directories. Each directory is separated with a semicolon.
Extend the input box by adding ";C:\MinGW\bin;C:\MinGW\msys\1.0\bin". The very first semicolon must only be added if it is missing. Extend the input box by adding ";C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\Program Files (x86)\CMake 2.8\bin".
The very first semicolon must only be added if it is missing. CMake may be added by installer automatically.
###Cloning the Repository ###Cloning the Repository
Clone the repository (https://github.com/tux3/qTox.git) with your preferred Git client. [SmartGit](http://www.syntevo.com/smartgit/) is very nice for this task. Clone the repository (https://github.com/tux3/qTox.git) with your preferred Git client. [SmartGit](http://www.syntevo.com/smartgit/) is very nice for this task.
The following steps assume that you cloned the repository at "C:\qTox". If you decided to choose another location, replace corresponding parts. The following steps assume that you cloned the repository at "C:\qTox". If you decided to choose another location, replace corresponding parts.
###Tox Core ### Getting dependencies
Run bootstrap.bat in cloned C:\qTox directory
[jenkins.libtoxcore.so](http://jenkins.libtoxcore.so/job/libtoxcore-win32-i686/lastSuccessfulBuild/artifact/libtoxcore-win32-i686.zip) Script will download rest of dependencies compile them and put to appropriate directories.
provides a prebuild package of Tox Core. Download this package and extract its content to "C:\qTox\libs". You may have to create the directory "libs".
If you prefer to compile Tox Core on your own follow the instructions at https://github.com/irungentoo/toxcore/blob/master/INSTALL.md#windows
###OpenCV
Unfortunately there are no prebuild packages for OpenCV compiled with MinGW. Thus, you have to create your own.
First of all download and install the most recent version of CMake from
[cmake.org](http://www.cmake.org/cmake/resources/software.html).
Afterwards download OpenCV in version 2.4.9 from [sourceforge.net](http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/download) and extract the content of the source archive to "C:\qTox\libs". Furthermore, create a new directory named "opencv-build" in "C:\qTox\libs".
Now you should have the two directories "opencv-2.4.9" and "opencv-build" inside your "C:\qTox\libs" directory.
Run CMake (cmake-gui) and set up the input boxes "Where is the source code:" and "Where to build the binaries" with "C:\qTox\libs\opencv-2.4.9" and "C:\qTox\libs\opencv-build". Press configure and choose "MSYS Makefiles" in the drop down menu with "Use default native compilers". To start initial configuration press Finish. Given that qTox only needs some components of OpenCV it's recommended to disable not required modules. Furthermore, this will decrease compilation time of OpenCV dramatically. Each module begins with "BUILD_opencv_" and can be disabled by deselecting its entry. Use the "Search" input box for convenience. Disable all modules except of "core", "highgui" and "imgproc" (highgui depends on imgproc and will automatically be disabled if imgproc is disabled). For maximum performance search for "CMAKE_BUILD_TYPE" and set this value to "Release". Finally, make sure "CMAKE_INSTALL_PREFIX" points to "C:\qTox\libs\opencv-build\install" (should be by default). To update the configuration press Configure again. To generate the Makefiles press Generate.
Open a new command prompt within "C:\qTox\libs\opencv-build" (HINT: Use shift + right click -> "Open command window here" on the directory within Windows Explorer). Compile and install OpenCV with the following command. It's not recommended to use -j for multicore compilation, because it freezes the terminal from time to time.
```bash
make
make install
```
After OpenCV was successfully installed to "C:\qTox\libs\opencv-build\install" copy the dlls "libopencv_core249.dll", "libopencv_highgui249.dll" and "libopencv_imgproc249.dll" located at "C:\qTox\libs\opencv-build\install\x86\mingw\bin" to "C:\qTox\libs\lib". Afterwards copy the content of the directory "C:\qTox\libs\opencv-build\install\include" to "C:\qTox\libs\include". Finally, you have to patch the file "C:\qTox\libs\include\opencv2\opencv.hpp" because it includes all modules of OpenCV regardless of your configuration. Open this file with your preferred text editor and remove all includes except of "opencv2/core/core_c.h", "opencv2/core/core.hpp", "opencv2/imgproc/imgproc_c.h", "opencv2/imgproc/imgproc.hpp", "opencv2/highgui/highgui_c.h" and "opencv2/highgui/highgui.hpp". OpenCV is now ready to use. Feel free to delete the directories "opencv-2.4.9" and "opencv-build", but you don't need to.
###OpenAL Soft
As for OpenCV there are no prebuild packages of OpenAL Softe compiled with MinGW, but the installation process is very similar to OpenCV. Download the most recent source archive of OpenAL Soft from [http://kcat.strangesoft.net](http://kcat.strangesoft.net/openal.html#download). Extract its content to "C:\qTox\libs". Besides the source folder itself you'll find the file "pax_global_header". It is not required and can be deleted. Create the directory "openal-build" next to source folder. Now you should have the two directories "openal-soft-x.y.z" where x.y.z is the version of OpenAL and "openal-build" inside your "C:\qTox\libs" directory. Run CMake (cmake-gui) and setup the source and build location. Run the initial configuration and use "MSYS Makefiles" with "Use default native compilers". The only thing you need to configure is "CMAKE_INSTALL_PREFIX" which does not point to "C:\qTox\libs\openal-build\install" by default. Configure the project and generate the Makefiles. Compile and install OpenAL Soft with:
```bash
make
make install
```
Copy the dll "OpenAL32.dll" located at "C:\qTox\libs\openal-build\install\bin" to "C:\qTox\libs\lib". Finally, copy the directory "AL" located at "C:\qTox\libs\openal-build\install\include" to "C:\qTox\libs\include". Unlike OpenCV you don't need to patch any files. Feel free to delete the directories "openal-soft-x.y.z" and "openal-build", but you don't need to.

View File

@ -1,4 +1,4 @@
@mkdir %~dp0libs @echo off
%~dp0tools\wget --no-check-certificate http://jenkins.libtoxcore.so/job/libtoxcore-win32-i686/lastSuccessfulBuild/artifact/libtoxcore-win32-i686.zip -O %~dp0libs\libtoxcore-latest.zip
%~dp0tools\unzip -o %~dp0libs\libtoxcore-latest.zip -d %~dp0libs\ sh bootstrap.sh
@del %~dp0libs\libtoxcore-latest.zip @pause

View File

@ -1,5 +1,12 @@
#!/bin/bash #!/bin/bash
WINDOWS_VERSION=$(cmd.exe /c ver 2>/dev/null | grep "Microsoft Windows")
if [ ! -z "$WINDOWS_VERSION" ]; then
cd windows
./bootstrap.sh
exit $?
fi
################ parameters ################ ################ parameters ################
# directory where the script is located # directory where the script is located
SCRIPT_DIR=$( cd $(dirname $0); pwd -P) SCRIPT_DIR=$( cd $(dirname $0); pwd -P)
@ -67,7 +74,7 @@ while [ $# -ge 1 ] ; do
echo "" echo ""
fi fi
# print help # print help
echo "Use this script to install/update libsodium and libtoxcore in ${INSTALL_DIR}" echo "Use this script to install/update libsodium and libtoxcore in ${INSTALL_DIR}"
echo "" echo ""
echo "usage:" echo "usage:"

View File

@ -14,6 +14,15 @@ else
INCLUDE_DIR="$2/include/" INCLUDE_DIR="$2/include/"
fi fi
WINDOWS_VERSION=$(cmd.exe /c ver 2>/dev/null | grep "Microsoft Windows")
if [ ! -z "$WINDOWS_VERSION" ]; then
EXT=dll
BIN_DIR="$2/bin/"
else
BIN_DIR=$LIB_DIR
EXT=so
fi
echo "Cloning filter_audio from GitHub.com" echo "Cloning filter_audio from GitHub.com"
git clone https://github.com/irungentoo/filter_audio.git $SOURCE_DIR git clone https://github.com/irungentoo/filter_audio.git $SOURCE_DIR
@ -22,16 +31,21 @@ cd $SOURCE_DIR
gcc -c -fPIC filter_audio.c aec/*.c agc/*.c ns/*.c other/*.c -lm -lpthread gcc -c -fPIC filter_audio.c aec/*.c agc/*.c ns/*.c other/*.c -lm -lpthread
echo "Creating shared object file" echo "Creating shared object file"
gcc *.o -shared -o libfilteraudio.so gcc *.o -shared -o libfilteraudio.$EXT -Wl,--out-implib,libfilteraudio.$EXT.a
echo "Cleaning up" echo "Cleaning up"
rm *.o rm *.o
muhcmd="cp libfilteraudio.so $LIB_DIR" muhcmd="cp libfilteraudio.$EXT $BIN_DIR"
[ -z "$2" ] && muhcmd="sudo $muhcmd" [ -z "$2" ] && muhcmd="sudo $muhcmd"
echo "Installing libfilteraudio.so with $muhcmd" echo "Installing libfilteraudio.so with $muhcmd"
$muhcmd $muhcmd
muhcmd="cp libfilteraudio.$EXT.a $LIB_DIR"
[ -z "$2" ] && muhcmd="sudo $muhcmd"
echo "Installing libfilteraudio.$EXT.a with $muhcmd"
$muhcmd
muhcmd="cp *.h $INCLUDE_DIR" muhcmd="cp *.h $INCLUDE_DIR"
[ -z "$2" ] && muhcmd="sudo $muhcmd" [ -z "$2" ] && muhcmd="sudo $muhcmd"
echo "Installing include files with $muhcmd" echo "Installing include files with $muhcmd"

109
windows/bootstrap.sh Normal file
View File

@ -0,0 +1,109 @@
#!/bin/sh
QTOX_DIR=`pwd`/..
if [ -d $QTOX_DIR/libs ]; then
echo "Remove ./libs and redownload/recompile dependencies?"
read -p "m/a/N (missing/all/no): " yn
yn=$(echo $yn | tr "[:upper:]" "[:lower:]")
if [ "$yn" == "a" ]; then
rm -rf $QTOX_DIR/libs
elif [ "$yn" == "n" ]; then
exit -1
elif [ "$yn" != "m" ]; then
exit -1
fi
fi
mkdir -p $QTOX_DIR/libs
cd $QTOX_DIR/libs
## toxcore
if [ ! -f "libtoxcore-win32-i686.zip" ]; then
wget --no-check-certificate http://jenkins.libtoxcore.so/job/libtoxcore-win32-i686/lastSuccessfulBuild/artifact/libtoxcore-win32-i686.zip
rm -rf include/tox
fi
if [ ! -d "include/tox" ]; then
$QTOX_DIR/tools/unzip -o libtoxcore-win32-i686.zip -d ./
fi
## filter_audio
if [ ! -f "bin/libfilteraudio.dll" ]; then
$QTOX_DIR/install_libfilteraudio.sh $QTOX_DIR/libs/filter_audio $QTOX_DIR/libs
fi
## OpenAL
if [ ! -f "openal-soft-1.16.0.tar.bz2" ]; then
wget http://kcat.strangesoft.net/openal-releases/openal-soft-1.16.0.tar.bz2
rm -rf openal-soft-1.16.0
fi
if [ ! -d "openal-soft-1.16.0" ]; then
tar -xvf openal-soft-1.16.0.tar.bz2
rm bin/OpenAL32.dll
fi
if [ ! -f "bin/OpenAL32.dll" ]; then
pushd openal-soft-1.16.0/build
cmake -G "MSYS Makefiles" -DQT_QMAKE_EXECUTABLE=NOTFOUND -DCMAKE_BUILD_TYPE=Release -DALSOFT_REQUIRE_DSOUND=NO -DCMAKE_INSTALL_PREFIX=$QTOX_DIR/libs ..
make
make install
popd
fi
## opencv
if [ ! -f "opencv-2.4.9.tar.gz" ]; then
wget --no-check-certificate https://github.com/Itseez/opencv/archive/2.4.9.tar.gz -O opencv-2.4.9.tar.gz
rm -rf opencv-2.4.9
fi
if [ ! -d "opencv-2.4.9" ]; then
tar -xvf opencv-2.4.9.tar.gz
rm bin/libopencv_core249.dll
fi
if [ ! -f "bin/libopencv_core249.dll" ]; then
mkdir opencv-2.4.9/build
pushd opencv-2.4.9/build
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$QTOX_DIR/libs \
-DBUILD_opencv_apps=NO \
-DBUILD_opencv_calib3d=NO \
-DBUILD_opencv_contrib=NO \
-DBUILD_opencv_core=YES \
-DBUILD_opencv_features2d=NO \
-DBUILD_opencv_flann=NO \
-DBUILD_opencv_gpu=NO \
-DBUILD_opencv_highgui=YES \
-DBUILD_opencv_imgproc=YES \
-DBUILD_opencv_legacy=NO \
-DBUILD_opencv_ml=NO \
-DBUILD_opencv_nonfree=NO \
-DBUILD_opencv_objdetect=NO \
-DBUILD_opencv_ocl=NO \
-DBUILD_opencv_photo=NO \
-DBUILD_opencv_stiching=NO \
-DBUILD_opencv_superres=NO \
-DBUILD_opencv_ts=NO \
-DBUILD_opencv_video=NO \
-DBUILD_opencv_videostab=NO \
-DBUILD_opencv_world=NO \
-DWITH_QT=NO \
-DBUILD_EXAMPLES=NO \
..
make
make install
for arch in x86 x64
do
if [ -d $QTOX_DIR/libs/$arch/mingw ]; then
mv $QTOX_DIR/libs/$arch/mingw/bin/* $QTOX_DIR/libs/bin/
mv $QTOX_DIR/libs/$arch/mingw/lib/* $QTOX_DIR/libs/lib/
rm -rf $QTOX_DIR/libs/$arch
fi
done
popd
fi
echo **Done**