Skip to content

Commit

Permalink
fix openssl component error
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jan 2, 2025
1 parent e58dde1 commit 6ce4de8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
14 changes: 10 additions & 4 deletions components/3rd_party/openssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,25 @@
###############################################

if(PLATFORM_LINUX)
set(compile_for_host 1)
set(compile_from_src 0)
else()
set(compile_for_host 0)
set(compile_from_src 1)
endif()
if(CONFIG_OPENSSL_COMPILE_FROM_SOURCE)
set(compile_from_src 1)
endif()

if(NOT compile_for_host)
if(compile_from_src)
if(NOT ADD_INCLUDE) # compile from source code
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE arch)
string(REGEX REPLACE "([^-]+)-.*" "\\1" arch "${arch}")
if(PLATFORM_MAIXCAM)
string(LENGTH "${CONFIG_TOOLCHAIN_PREFIX}" toolchain_prefix_len)
math(EXPR toolchain_prefix_len "${toolchain_prefix_len} - 1")
string(SUBSTRING "${CONFIG_TOOLCHAIN_PREFIX}" 0 ${toolchain_prefix_len} host_prefix)
set(host_prefix "${host_prefix}-")
elseif(PLATFORM_LINUX)
set(host_prefix "")
else()
message(FATAL_ERROR "openssle compile not support this platform yet, please edit CMakeLists.txt to support")
endif()
Expand All @@ -96,7 +102,7 @@ if(NOT compile_for_host)

set(openssl_src_path "${DL_EXTRACTED_PATH}/openssl/openssl-3.0.12")
set(openssl_install_path "${target_install_dir}")
set(openssl_compile_cmd COMMAND set -x && cd ${openssl_src_path} && echo "-- compile openssl now" && make distclean || true && chmod +x ./Configure && ./Configure linux-generic32 shared -DL_ENDIAN --openssldir=${openssl_install_path} --prefix=${openssl_install_path} && export PATH=${CONFIG_TOOLCHAIN_PATH}:$ENV{PATH} && make CC="${host_prefix}"-gcc RANLIB="${host_prefix}"-ranlib LD="${host_prefix}"-ld MAKEDEPPROG="${host_prefix}"-gcc PROCESSOR=${arch} -j`nproc` && make install_sw)
set(openssl_compile_cmd COMMAND set -x && cd ${openssl_src_path} && echo "-- compile openssl now" && make distclean || true && chmod +x ./Configure && ./Configure linux-generic32 shared -DL_ENDIAN --openssldir=${openssl_install_path} --prefix=${openssl_install_path} && export PATH=${CONFIG_TOOLCHAIN_PATH}:$ENV{PATH} && make CC="${host_prefix}"gcc RANLIB="${host_prefix}"ranlib LD="${host_prefix}"ld MAKEDEPPROG="${host_prefix}"gcc PROCESSOR=${arch} -j`nproc` && make install_sw)

add_custom_command(OUTPUT ${target_h_path}
${openssl_compile_cmd}
Expand Down
23 changes: 5 additions & 18 deletions components/3rd_party/openssl/Kconfig
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
# Python version major minor patch
menu "Python version"
config PYTHON_VERSION_MAJOR
int "python package major version"
default 0
menu "OpenSSL"
config OPENSSL_COMPILE_FROM_SOURCE
bool "compile openssl from souce code"
default n
help
Python package major version, 0 means auto select according to board

config PYTHON_VERSION_MINOR
int "python package minor version"
default 0
help
Python package minor version

config PYTHON_VERSION_PATCH
int "python package patch version"
default 0
help
Python package patch version
compile openssl from source code, or use system libs
endmenu
2 changes: 2 additions & 0 deletions tools/cmake/components_depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def get_depends(component, data):
depends = data[component] if component in data else []
sub_depends = []
for d in depends:
if d == component:
continue
sub_depends += get_depends(d, data)
return depends + sub_depends

Expand Down

0 comments on commit 6ce4de8

Please sign in to comment.