Configurations/60-otok.conf 4786 bytes · raw
## 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 of the Windows target. 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-<version>-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)) : ()),
};
}
}
%targets;
build.lua 1929 bytes · raw
-- Configure with a target of Configurations/60-otok.conf and the slice's toolchain, then the
-- libraries and the development files only.
function build(slice, options, deps)
local t = slice.toolchain
otok.copy(slice.recipe .. "/Configurations/60-otok.conf", slice.source .. "/Configurations/60-otok.conf")
local configure = { slice.toolchains.perl, slice.source .. "/Configure", "otok-" .. slice.vars.openssl_os .. "-" .. slice.arch, "no-shared",
"no-tests", "--prefix=" .. slice.prefix, "--openssldir=/etc/ssl", "--libdir=lib",
"CC=" .. t.cc, "CFLAGS=" .. table.concat(t.cflags, " ") .. " -Wall", "AR=" .. t.ar, "RANLIB=" .. t.ranlib }
if options["no-deprecated"] then table.insert(configure, "no-deprecated") end
otok.run(configure, { cwd = slice.build })
if slice.vars.no_fork then
local makefile = otok.read(slice.build .. "/Makefile")
makefile = makefile:gsub("apps/lib/libapps%-lib%-http_server%.o \\\n", ""):gsub("apps/lib/libapps%-lib%-http_server%.o ", "")
otok.write(slice.build .. "/Makefile", makefile)
end
otok.make{ "build_libs", cwd = slice.build }
otok.make{ "install_dev", cwd = slice.build }
-- the headers Swift and Objective-C use; the others come along through their includes
local module = { "module COpenSSL {" }
for _, h in ipairs{ "ssl", "err", "evp", "rand", "sha", "hmac", "kdf", "x509v3", "pem", "pkcs12", "core_names", "provider" } do
table.insert(module, ' header "../openssl/' .. h .. '.h"')
end
table.insert(module, " export *\n}\n")
otok.write(slice.prefix .. "/module.modulemap", table.concat(module, "\n"))
return {
libraries = {
ssl = slice.prefix .. "/lib/libssl.a",
crypto = slice.prefix .. "/lib/libcrypto.a",
},
headers = slice.prefix .. "/include",
module_map = slice.prefix .. "/module.modulemap",
}
end
recipe.toml 1672 bytes · raw
# The otok recipe of OpenSSL (https://github.com/apotocki/otok): libssl and libcrypto for every
# Apple platform, from the release tag.
[recipe]
api = 1
library = "openssl"
name = "openssl"
version = "4.1.0"
revision = 1
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
homepage = "https://www.openssl.org"
description = "OpenSSL (libssl, libcrypto), built from source."
keywords = ["tls", "crypto"]
linkage = ["static"]
[source]
git = "https://github.com/openssl/openssl"
commit = "2f4e3a5fec05394068cfa7379890ab552483a8a6"
tag = "openssl-4.1.0"
[platforms]
supported = ["ios", "iossim", "macosx", "catalyst", "tvos", "tvossim", "watchos", "watchossim", "xros", "xrossim"]
build-on = ["macos/xcode"]
[vars]
# the OS part of the Configure targets of Configurations/60-otok.conf
openssl_os = { macosx = "macos", catalyst = "macos", ios = "ios", iossim = "ios", tvos = "tvos", tvossim = "tvos", watchos = "watchos", watchossim = "watchos", xros = "xros", xrossim = "xros" }
# fork() is unavailable: libapps, which build_libs builds too, leaves out its HTTP server
no_fork = { tvos = true, tvossim = true, watchos = true, watchossim = true, default = false }
[options.no-deprecated]
type = "bool"
default = false
doc = "Configure with no-deprecated: removes the deprecated APIs."
[[product]]
name = "OpenSSL"
libraries = ["ssl", "crypto"]
headers = "crypto"
defines = [{ define = "OPENSSL_NO_DEPRECATED", when = { option = "no-deprecated" } }]
apple = { module = "COpenSSL", privacy-manifest = "PrivacyInfo.xcprivacy" }
[toolchains]
make = { version = ">= 3.81", default-recipe = "apotocki/make" }
perl = { version = ">= 5.30", default-recipe = "apotocki/perl" }