Commit 789acd42 authored by Anthony Léonard's avatar Anthony Léonard Committed by Guillaume Roguez

make-ring: now able to build Ring for Windows

The script is modified so we can compile Ring for
Windows by using '--distribution=mingw[32|64]'. At the moment, it
can only be used on Fedora (>=23).

Modifications:
 * script/win_compile.sh do the actual job
 * make-ring.py call this script when needed

Change-Id: I964b2bb9fb174bebd8e6b8746f3721066c278251
Reviewed-by: Guillaume Roguez's avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent ab74db46
......@@ -74,6 +74,20 @@ OPENSUSE_DEPENDENCIES = [
'gettext-tools', 'libnotify-devel', 'libappindicator3-devel',
]
MINGW64_FEDORA_DEPENDENCIES = [
'mingw64-binutils', 'mingw64-gcc', 'mingw64-headers', 'mingw64-crt', 'mingw64-gcc-c++',
'mingw64-pkg-config', 'yasm', 'gettext-devel', 'cmake', 'patch', 'libtool', 'automake',
'make', 'xz', 'bzip2', 'which', 'mingw64-qt5-qtbase', 'mingw64-qt5-qttools',
'mingw64-qt5-qtsvg', 'mingw64-qt5-qtwinextras'
]
MINGW32_FEDORA_DEPENDENCIES = [
'mingw32-binutils', 'mingw32-gcc', 'mingw32-headers', 'mingw32-crt', 'mingw32-gcc-c++',
'mingw32-pkg-config', 'yasm', 'gettext-devel', 'cmake', 'patch', 'libtool', 'automake',
'make', 'xz', 'bzip2', 'which', 'mingw32-qt5-qtbase', 'mingw32-qt5-qttools',
'mingw32-qt5-qtsvg', 'mingw32-qt5-qtwinextras'
]
FEDORA_DEPENDENCIES = [
'autoconf', 'automake', 'cmake', 'speexdsp-devel', 'pulseaudio-libs-devel',
'libsamplerate-devel', 'libtool', 'dbus-devel', 'expat-devel', 'pcre-devel',
......@@ -161,7 +175,16 @@ def run_dependencies(args):
RPM_INSTALL_SCRIPT,
{"packages": ' '.join(FEDORA_DEPENDENCIES)}
)
elif args.distribution == "mingw32":
execute_script(
RPM_INSTALL_SCRIPT,
{"packages": ' '.join(MINGW32_FEDORA_DEPENDENCIES)}
)
elif args.distribution == "mingw64":
execute_script(
RPM_INSTALL_SCRIPT,
{"packages": ' '.join(MINGW64_FEDORA_DEPENDENCIES)}
)
elif args.distribution == "Arch Linux":
execute_script(
PACMAN_INSTALL_SCRIPT,
......@@ -220,6 +243,16 @@ def run_install(args):
elif args.distribution == "Android":
os.chdir("./client-android")
execute_script(["./compile.sh"])
elif args.distribution == 'mingw32':
os.environ['CMAKE_PREFIX_PATH'] = '/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake'
os.environ['QTDIR'] = '/usr/i686-w64-mingw32/sys-root/mingw/lib/qt5/'
os.environ['PATH'] = '/usr/i686-w64-mingw32/bin/qt5/:' + os.environ['PATH']
execute_script(["./scripts/win_compile.sh"])
elif args.distribution == 'mingw64':
os.environ['CMAKE_PREFIX_PATH'] = '/usr/x86_64-w64-mingw32/sys-root/mingw/lib/cmake'
os.environ['QTDIR'] = '/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt5/'
os.environ['PATH'] = '/usr/x86_64-w64-mingw32/bin/qt5/:' + os.environ['PATH']
execute_script(["./scripts/win_compile.sh --arch=64"])
else:
if args.distribution == "openSUSE":
os.environ['JSONCPP_LIBS'] = "-ljsoncpp" #fix jsoncpp pkg-config bug, remove when jsoncpp package bumped
......@@ -319,7 +352,7 @@ def validate_args(parsed_args):
"""Validate the args values, exit if error is found"""
# Check arg values
supported_distros = ['Android', 'Ubuntu', 'Debian', 'OSX', 'Fedora', 'Arch Linux', 'openSUSE', 'Automatic']
supported_distros = ['Android', 'Ubuntu', 'Debian', 'OSX', 'Fedora', 'Arch Linux', 'openSUSE', 'Automatic', 'mingw32', 'mingw64']
if parsed_args.distribution not in supported_distros:
print('Distribution not supported.\nChoose one of: %s' \
......@@ -361,6 +394,11 @@ def parse_args():
if parsed_args.distribution == 'Automatic':
parsed_args.distribution = choose_distribution()
if parsed_args.distribution in ['mingw32', 'mingw64']:
if choose_distribution() != "Fedora":
print('Windows version must be built on a Fedora distribution (>=23)')
sys.exit(1)
validate_args(parsed_args)
return parsed_args
......
#!/bin/bash
rootdir=$(pwd)
HOST=i686-w64-mingw32
ARCH=32
CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild.cmake
while test -n "$1"
do
case "$1" in
--clean)
;;
--arch=*)
ARCH="${1#--arch=}"
;;
esac
shift
done
if [ "$ARCH" = "64" ]
then
HOST=x86_64-w64-mingw32
CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild64.cmake
fi
INSTALL_PREFIX=$rootdir/daemon/_win${ARCH}
cd daemon/contrib
mkdir -p native${ARCH}
cd native${ARCH}
../bootstrap --host=${HOST}
make fetch || exit 1
make -j4 || exit 1
cd ../..
./autogen.sh || exit 1
mkdir -p "build${ARCH}"
cd build${ARCH}
$rootdir/daemon/configure --host=${HOST} --without-dbus --prefix=$INSTALL_PREFIX
rsync -a $rootdir/daemon/src/buildinfo.cpp ./src/buildinfo.cpp
make -j4 install || exit 1
cd $rootdir
cd lrc
mkdir -p build${ARCH}
cd build${ARCH}
export CMAKE_PREFIX_PATH=/usr/${HOST}/sys-root/mingw/lib/cmake
cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DRING_BUILD_DIR=$INSTALL_PREFIX -DENABLE_LIBWRAP=true ..
make -j4 install || exit 1
cd $rootdir
cd client-windows
git submodule update --init
if [ ! -f "../daemon/_win32/bin/WinSparkle.dll" ]
then
cd winsparkle
git submodule init && git submodule update
mkdir -p build${ARCH} && cd build${ARCH}
cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ../cmake
make -j4 || exit 1
make install
cd ../../
fi
if [ ! -f "../daemon/_win32/bin/libqrencode.dll" ]
then
cd libqrencode
./autogen.sh || exit 1
mkdir -p build${ARCH} && cd build${ARCH}
../configure --host=${HOST} --prefix=$INSTALL_PREFIX
make -j4 || exit 1
make install
cd ../..
fi
mkdir -p build
cd build
${HOST}-qmake-qt5 ../RingWinClient.pro -r -spec win32-g++ RING=$INSTALL_PREFIX
make -j4 || exit 1
make install
make clean
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment