Skip to content

Commit

Permalink
contrib(win32): bump opendht and openssl build
Browse files Browse the repository at this point in the history
- Uses 1.1.1 stable branch of https://github.com/openssl/openssl
  instead of https://github.com/microsoft/openssl. Note that this
  build will not pass app certification for the Windows store.
- bumps opendht to support the new OpenSSL build and removes some
  unused linkage
- adds a 'use_cmake' key to the package.json windows contrib
  build system
- allows us to shave about 4.5 min off openssl build time by
  defining MAKE_TOOL to jom.exe to override nmake
- adds /FS to force synchronous PDB writes

Change-Id: Idd06a0805b45fa19551c15d1859cbccca49e6bb6
  • Loading branch information
atraczyk committed Oct 21, 2020
1 parent d7f840f commit 0350064
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 45 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if(MSVC)
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_DIRECTORY_RELEASELIB_WIN32 "${CMAKE_CURRENT_SOURCE_DIR}/build-local/${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>/bin/"
OUTPUT_DIRECTORY_RELEASELIB_WIN32 "${CMAKE_CURRENT_SOURCE_DIR}/build/${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>/bin/"
)
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
Expand All @@ -121,7 +121,7 @@ if(MSVC)
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/include/upnp;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/ffmpeg/Build/win32/x64/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/sndfile/src;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/inc32;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/asio/asio/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/restinio/dev;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/fmt/include;"
Expand All @@ -148,6 +148,7 @@ if(MSVC)
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/msgpack-c/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/opendht/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/libarchive/libarchive;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/jsoncpp/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/yaml-cpp/include;"
Expand Down Expand Up @@ -201,7 +202,8 @@ if(MSVC)
/Oy-;
/sdl-;
/W0;
/FC
/FC;
/FS
>
/nologo;
/Zi;
Expand Down Expand Up @@ -245,7 +247,7 @@ if(MSVC)
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/ffmpeg/Build/win32/x64/bin/swscale.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/libgnutls.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/lib_json.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/libopendht.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/opendht/build/Release/libopendht.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/argon2/vs2015/Argon2Ref/vs2015/build/Argon2Ref.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/secp256k1.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/yaml-cpp/msvc/Release/libyaml-cppmd.lib
Expand All @@ -264,9 +266,8 @@ if(MSVC)
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/pjproject/pjnath/lib/pjnath-x86_64-x64-vc15-Release.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/fmt/msvc/Release/fmt.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/http_parser/x64/Release/http-parser.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/asio/asio/msvc/x64/Release/asio.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/out32dll/libeay32.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/out32dll/ssleay32.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/libcrypto.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/libssl.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/speexdsp/lib/libspeexdsp.lib
/ignore:4006
"
Expand Down
73 changes: 61 additions & 12 deletions compat/msvc/winmake.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
"""
This tool is designed to facilitate downloading, patching, and building
of library dependencies for the Jami daemon project on windows. MSBuild
toolset and sdk versions can be supplied as parameters and will be sedded
into vcxproj files accordingly.
A package can be defined with a json like this:
{
"name": "mylibrary",
"version": "76a5006623539a58262d33458a5605be096b3a10",
"url": "https://git.example.com/gorblok/mylibrary/archive/__VERSION__.tar.gz",
"deps": ["mydep"],
"use_cmake" : true,
"defines": ["SEGFAULTS=0", "MY_CMAKE_DEFINE=true"],
"patches": ["some_patch.patch"],
"win_patches": ["some_windows_line_ending_patch.patch"],
"project_paths": ["mylibrary-static.vcxproj"],
"with_env" : "10.0.16299.0",
"custom_scripts": { "pre_build": [], "build": [], "post_build": [] }
}
"""

import sys
import os
import subprocess
Expand Down Expand Up @@ -26,7 +48,7 @@
# project paths
daemon_msvc_dir = os.path.dirname(os.path.realpath(__file__))
daemon_dir = os.path.dirname(os.path.dirname(daemon_msvc_dir))
daemon_msvc_build_local_dir = daemon_dir + r'\build-local'
daemon_build_dir = daemon_dir + r'\build'
contrib_src_dir = daemon_dir + r'\contrib\src'
contrib_build_dir = daemon_dir + r'\contrib\build'
contrib_tmp_dir = daemon_dir + r'\contrib\tarballs'
Expand Down Expand Up @@ -173,7 +195,7 @@ def make_plugin(pkg_info, force, sdk_version, toolset):
cmake_script = "cmake -G " + getCMakeGenerator(getLatestVSVersion(
)) + cmake_defines + "-S " + plugin_path + " -B " + plugin_path + "/msvc"
root_logger.warning("Cmake generating vcxproj files")
result = getSHrunner().exec_batch(cmake_script)
_ = getSHrunner().exec_batch(cmake_script)
build(pkg_name,
plugin_path,
pkg_info.get('project_paths', []),
Expand All @@ -187,7 +209,7 @@ def make_plugin(pkg_info, force, sdk_version, toolset):
def make_daemon(pkg_info, force, sdk_version, toolset):
cmake_script = 'cmake -DCMAKE_CONFIGURATION_TYPES="ReleaseLib_win32" -DCMAKE_SYSTEM_VERSION=' + sdk_version + \
' -DCMAKE_VS_PLATFORM_NAME="x64" -G ' + getCMakeGenerator(getLatestVSVersion(
)) + ' -T $(DefaultPlatformToolset) -S ../../ -B ../../build-local'
)) + ' -T $(DefaultPlatformToolset) -S ../../ -B ../../build'
root_logger.warning("Cmake generating vcxproj files")
result = getSHrunner().exec_batch(cmake_script)
if result[0] is not 0:
Expand All @@ -200,7 +222,7 @@ def make_daemon(pkg_info, force, sdk_version, toolset):
env_set = 'false' if pkg_info.get('with_env', '') == '' else 'true'
sdk_to_use = sdk_version if env_set == 'false' else pkg_info.get(
'with_env', '')
build('daemon', daemon_msvc_build_local_dir,
build('daemon', daemon_build_dir,
pkg_info.get('project_paths', []),
pkg_info.get('custom_scripts', {}),
env_set,
Expand Down Expand Up @@ -254,13 +276,30 @@ def make(pkg_info, force, sdk_version, toolset):
env_set = 'false' if pkg_info.get('with_env', '') == '' else 'true'
sdk_to_use = sdk_version if env_set == 'false' else pkg_info.get(
'with_env', '')

# configure with cmake ?
use_cmake = pkg_info.get('use_cmake', False)
if use_cmake:
cmake_defines = ""
for define in pkg_info.get('defines', []):
cmake_defines += " -D" + define + " "
if not pkg_up_to_date or current_version is None or force:
cmake_conf_script = "cmake -G " + getCMakeGenerator(getLatestVSVersion(
)) + cmake_defines + "-S '" + pkg_build_path + "' -B '" + pkg_build_path + "\\build'"
log.debug("Configuring with Cmake")
result = getSHrunner().exec_batch(cmake_conf_script)
if result[0] is not 0:
log.error("Error configuring with CMake")
exit(1)

if build(pkg_name,
contrib_build_dir + '\\' + pkg_name,
pkg_info.get('project_paths', []),
pkg_info.get('custom_scripts', {}),
env_set,
sdk_to_use,
toolset):
toolset,
use_cmake=use_cmake):
track_build(pkg_name, version)
else:
log.error("Couldn't build contrib " + pkg_name)
Expand Down Expand Up @@ -428,7 +467,7 @@ def track_build(pkg_name, version):


def build(pkg_name, pkg_dir, project_paths, custom_scripts, with_env, sdk,
toolset, arch='x64', conf='Release'):
toolset, arch='x64', conf='Release', use_cmake=False):
getMSbuilder().set_msbuild_configuration(with_env, arch, conf, toolset)
getMSbuilder().setup_vs_env(sdk)

Expand Down Expand Up @@ -458,12 +497,22 @@ def build(pkg_name, pkg_dir, project_paths, custom_scripts, with_env, sdk,
# vcxproj files
if project_paths:
log.debug('Msbuild phase')
for pp in project_paths:
project_full_path = pkg_dir + '\\' + pp
log.debug('Building: ' + pkg_name + " with sdk version " +
sdk + " and toolset " + toolset)
getMSbuilder().build(pkg_name, project_full_path, sdk, toolset)
build_operations += 1
for pp in project_paths:
project_full_path = pkg_dir + '\\' + pp
log.debug('Building: ' + pkg_name + " with sdk version " +
sdk + " and toolset " + toolset)
getMSbuilder().build(pkg_name, project_full_path, sdk, toolset)
build_operations += 1
else:
# build directly with cmake
if use_cmake is True:
log.debug('CMake build phase')
cmake_build_script = "cmake --build '" + pkg_dir + \
"\\build' " + "--config " + conf
result = getSHrunner().exec_batch(cmake_build_script)
if result[0] is not 0:
log.error("Error building with CMake")
exit(1)

os.chdir(tmp_dir)

Expand Down
8 changes: 4 additions & 4 deletions contrib/src/asio/asio-vcxproj.patch
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\inc32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WIN32_WINNT=0x0A00;ASIO_STANDALONE;ASIO_SEPARATE_COMPILATION;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
Expand All @@ -95,7 +95,7 @@
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\inc32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WIN32_WINNT=0x0A00;ASIO_STANDALONE;ASIO_SEPARATE_COMPILATION;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
Expand All @@ -113,7 +113,7 @@
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\inc32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WIN32_WINNT=0x0A00;ASIO_STANDALONE;ASIO_SEPARATE_COMPILATION;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
Expand All @@ -131,7 +131,7 @@
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\inc32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\include;$(ProjectDir)..\..\..\openssl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WIN32_WINNT=0x0A00;ASIO_STANDALONE;ASIO_SEPARATE_COMPILATION;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
Expand Down
4 changes: 1 addition & 3 deletions contrib/src/asio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"win_patches": [
"asio-vcxproj.patch"
],
"project_paths": [
"asio/msvc/asio.vcxproj"
],
"project_paths": [],
"with_env" : "",
"custom_scripts": {
"pre_build": [],
Expand Down
6 changes: 2 additions & 4 deletions contrib/src/msgpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
"deps": [],
"patches": [],
"win_patches": [],
"project_paths": ["vs2017/msgpackc.vcxproj"],
"project_paths": [],
"with_env" : "",
"custom_scripts": {
"pre_build": [
"mkdir vs2017 & cd vs2017 & cmake .. -DMSGPACK_CXX11=ON -G %CMAKE_GENERATOR%"
],
"pre_build": [],
"build": [],
"post_build": []
}
Expand Down
12 changes: 10 additions & 2 deletions contrib/src/opendht/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opendht",
"version": "cf44bb608f220d8e592380e7fb0157aaa9f3a20d",
"version": "076a5006623539a58262d33458a5605be096b3a1",
"url": "https://github.com/savoirfairelinux/opendht/archive/__VERSION__.tar.gz",
"deps": [
"argon2",
Expand All @@ -10,9 +10,17 @@
"msgpack",
"restinio"
],
"use_cmake" : true,
"defines": [
"OPENDHT_SHARED=0",
"OPENDHT_PROXY_CLIENT=1",
"OPENDHT_PROXY_SERVER=1",
"OPENDHT_PUSH_NOTIFICATIONS=1",
"OPENDHT_TOOLS=0"
],
"patches": [],
"win_patches": [],
"project_paths": ["msvc/opendht.vcxproj"],
"project_paths": [],
"with_env" : "",
"custom_scripts": {
"pre_build": [],
Expand Down
18 changes: 5 additions & 13 deletions contrib/src/openssl/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
{
"name": "openssl",
"version": "5cc1e25bc76bcf0db03bc37bd64b3290727963b6",
"url": "https://github.com/Microsoft/openssl/archive/__VERSION__.tar.gz",
"deps": [],
"patches": [],
"win_patches": [],
"project_paths": [],
"with_env" : "10.0.16299.0",
"version": "OpenSSL_1_1_1-stable",
"url": "https://github.com/openssl/openssl/archive/__VERSION__.tar.gz",
"custom_scripts": {
"pre_build": [],
"build": [
"call perl Configure no-asm no-hw VC-WIN64A",
"call ms/do_win64a",
"set CL=/MP & call nmake -f ms/ntdll.mak"
],
"post_build": []
"call perl Configure no-asm no-hw no-tests /Z7 /FS VC-WIN64A",
"if defined MAKE_TOOL (call %MAKE_TOOL%) else (call nmake)"
]
}
}

0 comments on commit 0350064

Please sign in to comment.