git: ab7a02844ff1 - main - games/openclonk: fix build on !amd64

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Thu, 11 Sep 2025 15:10:10 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ab7a02844ff152f70ebbee3ee303e835c03f9f7e

commit ab7a02844ff152f70ebbee3ee303e835c03f9f7e
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-09-03 12:40:13 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-09-11 15:09:49 +0000

    games/openclonk: fix build on !amd64
    
     - the problem was that the bundled blake2 impl. was hardwired for
       SSE2 only
     - fix the problem by picking some upstream commits that update blake2
       and permit compilation without SSE2
     - while here, roll static REINPLACE_CMD into existing patch file as
       per policy
     - pet portlint
     - powerpc64 remains broken due to unrelated issue, can't test due to
       a lack of hardware
    
    Approved by:    portmgr (build fix blanket)
    MFH:            2025Q3
---
 games/openclonk/Makefile                   |    10 +-
 games/openclonk/distinfo                   |     6 +-
 games/openclonk/files/patch-CMakeLists.txt |    40 +-
 games/openclonk/files/patch-blake2         | 10621 +++++++++++++++++++++++++++
 4 files changed, 10665 insertions(+), 12 deletions(-)

diff --git a/games/openclonk/Makefile b/games/openclonk/Makefile
index e23354bf7ea1..a461147ee165 100644
--- a/games/openclonk/Makefile
+++ b/games/openclonk/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	openclonk
 DISTVERSION=	8.1
-PORTREVISION=	7
 DISTVERSIONSUFFIX=	-src
+PORTREVISION=	8
 CATEGORIES=	games
 MASTER_SITES=	http://www.openclonk.org/builds/release/${DISTVERSION}/
 
@@ -13,7 +13,6 @@ LICENSE=	ISCL CC0-1.0
 LICENSE_COMB=	multi
 LICENSE_FILE_ISCL=	${WRKSRC}/COPYING
 
-BROKEN_aarch64=		fails to compile: mmintrin.h:50:12: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
 BROKEN_powerpc64=	fails to compile: C4Texture.cpp:260:13: error: 'stoul' is not a member of 'std'
 
 LIB_DEPENDS=	libalut.so:audio/freealut \
@@ -24,8 +23,6 @@ LIB_DEPENDS=	libalut.so:audio/freealut \
 		libtinyxml.so:textproc/tinyxml \
 		libvorbis.so:audio/libvorbis
 
-WRKSRC=		${WRKDIR}/openclonk-release-${PORTVERSION}-src
-
 # make install has parallel issues with ninja
 USES=		cmake:noninja compiler:c++14-lang desktop-file-utils gl gnome jpeg openal \
 		pkgconfig sdl tar:bzip2 xorg
@@ -35,6 +32,7 @@ USE_XORG=	x11 xpm
 CMAKE_ARGS=	-DAudio_TK:STRING="OpenAL"
 CFLAGS_powerpc64le=	-DNO_WARN_X86_INTRINSICS
 LDFLAGS_i386=	-Wl,-znotext
+WRKSRC=		${WRKDIR}/openclonk-release-${PORTVERSION}-src
 
 .include <bsd.port.pre.mk>
 
@@ -42,8 +40,4 @@ LDFLAGS_i386=	-Wl,-znotext
 LDFLAGS_i386+=  -Wl,--no-check-dynamic-relocations
 .endif
 
-post-patch:
-	@${REINPLACE_CMD} -e 's|DESTINATION games|DESTINATION bin|' \
-		-e 's|share/games|share|' ${WRKSRC}/CMakeLists.txt
-
 .include <bsd.port.post.mk>
diff --git a/games/openclonk/distinfo b/games/openclonk/distinfo
index 5da768b39294..463b137202dc 100644
--- a/games/openclonk/distinfo
+++ b/games/openclonk/distinfo
@@ -1,3 +1,7 @@
-TIMESTAMP = 1531177508
+TIMESTAMP = 1756900968
 SHA256 (openclonk-8.1-src.tar.bz2) = 337677f25457e7137eac7818adb4ad02992d562593386c19b885738aaec4b346
 SIZE (openclonk-8.1-src.tar.bz2) = 120149164
+SHA256 (288e9f339b2e0aba9a136e2c91283213d863c7d4.diff) = f5365d3d38d5ffe3708bce4dc79dd3737472f91c5ac75febe0b5895a46e89bca
+SIZE (288e9f339b2e0aba9a136e2c91283213d863c7d4.diff) = 5112218
+SHA256 (c1ee1bdac7990605ad0271f2bcb09edea4524c5a.diff) = 2ca0700e27b3de680501837437fee7e6961ef1a43230f743641733e8ded81f24
+SIZE (c1ee1bdac7990605ad0271f2bcb09edea4524c5a.diff) = 139333
diff --git a/games/openclonk/files/patch-CMakeLists.txt b/games/openclonk/files/patch-CMakeLists.txt
index 24afcb82ee29..592aebc110e9 100644
--- a/games/openclonk/files/patch-CMakeLists.txt
+++ b/games/openclonk/files/patch-CMakeLists.txt
@@ -1,6 +1,6 @@
 --- CMakeLists.txt.orig	2018-03-16 17:25:33 UTC
 +++ CMakeLists.txt
-@@ -91,7 +91,6 @@ function(add_linker_flags)
+@@ -91,7 +91,6 @@ endfunction()
  	endforeach()
  endfunction()
  
@@ -8,7 +8,16 @@
  if(USE_GCC_STYLE_LTCG)
  	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto")
  	set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -flto")
-@@ -337,8 +336,6 @@ if(READLINE_FOUND)
+@@ -167,7 +166,7 @@ if(UNIX)
+ endif()
+ 
+ if(UNIX)
+-	add_definitions("-DOC_SYSTEM_DATA_DIR=\"${CMAKE_INSTALL_PREFIX}/share/games/openclonk\"")
++	add_definitions("-DOC_SYSTEM_DATA_DIR=\"${CMAKE_INSTALL_PREFIX}/share/openclonk\"")
+ endif()
+ 
+ if(APPLE)
+@@ -337,8 +336,6 @@ SET(HAVE_LIBREADLINE ${READLINE_FOUND} CACHE INTERNAL 
  endif()
  SET(HAVE_LIBREADLINE ${READLINE_FOUND} CACHE INTERNAL "libreadline available")
  
@@ -17,7 +26,7 @@
  # Select an audio library
  find_package("Audio")
  if(Audio_FOUND)
-@@ -356,8 +353,6 @@ set(HAVE_SDL ${SDL2_FOUND})
+@@ -356,8 +353,6 @@ include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
  include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
  
  # Qt5 for editor
@@ -26,3 +35,28 @@
  if(Qt5Widgets_FOUND)
  	SET(WITH_QT_EDITOR ${Qt5Widgets_FOUND} "Qt editor dialogues available")
  	set(CMAKE_AUTOMOC ON)
+@@ -1537,13 +1532,13 @@ foreach(group ${OC_C4GROUPS})
+ 			DEPENDS "${native_c4group}"
+ 			VERBATIM
+ 		)
+-		install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${group} DESTINATION share/games/openclonk)
++		install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${group} DESTINATION share/openclonk)
+ 	endif()
+ endforeach()
+ 
+ if(NOT APPLE)
+ 	if(NOT HEADLESS_ONLY)
+-		install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/planet/Music.ocg DESTINATION share/games/openclonk)
++		install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/planet/Music.ocg DESTINATION share/openclonk)
+ 	endif()
+ 	# group files (game data)
+ 	add_custom_target(groups DEPENDS ${OC_C4GROUPS})
+@@ -1563,7 +1558,7 @@ if(NOT HEADLESS_ONLY)
+ 		install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/openclonk.appdata.xml DESTINATION share/appdata)
+ 
+ 		# Install binaries
+-		install(TARGETS openclonk DESTINATION games)
++		install(TARGETS openclonk DESTINATION bin)
+ 	else()
+ 		install(TARGETS openclonk
+ 			BUNDLE DESTINATION .
diff --git a/games/openclonk/files/patch-blake2 b/games/openclonk/files/patch-blake2
new file mode 100644
index 000000000000..f7aa744692dd
--- /dev/null
+++ b/games/openclonk/files/patch-blake2
@@ -0,0 +1,10621 @@
+This patch set updates blake2 and enables compilation on non-x86.  It is
+an amalgamation of the following upstream patches, which could not be
+taken from upstream directly due to the presence of a merge:
+
+c1ee1bdac Fix the most horrible merge I've done yet
+c29148803 Merge branch 'blake2-no-sse2' into stable-8
+e0850947b BLAKE2: Fall back to plain C implementation on non-amd64 platforms
+288e9f339 Merge commit '9493ed1277ef924c3005a9ff51f194d1cda87947' as 'thirdparty/blake2'
+
+Files not needed for compilation were omitted to save space.
+
+--- thirdparty/blake2/CMakeLists.txt.orig	2018-03-16 17:25:33 UTC
++++ thirdparty/blake2/CMakeLists.txt
+@@ -11,33 +11,64 @@
+ # To redistribute this file separately, substitute the full license texts
+ # for the above references.
+ 
+-add_library(blake2 STATIC
+-	blake2.h
+-)
++include(CheckCSourceCompiles)
+ 
+-target_sources(blake2
+-	PRIVATE
+-	blake2b.c
+-	blake2bp.c
+-	blake2s.c
+-	blake2sp.c
+-	blake2xb.c
+-	blake2xs.c
+-	blake2b-load-sse2.h
+-	blake2b-load-sse41.h
+-	blake2b-round.h
+-	blake2s-load-sse2.h
+-	blake2s-load-sse41.h
+-	blake2s-load-xop.h
+-	blake2s-round.h
+-	blake2-config.h
+-	blake2-impl.h
+-)
++CHECK_C_SOURCE_COMPILES("
++#if __x86_64 || __x86_64__ || __amd64 || __AMD64 || _M_X64
++// x86-64 target system
++#else
++#error Not building for x86-64
++#endif
++int main() {}
++" HAVE_X86_64)
+ 
+-include(CheckCCompilerFlag)
+-CHECK_C_COMPILER_FLAG("-msse2" HAVE_CFLAG_MSSE2)
+-target_compile_definitions(blake2 PRIVATE -DHAVE_SSE2)
+-if(HAVE_CFLAG_MSSE2)
+-	target_compile_options(blake2 PUBLIC -msse2)
++option(BLAKE2B_USE_SSE2 "Use SSE2 instructions for BLAKE2b" ${HAVE_X86_64})
++
++if (BLAKE2B_USE_SSE2)
++	add_library(blake2 STATIC
++		sse/blake2.h
++	)
++
++	target_sources(blake2
++		PRIVATE
++		sse/blake2b.c
++		sse/blake2bp.c
++		sse/blake2s.c
++		sse/blake2sp.c
++		sse/blake2xb.c
++		sse/blake2xs.c
++		sse/blake2b-load-sse2.h
++		sse/blake2b-load-sse41.h
++		sse/blake2b-round.h
++		sse/blake2s-load-sse2.h
++		sse/blake2s-load-sse41.h
++		sse/blake2s-load-xop.h
++		sse/blake2s-round.h
++		sse/blake2-config.h
++		sse/blake2-impl.h
++	)
++
++	include(CheckCCompilerFlag)
++	CHECK_C_COMPILER_FLAG("-msse2" HAVE_CFLAG_MSSE2)
++	target_compile_definitions(blake2 PRIVATE -DHAVE_SSE2)
++	if(HAVE_CFLAG_MSSE2)
++		target_compile_options(blake2 PUBLIC -msse2)
++	endif()
++	target_include_directories(blake2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/sse)
++else()
++	add_library(blake2 STATIC
++		ref/blake2.h
++	)
++
++	target_sources(blake2
++		PRIVATE
++		ref/blake2bp-ref.c
++		ref/blake2b-ref.c
++		ref/blake2sp-ref.c
++		ref/blake2s-ref.c
++		ref/blake2xb-ref.c
++		ref/blake2xs-ref.c
++		ref/blake2-impl.h
++	)
++	target_include_directories(blake2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ref)
+ endif()
+-target_include_directories(blake2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+--- thirdparty/blake2/blake2-config.h.orig	2018-03-16 17:25:33 UTC
++++ thirdparty/blake2/blake2-config.h
+@@ -1,72 +0,0 @@
+-/*
+-   BLAKE2 reference source code package - optimized C implementations
+-
+-   Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.  You may use this under the
+-   terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
+-   your option.  The terms of these licenses can be found at:
+-
+-   - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+-   - OpenSSL license   : https://www.openssl.org/source/license.html
+-   - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+-
+-   More information about the BLAKE2 hash function can be found at
+-   https://blake2.net.
+-*/
+-#ifndef BLAKE2_CONFIG_H
+-#define BLAKE2_CONFIG_H
+-
+-/* These don't work everywhere */
+-#if defined(__SSE2__) || defined(__x86_64__) || defined(__amd64__)
+-#define HAVE_SSE2
+-#endif
+-
+-#if defined(__SSSE3__)
+-#define HAVE_SSSE3
+-#endif
+-
+-#if defined(__SSE4_1__)
+-#define HAVE_SSE41
+-#endif
+-
+-#if defined(__AVX__)
+-#define HAVE_AVX
+-#endif
+-
+-#if defined(__XOP__)
+-#define HAVE_XOP
+-#endif
+-
+-
+-#ifdef HAVE_AVX2
+-#ifndef HAVE_AVX
+-#define HAVE_AVX
+-#endif
+-#endif
+-
+-#ifdef HAVE_XOP
+-#ifndef HAVE_AVX
+-#define HAVE_AVX
+-#endif
+-#endif
+-
+-#ifdef HAVE_AVX
+-#ifndef HAVE_SSE41
+-#define HAVE_SSE41
+-#endif
+-#endif
+-
+-#ifdef HAVE_SSE41
+-#ifndef HAVE_SSSE3
+-#define HAVE_SSSE3
+-#endif
+-#endif
+-
+-#ifdef HAVE_SSSE3
+-#define HAVE_SSE2
+-#endif
+-
+-#if !defined(HAVE_SSE2)
+-#error "This code requires at least SSE2."
+-#endif
+-
+-#endif
+--- thirdparty/blake2/blake2-impl.h.orig	2018-03-16 17:25:33 UTC
++++ thirdparty/blake2/blake2-impl.h
+@@ -1,160 +0,0 @@
+-/*
+-   BLAKE2 reference source code package - reference C implementations
+-
+-   Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.  You may use this under the
+-   terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
+-   your option.  The terms of these licenses can be found at:
+-
+-   - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+-   - OpenSSL license   : https://www.openssl.org/source/license.html
+-   - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+-
+-   More information about the BLAKE2 hash function can be found at
+-   https://blake2.net.
+-*/
+-#ifndef BLAKE2_IMPL_H
+-#define BLAKE2_IMPL_H
+-
+-#include <stdint.h>
+-#include <string.h>
+-
+-#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
+-  #if   defined(_MSC_VER)
+-    #define BLAKE2_INLINE __inline
+-  #elif defined(__GNUC__)
+-    #define BLAKE2_INLINE __inline__
+-  #else
+-    #define BLAKE2_INLINE
+-  #endif
+-#else
+-  #define BLAKE2_INLINE inline
+-#endif
+-
+-static BLAKE2_INLINE uint32_t load32( const void *src )
+-{
+-#if defined(NATIVE_LITTLE_ENDIAN)
+-  uint32_t w;
+-  memcpy(&w, src, sizeof w);
+-  return w;
+-#else
+-  const uint8_t *p = ( const uint8_t * )src;
+-  return (( uint32_t )( p[0] ) <<  0) |
+-         (( uint32_t )( p[1] ) <<  8) |
+-         (( uint32_t )( p[2] ) << 16) |
+-         (( uint32_t )( p[3] ) << 24) ;
+-#endif
+-}
+-
+-static BLAKE2_INLINE uint64_t load64( const void *src )
+-{
+-#if defined(NATIVE_LITTLE_ENDIAN)
+-  uint64_t w;
+-  memcpy(&w, src, sizeof w);
+-  return w;
+-#else
+-  const uint8_t *p = ( const uint8_t * )src;
+-  return (( uint64_t )( p[0] ) <<  0) |
+-         (( uint64_t )( p[1] ) <<  8) |
+-         (( uint64_t )( p[2] ) << 16) |
+-         (( uint64_t )( p[3] ) << 24) |
+-         (( uint64_t )( p[4] ) << 32) |
+-         (( uint64_t )( p[5] ) << 40) |
+-         (( uint64_t )( p[6] ) << 48) |
+-         (( uint64_t )( p[7] ) << 56) ;
+-#endif
+-}
+-
+-static BLAKE2_INLINE uint16_t load16( const void *src )
+-{
+-#if defined(NATIVE_LITTLE_ENDIAN)
+-  uint16_t w;
+-  memcpy(&w, src, sizeof w);
+-  return w;
+-#else
+-  const uint8_t *p = ( const uint8_t * )src;
+-  return (( uint16_t )( p[0] ) <<  0) |
+-         (( uint16_t )( p[1] ) <<  8) ;
+-#endif
+-}
+-
+-static BLAKE2_INLINE void store16( void *dst, uint16_t w )
+-{
+-#if defined(NATIVE_LITTLE_ENDIAN)
+-  memcpy(dst, &w, sizeof w);
+-#else
+-  uint8_t *p = ( uint8_t * )dst;
+-  *p++ = ( uint8_t )w; w >>= 8;
+-  *p++ = ( uint8_t )w;
+-#endif
+-}
+-
+-static BLAKE2_INLINE void store32( void *dst, uint32_t w )
+-{
+-#if defined(NATIVE_LITTLE_ENDIAN)
+-  memcpy(dst, &w, sizeof w);
+-#else
+-  uint8_t *p = ( uint8_t * )dst;
+-  p[0] = (uint8_t)(w >>  0);
+-  p[1] = (uint8_t)(w >>  8);
+-  p[2] = (uint8_t)(w >> 16);
+-  p[3] = (uint8_t)(w >> 24);
+-#endif
+-}
+-
+-static BLAKE2_INLINE void store64( void *dst, uint64_t w )
+-{
+-#if defined(NATIVE_LITTLE_ENDIAN)
+-  memcpy(dst, &w, sizeof w);
+-#else
+-  uint8_t *p = ( uint8_t * )dst;
+-  p[0] = (uint8_t)(w >>  0);
+-  p[1] = (uint8_t)(w >>  8);
+-  p[2] = (uint8_t)(w >> 16);
+-  p[3] = (uint8_t)(w >> 24);
+-  p[4] = (uint8_t)(w >> 32);
+-  p[5] = (uint8_t)(w >> 40);
+-  p[6] = (uint8_t)(w >> 48);
+-  p[7] = (uint8_t)(w >> 56);
+-#endif
+-}
+-
+-static BLAKE2_INLINE uint64_t load48( const void *src )
+-{
+-  const uint8_t *p = ( const uint8_t * )src;
+-  return (( uint64_t )( p[0] ) <<  0) |
+-         (( uint64_t )( p[1] ) <<  8) |
+-         (( uint64_t )( p[2] ) << 16) |
+-         (( uint64_t )( p[3] ) << 24) |
+-         (( uint64_t )( p[4] ) << 32) |
+-         (( uint64_t )( p[5] ) << 40) ;
+-}
+-
+-static BLAKE2_INLINE void store48( void *dst, uint64_t w )
+-{
+-  uint8_t *p = ( uint8_t * )dst;
+-  p[0] = (uint8_t)(w >>  0);
+-  p[1] = (uint8_t)(w >>  8);
+-  p[2] = (uint8_t)(w >> 16);
+-  p[3] = (uint8_t)(w >> 24);
+-  p[4] = (uint8_t)(w >> 32);
+-  p[5] = (uint8_t)(w >> 40);
+-}
+-
+-static BLAKE2_INLINE uint32_t rotr32( const uint32_t w, const unsigned c )
+-{
+-  return ( w >> c ) | ( w << ( 32 - c ) );
+-}
+-
+-static BLAKE2_INLINE uint64_t rotr64( const uint64_t w, const unsigned c )
+-{
+-  return ( w >> c ) | ( w << ( 64 - c ) );
+-}
+-
+-/* prevents compiler optimizing out memset() */
+-static BLAKE2_INLINE void secure_zero_memory(void *v, size_t n)
+-{
+-  static void *(*const volatile memset_v)(void *, int, size_t) = &memset;
+-  memset_v(v, 0, n);
+-}
+-
+-#endif
+--- thirdparty/blake2/blake2.h.orig	2018-03-16 17:25:33 UTC
++++ thirdparty/blake2/blake2.h
+@@ -1,195 +0,0 @@
+-/*
+-   BLAKE2 reference source code package - reference C implementations
+-
+-   Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.  You may use this under the
+-   terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
+-   your option.  The terms of these licenses can be found at:
+-
+-   - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+-   - OpenSSL license   : https://www.openssl.org/source/license.html
+-   - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+-
+-   More information about the BLAKE2 hash function can be found at
+-   https://blake2.net.
+-*/
+-#ifndef BLAKE2_H
+-#define BLAKE2_H
+-
+-#include <stddef.h>
+-#include <stdint.h>
+-
+-#if defined(_MSC_VER)
+-#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
+-#else
+-#define BLAKE2_PACKED(x) x __attribute__((packed))
+-#endif
+-
+-#if defined(__cplusplus)
+-extern "C" {
+-#endif
+-
+-  enum blake2s_constant
+-  {
+-    BLAKE2S_BLOCKBYTES = 64,
+-    BLAKE2S_OUTBYTES   = 32,
+-    BLAKE2S_KEYBYTES   = 32,
+-    BLAKE2S_SALTBYTES  = 8,
+-    BLAKE2S_PERSONALBYTES = 8
+-  };
+-
+-  enum blake2b_constant
+-  {
+-    BLAKE2B_BLOCKBYTES = 128,
+-    BLAKE2B_OUTBYTES   = 64,
+-    BLAKE2B_KEYBYTES   = 64,
+-    BLAKE2B_SALTBYTES  = 16,
+-    BLAKE2B_PERSONALBYTES = 16
+-  };
+-
+-  typedef struct blake2s_state__
+-  {
+-    uint32_t h[8];
+-    uint32_t t[2];
+-    uint32_t f[2];
+-    uint8_t  buf[BLAKE2S_BLOCKBYTES];
+-    size_t   buflen;
+-    size_t   outlen;
+-    uint8_t  last_node;
+-  } blake2s_state;
+-
+-  typedef struct blake2b_state__
+-  {
+-    uint64_t h[8];
+-    uint64_t t[2];
+-    uint64_t f[2];
+-    uint8_t  buf[BLAKE2B_BLOCKBYTES];
+-    size_t   buflen;
+-    size_t   outlen;
+-    uint8_t  last_node;
+-  } blake2b_state;
+-
+-  typedef struct blake2sp_state__
+-  {
+-    blake2s_state S[8][1];
+-    blake2s_state R[1];
+-    uint8_t       buf[8 * BLAKE2S_BLOCKBYTES];
+-    size_t        buflen;
+-    size_t        outlen;
+-  } blake2sp_state;
+-
+-  typedef struct blake2bp_state__
+-  {
+-    blake2b_state S[4][1];
+-    blake2b_state R[1];
+-    uint8_t       buf[4 * BLAKE2B_BLOCKBYTES];
+-    size_t        buflen;
+-    size_t        outlen;
+-  } blake2bp_state;
+-
+-
+-  BLAKE2_PACKED(struct blake2s_param__
+-  {
+-    uint8_t  digest_length; /* 1 */
+-    uint8_t  key_length;    /* 2 */
+-    uint8_t  fanout;        /* 3 */
+-    uint8_t  depth;         /* 4 */
+-    uint32_t leaf_length;   /* 8 */
+-    uint32_t node_offset;  /* 12 */
+-    uint16_t xof_length;    /* 14 */
+-    uint8_t  node_depth;    /* 15 */
+-    uint8_t  inner_length;  /* 16 */
+-    /* uint8_t  reserved[0]; */
+-    uint8_t  salt[BLAKE2S_SALTBYTES]; /* 24 */
+-    uint8_t  personal[BLAKE2S_PERSONALBYTES];  /* 32 */
+-  });
+-
+-  typedef struct blake2s_param__ blake2s_param;
+-
+-  BLAKE2_PACKED(struct blake2b_param__
+-  {
+-    uint8_t  digest_length; /* 1 */
+-    uint8_t  key_length;    /* 2 */
+-    uint8_t  fanout;        /* 3 */
+-    uint8_t  depth;         /* 4 */
+-    uint32_t leaf_length;   /* 8 */
+-    uint32_t node_offset;   /* 12 */
+-    uint32_t xof_length;    /* 16 */
+-    uint8_t  node_depth;    /* 17 */
+-    uint8_t  inner_length;  /* 18 */
+-    uint8_t  reserved[14];  /* 32 */
+-    uint8_t  salt[BLAKE2B_SALTBYTES]; /* 48 */
+-    uint8_t  personal[BLAKE2B_PERSONALBYTES];  /* 64 */
+-  });
+-
+-  typedef struct blake2b_param__ blake2b_param;
+-
+-  typedef struct blake2xs_state__
+-  {
+-    blake2s_state S[1];
+-    blake2s_param P[1];
+-  } blake2xs_state;
+-
+-  typedef struct blake2xb_state__
+-  {
+-    blake2b_state S[1];
+-    blake2b_param P[1];
+-  } blake2xb_state;
+-
+-  /* Padded structs result in a compile-time error */
+-  enum {
+-    BLAKE2_DUMMY_1 = 1/(sizeof(blake2s_param) == BLAKE2S_OUTBYTES),
+-    BLAKE2_DUMMY_2 = 1/(sizeof(blake2b_param) == BLAKE2B_OUTBYTES)
+-  };
+-
+-  /* Streaming API */
+-  int blake2s_init( blake2s_state *S, size_t outlen );
+-  int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen );
+-  int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
+-  int blake2s_update( blake2s_state *S, const void *in, size_t inlen );
+-  int blake2s_final( blake2s_state *S, void *out, size_t outlen );
+-
+-  int blake2b_init( blake2b_state *S, size_t outlen );
+-  int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen );
+-  int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
+-  int blake2b_update( blake2b_state *S, const void *in, size_t inlen );
+-  int blake2b_final( blake2b_state *S, void *out, size_t outlen );
+-
+-  int blake2sp_init( blake2sp_state *S, size_t outlen );
+-  int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen );
+-  int blake2sp_update( blake2sp_state *S, const void *in, size_t inlen );
+-  int blake2sp_final( blake2sp_state *S, void *out, size_t outlen );
+-
+-  int blake2bp_init( blake2bp_state *S, size_t outlen );
+-  int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen );
+-  int blake2bp_update( blake2bp_state *S, const void *in, size_t inlen );
+-  int blake2bp_final( blake2bp_state *S, void *out, size_t outlen );
+-
+-  /* Variable output length API */
+-  int blake2xs_init( blake2xs_state *S, const size_t outlen );
+-  int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
+-  int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
+-  int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
+-
+-  int blake2xb_init( blake2xb_state *S, const size_t outlen );
+-  int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
+-  int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
+-  int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
+-
+-  /* Simple API */
+-  int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-  int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-
+-  int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-  int blake2bp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-
+-  int blake2xs( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-  int blake2xb( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-
+-  /* This is simply an alias for blake2b */
+-  int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
+-
+-#if defined(__cplusplus)
+-}
+-#endif
+-
+-#endif
+--- thirdparty/blake2/blake2b-load-sse2.h.orig	2018-03-16 17:25:33 UTC
++++ thirdparty/blake2/blake2b-load-sse2.h
+@@ -1,68 +0,0 @@
+-/*
+-   BLAKE2 reference source code package - optimized C implementations
+-
+-   Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.  You may use this under the
+-   terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
+-   your option.  The terms of these licenses can be found at:
+-
+-   - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+-   - OpenSSL license   : https://www.openssl.org/source/license.html
+-   - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+-
+-   More information about the BLAKE2 hash function can be found at
+-   https://blake2.net.
+-*/
+-#ifndef BLAKE2B_LOAD_SSE2_H
+-#define BLAKE2B_LOAD_SSE2_H
+-
+-#define LOAD_MSG_0_1(b0, b1) b0 = _mm_set_epi64x(m2, m0); b1 = _mm_set_epi64x(m6, m4)
+-#define LOAD_MSG_0_2(b0, b1) b0 = _mm_set_epi64x(m3, m1); b1 = _mm_set_epi64x(m7, m5)
+-#define LOAD_MSG_0_3(b0, b1) b0 = _mm_set_epi64x(m10, m8); b1 = _mm_set_epi64x(m14, m12)
+-#define LOAD_MSG_0_4(b0, b1) b0 = _mm_set_epi64x(m11, m9); b1 = _mm_set_epi64x(m15, m13)
+-#define LOAD_MSG_1_1(b0, b1) b0 = _mm_set_epi64x(m4, m14); b1 = _mm_set_epi64x(m13, m9)
+-#define LOAD_MSG_1_2(b0, b1) b0 = _mm_set_epi64x(m8, m10); b1 = _mm_set_epi64x(m6, m15)
+-#define LOAD_MSG_1_3(b0, b1) b0 = _mm_set_epi64x(m0, m1); b1 = _mm_set_epi64x(m5, m11)
+-#define LOAD_MSG_1_4(b0, b1) b0 = _mm_set_epi64x(m2, m12); b1 = _mm_set_epi64x(m3, m7)
+-#define LOAD_MSG_2_1(b0, b1) b0 = _mm_set_epi64x(m12, m11); b1 = _mm_set_epi64x(m15, m5)
+-#define LOAD_MSG_2_2(b0, b1) b0 = _mm_set_epi64x(m0, m8); b1 = _mm_set_epi64x(m13, m2)
+-#define LOAD_MSG_2_3(b0, b1) b0 = _mm_set_epi64x(m3, m10); b1 = _mm_set_epi64x(m9, m7)
+-#define LOAD_MSG_2_4(b0, b1) b0 = _mm_set_epi64x(m6, m14); b1 = _mm_set_epi64x(m4, m1)
+-#define LOAD_MSG_3_1(b0, b1) b0 = _mm_set_epi64x(m3, m7); b1 = _mm_set_epi64x(m11, m13)
+-#define LOAD_MSG_3_2(b0, b1) b0 = _mm_set_epi64x(m1, m9); b1 = _mm_set_epi64x(m14, m12)
+-#define LOAD_MSG_3_3(b0, b1) b0 = _mm_set_epi64x(m5, m2); b1 = _mm_set_epi64x(m15, m4)
+-#define LOAD_MSG_3_4(b0, b1) b0 = _mm_set_epi64x(m10, m6); b1 = _mm_set_epi64x(m8, m0)
+-#define LOAD_MSG_4_1(b0, b1) b0 = _mm_set_epi64x(m5, m9); b1 = _mm_set_epi64x(m10, m2)
+-#define LOAD_MSG_4_2(b0, b1) b0 = _mm_set_epi64x(m7, m0); b1 = _mm_set_epi64x(m15, m4)
+-#define LOAD_MSG_4_3(b0, b1) b0 = _mm_set_epi64x(m11, m14); b1 = _mm_set_epi64x(m3, m6)
+-#define LOAD_MSG_4_4(b0, b1) b0 = _mm_set_epi64x(m12, m1); b1 = _mm_set_epi64x(m13, m8)
+-#define LOAD_MSG_5_1(b0, b1) b0 = _mm_set_epi64x(m6, m2); b1 = _mm_set_epi64x(m8, m0)
+-#define LOAD_MSG_5_2(b0, b1) b0 = _mm_set_epi64x(m10, m12); b1 = _mm_set_epi64x(m3, m11)
+-#define LOAD_MSG_5_3(b0, b1) b0 = _mm_set_epi64x(m7, m4); b1 = _mm_set_epi64x(m1, m15)
+-#define LOAD_MSG_5_4(b0, b1) b0 = _mm_set_epi64x(m5, m13); b1 = _mm_set_epi64x(m9, m14)
+-#define LOAD_MSG_6_1(b0, b1) b0 = _mm_set_epi64x(m1, m12); b1 = _mm_set_epi64x(m4, m14)
+-#define LOAD_MSG_6_2(b0, b1) b0 = _mm_set_epi64x(m15, m5); b1 = _mm_set_epi64x(m10, m13)
+-#define LOAD_MSG_6_3(b0, b1) b0 = _mm_set_epi64x(m6, m0); b1 = _mm_set_epi64x(m8, m9)
+-#define LOAD_MSG_6_4(b0, b1) b0 = _mm_set_epi64x(m3, m7); b1 = _mm_set_epi64x(m11, m2)
+-#define LOAD_MSG_7_1(b0, b1) b0 = _mm_set_epi64x(m7, m13); b1 = _mm_set_epi64x(m3, m12)
+-#define LOAD_MSG_7_2(b0, b1) b0 = _mm_set_epi64x(m14, m11); b1 = _mm_set_epi64x(m9, m1)
+-#define LOAD_MSG_7_3(b0, b1) b0 = _mm_set_epi64x(m15, m5); b1 = _mm_set_epi64x(m2, m8)
+-#define LOAD_MSG_7_4(b0, b1) b0 = _mm_set_epi64x(m4, m0); b1 = _mm_set_epi64x(m10, m6)
+-#define LOAD_MSG_8_1(b0, b1) b0 = _mm_set_epi64x(m14, m6); b1 = _mm_set_epi64x(m0, m11)
+-#define LOAD_MSG_8_2(b0, b1) b0 = _mm_set_epi64x(m9, m15); b1 = _mm_set_epi64x(m8, m3)
+-#define LOAD_MSG_8_3(b0, b1) b0 = _mm_set_epi64x(m13, m12); b1 = _mm_set_epi64x(m10, m1)
+-#define LOAD_MSG_8_4(b0, b1) b0 = _mm_set_epi64x(m7, m2); b1 = _mm_set_epi64x(m5, m4)
+-#define LOAD_MSG_9_1(b0, b1) b0 = _mm_set_epi64x(m8, m10); b1 = _mm_set_epi64x(m1, m7)
+-#define LOAD_MSG_9_2(b0, b1) b0 = _mm_set_epi64x(m4, m2); b1 = _mm_set_epi64x(m5, m6)
+-#define LOAD_MSG_9_3(b0, b1) b0 = _mm_set_epi64x(m9, m15); b1 = _mm_set_epi64x(m13, m3)
+-#define LOAD_MSG_9_4(b0, b1) b0 = _mm_set_epi64x(m14, m11); b1 = _mm_set_epi64x(m0, m12)
+-#define LOAD_MSG_10_1(b0, b1) b0 = _mm_set_epi64x(m2, m0); b1 = _mm_set_epi64x(m6, m4)
+-#define LOAD_MSG_10_2(b0, b1) b0 = _mm_set_epi64x(m3, m1); b1 = _mm_set_epi64x(m7, m5)
+-#define LOAD_MSG_10_3(b0, b1) b0 = _mm_set_epi64x(m10, m8); b1 = _mm_set_epi64x(m14, m12)
+-#define LOAD_MSG_10_4(b0, b1) b0 = _mm_set_epi64x(m11, m9); b1 = _mm_set_epi64x(m15, m13)
+-#define LOAD_MSG_11_1(b0, b1) b0 = _mm_set_epi64x(m4, m14); b1 = _mm_set_epi64x(m13, m9)
+-#define LOAD_MSG_11_2(b0, b1) b0 = _mm_set_epi64x(m8, m10); b1 = _mm_set_epi64x(m6, m15)
+-#define LOAD_MSG_11_3(b0, b1) b0 = _mm_set_epi64x(m0, m1); b1 = _mm_set_epi64x(m5, m11)
+-#define LOAD_MSG_11_4(b0, b1) b0 = _mm_set_epi64x(m2, m12); b1 = _mm_set_epi64x(m3, m7)
+-
+-
+-#endif
+--- thirdparty/blake2/blake2b-load-sse41.h.orig	2018-03-16 17:25:33 UTC
++++ thirdparty/blake2/blake2b-load-sse41.h
+@@ -1,402 +0,0 @@
+-/*
+-   BLAKE2 reference source code package - optimized C implementations
+-
+-   Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.  You may use this under the
+-   terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
+-   your option.  The terms of these licenses can be found at:
+-
+-   - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+-   - OpenSSL license   : https://www.openssl.org/source/license.html
+-   - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+-
+-   More information about the BLAKE2 hash function can be found at
+-   https://blake2.net.
+-*/
+-#ifndef BLAKE2B_LOAD_SSE41_H
+-#define BLAKE2B_LOAD_SSE41_H
+-
+-#define LOAD_MSG_0_1(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m0, m1); \
+-b1 = _mm_unpacklo_epi64(m2, m3); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_0_2(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpackhi_epi64(m0, m1); \
+-b1 = _mm_unpackhi_epi64(m2, m3); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_0_3(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m4, m5); \
+-b1 = _mm_unpacklo_epi64(m6, m7); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_0_4(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpackhi_epi64(m4, m5); \
+-b1 = _mm_unpackhi_epi64(m6, m7); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_1_1(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m7, m2); \
+-b1 = _mm_unpackhi_epi64(m4, m6); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_1_2(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m5, m4); \
+-b1 = _mm_alignr_epi8(m3, m7, 8); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_1_3(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1,0,3,2)); \
+-b1 = _mm_unpackhi_epi64(m5, m2); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_1_4(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m6, m1); \
+-b1 = _mm_unpackhi_epi64(m3, m1); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_2_1(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_alignr_epi8(m6, m5, 8); \
+-b1 = _mm_unpackhi_epi64(m2, m7); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_2_2(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m4, m0); \
+-b1 = _mm_blend_epi16(m1, m6, 0xF0); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_2_3(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_blend_epi16(m5, m1, 0xF0); \
+-b1 = _mm_unpackhi_epi64(m3, m4); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_2_4(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m7, m3); \
+-b1 = _mm_alignr_epi8(m2, m0, 8); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_3_1(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpackhi_epi64(m3, m1); \
+-b1 = _mm_unpackhi_epi64(m6, m5); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_3_2(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpackhi_epi64(m4, m0); \
+-b1 = _mm_unpacklo_epi64(m6, m7); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_3_3(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_blend_epi16(m1, m2, 0xF0); \
+-b1 = _mm_blend_epi16(m2, m7, 0xF0); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_3_4(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m3, m5); \
+-b1 = _mm_unpacklo_epi64(m0, m4); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_4_1(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpackhi_epi64(m4, m2); \
+-b1 = _mm_unpacklo_epi64(m1, m5); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_4_2(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_blend_epi16(m0, m3, 0xF0); \
+-b1 = _mm_blend_epi16(m2, m7, 0xF0); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_4_3(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_blend_epi16(m7, m5, 0xF0); \
+-b1 = _mm_blend_epi16(m3, m1, 0xF0); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_4_4(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_alignr_epi8(m6, m0, 8); \
+-b1 = _mm_blend_epi16(m4, m6, 0xF0); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_5_1(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m1, m3); \
+-b1 = _mm_unpacklo_epi64(m0, m4); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_5_2(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpacklo_epi64(m6, m5); \
+-b1 = _mm_unpackhi_epi64(m5, m1); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_5_3(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_blend_epi16(m2, m3, 0xF0); \
+-b1 = _mm_unpackhi_epi64(m7, m0); \
+-} while(0)
+-
+-
+-#define LOAD_MSG_5_4(b0, b1) \
+-do \
+-{ \
+-b0 = _mm_unpackhi_epi64(m6, m2); \
+-b1 = _mm_blend_epi16(m7, m4, 0xF0); \
*** 9800 LINES SKIPPED ***