Fix host build of mkimxboot, mknwzboot, nwztools, and rbutil with crypto++
Necessary to get working builds on my Fedora 29 system. Change-Id: Ia6232427c959629ade9a85fc412738f688facedb
This commit is contained in:
parent
9605237349
commit
07084f62c4
6 changed files with 53 additions and 14 deletions
|
@ -6,17 +6,26 @@
|
||||||
# \/ \/ \/ \/ \/
|
# \/ \/ \/ \/ \/
|
||||||
|
|
||||||
# We use the SB code available in the Rockbox utils/sbtools directory
|
# We use the SB code available in the Rockbox utils/sbtools directory
|
||||||
|
|
||||||
IMXTOOLS_DIR=../../utils/imxtools/sbtools/
|
IMXTOOLS_DIR=../../utils/imxtools/sbtools/
|
||||||
CFLAGS += -I$(IMXTOOLS_DIR) -Wall
|
CFLAGS += -I$(IMXTOOLS_DIR) -Wall
|
||||||
# std=gnu99 is required by MinGW on Windows (c99 is sufficient for Linux / MXE)
|
# std=gnu99 is required by MinGW on Windows (c99 is sufficient for Linux / MXE)
|
||||||
CFLAGS += -std=gnu99 -g -O3
|
CFLAGS += -std=gnu99 -g -O3
|
||||||
|
|
||||||
|
# Location to pkg-config binary.
|
||||||
|
PKGCONFIG := pkg-config
|
||||||
|
|
||||||
# Distros could use different names for the crypto library. We try a list
|
# Distros could use different names for the crypto library. We try a list
|
||||||
# of candidate names, only one of them should be the valid one.
|
# of candidate names, only one of them should be the valid one.
|
||||||
PKGCONFIG := $(CROSS)pkg-config
|
|
||||||
LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++
|
LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++
|
||||||
|
|
||||||
$(foreach l,$(LIBCRYPTO_NAMES),\
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
$(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
|
$(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||||
|
LDOPTS += -lpthread
|
||||||
|
|
||||||
OUTPUT = mkimxboot
|
OUTPUT = mkimxboot
|
||||||
|
|
||||||
|
@ -34,4 +43,3 @@ include ../libtools.make
|
||||||
# explicit dependencies on dualboot.{c,h} and mkimxboot.h
|
# explicit dependencies on dualboot.{c,h} and mkimxboot.h
|
||||||
$(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h
|
$(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h
|
||||||
$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h
|
$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,21 @@ CFLAGS += -I$(UPGTOOLS_DIR) -Wall
|
||||||
CFLAGS += -std=gnu99 -g -O3
|
CFLAGS += -std=gnu99 -g -O3
|
||||||
# dependencies
|
# dependencies
|
||||||
# FIXME make it work for windows and maybe embed crypto++
|
# FIXME make it work for windows and maybe embed crypto++
|
||||||
LDOPTS += `pkg-config --libs libcrypto++`
|
|
||||||
|
# Location to pkg-config binary.
|
||||||
|
PKGCONFIG := pkg-config
|
||||||
|
|
||||||
|
# Distros could use different names for the crypto library. We try a list
|
||||||
|
# of candidate names, only one of them should be the valid one.
|
||||||
|
LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++
|
||||||
|
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||||
|
LDOPTS += -lpthread
|
||||||
|
|
||||||
OUTPUT = mknwzboot
|
OUTPUT = mknwzboot
|
||||||
|
|
||||||
|
@ -23,7 +37,7 @@ LIBSOURCES := mknwzboot.c install_script.c uninstall_script.c \
|
||||||
# inputs for binary only
|
# inputs for binary only
|
||||||
SOURCES := $(LIBSOURCES) main.c
|
SOURCES := $(LIBSOURCES) main.c
|
||||||
# dependencies for binary
|
# dependencies for binary
|
||||||
EXTRADEPS :=
|
EXTRADEPS :=
|
||||||
|
|
||||||
include ../libtools.make
|
include ../libtools.make
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,9 @@ for(rblib, RBLIBS) {
|
||||||
LIBS += -l$$rblib
|
LIBS += -l$$rblib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# We need libcrypto++
|
||||||
|
LIBS += -lcryptopp
|
||||||
|
|
||||||
# on win32 libz is linked implicitly.
|
# on win32 libz is linked implicitly.
|
||||||
!win32 {
|
!win32 {
|
||||||
LIBS += -lz
|
LIBS += -lz
|
||||||
|
@ -264,4 +267,3 @@ unix {
|
||||||
include(rbutilqt.pri)
|
include(rbutilqt.pri)
|
||||||
include(quazip/quazip.pri)
|
include(quazip/quazip.pri)
|
||||||
include(logger/logger.pri)
|
include(logger/logger.pri)
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,23 @@ CC=gcc
|
||||||
CXX=g++
|
CXX=g++
|
||||||
LD=g++
|
LD=g++
|
||||||
PROFILE=
|
PROFILE=
|
||||||
CFLAGS=-g $(PROFILE) -std=c99 -Wall $(DEFINES) `pkg-config --cflags libcrypto++`
|
PKGCONFIG := $(CROSS)pkg-config
|
||||||
CXXFLAGS=-g $(PROFILE) -Wall $(DEFINES) `pkg-config --cflags libcrypto++`
|
|
||||||
LDFLAGS=$(PROFILE) `pkg-config --libs libcrypto++` -lpthread
|
# Distros could use different names for the crypto library. We try a list
|
||||||
|
# of candidate names, only one of them should be the valid one.
|
||||||
|
LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++
|
||||||
|
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||||
|
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||||
|
$(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||||
|
|
||||||
|
CXXFLAGS=-g $(PROFILE) -Wall $(DEFINES)
|
||||||
|
CFLAGS=-g $(PROFILE) -Wall -std=c99 $(DEFINES)
|
||||||
|
LDFLAGS=$(PROFILE) $(LDOPTS) -lpthread
|
||||||
|
|
||||||
BINS=upgtool
|
BINS=upgtool
|
||||||
|
|
||||||
all: $(BINS)
|
all: $(BINS)
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
/* MD5 is considered insecure by crypto++ */
|
/* MD5 is considered insecure by crypto++ */
|
||||||
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
|
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
|
||||||
#include <crypto++/md5.h>
|
#include <cryptopp/cryptlib.h>
|
||||||
|
#include <cryptopp/md5.h>
|
||||||
|
|
||||||
using namespace CryptoPP::Weak;
|
using namespace CryptoPP::Weak;
|
||||||
|
|
||||||
void MD5_CalculateDigest(void *digest, const void *input, size_t length)
|
void MD5_CalculateDigest(void *digest, const void *input, size_t length)
|
||||||
{
|
{
|
||||||
MD5().CalculateDigest((byte *)digest, (const byte *)input, length);
|
MD5().CalculateDigest((CryptoPP::byte *)digest, (const CryptoPP::byte *)input, length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "mg.h"
|
#include "mg.h"
|
||||||
#include <crypto++/cryptlib.h>
|
#include <cryptopp/cryptlib.h>
|
||||||
#include <crypto++/modes.h>
|
#include <cryptopp/modes.h>
|
||||||
#include <crypto++/des.h>
|
#include <cryptopp/des.h>
|
||||||
#include <crypto++/aes.h>
|
#include <cryptopp/aes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace CryptoPP;
|
using namespace CryptoPP;
|
||||||
|
|
Loading…
Reference in a new issue