From: Jonas Gorski Date: Sat, 18 Nov 2017 11:30:11 +0000 (+0100) Subject: libopkg: fix SHA256 calculation for big endian system X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=468158f01ea0cb891f586936217f1a765fd207b7;p=oweals%2Fopkg-lede.git libopkg: fix SHA256 calculation for big endian system The SHA256 implementation relied on WORDS_BIGENDIAN being defined for big endian systems, but this was broken since the switch to cmake, causing wrong checksums on big endian systems like ar71xx. Fix this by adding a cmake check for endianess similar to the one done by the original autotools. Fixes: e6e6c5a21634 ("build: add cmake build system") Acked-by: Jo-Philipp Wich Signed-off-by: Jonas Gorski --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 30a5d44..26230b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.6) PROJECT(opkg C) +INCLUDE(TestBigEndian) + SET(HOST_CPU "" CACHE STRING "Override Host CPU") SET(BUILD_CPU "" CACHE STRING "Override Host CPU") SET(LOCK_FILE "/var/lock/opkg.lock" CACHE STRING "Override lock file path") @@ -31,6 +33,8 @@ IF(NOT VERSION) SET(VERSION "unknown") ENDIF() +TEST_BIG_ENDIAN(WORDS_BIGENDIAN) + ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 -Wmissing-declarations -DDATADIR="/usr/share" -DOPKGETCDIR="/etc" @@ -46,6 +50,10 @@ IF(ENABLE_USIGN) ADD_DEFINITIONS(-DHAVE_USIGN) ENDIF() +IF(WORDS_BIGENDIAN) + ADD_DEFINITIONS(-DWORDS_BIGENDIAN) +ENDIF() + ADD_SUBDIRECTORY(libbb) ADD_SUBDIRECTORY(libopkg) ADD_SUBDIRECTORY(src)