2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00
This commit is contained in:
Andrei Pavel
2025-02-17 11:02:58 +02:00
parent e41685233c
commit 694a04fbcb
5 changed files with 70 additions and 58 deletions

View File

@@ -123,6 +123,36 @@ conf_data = configuration_data(
},
)
#### System-specific Variables
SYSTEM = build_machine.system()
if SYSTEM == 'linux'
conf_data.set('OS_LINUX', true)
OS_TYPE = 'Linux'
elif SYSTEM == 'freebsd'
conf_data.set('OS_BSD', true)
conf_data.set('OS_FREEBSD', true)
OS_TYPE = 'BSD'
elif SYSTEM == 'netbsd'
conf_data.set('OS_BSD', true)
conf_data.set('OS_NETBSD', true)
OS_TYPE = 'BSD'
elif SYSTEM == 'openbsd'
conf_data.set('OS_BSD', true)
conf_data.set('OS_OPENBSD', true)
OS_TYPE = 'BSD'
elif SYSTEM == 'sun'
conf_data.set('OS_SOLARIS', true)
OS_TYPE = 'Solaris'
elif SYSTEM == 'darwin'
conf_data.set('OS_BSD', true)
conf_data.set('OS_OSX', true)
OS_TYPE = 'BSD'
else
error(f'Build failed: Unsupported system "@SYSTEM@".')
endif
message(f'Detected system "@SYSTEM@".')
#### Programs
python_exe = find_program('python3', 'python', required: false)
@@ -261,15 +291,30 @@ foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
endif
# Search in /opt.
lib = cpp.find_library(dep, dirs: [f'/opt/@dep@/lib'], required: false)
if lib.found()
netconf_deps = netconf_deps + {
dep: declare_dependency(
dependencies: [lib],
include_directories: include_directories(f'/opt/@dep@/include'),
),
}
endif
foreach prefix : ['', 'lib']
path = f'/opt/@prefix@@dep@'
lib = cpp.find_library(dep, dirs: [f'/@path@/lib'], required: false)
if lib.found()
netconf_deps = netconf_deps + {
dep: declare_dependency(
dependencies: [lib],
include_directories: include_directories(f'/@path@/include'),
variables: {'prefix': f'@path@'},
),
}
if SYSTEM == 'darwin'
add_project_link_arguments(
f'-Wl,-rpath,@path@/lib',
language: 'cpp',
)
else
add_project_link_arguments(
f'-Wl,-rpath=@path@/lib',
language: 'cpp',
)
endif
endif
endforeach
endforeach
foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
if netconf_deps[dep].found()
@@ -341,36 +386,6 @@ result = cpp.run(
)
conf_data.set('HAVE_STREAM_TRUNCATED_ERROR', result.returncode() == 0)
#### System-specific Variables
SYSTEM = build_machine.system()
if SYSTEM == 'linux'
conf_data.set('OS_LINUX', true)
OS_TYPE = 'Linux'
elif SYSTEM == 'freebsd'
conf_data.set('OS_BSD', true)
conf_data.set('OS_FREEBSD', true)
OS_TYPE = 'BSD'
elif SYSTEM == 'netbsd'
conf_data.set('OS_BSD', true)
conf_data.set('OS_NETBSD', true)
OS_TYPE = 'BSD'
elif SYSTEM == 'openbsd'
conf_data.set('OS_BSD', true)
conf_data.set('OS_OPENBSD', true)
OS_TYPE = 'BSD'
elif SYSTEM == 'sun'
conf_data.set('OS_SOLARIS', true)
OS_TYPE = 'Solaris'
elif SYSTEM == 'darwin'
conf_data.set('OS_BSD', true)
conf_data.set('OS_OSX', true)
OS_TYPE = 'BSD'
else
error(f'Build failed: Unsupported system "@SYSTEM@".')
endif
message(f'Detected system "@SYSTEM@".')
#### System-specific Compiler Flags
compile_args = []

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this

View File

@@ -1,24 +1,19 @@
yangdir = f'@DATADIR@/kea/yang/modules/utils'
yang_utils_conf_data = configuration_data()
# Comment says sources (vs build)
yang_utils_conf_data.set('abs_top_builddir', TOP_SOURCE_DIR)
yang_utils_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
# Beware that top_srcdir here must be a relative path.
yang_utils_conf_data.set('top_srcdir', '../../../../..')
yang_utils_conf_data.set('datarootdir', f'@PREFIX@/@DATADIR@')
yang_lint = find_program('/opt/bin/yanglint', required: false)
if yang_lint.found()
yang_utils_conf_data.set('LIBYANG_PREFIX', '/opt')
yang_utils_conf_data.set('SYSREPO_PREFIX', '/opt')
else
yang_utils_conf_data.set('SYSREPO_PREFIX', '/usr/local')
yang_lint = find_program('/usr/local/bin/yanglint', required: false)
if yang_lint.found()
yang_utils_conf_data.set('LIBYANG_PREFIX', '/usr/local')
else
yang_lint = find_program('yanglint', required: true)
yang_utils_conf_data.set('LIBYANG_PREFIX', '')
endif
endif
yang_utils_conf_data.set('prefix', PREFIX)
yang_utils_conf_data.set(
'LIBYANG_PREFIX',
netconf_deps['yang'].get_variable('prefix'),
)
yang_utils_conf_data.set(
'SYSREPO_PREFIX',
netconf_deps['sysrepo'].get_variable('prefix'),
)
configure_file(
input: 'check-hashes.sh.in',
@@ -34,4 +29,6 @@ configure_file(
input: 'reinstall.sh.in',
output: 'reinstall.sh',
configuration: yang_utils_conf_data,
install: true,
install_dir: 'share/kea/yang/modules/utils',
)

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (C) 2021-2024 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2021-2025 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -87,7 +87,7 @@ prefix="@prefix@"
# If script is in sources, use modules from sources.
# If script is in installation, use modules from installation.
for i in \
"@datarootdir@/@PACKAGE_NAME@/yang/modules" \
"@datarootdir@/kea/yang/modules" \
"@abs_top_builddir@/src/share/yang/modules" \
; do
if test "${script_path}" = "${i}/utils"; then