Fixed CURL and Boost compilation on Windows.

This commit is contained in:
Patrick 2024-10-25 09:42:03 +02:00
parent 651c8770c3
commit 7345305a77
4 changed files with 68 additions and 7 deletions

View File

@ -61,7 +61,10 @@ def cook(env: Environment, version) -> dict:
libs.append(env.FindLib(f'libboost_{lib}-*', paths=build_result['LIBPATH'], use_glob=True)) libs.append(env.FindLib(f'libboost_{lib}-*', paths=build_result['LIBPATH'], use_glob=True))
else: else:
raise Exception('Boost not supported on this platform.') raise Exception('Boost not supported on this platform.')
cpppath = {
'nt': [f'{build_result['CPPPATH'][0]}/boost-{version[0]}_{version[1]}']
}.get(os.name, build_result['CPPPATH'])
return { return {
'CPPPATH': build_result['CPPPATH'], 'CPPPATH': cpppath,
'LIBS': libs 'LIBS': libs
} }

View File

@ -8,7 +8,9 @@ def _build_lib_name(env: Environment) -> str:
'debug': 'curl-d' 'debug': 'curl-d'
}.get(env['BUILD_TYPE'], 'curl') }.get(env['BUILD_TYPE'], 'curl')
elif os.name == 'nt': elif os.name == 'nt':
raise Exception('TODO') return {
'debug': 'libcurl-d'
}.get(env['BUILD_TYPE'], 'libcurl')
else: else:
raise Exception('curl is not supported yet on this OS') raise Exception('curl is not supported yet on this OS')
@ -21,9 +23,23 @@ def _git_cook(env: Environment, repo: dict) -> dict:
return { return {
'CPPPATH': build_result['CPPPATH'], 'CPPPATH': build_result['CPPPATH'],
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])], 'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])],
'CPPDEFINES': ['CURL_STATICLIB=1']
} }
_DEPENDENCIES = {
'posix': {
'openssl': {},
'zlib': {},
'psl': {}
},
'nt': {
'wincrypt': {},
'winldap': {},
'winsock2': {}
}
}
env.GitRecipe( env.GitRecipe(
globals = globals(), globals = globals(),
repo_name = 'curl', repo_name = 'curl',
@ -31,9 +47,5 @@ env.GitRecipe(
tag_pattern = re.compile(r'^curl-([0-9]+)_([0-9]+)_([0-9]+)$'), tag_pattern = re.compile(r'^curl-([0-9]+)_([0-9]+)_([0-9]+)$'),
tag_fn = lambda version: f'curl-{version[0]}_{version[1]}_{version[2]}', tag_fn = lambda version: f'curl-{version[0]}_{version[1]}_{version[2]}',
cook_fn = _git_cook, cook_fn = _git_cook,
dependencies = { dependencies = _DEPENDENCIES.get(os.name, {})
'openssl': {},
'zlib': {},
'psl': {}
}
) )

View File

@ -0,0 +1,23 @@
import os
from SCons.Script import *
def available(env: Environment):
if os.name != 'nt':
return 'Winscript is only available on Windows.'
def versions(env: Environment, update: bool = False):
if os.name == 'nt':
return [(0, 0, 0)]
else:
return []
def dependencies(env: Environment, version) -> 'dict':
return {}
def cook(env: Environment, version) -> dict:
return {
'LIBS': ['Advapi32']
}

23
recipes/winldap/recipe.py Normal file
View File

@ -0,0 +1,23 @@
import os
from SCons.Script import *
def available(env: Environment):
if os.name != 'nt':
return 'Winldap is only available on Windows.'
def versions(env: Environment, update: bool = False):
if os.name == 'nt':
return [(0, 0, 0)]
else:
return []
def dependencies(env: Environment, version) -> 'dict':
return {}
def cook(env: Environment, version) -> dict:
return {
'LIBS': ['Wldap32']
}