Latest libsodium-1.0.19-stable.tar.gz
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4622 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
699438602c
commit
5e8cd12760
10
deps/libsodium/ChangeLog
vendored
10
deps/libsodium/ChangeLog
vendored
@ -1,3 +1,11 @@
|
||||
* Version 1.0.19-stable
|
||||
- Building with `zig build` now works both with Zig 0.11 and Zig 0.12.
|
||||
- When using the traditional build system, -O3 is used instead of -Ofast.
|
||||
- Improved detection of the compiler flags required on aarch64.
|
||||
- Improved compatibility with custom build systems on aarch64.
|
||||
- apple-xcframework: VisionOS packages are not built if Xcode doesn't
|
||||
include that SDK.
|
||||
|
||||
* Version 1.0.19
|
||||
This release includes all the changes from 1.0.18-stable, as well as two
|
||||
additions:
|
||||
@ -19,7 +27,7 @@ the SHA-256 and SHA-512 hash functions.
|
||||
- Visual Studio: AVX512 implementations are enabled on supported CPUs.
|
||||
- Visual Studio: an MSVC 2022 solution was added.
|
||||
- Apple XCFramework: support for VisionOS was added.
|
||||
- Apple XCFranework: support for Catalyst was added.
|
||||
- Apple XCFramework: support for Catalyst was added.
|
||||
- Apple XCFramework: building the simulators is now optional.
|
||||
- iOS: bitcode is not generated any more, as it was deprecated by Apple.
|
||||
- watchOS: support for arm64 was added.
|
||||
|
155
deps/libsodium/build-aux/config.sub
vendored
155
deps/libsodium/build-aux/config.sub
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
# shellcheck disable=SC2006,SC2268 # see below for rationale
|
||||
|
||||
timestamp='2023-07-31'
|
||||
timestamp='2023-09-19'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -1181,7 +1181,7 @@ case $cpu-$vendor in
|
||||
case $cpu in
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64c | aarch64_be \
|
||||
| aarch64 | aarch64_be | aarch64c | arm64ec \
|
||||
| abacus \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
|
||||
@ -1200,6 +1200,7 @@ case $cpu-$vendor in
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| e2k | elxsi | epiphany \
|
||||
| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
|
||||
| javascript \
|
||||
| h8300 | h8500 \
|
||||
| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
@ -1284,11 +1285,12 @@ esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if test x$basic_os != x
|
||||
if test x"$basic_os" != x
|
||||
then
|
||||
|
||||
# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
|
||||
# set os.
|
||||
obj=
|
||||
case $basic_os in
|
||||
gnu/linux*)
|
||||
kernel=linux
|
||||
@ -1488,10 +1490,16 @@ case $os in
|
||||
os=eabi
|
||||
;;
|
||||
*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
aout* | coff* | elf* | pe*)
|
||||
# These are machine code file formats, not OSes
|
||||
obj=$os
|
||||
os=
|
||||
;;
|
||||
*)
|
||||
# No normalization, but not necessarily accepted, that comes below.
|
||||
;;
|
||||
@ -1510,12 +1518,15 @@ else
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
kernel=
|
||||
obj=
|
||||
case $cpu-$vendor in
|
||||
score-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
spu-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
*-acorn)
|
||||
os=riscix1.2
|
||||
@ -1525,28 +1536,35 @@ case $cpu-$vendor in
|
||||
os=gnu
|
||||
;;
|
||||
arm*-semi)
|
||||
os=aout
|
||||
os=
|
||||
obj=aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
clipper-intergraph)
|
||||
os=clix
|
||||
;;
|
||||
hexagon-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
@ -1568,19 +1586,24 @@ case $cpu-$vendor in
|
||||
os=sunos3
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=aout
|
||||
os=
|
||||
obj=aout
|
||||
;;
|
||||
mep-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
mips*-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
or32-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=sysv3
|
||||
@ -1589,7 +1612,8 @@ case $cpu-$vendor in
|
||||
os=sunos4.1.1
|
||||
;;
|
||||
pru-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
*-be)
|
||||
os=beos
|
||||
@ -1670,10 +1694,12 @@ case $cpu-$vendor in
|
||||
os=uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
*-*bug)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
*-apple)
|
||||
os=macos
|
||||
@ -1691,7 +1717,8 @@ esac
|
||||
|
||||
fi
|
||||
|
||||
# Now, validate our (potentially fixed-up) OS.
|
||||
# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
|
||||
|
||||
case $os in
|
||||
# Sometimes we do "kernel-libc", so those need to count as OSes.
|
||||
musl* | newlib* | relibc* | uclibc*)
|
||||
@ -1702,6 +1729,9 @@ case $os in
|
||||
# VxWorks passes extra cpu info in the 4th filed.
|
||||
simlinux | simwindows | spe)
|
||||
;;
|
||||
# See `case $cpu-$os` validation below
|
||||
ghcjs)
|
||||
;;
|
||||
# Now accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST end in a * to match a version number.
|
||||
@ -1719,11 +1749,11 @@ case $os in
|
||||
| mirbsd* | netbsd* | dicos* | openedition* | ose* \
|
||||
| bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
|
||||
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
|
||||
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
|
||||
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
|
||||
| bosx* | nextstep* | cxux* | oabi* \
|
||||
| ptx* | ecoff* | winnt* | domain* | vsta* \
|
||||
| udi* | lites* | ieee* | go32* | aux* | hcos* \
|
||||
| chorusrdb* | cegcc* | glidix* | serenity* \
|
||||
| cygwin* | msys* | pe* | moss* | proelf* | rtems* \
|
||||
| cygwin* | msys* | moss* | proelf* | rtems* \
|
||||
| midipix* | mingw32* | mingw64* | mint* \
|
||||
| uxpv* | beos* | mpeix* | udk* | moxiebox* \
|
||||
| interix* | uwin* | mks* | rhapsody* | darwin* \
|
||||
@ -1747,60 +1777,95 @@ case $os in
|
||||
kernel* | msvc* )
|
||||
# Restricted further below
|
||||
;;
|
||||
'')
|
||||
if test x"$obj" = x
|
||||
then
|
||||
echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case $obj in
|
||||
aout* | coff* | elf* | pe*)
|
||||
;;
|
||||
'')
|
||||
# empty is fine
|
||||
;;
|
||||
*)
|
||||
echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we handle the constraint that a (synthetic) cpu and os are
|
||||
# valid only in combination with each other and nowhere else.
|
||||
case $cpu-$os in
|
||||
# The "javascript-unknown-ghcjs" triple is used by GHC; we
|
||||
# accept it here in order to tolerate that, but reject any
|
||||
# variations.
|
||||
javascript-ghcjs)
|
||||
;;
|
||||
javascript-* | *-ghcjs)
|
||||
echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# As a final step for OS-related things, validate the OS-kernel combination
|
||||
# (given a valid OS), if there is a kernel.
|
||||
case $kernel-$os in
|
||||
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
|
||||
| linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
|
||||
case $kernel-$os-$obj in
|
||||
linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \
|
||||
| linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- )
|
||||
;;
|
||||
uclinux-uclibc* )
|
||||
uclinux-uclibc*- )
|
||||
;;
|
||||
managarm-mlibc* | managarm-kernel* )
|
||||
managarm-mlibc*- | managarm-kernel*- )
|
||||
;;
|
||||
windows*-gnu* | windows*-msvc*)
|
||||
windows*-msvc*-)
|
||||
;;
|
||||
-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
|
||||
-dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- )
|
||||
# These are just libc implementations, not actual OSes, and thus
|
||||
# require a kernel.
|
||||
echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
-kernel* )
|
||||
-kernel*- )
|
||||
echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*-kernel* )
|
||||
*-kernel*- )
|
||||
echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*-msvc* )
|
||||
*-msvc*- )
|
||||
echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
kfreebsd*-gnu* | kopensolaris*-gnu*)
|
||||
kfreebsd*-gnu*- | kopensolaris*-gnu*-)
|
||||
;;
|
||||
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
|
||||
vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
|
||||
;;
|
||||
nto-qnx*)
|
||||
nto-qnx*-)
|
||||
;;
|
||||
os2-emx)
|
||||
os2-emx-)
|
||||
;;
|
||||
*-eabi* | *-gnueabi*)
|
||||
*-eabi*- | *-gnueabi*-)
|
||||
;;
|
||||
none-coff* | none-elf*)
|
||||
none--*)
|
||||
# None (no kernel, i.e. freestanding / bare metal),
|
||||
# can be paired with an output format "OS"
|
||||
# can be paired with an machine code file format
|
||||
;;
|
||||
-*)
|
||||
-*-)
|
||||
# Blank kernel with real OS is always fine.
|
||||
;;
|
||||
*-*)
|
||||
--*)
|
||||
# Blank kernel and OS with real machine code file format is always fine.
|
||||
;;
|
||||
*-*-*)
|
||||
echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
@ -1884,7 +1949,7 @@ case $vendor in
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$cpu-$vendor-${kernel:+$kernel-}$os"
|
||||
echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
|
||||
exit
|
||||
|
||||
# Local variables:
|
||||
|
30
deps/libsodium/build.zig
vendored
30
deps/libsodium/build.zig
vendored
@ -103,9 +103,17 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
lib.defineCMacro("HAVE_TI_MODE", "1");
|
||||
|
||||
if (target.cpu_arch) |arch| {
|
||||
switch (arch.endian()) {
|
||||
.Big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"),
|
||||
.Little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"),
|
||||
const endian = arch.endian();
|
||||
if (@hasField(@TypeOf(endian), "big")) {
|
||||
switch (endian) {
|
||||
.big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"),
|
||||
.little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"),
|
||||
}
|
||||
} else {
|
||||
switch (endian) {
|
||||
.Big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"),
|
||||
.Little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,13 +255,18 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
const name = entry.basename;
|
||||
if (mem.endsWith(u8, name, ".c")) {
|
||||
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path });
|
||||
lib.addCSourceFiles(&.{full_path}, &.{
|
||||
const flags = &.{
|
||||
"-fvisibility=hidden",
|
||||
"-fno-strict-aliasing",
|
||||
"-fno-strict-overflow",
|
||||
"-fwrapv",
|
||||
"-flax-vector-conversions",
|
||||
});
|
||||
};
|
||||
if (@hasDecl(std.Build.Step.Compile, "AddCSourceFilesOptions")) {
|
||||
lib.addCSourceFiles(.{ .files = &.{full_path}, .flags = flags });
|
||||
} else {
|
||||
lib.addCSourceFiles(&.{full_path}, flags);
|
||||
}
|
||||
} else if (mem.endsWith(u8, name, ".S")) {
|
||||
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path });
|
||||
lib.addAssemblyFile(.{ .path = full_path });
|
||||
@ -291,8 +304,11 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
exe.addIncludePath(.{ .path = "src/libsodium/include" });
|
||||
exe.addIncludePath(.{ .path = "test/quirks" });
|
||||
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ test_path, entry.path });
|
||||
exe.addCSourceFiles(&.{full_path}, &.{});
|
||||
|
||||
if (@hasDecl(std.Build.Step.Compile, "AddCSourceFilesOptions")) {
|
||||
exe.addCSourceFiles(.{ .files = &.{full_path} });
|
||||
} else {
|
||||
exe.addCSourceFiles(&.{full_path}, &.{});
|
||||
}
|
||||
if (enable_benchmarks) {
|
||||
exe.defineCMacro("BENCHMARKS", "1");
|
||||
var buf: [16]u8 = undefined;
|
||||
|
50
deps/libsodium/configure
vendored
50
deps/libsodium/configure
vendored
@ -5294,43 +5294,6 @@ fi
|
||||
|
||||
|
||||
if test "$sodium_CFLAGS" != "set" ; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Ofast" >&5
|
||||
printf %s "checking whether C compiler accepts -Ofast... " >&6; }
|
||||
if test ${ax_cv_check_cflags___Ofast+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
|
||||
ax_check_save_flags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Ofast"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <time.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
ax_cv_check_cflags___Ofast=yes
|
||||
else $as_nop
|
||||
ax_cv_check_cflags___Ofast=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ax_check_save_flags
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Ofast" >&5
|
||||
printf "%s\n" "$ax_cv_check_cflags___Ofast" >&6; }
|
||||
if test "x$ax_cv_check_cflags___Ofast" = xyes
|
||||
then :
|
||||
CFLAGS="$CFLAGS -Ofast"
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -O3" >&5
|
||||
printf %s "checking whether C compiler accepts -O3... " >&6; }
|
||||
if test ${ax_cv_check_cflags___O3+y}
|
||||
@ -5490,8 +5453,6 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-ssp was given.
|
||||
if test ${enable_ssp+y}
|
||||
@ -18562,11 +18523,6 @@ printf %s "checking for ARM crypto instructions set... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
# pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
#ifndef __ARM_FEATURE_CRYPTO
|
||||
# define __ARM_FEATURE_CRYPTO 1
|
||||
#endif
|
||||
@ -18576,6 +18532,12 @@ printf %s "checking for ARM crypto instructions set... " >&6; }
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
# pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
20
deps/libsodium/configure.ac
vendored
20
deps/libsodium/configure.ac
vendored
@ -52,11 +52,10 @@ AC_USE_SYSTEM_EXTENSIONS
|
||||
dnl Default optimization flags
|
||||
|
||||
if test "$sodium_CFLAGS" != "set" ; then
|
||||
AX_CHECK_COMPILE_FLAG([-Ofast], [CFLAGS="$CFLAGS -Ofast"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O3], [CFLAGS="$CFLAGS -O3"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O2], [CFLAGS="$CFLAGS -O2"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O1], [CFLAGS="$CFLAGS -O1"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O], [CFLAGS="$CFLAGS -O"])])])])])
|
||||
AX_CHECK_COMPILE_FLAG([-O3], [CFLAGS="$CFLAGS -O3"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O2], [CFLAGS="$CFLAGS -O2"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O1], [CFLAGS="$CFLAGS -O1"],
|
||||
[AX_CHECK_COMPILE_FLAG([-O], [CFLAGS="$CFLAGS -O"])])])])
|
||||
fi
|
||||
|
||||
dnl Switches
|
||||
@ -398,11 +397,6 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
have_armcrypto=no
|
||||
AC_MSG_CHECKING(for ARM crypto instructions set)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#ifdef __clang__
|
||||
# pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
# pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
#ifndef __ARM_FEATURE_CRYPTO
|
||||
# define __ARM_FEATURE_CRYPTO 1
|
||||
#endif
|
||||
@ -411,6 +405,12 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
#endif
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
# pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
]], [[
|
||||
int64x2_t x = { 0, 0 };
|
||||
vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(0));
|
||||
|
245
deps/libsodium/dist-build/apple-xcframework.sh
vendored
245
deps/libsodium/dist-build/apple-xcframework.sh
vendored
@ -51,9 +51,8 @@ else
|
||||
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
|
||||
fi
|
||||
|
||||
APPLE_SILICON_SUPPORTED=false
|
||||
echo 'int main(void){return 0;}' >comptest.c && cc --target=arm64-macos comptest.c 2>/dev/null && APPLE_SILICON_SUPPORTED=true
|
||||
rm -f comptest.c
|
||||
VISIONOS_SUPPORTED=false
|
||||
[ -d "${XCODEDIR}/Platforms/XROS.platform" ] && VISIONOS_SUPPORTED=true
|
||||
|
||||
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
|
||||
PROCESSORS=${NPROCESSORS:-3}
|
||||
@ -70,18 +69,16 @@ build_macos() {
|
||||
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
|
||||
|
||||
## macOS arm64
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
export CFLAGS="-Ofast -arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$MACOS_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
fi
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$MACOS_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## macOS x86_64
|
||||
export CFLAGS="-Ofast -arch x86_64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch x86_64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
export LDFLAGS="-arch x86_64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -96,7 +93,7 @@ build_ios() {
|
||||
export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
|
||||
|
||||
## 32-bit iOS
|
||||
export CFLAGS="-Ofast -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
export LDFLAGS="-mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -105,7 +102,7 @@ build_ios() {
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## 32-bit armv7s iOS
|
||||
export CFLAGS="-Ofast -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
export LDFLAGS="-mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -114,7 +111,7 @@ build_ios() {
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## 64-bit iOS
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -129,18 +126,16 @@ build_ios_simulator() {
|
||||
export SDK="${BASEDIR}/SDKs/iPhoneSimulator.sdk"
|
||||
|
||||
## arm64 simulator
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$IOS_SIMULATOR_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
fi
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$IOS_SIMULATOR_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## i386 simulator
|
||||
export CFLAGS="-Ofast -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -149,7 +144,7 @@ build_ios_simulator() {
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## x86_64 simulator
|
||||
export CFLAGS="-Ofast -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -164,7 +159,7 @@ build_watchos() {
|
||||
export SDK="${BASEDIR}/SDKs/WatchOS.sdk"
|
||||
|
||||
# 32-bit watchOS
|
||||
export CFLAGS="-Ofast -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
export LDFLAGS="-mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -173,7 +168,7 @@ build_watchos() {
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## 64-bit arm64_32 watchOS
|
||||
export CFLAGS="-Ofast -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
export LDFLAGS="-mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -182,7 +177,7 @@ build_watchos() {
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## 64-bit arm64 watchOS
|
||||
export CFLAGS="-Ofast -mthumb -arch arm64 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -mthumb -arch arm64 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
export LDFLAGS="-mthumb -arch arm64 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -197,18 +192,16 @@ build_watchos_simulator() {
|
||||
export SDK="${BASEDIR}/SDKs/WatchSimulator.sdk"
|
||||
|
||||
## arm64 simulator
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$WATCHOS_SIMULATOR_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
fi
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$WATCHOS_SIMULATOR_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## i386 simulator
|
||||
export CFLAGS="-Ofast -arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -217,7 +210,7 @@ build_watchos_simulator() {
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## x86_64 simulator
|
||||
export CFLAGS="-Ofast -arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -232,7 +225,7 @@ build_tvos() {
|
||||
export SDK="${BASEDIR}/SDKs/AppleTVOS.sdk"
|
||||
|
||||
## 64-bit tvOS
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mtvos-version-min=${TVOS_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK} -mtvos-version-min=${TVOS_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mtvos-version-min=${TVOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -247,18 +240,16 @@ build_tvos_simulator() {
|
||||
export SDK="${BASEDIR}/SDKs/AppleTVSimulator.sdk"
|
||||
|
||||
## arm64 simulator
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$TVOS_SIMULATOR_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
fi
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$TVOS_SIMULATOR_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## x86_64 simulator
|
||||
export CFLAGS="-Ofast -arch x86_64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
export CFLAGS="-O3 -arch x86_64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -272,7 +263,7 @@ build_visionos() {
|
||||
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
|
||||
export SDK="${BASEDIR}/SDKs/XROS.sdk"
|
||||
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -286,15 +277,13 @@ build_visionos_simulator() {
|
||||
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
|
||||
export SDK="${BASEDIR}/SDKs/XRSimulator.sdk"
|
||||
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK}"
|
||||
export CFLAGS="-O3 -arch arm64 -isysroot ${SDK}"
|
||||
export LDFLAGS="-arch arm64 -isysroot ${SDK}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$VISIONOS_SIMULATOR_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
fi
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-darwin23 --prefix="$VISIONOS_SIMULATOR_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
}
|
||||
|
||||
build_catalyst() {
|
||||
@ -303,18 +292,16 @@ build_catalyst() {
|
||||
export SDK="${BASEDIR}/SDKs/MacOSX.sdk"
|
||||
|
||||
## arm64 catalyst
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
export CFLAGS="-Ofast -arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
export LDFLAGS="-arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
export CFLAGS="-O3 -arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
export LDFLAGS="-arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-ios --prefix="$CATALYST_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
fi
|
||||
make distclean >/dev/null 2>&1
|
||||
./configure --host=aarch64-apple-ios --prefix="$CATALYST_ARM64_PREFIX" \
|
||||
${LIBSODIUM_ENABLE_MINIMAL_FLAG} || exit 1
|
||||
make -j${PROCESSORS} install || exit 1
|
||||
|
||||
## x86_64 catalyst
|
||||
export CFLAGS="-Ofast -arch x86_64 -target x86_64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
export CFLAGS="-O3 -arch x86_64 -target x86_64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
export LDFLAGS="-arch x86_64 -target x86_64-apple-ios13.1-macabi -isysroot ${SDK}"
|
||||
|
||||
make distclean >/dev/null 2>&1
|
||||
@ -333,10 +320,12 @@ echo "Building for watchOS..."
|
||||
build_watchos >"$LOG_FILE" 2>&1 || exit 1
|
||||
echo "Building for tvOS..."
|
||||
build_tvos >"$LOG_FILE" 2>&1 || exit 1
|
||||
echo "Building for visionOS..."
|
||||
build_visionos >"$LOG_FILE" 2>&1 || exit 1
|
||||
echo "Building for Catalyst..."
|
||||
build_catalyst >"$LOG_FILE" 2>&1 || exit 1
|
||||
if [ "$VISIONOS_SUPPORTED" = true ]; then
|
||||
echo "Building for visionOS..."
|
||||
build_visionos >"$LOG_FILE" 2>&1 || exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
echo "Building for the iOS simulator..."
|
||||
@ -345,8 +334,10 @@ if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
build_watchos_simulator >"$LOG_FILE" 2>&1 || exit 1
|
||||
echo "Building for the tvOS simulator..."
|
||||
build_tvos_simulator >"$LOG_FILE" 2>&1 || exit 1
|
||||
echo "Building for the visionOS simulator..."
|
||||
build_visionos_simulator >"$LOG_FILE" 2>&1 || exit 1
|
||||
if [ "$VISIONOS_SUPPORTED" = true ]; then
|
||||
echo "Building for the visionOS simulator..."
|
||||
build_visionos_simulator >"$LOG_FILE" 2>&1 || exit 1
|
||||
fi
|
||||
else
|
||||
echo "[Skipping the simulators]"
|
||||
fi
|
||||
@ -362,16 +353,10 @@ echo "Bundling macOS targets..."
|
||||
mkdir -p "${PREFIX}/macos/lib"
|
||||
cp -a "${MACOS_X86_64_PREFIX}/include" "${PREFIX}/macos/"
|
||||
for ext in a dylib; do
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
lipo -create \
|
||||
"${MACOS_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${MACOS_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/macos/lib/libsodium.${ext}"
|
||||
else
|
||||
lipo -create \
|
||||
"${MACOS_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/macos/lib/libsodium.${ext}"
|
||||
fi
|
||||
lipo -create \
|
||||
"${MACOS_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${MACOS_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/macos/lib/libsodium.${ext}"
|
||||
done
|
||||
|
||||
echo "Bundling iOS targets..."
|
||||
@ -408,15 +393,17 @@ for ext in a dylib; do
|
||||
-output "$PREFIX/tvos/lib/libsodium.${ext}"
|
||||
done
|
||||
|
||||
echo "Bundling visionOS targets..."
|
||||
if [ "$VISIONOS_SUPPORTED" = true ]; then
|
||||
echo "Bundling visionOS targets..."
|
||||
|
||||
mkdir -p "${PREFIX}/visionos/lib"
|
||||
cp -a "${VISIONOS_PREFIX}/include" "${PREFIX}/visionos/"
|
||||
for ext in a dylib; do
|
||||
lipo -create \
|
||||
"$VISIONOS_PREFIX/lib/libsodium.${ext}" \
|
||||
-output "$PREFIX/visionos/lib/libsodium.${ext}"
|
||||
done
|
||||
mkdir -p "${PREFIX}/visionos/lib"
|
||||
cp -a "${VISIONOS_PREFIX}/include" "${PREFIX}/visionos/"
|
||||
for ext in a dylib; do
|
||||
lipo -create \
|
||||
"$VISIONOS_PREFIX/lib/libsodium.${ext}" \
|
||||
-output "$PREFIX/visionos/lib/libsodium.${ext}"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Bundling Catalyst targets..."
|
||||
|
||||
@ -426,16 +413,10 @@ for ext in a dylib; do
|
||||
if [ ! -f "${CATALYST_X86_64_PREFIX}/lib/libsodium.${ext}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
lipo -create \
|
||||
"${CATALYST_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${CATALYST_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/catalyst/lib/libsodium.${ext}"
|
||||
else
|
||||
lipo -create \
|
||||
"${CATALYST_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/catalyst/lib/libsodium.${ext}"
|
||||
fi
|
||||
lipo -create \
|
||||
"${CATALYST_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${CATALYST_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/catalyst/lib/libsodium.${ext}"
|
||||
done
|
||||
|
||||
if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
@ -444,18 +425,11 @@ if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
mkdir -p "${PREFIX}/ios-simulators/lib"
|
||||
cp -a "${IOS_SIMULATOR_X86_64_PREFIX}/include" "${PREFIX}/ios-simulators/"
|
||||
for ext in a dylib; do
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
lipo -create \
|
||||
"${IOS_SIMULATOR_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${IOS_SIMULATOR_I386_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${IOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/ios-simulators/lib/libsodium.${ext}" || exit 1
|
||||
else
|
||||
lipo -create \
|
||||
"${IOS_SIMULATOR_I386_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${IOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/ios-simulators/lib/libsodium.${ext}" || exit 1
|
||||
fi
|
||||
lipo -create \
|
||||
"${IOS_SIMULATOR_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${IOS_SIMULATOR_I386_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${IOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/ios-simulators/lib/libsodium.${ext}" || exit 1
|
||||
done
|
||||
|
||||
echo "Bundling watchOS simulators..."
|
||||
@ -463,18 +437,11 @@ if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
mkdir -p "${PREFIX}/watchos-simulators/lib"
|
||||
cp -a "${WATCHOS_SIMULATOR_X86_64_PREFIX}/include" "${PREFIX}/watchos-simulators/"
|
||||
for ext in a dylib; do
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
lipo -create \
|
||||
"${WATCHOS_SIMULATOR_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${WATCHOS_SIMULATOR_I386_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${WATCHOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/watchos-simulators/lib/libsodium.${ext}"
|
||||
else
|
||||
lipo -create \
|
||||
"${WATCHOS_SIMULATOR_I386_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${WATCHOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/watchos-simulators/lib/libsodium.${ext}"
|
||||
fi
|
||||
lipo -create \
|
||||
"${WATCHOS_SIMULATOR_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${WATCHOS_SIMULATOR_I386_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${WATCHOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/watchos-simulators/lib/libsodium.${ext}"
|
||||
done
|
||||
|
||||
echo "Bundling tvOS simulators..."
|
||||
@ -482,29 +449,23 @@ if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
mkdir -p "${PREFIX}/tvos-simulators/lib"
|
||||
cp -a "${TVOS_SIMULATOR_X86_64_PREFIX}/include" "${PREFIX}/tvos-simulators/"
|
||||
for ext in a dylib; do
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
lipo -create \
|
||||
"${TVOS_SIMULATOR_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${TVOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/tvos-simulators/lib/libsodium.${ext}" || exit 1
|
||||
else
|
||||
lipo -create \
|
||||
"${TVOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/tvos-simulators/lib/libsodium.${ext}" || exit 1
|
||||
fi
|
||||
lipo -create \
|
||||
"${TVOS_SIMULATOR_ARM64_PREFIX}/lib/libsodium.${ext}" \
|
||||
"${TVOS_SIMULATOR_X86_64_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/tvos-simulators/lib/libsodium.${ext}" || exit 1
|
||||
done
|
||||
|
||||
echo "Bundling visionOS simulators..."
|
||||
if [ "$VISIONOS_SUPPORTED" = true ]; then
|
||||
echo "Bundling visionOS simulators..."
|
||||
|
||||
mkdir -p "${PREFIX}/visionos-simulators/lib"
|
||||
cp -a "${VISIONOS_SIMULATOR_PREFIX}/include" "${PREFIX}/visionos-simulators/"
|
||||
for ext in a dylib; do
|
||||
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
|
||||
mkdir -p "${PREFIX}/visionos-simulators/lib"
|
||||
cp -a "${VISIONOS_SIMULATOR_PREFIX}/include" "${PREFIX}/visionos-simulators/"
|
||||
for ext in a dylib; do
|
||||
lipo -create \
|
||||
"${VISIONOS_SIMULATOR_PREFIX}/lib/libsodium.${ext}" \
|
||||
-output "${PREFIX}/visionos-simulators/lib/libsodium.${ext}" || exit 1
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Creating Clibsodium.xcframework..."
|
||||
@ -513,11 +474,17 @@ rm -rf "${PREFIX}/Clibsodium.xcframework"
|
||||
|
||||
XCFRAMEWORK_ARGS=""
|
||||
for f in macos ios watchos tvos visionos catalyst; do
|
||||
if [ "$VISIONOS_SUPPORTED" = false ] && [ "$f" = "visionos" ]; then
|
||||
continue
|
||||
fi
|
||||
XCFRAMEWORK_ARGS="${XCFRAMEWORK_ARGS} -library ${PREFIX}/${f}/lib/libsodium.a"
|
||||
XCFRAMEWORK_ARGS="${XCFRAMEWORK_ARGS} -headers ${PREFIX}/${f}/include"
|
||||
done
|
||||
if [ -z "$LIBSODIUM_SKIP_SIMULATORS" ]; then
|
||||
for f in ios-simulators watchos-simulators tvos-simulators visionos-simulators; do
|
||||
if [ "$VISIONOS_SUPPORTED" = false ] && [ "$f" = "visionos-simulators" ]; then
|
||||
continue
|
||||
fi
|
||||
XCFRAMEWORK_ARGS="${XCFRAMEWORK_ARGS} -library ${PREFIX}/${f}/lib/libsodium.a"
|
||||
XCFRAMEWORK_ARGS="${XCFRAMEWORK_ARGS} -headers ${PREFIX}/${f}/include"
|
||||
done
|
||||
|
2
deps/libsodium/dist-build/macos.sh
vendored
2
deps/libsodium/dist-build/macos.sh
vendored
@ -14,7 +14,7 @@ PROCESSORS=${NPROCESSORS:-3}
|
||||
|
||||
mkdir -p $PREFIX || exit 1
|
||||
|
||||
export CFLAGS="-mmacosx-version-min=${MACOS_VERSION_MIN} -Ofast"
|
||||
export CFLAGS="-mmacosx-version-min=${MACOS_VERSION_MIN} -O3"
|
||||
export LDFLAGS="-mmacosx-version-min=${MACOS_VERSION_MIN}"
|
||||
|
||||
make distclean >/dev/null
|
||||
|
2
deps/libsodium/dist-build/msys2-win32.sh
vendored
2
deps/libsodium/dist-build/msys2-win32.sh
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
export CFLAGS="-Ofast -fomit-frame-pointer -m32 -march=pentium3 -mtune=westmere"
|
||||
export CFLAGS="-O3 -fomit-frame-pointer -m32 -march=pentium3 -mtune=westmere"
|
||||
export PREFIX="$(pwd)/libsodium-win32"
|
||||
|
||||
if (i686-w64-mingw32-gcc --version >/dev/null 2>&1); then
|
||||
|
2
deps/libsodium/dist-build/msys2-win64.sh
vendored
2
deps/libsodium/dist-build/msys2-win64.sh
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
export CFLAGS="-Ofast -fomit-frame-pointer -m64 -mtune=westmere"
|
||||
export CFLAGS="-O3 -fomit-frame-pointer -m64 -mtune=westmere"
|
||||
export PREFIX="$(pwd)/libsodium-win64"
|
||||
|
||||
if (x86_64-w64-mingw32-gcc --version >/dev/null 2>&1); then
|
||||
|
@ -17,12 +17,6 @@
|
||||
|
||||
#include "aegis128l_armcrypto.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_FEATURE_CRYPTO
|
||||
#define __ARM_FEATURE_CRYPTO 1
|
||||
#endif
|
||||
@ -32,6 +26,12 @@
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
#define AES_BLOCK_LENGTH 16
|
||||
|
||||
typedef uint8x16_t aes_block_t;
|
||||
|
@ -17,12 +17,6 @@
|
||||
|
||||
#include "aegis256_armcrypto.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_FEATURE_CRYPTO
|
||||
#define __ARM_FEATURE_CRYPTO 1
|
||||
#endif
|
||||
@ -32,6 +26,12 @@
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
#define AES_BLOCK_LENGTH 16
|
||||
|
||||
typedef uint8x16_t aes_block_t;
|
||||
|
@ -19,12 +19,6 @@
|
||||
#define __vectorcall
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_FEATURE_CRYPTO
|
||||
#define __ARM_FEATURE_CRYPTO 1
|
||||
#endif
|
||||
@ -34,6 +28,12 @@
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC target("+simd+crypto")
|
||||
#endif
|
||||
|
||||
#define ABYTES crypto_aead_aes256gcm_ABYTES
|
||||
#define NPUBBYTES crypto_aead_aes256gcm_NPUBBYTES
|
||||
#define KEYBYTES crypto_aead_aes256gcm_KEYBYTES
|
||||
|
@ -228,7 +228,7 @@ xor_buf(unsigned char *out, const unsigned char *in, size_t n)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
# if defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86)
|
||||
# if defined(_M_X64) || defined(_M_IX86)
|
||||
# include <intrin.h>
|
||||
|
||||
# define HAVE_INTRIN_H 1
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && \
|
||||
!(defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || \
|
||||
defined(_M_X64) || defined(_M_AMD64))
|
||||
defined(_M_X64))
|
||||
|
||||
# include <emmintrin.h>
|
||||
# include <stdint.h>
|
||||
|
@ -150,8 +150,7 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
|
||||
static void
|
||||
_cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
|
||||
{
|
||||
#if defined(_MSC_VER) && \
|
||||
(defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86))
|
||||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
|
||||
__cpuid((int *) cpu_info, cpu_info_type);
|
||||
#elif defined(HAVE_CPUID)
|
||||
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user