summaryrefslogtreecommitdiffstats
path: root/utils/nwztools/upgtools
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-01-24 07:31:07 -0500
committerSolomon Peachy <pizza@shaftnet.org>2019-01-25 12:58:18 +0100
commit07084f62c40d3197f3a11ac4e5fbe3b923e9ae1e (patch)
tree89eaf3845056d5c4b0b8e86799f4bb6602e6ab03 /utils/nwztools/upgtools
parent96052373490095cd02fca7eb6ccdcfabe6403803 (diff)
downloadrockbox-07084f62c40d3197f3a11ac4e5fbe3b923e9ae1e.tar.gz
rockbox-07084f62c40d3197f3a11ac4e5fbe3b923e9ae1e.tar.bz2
rockbox-07084f62c40d3197f3a11ac4e5fbe3b923e9ae1e.zip
Fix host build of mkimxboot, mknwzboot, nwztools, and rbutil with crypto++
Necessary to get working builds on my Fedora 29 system. Change-Id: Ia6232427c959629ade9a85fc412738f688facedb
Diffstat (limited to 'utils/nwztools/upgtools')
-rw-r--r--utils/nwztools/upgtools/Makefile20
-rw-r--r--utils/nwztools/upgtools/md5.cpp5
-rw-r--r--utils/nwztools/upgtools/mg.cpp8
3 files changed, 24 insertions, 9 deletions
diff --git a/utils/nwztools/upgtools/Makefile b/utils/nwztools/upgtools/Makefile
index fcfc889ae6..046eb1a1a9 100644
--- a/utils/nwztools/upgtools/Makefile
+++ b/utils/nwztools/upgtools/Makefile
@@ -3,9 +3,23 @@ CC=gcc
CXX=g++
LD=g++
PROFILE=
-CFLAGS=-g $(PROFILE) -std=c99 -Wall $(DEFINES) `pkg-config --cflags libcrypto++`
-CXXFLAGS=-g $(PROFILE) -Wall $(DEFINES) `pkg-config --cflags libcrypto++`
-LDFLAGS=$(PROFILE) `pkg-config --libs libcrypto++` -lpthread
+PKGCONFIG := $(CROSS)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))))
+
+CXXFLAGS=-g $(PROFILE) -Wall $(DEFINES)
+CFLAGS=-g $(PROFILE) -Wall -std=c99 $(DEFINES)
+LDFLAGS=$(PROFILE) $(LDOPTS) -lpthread
+
BINS=upgtool
all: $(BINS)
diff --git a/utils/nwztools/upgtools/md5.cpp b/utils/nwztools/upgtools/md5.cpp
index 3b0c2358e4..3d453da409 100644
--- a/utils/nwztools/upgtools/md5.cpp
+++ b/utils/nwztools/upgtools/md5.cpp
@@ -21,11 +21,12 @@
#include "md5.h"
/* MD5 is considered insecure by crypto++ */
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
-#include <crypto++/md5.h>
+#include <cryptopp/cryptlib.h>
+#include <cryptopp/md5.h>
using namespace CryptoPP::Weak;
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);
}
diff --git a/utils/nwztools/upgtools/mg.cpp b/utils/nwztools/upgtools/mg.cpp
index 79039702db..66566770f9 100644
--- a/utils/nwztools/upgtools/mg.cpp
+++ b/utils/nwztools/upgtools/mg.cpp
@@ -19,10 +19,10 @@
*
****************************************************************************/
#include "mg.h"
-#include <crypto++/cryptlib.h>
-#include <crypto++/modes.h>
-#include <crypto++/des.h>
-#include <crypto++/aes.h>
+#include <cryptopp/cryptlib.h>
+#include <cryptopp/modes.h>
+#include <cryptopp/des.h>
+#include <cryptopp/aes.h>
#include <stdio.h>
using namespace CryptoPP;