diff --git a/openssl/30-phoenix.conf b/openssl/30-phoenix.conf deleted file mode 100644 index 124bb842..00000000 --- a/openssl/30-phoenix.conf +++ /dev/null @@ -1,39 +0,0 @@ -#phoenix - -my %targets = ( - "phoenix" => { - template => 1, - inherit_from => [ "BASE_unix" ], - sys_id => "PHOENIX_RTOS", - defines => add("OPENSSL_SYS_PHOENIX"), - disable => [ "dynamic-engine", "pic", "shared", "threads", "tests", "tls1_3" ], - enable => [ "epoll", "pktinfo" ], - }, - - "phoenix-armv7a7-imx6ull" => { - inherit_from => [ "phoenix", asm("armv4_asm") ], - cc => "arm-phoenix-gcc", - ld => "arm-phoenix-ld", - ranlib => "arm-phoenix-gcc-ranlib", - cflags => "-Os -Wall -Wstrict-prototypes -g -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mthumb -fomit-frame-pointer -mno-unaligned-access -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-z,max-page-size=0x1000", - arflags => "-r", - }, - - "phoenix-ia32-generic" => { - inherit_from => [ "phoenix", asm("x86_elf_asm") ], - cc => "i386-pc-phoenix-gcc", - ld => "i386-pc-phoenix-ld", - ranlib => "i386-pc-phoenix-gcc-ranlib", - cflags => "-Os -march=i586 -mtune=generic -Wall -Wstrict-prototypes -g -fomit-frame-pointer -fdata-sections -ffunction-sections", - arflags => "-r", - }, - - "phoenix-riscv64-generic" => { - inherit_from => [ "phoenix" ], - cc => "riscv64-phoenix-gcc", - ld => "riscv64-phoenix-ld", - ranlib => "riscv64-phoenix-gcc-ranlib", - cflags => "-Os -Wall -Wstrict-prototypes -fomit-frame-pointer -ffreestanding -mcmodel=medany", - arflags => "-r", - }, -); diff --git a/openssl/30-phoenix.conf.jinja b/openssl/30-phoenix.conf.jinja new file mode 100644 index 00000000..c90db9f0 --- /dev/null +++ b/openssl/30-phoenix.conf.jinja @@ -0,0 +1,27 @@ +#phoenix + +my %targets = ( + "phoenix" => { + template => 1, + inherit_from => [ "BASE_unix" ], + sys_id => "PHOENIX_RTOS", + defines => add("OPENSSL_SYS_PHOENIX"), + disable => [ "dynamic-engine", "pic", "shared", "threads", "tests", "tls1_3" ], + enable => [ "epoll", "pktinfo" ], + }, + "{{ env.OPENSSL_TARGET }}" => { +{% if env.OPENSSL_TARGET == "phoenix-armv7a7-imx6ull" %} + inherit_from => [ "phoenix", asm("armv4_asm") ], +{% elif env.OPENSSL_TARGET == "phoenix-ia32-generic" %} + inherit_from => [ "phoenix", asm("x86_elf_asm") ], +{% elif env.OPENSSL_TARGET == "phoenix-riscv64-generic" %} + inherit_from => [ "phoenix" ], +{% endif %} + cc => "{{ env.CC }}", + ld => "{{ env.LD }}", + ranlib => "{{ env.CROSS }}gcc-ranlib", + arflags => "-r", + cflags => "{{ env.CFLAGS }}", + lflags => "{{ env.LDFLAGS }}" + }, +); diff --git a/openssl/build.sh b/openssl/build.sh index 57a0f79c..f1da666e 100755 --- a/openssl/build.sh +++ b/openssl/build.sh @@ -36,8 +36,11 @@ done # Configure # if [ ! -f "${PREFIX_PORT_BUILD}/Makefile" ]; then - cp "$PREFIX_PORT/30-phoenix.conf" "$PREFIX_OPENSSL_SRC/Configurations/" - (cd "${PREFIX_PORT_BUILD}" && "${PREFIX_OPENSSL_SRC}/Configure" "phoenix-${TARGET_FAMILY}-${TARGET_SUBFAMILY}" --prefix="$PREFIX_OPENSSL_INSTALL" --openssldir="/etc/ssl") + # Fill the Phoenix compilation settings. + # NOTE: This causes setting of all other Phoenix targets to be wrong. + openssl_target="phoenix-${TARGET_FAMILY}-${TARGET_SUBFAMILY}" + OPENSSL_TARGET="$openssl_target" python3 "$PREFIX_PORT/render-config.py" "$PREFIX_PORT/30-phoenix.conf.jinja" > "$PREFIX_OPENSSL_SRC/Configurations/30-phoenix.conf" + (cd "${PREFIX_PORT_BUILD}" && "${PREFIX_OPENSSL_SRC}/Configure" "$openssl_target" --prefix="$PREFIX_OPENSSL_INSTALL" --openssldir="/etc/ssl") fi diff --git a/openssl/render-config.py b/openssl/render-config.py new file mode 100644 index 00000000..69ad3f47 --- /dev/null +++ b/openssl/render-config.py @@ -0,0 +1,9 @@ +import jinja2 +import os +import sys +from pathlib import Path + +tmpl = Path(sys.argv[1]).read_text() +rendered = jinja2.Template(tmpl, undefined=jinja2.StrictUndefined).render(env=os.environ) + +print(rendered)