diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-08-08 18:46:43 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-10-18 19:08:32 +0200 |
commit | 2037b837f81485770fcb066adea70b1d22e9b727 (patch) | |
tree | 41d15b95f38843dfe5fb45327c25d3a116731b05 /rbutil | |
parent | 815b289cb3438ed566b3e9dc5074fe12e4b98f46 (diff) | |
download | rockbox-2037b837f81485770fcb066adea70b1d22e9b727.tar.gz rockbox-2037b837f81485770fcb066adea70b1d22e9b727.zip |
sbtools: convert crypto to libtomcrypt.
Replace the use of crypto++ with tomcrypt, which is much smaller and C.
This gets rid of various build issues for systems that don't ship
crypo++ (i.e. everything except Linux.)
Change-Id: Ic0799e17b94935c71b14765cf9a2a7ea2b0adc7a
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/mkimxboot/Makefile | 33 | ||||
-rw-r--r-- | rbutil/rbutilqt/Makefile.libs | 4 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 6 |
3 files changed, 23 insertions, 20 deletions
diff --git a/rbutil/mkimxboot/Makefile b/rbutil/mkimxboot/Makefile index 9ad21a1966..d2c487c475 100644 --- a/rbutil/mkimxboot/Makefile +++ b/rbutil/mkimxboot/Makefile | |||
@@ -8,24 +8,18 @@ | |||
8 | # We use the SB code available in the Rockbox utils/sbtools directory | 8 | # We use the SB code available in the Rockbox utils/sbtools directory |
9 | 9 | ||
10 | IMXTOOLS_DIR=../../utils/imxtools/sbtools/ | 10 | IMXTOOLS_DIR=../../utils/imxtools/sbtools/ |
11 | CFLAGS += -I$(IMXTOOLS_DIR) -Wall | ||
12 | # std=gnu99 is required by MinGW on Windows (c99 is sufficient for Linux / MXE) | ||
13 | CFLAGS += -std=gnu99 -g -O3 | ||
14 | 11 | ||
15 | # Location to pkg-config binary. | 12 | COMPILEFLAGS := -Wall -g -O3 -I$(IMXTOOLS_DIR) |
16 | PKGCONFIG := pkg-config | 13 | |
14 | # std=gnu99 is required by MinGW on Windows (c99 is sufficient for Linux / MXE) | ||
15 | CFLAGS += -std=gnu99 $(COMPILEFLAGS) | ||
16 | CXXFLAGS += $(COMPILEFLAGS) | ||
17 | 17 | ||
18 | # Distros could use different names for the crypto library. We try a list | 18 | TOMCRYPT_DIR := ../../utils/tomcrypt |
19 | # of candidate names, only one of them should be the valid one. | ||
20 | LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++ | ||
21 | 19 | ||
22 | $(foreach l,$(LIBCRYPTO_NAMES),\ | 20 | CXXFLAGS += -I$(TOMCRYPT_DIR)/src/headers |
23 | $(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l)))) | 21 | CFLAGS += -I$(TOMCRYPT_DIR)/src/headers |
24 | $(foreach l,$(LIBCRYPTO_NAMES),\ | 22 | LDOPTS += -lpthread $(TOMCRYPT_DIR)/librbtomcrypt.a |
25 | $(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l)))) | ||
26 | $(foreach l,$(LIBCRYPTO_NAMES),\ | ||
27 | $(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l)))) | ||
28 | LDOPTS += -lpthread | ||
29 | 23 | ||
30 | OUTPUT = mkimxboot | 24 | OUTPUT = mkimxboot |
31 | 25 | ||
@@ -33,6 +27,10 @@ OUTPUT = mkimxboot | |||
33 | IMXTOOLS_SOURCES = misc.c sb.c crypto.cpp crc.c elf.c | 27 | IMXTOOLS_SOURCES = misc.c sb.c crypto.cpp crc.c elf.c |
34 | LIBSOURCES := dualboot.c mkimxboot.c md5.c \ | 28 | LIBSOURCES := dualboot.c mkimxboot.c md5.c \ |
35 | $(addprefix $(IMXTOOLS_DIR),$(IMXTOOLS_SOURCES)) | 29 | $(addprefix $(IMXTOOLS_DIR),$(IMXTOOLS_SOURCES)) |
30 | |||
31 | # for now build tomcrypt as part of the lib. | ||
32 | LIBSOURCES += $(addprefix $(TOMCRYPT_DIR),$(TOMCRYPT_SOURCES)) | ||
33 | |||
36 | # inputs for binary only | 34 | # inputs for binary only |
37 | SOURCES := $(LIBSOURCES) main.c | 35 | SOURCES := $(LIBSOURCES) main.c |
38 | # dependencies for binary | 36 | # dependencies for binary |
@@ -43,3 +41,8 @@ include ../libtools.make | |||
43 | # explicit dependencies on dualboot.{c,h} and mkimxboot.h | 41 | # explicit dependencies on dualboot.{c,h} and mkimxboot.h |
44 | $(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h | 42 | $(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h |
45 | $(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h | 43 | $(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h |
44 | $(BINARY): librbtomcrypt.a | ||
45 | |||
46 | librbtomcrypt.a: | ||
47 | $(MAKE) -C ../../utils/tomcrypt | ||
48 | |||
diff --git a/rbutil/rbutilqt/Makefile.libs b/rbutil/rbutilqt/Makefile.libs index 6d5c8c5354..938426f124 100644 --- a/rbutil/rbutilqt/Makefile.libs +++ b/rbutil/rbutilqt/Makefile.libs | |||
@@ -33,12 +33,14 @@ export CC=$(EXTRALIBS_CC) | |||
33 | export CXX=$(EXTRALIBS_CXX) | 33 | export CXX=$(EXTRALIBS_CXX) |
34 | export AR=$(EXTRALIBS_AR) | 34 | export AR=$(EXTRALIBS_AR) |
35 | 35 | ||
36 | libs: librbspeex libucl libipodpatcher libsansapatcher libmkamsboot libmktccboot libmkmpioboot libchinachippatcher libmkimxboot libmks5lboot libbzip2 libbspatch | 36 | libs: librbspeex libucl libipodpatcher libsansapatcher libmkamsboot libmktccboot libmkmpioboot libchinachippatcher libmkimxboot libmks5lboot libbzip2 libbspatch librbtomcrypt |
37 | 37 | ||
38 | # To support cross compiles, we explicitly pass the CC flag below for | 38 | # To support cross compiles, we explicitly pass the CC flag below for |
39 | # all tools which override CC or CXX in their makefiles. CXX is only | 39 | # all tools which override CC or CXX in their makefiles. CXX is only |
40 | # used by mkimxboot. | 40 | # used by mkimxboot. |
41 | 41 | ||
42 | librbtomcrypt: | ||
43 | $(SILENT) $(MAKE) -C $(RBBASE_DIR)/utils/tomcrypt BUILD_DIR=$(BUILD_DIR)/tomcrypt librbtomcrypt.a | ||
42 | librbspeex: | 44 | librbspeex: |
43 | $(SILENT) $(MAKE) -C $(RBBASE_DIR)/tools/rbspeex BUILD_DIR=$(BUILD_DIR)/libspeex librbspeex.a | 45 | $(SILENT) $(MAKE) -C $(RBBASE_DIR)/tools/rbspeex BUILD_DIR=$(BUILD_DIR)/libspeex librbspeex.a |
44 | 46 | ||
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index d07c1e01bc..9d7da92dbf 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -85,7 +85,8 @@ extralibs.commands = $$SILENT \ | |||
85 | # Note: order is important for RBLIBS! The libs are appended to the linker | 85 | # Note: order is important for RBLIBS! The libs are appended to the linker |
86 | # flags in this order, put libucl at the end. | 86 | # flags in this order, put libucl at the end. |
87 | RBLIBS = rbspeex ipodpatcher sansapatcher mkamsboot mktccboot \ | 87 | RBLIBS = rbspeex ipodpatcher sansapatcher mkamsboot mktccboot \ |
88 | mkmpioboot chinachippatcher mkimxboot mks5lboot bspatch ucl | 88 | mkmpioboot chinachippatcher mkimxboot mks5lboot bspatch ucl \ |
89 | rbtomcrypt | ||
89 | # NOTE: Linking bzip2 causes problems on Windows (Qt seems to export those | 90 | # NOTE: Linking bzip2 causes problems on Windows (Qt seems to export those |
90 | # symbols as well, similar to what we have with zlib.) Only link that on | 91 | # symbols as well, similar to what we have with zlib.) Only link that on |
91 | # non-Windows for now. | 92 | # non-Windows for now. |
@@ -139,9 +140,6 @@ for(rblib, RBLIBS) { | |||
139 | LIBS += -l$$rblib | 140 | LIBS += -l$$rblib |
140 | } | 141 | } |
141 | 142 | ||
142 | # We need libcrypto++ | ||
143 | LIBS += -lcryptopp | ||
144 | |||
145 | # on win32 libz is linked implicitly. | 143 | # on win32 libz is linked implicitly. |
146 | !win32 { | 144 | !win32 { |
147 | LIBS += -lz | 145 | LIBS += -lz |