## SPDX-License-Identifier: Apache-2.0 ## An extension of OpenSSL's Configurations, after the settings of its targets in 10-main.conf and 15-ios.conf ## (Copyright The OpenSSL Project Authors), under OpenSSL's license, the Apache License 2.0. ## Configure targets of the otok recipe: one per OS and architecture of the Apple slices, and one per ## architecture and environment of the Windows target (clang-cl across from Linux, MSVC on Windows). otok's ## toolchain brings the compiler and its flags (CC, CFLAGS with -target and -isysroot, or --target for clang-cl), ## so these targets carry no compiler, SDK or deployment version, unlike the -xcrun targets of 15-ios.conf. my %targets = ( # Windows, cross-built with clang-cl: the settings of the VC- targets, with the Unix makefile template # and GNU make instead of nmake. platform/Windows/otok.pm keeps the MSVC names of the libraries # (libcrypto.lib, libcrypto--x64.dll); clang-cl links the DLLs, passing lld-link's options # behind /clang:-Wl, and llvm-ar fills COFF archives. The names of these targets are not VC-: the # version resources of the DLLs, which want rc's options, stay out. "otok-windows" => { template => 1, inherit_from => [ "VC-noCE-common" ], build_file => "Makefile", build_scheme => [ "unified", "unix" ], perl_platform => 'Windows::otok', # otok's flags choose the optimization and the runtime (/MD, /MDd), also in static libraries cflags => "/GF /Gy", lib_cflags => "", dso_cflags => "", bin_cflags => "", bin_lflags => "", LDFLAGS => "", ARFLAGS => "--format=coff rc", RANLIB => "", shared_target => "windows-shared", shared_ldflag => "/LD", shared_impflag => "/clang:-Wl,/implib:", shared_defflag => "/clang:-Wl,/def:", }, # The Windows target keeps one include/ for its architectures, so both write the same configuration.h: # no sys_id (VC-WIN64A's OPENSSL_SYS_WIN64A, which no source tests) and no RC4_CHAR (a speed choice for # RC4 that VC-CLANG-WIN64-CLANGASM-ARM makes). "otok-windows-x86_64" => { inherit_from => [ "otok-windows" ], bn_ops => "SIXTY_FOUR_BIT", asm_arch => 'x86_64', # GNU syntax with Win64's calling convention and unwind tables, which clang-cl assembles perlasm_scheme => "mingw64", multilib => "-x64", }, # as VC-CLANG-WIN64-CLANGASM-ARM "otok-windows-arm64" => { inherit_from => [ "otok-windows" ], defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE", "OPENSSL_SYS_WIN_CORE"), bn_ops => "SIXTY_FOUR_BIT", asm_arch => 'aarch64', perlasm_scheme => "win64", multilib => "-arm64", }, "otok-apple" => { template => 1, inherit_from => [ "darwin-common" ], disable => [ "shared", "async" ], }, # as darwin64-arm64; ios64-xcrun adds RC4_CHAR, a speed choice for RC4. Where the architectures of # one platform differ in bn_ops (watchOS: arm64_32 beside arm64), otok keeps configuration.h per # architecture. "otok-apple-arm64" => { template => 1, inherit_from => [ "otok-apple" ], lib_cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT_LONG", asm_arch => 'aarch64', perlasm_scheme => "ios64", }, "otok-apple-x86_64" => { template => 1, inherit_from => [ "otok-apple" ], lib_cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT_LONG", asm_arch => 'x86_64', perlasm_scheme => "macosx", }, # Apple Watch: 32-bit pointers on a 64-bit CPU, no assembler "otok-apple-arm64_32" => { template => 1, inherit_from => [ "otok-apple" ], lib_cppflags => add("-DL_ENDIAN"), bn_ops => "BN_LLONG RC4_CHAR", }, ); # sys_id tells OpenSSL the OS; macOS and Mac Catalyst keep darwin-common's MACOSX my @systems = ([ "macos", undef, [] ], [ "ios", "iOS", [] ], [ "tvos", "tvOS", [ "engine" ] ], [ "watchos", "watchOS", [ "engine" ] ], [ "xros", "visionOS", [] ]); foreach my $system (@systems) { my ($os, $sys_id, $disable) = @$system; foreach my $arch ("arm64", "x86_64", "arm64_32") { $targets{"otok-$os-$arch"} = { inherit_from => [ "otok-apple-$arch" ], (defined $sys_id ? (sys_id => $sys_id) : ()), (@$disable ? (disable => add(@$disable)) : ()), }; } } # Windows with MSVC on Windows: the VC- targets with nmake and their makefile, whose compiler flags are otok's (CFLAGS on # Configure's command line: the optimization and the runtime, /MD or /MDd, also in static libraries, which the VC- # targets build with /MT /Zl). As for clang-cl, no sys_id and no RC4_CHAR, so that both architectures write one # configuration.h; no uplink, the applink of OpenSSL's own programs, which these builds do not make. my %msvc = ( cflags => "/GF /Gy", lib_cflags => "", dso_cflags => "", bin_cflags => "", sys_id => undef, uplink_arch => undef, ); # VC-WIN64A: x86_64 with the assembler of NASM $targets{"otok-windows-msvc-x86_64"} = { inherit_from => [ "VC-WIN64A" ], %msvc, }; # VC-WIN64-ARM without onecore.lib (kernel32 of the desktop instead) and without assembler: MSVC's armasm64 takes none of # OpenSSL's $targets{"otok-windows-msvc-arm64"} = { inherit_from => [ "VC-WIN64-common" ], %msvc, defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE", "OPENSSL_SYS_WIN_CORE"), multilib => "-arm64", disable => [ "asm" ], }; %targets;