Skip to content
Snippets Groups Projects
Commit 297ad484 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

build: fix Windows build

Makes build.py commands work for Windows.

Change-Id: Ie21314b090106286348ad51d6137fac84fa651df
parent ada7c4f0
No related branches found
No related tags found
No related merge requests found
build.py 100755 → 100644
...@@ -91,7 +91,7 @@ ZYPPER_INSTALL_SCRIPT = [ ...@@ -91,7 +91,7 @@ ZYPPER_INSTALL_SCRIPT = [
ZYPPER_DEPENDENCIES = [ ZYPPER_DEPENDENCIES = [
# build system # build system
'autoconf', 'autoconf-archive', 'automake', 'cmake', 'make', 'patch', 'gcc-c++', 'autoconf', 'autoconf-archive', 'automake', 'cmake', 'make', 'patch', 'gcc-c++',
'libtool', 'which', 'pandoc','nasm', 'doxygen', 'graphviz', 'libtool', 'which', 'pandoc', 'nasm', 'doxygen', 'graphviz',
# contrib dependencies # contrib dependencies
'curl', 'gzip', 'bzip2', 'curl', 'gzip', 'bzip2',
# daemon # daemon
...@@ -138,7 +138,7 @@ DNF_CLIENT_DEPENDENCIES = [ ...@@ -138,7 +138,7 @@ DNF_CLIENT_DEPENDENCIES = [
'qrencode-devel', 'NetworkManager-libnm-devel' 'qrencode-devel', 'NetworkManager-libnm-devel'
] ]
DNF_QT_WEBENGINE = [ 'qt6-qtwebengine-devel' ] DNF_QT_WEBENGINE = ['qt6-qtwebengine-devel']
APT_DEPENDENCIES = [ APT_DEPENDENCIES = [
'autoconf', 'autoconf-archive', 'autopoint', 'automake', 'cmake', 'make', 'dbus', 'doxygen', 'graphviz', 'autoconf', 'autoconf-archive', 'autopoint', 'automake', 'cmake', 'make', 'dbus', 'doxygen', 'graphviz',
...@@ -173,7 +173,7 @@ APT_CLIENT_DEPENDENCIES = [ ...@@ -173,7 +173,7 @@ APT_CLIENT_DEPENDENCIES = [
APT_QT_WEBENGINE = [ APT_QT_WEBENGINE = [
'libqt6webengine6-data', 'libqt6webenginecore6-bin', 'libqt6webengine6-data', 'libqt6webenginecore6-bin',
'qt6-webengine-dev', 'qt6-webengine-dev-tools', 'qt6-webengine-dev', 'qt6-webengine-dev-tools',
'qml6-module-qtwebengine', 'qml6-module-qtwebchannel' ] 'qml6-module-qtwebengine', 'qml6-module-qtwebchannel']
PACMAN_DEPENDENCIES = [ PACMAN_DEPENDENCIES = [
'autoconf', 'autoconf-archive', 'gettext', 'cmake', 'dbus', 'doxygen', 'graphviz', 'autoconf', 'autoconf-archive', 'gettext', 'cmake', 'dbus', 'doxygen', 'graphviz',
...@@ -193,7 +193,7 @@ PACMAN_CLIENT_DEPENDENCIES = [ ...@@ -193,7 +193,7 @@ PACMAN_CLIENT_DEPENDENCIES = [
'qrencode', 'libnm' 'qrencode', 'libnm'
] ]
PACMAN_QT_WEBENGINE = [ 'qt6-webengine' ] PACMAN_QT_WEBENGINE = ['qt6-webengine']
OSX_DEPENDENCIES = [ OSX_DEPENDENCIES = [
'autoconf', 'cmake', 'gettext', 'pkg-config', 'qt6', 'autoconf', 'cmake', 'gettext', 'pkg-config', 'qt6',
...@@ -212,6 +212,7 @@ UNINSTALL_DAEMON_SCRIPT = [ ...@@ -212,6 +212,7 @@ UNINSTALL_DAEMON_SCRIPT = [
ASSUME_YES_FLAG = ' -y' ASSUME_YES_FLAG = ' -y'
ASSUME_YES_FLAG_PACMAN = ' --noconfirm' ASSUME_YES_FLAG_PACMAN = ' --noconfirm'
def run_powershell_cmd(cmd): def run_powershell_cmd(cmd):
p = subprocess.Popen(["powershell.exe", cmd], stdout=sys.stdout) p = subprocess.Popen(["powershell.exe", cmd], stdout=sys.stdout)
p.communicate() p.communicate()
...@@ -354,13 +355,13 @@ def cwd(path): ...@@ -354,13 +355,13 @@ def cwd(path):
def run_install(args): def run_install(args):
# Platforms with special compilation scripts # Platforms with special compilation scripts
if args.distribution == WIN32_DISTRIBUTION_NAME: if args.distribution == WIN32_DISTRIBUTION_NAME:
winmake = 'daemon/compat/msvc/winmake.py' with cwd('daemon/compat/msvc'):
with cwd(os.path.dirname(winmake)):
execute_script( execute_script(
f'python {winmake} -iv -s {args.sdk} -b daemon') ['python winmake.py -iv '
f'-s {args.sdk} -b daemon'])
build_windows = 'extras/scripts/build-windows.py' build_windows = 'extras/scripts/build-windows.py'
execute_script(f'python {build_windows} init') execute_script([f'python {build_windows} init'])
execute_script(f'python {build_windows}') execute_script([f'python {build_windows}'])
return True return True
# Unix-like platforms # Unix-like platforms
...@@ -393,7 +394,8 @@ def run_install(args): ...@@ -393,7 +394,8 @@ def run_install(args):
environ['CMAKE_PREFIX_PATH'] = proc.stdout.rstrip("\n") environ['CMAKE_PREFIX_PATH'] = proc.stdout.rstrip("\n")
environ['CONFIGURE_FLAGS'] = '--without-dbus' environ['CONFIGURE_FLAGS'] = '--without-dbus'
if not args.qt: if not args.qt:
raise Exception('provide the Qt path using --qt=/qt/install/prefix') raise Exception(
'provide the Qt path using --qt=/qt/install/prefix')
install_args += ("-Q", args.qt) install_args += ("-Q", args.qt)
else: else:
if args.distribution in ZYPPER_BASED_DISTROS: if args.distribution in ZYPPER_BASED_DISTROS:
...@@ -423,7 +425,7 @@ def run_install(args): ...@@ -423,7 +425,7 @@ def run_install(args):
'--expose=/gnu/store', '--expose=/etc/ssl/certs', '--expose=/gnu/store', '--expose=/etc/ssl/certs',
'--expose=/usr/bin/env', '--expose=/usr/bin/env',
'--container', '--network'] + share_tarballs_args \ '--container', '--network'] + share_tarballs_args \
+ ['--'] + command + ['--'] + command
print(f'info: Building/installing using the command: {" ".join(command)}') print(f'info: Building/installing using the command: {" ".join(command)}')
return subprocess.run(command, env=environ, check=True) return subprocess.run(command, env=environ, check=True)
...@@ -436,8 +438,8 @@ def run_uninstall(args): ...@@ -436,8 +438,8 @@ def run_uninstall(args):
if (os.path.exists(BUILD_DIR)): if (os.path.exists(BUILD_DIR)):
UNINSTALL_CLIENT_SCRIPT = [ UNINSTALL_CLIENT_SCRIPT = [
f'make -C {BUILD_DIR} uninstall', f'make -C {BUILD_DIR} uninstall',
f'rm -rf {BUILD_DIR}' f'rm -rf {BUILD_DIR}'
] ]
execute_script(UNINSTALL_CLIENT_SCRIPT) execute_script(UNINSTALL_CLIENT_SCRIPT)
...@@ -518,8 +520,8 @@ def execute_script(script, settings=None, fail=True): ...@@ -518,8 +520,8 @@ def execute_script(script, settings=None, fail=True):
line = line % settings line = line % settings
rv = os.system(line) rv = os.system(line)
if rv and fail: if rv and fail:
print('Error executing script! Exit code: %s' % print('Error executing script! Exit code: %s (%s)' %
rv, file=sys.stderr) (rv, script), file=sys.stderr)
sys.exit(1) sys.exit(1)
...@@ -540,7 +542,7 @@ def validate_args(parsed_args): ...@@ -540,7 +542,7 @@ def validate_args(parsed_args):
# Filter unsupported distributions. # Filter unsupported distributions.
supported_distros = \ supported_distros = \
[ OSX_DISTRIBUTION_NAME, WIN32_DISTRIBUTION_NAME, 'guix'] + \ [OSX_DISTRIBUTION_NAME, WIN32_DISTRIBUTION_NAME, 'guix'] + \
APT_BASED_DISTROS + DNF_BASED_DISTROS + PACMAN_BASED_DISTROS \ APT_BASED_DISTROS + DNF_BASED_DISTROS + PACMAN_BASED_DISTROS \
+ ZYPPER_BASED_DISTROS + FLATPAK_BASED_RUNTIMES + ZYPPER_BASED_DISTROS + FLATPAK_BASED_RUNTIMES
......
...@@ -81,6 +81,7 @@ if(NOT LIBJAMI_LIB) ...@@ -81,6 +81,7 @@ if(NOT LIBJAMI_LIB)
if(WITH_DAEMON_SUBMODULE) if(WITH_DAEMON_SUBMODULE)
find_library(LIBJAMI_LIB NAMES jami ring find_library(LIBJAMI_LIB NAMES jami ring
PATHS ${DAEMON_DIR}/src/.libs PATHS ${DAEMON_DIR}/src/.libs
PATHS ${CMAKE_INSTALL_PREFIX}
PATHS ${CMAKE_INSTALL_PREFIX}/lib PATHS ${CMAKE_INSTALL_PREFIX}/lib
PATHS ${CMAKE_INSTALL_PREFIX}/libexec PATHS ${CMAKE_INSTALL_PREFIX}/libexec
NO_DEFAULT_PATH) NO_DEFAULT_PATH)
...@@ -89,6 +90,7 @@ if(NOT LIBJAMI_LIB) ...@@ -89,6 +90,7 @@ if(NOT LIBJAMI_LIB)
find_library(LIBJAMI_LIB NAMES jami ring find_library(LIBJAMI_LIB NAMES jami ring
PATHS ${LIBJAMI_BUILD_DIR}/.libs PATHS ${LIBJAMI_BUILD_DIR}/.libs
PATHS ${RING_BUILD_DIR}/.libs PATHS ${RING_BUILD_DIR}/.libs
PATHS ${CMAKE_INSTALL_PREFIX}
PATHS ${CMAKE_INSTALL_PREFIX}/lib PATHS ${CMAKE_INSTALL_PREFIX}/lib
PATHS ${CMAKE_INSTALL_PREFIX}/libexec PATHS ${CMAKE_INSTALL_PREFIX}/libexec
NO_DEFAULT_PATH) NO_DEFAULT_PATH)
......
...@@ -184,7 +184,7 @@ def build_deps(): ...@@ -184,7 +184,7 @@ def build_deps():
patch_file = os.path.join(repo_root_dir, 'qrencode-win32.patch') patch_file = os.path.join(repo_root_dir, 'qrencode-win32.patch')
apply_cmd.append(patch_file) apply_cmd.append(patch_file)
print(apply_cmd) print(apply_cmd)
if(execute_cmd(apply_cmd, False, None, qrencode_dir)): if (execute_cmd(apply_cmd, False, None, qrencode_dir)):
print("Couldn't patch qrencode-win32.") print("Couldn't patch qrencode-win32.")
vs_env_vars = {} vs_env_vars = {}
...@@ -207,12 +207,13 @@ def build(config_str, qtver, tests=False): ...@@ -207,12 +207,13 @@ def build(config_str, qtver, tests=False):
vs_env_vars.update(getVSEnv()) vs_env_vars.update(getVSEnv())
qt_dir = os.path.join(qt_root_path, qtver, qt_kit_path) qt_dir = os.path.join(qt_root_path, qtver, qt_kit_path)
daemon_dir = os.path.dirname(repo_root_dir) + '\\daemon' daemon_dir = os.path.join(repo_root_dir, 'daemon')
daemon_bin_dir = daemon_dir + '\\build\\x64\\ReleaseLib_win32\\bin' daemon_bin_dir = os.path.join(daemon_dir, 'build/x64/ReleaseLib_win32/bin')
# We need to update the minimum SDK version to be able to # We need to update the minimum SDK version to be able to
# build with system theme support # build with system theme support
cmake_options = [ cmake_options = [
'-DWITH_DAEMON_SUBMODULE=ON',
'-DCMAKE_PREFIX_PATH=' + qt_dir, '-DCMAKE_PREFIX_PATH=' + qt_dir,
'-DCMAKE_INSTALL_PREFIX=' + daemon_bin_dir, '-DCMAKE_INSTALL_PREFIX=' + daemon_bin_dir,
'-DLIBJAMI_INCLUDE_DIR=' + daemon_dir + '\\src\\jami', '-DLIBJAMI_INCLUDE_DIR=' + daemon_dir + '\\src\\jami',
...@@ -230,7 +231,7 @@ def build(config_str, qtver, tests=False): ...@@ -230,7 +231,7 @@ def build(config_str, qtver, tests=False):
print('Generating…') print('Generating…')
cmd.extend(cmake_options) cmd.extend(cmake_options)
if(execute_cmd(cmd, False, vs_env_vars, build_dir)): if (execute_cmd(cmd, False, vs_env_vars, build_dir)):
print("Cmake generate error") print("Cmake generate error")
sys.exit(1) sys.exit(1)
...@@ -240,7 +241,7 @@ def build(config_str, qtver, tests=False): ...@@ -240,7 +241,7 @@ def build(config_str, qtver, tests=False):
'--config', 'Release', '--config', 'Release',
'--', '-m' '--', '-m'
] ]
if(execute_cmd(cmd, False, vs_env_vars, build_dir)): if (execute_cmd(cmd, False, vs_env_vars, build_dir)):
print("Cmake build error") print("Cmake build error")
sys.exit(1) sys.exit(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment