diff --git a/thirdparty/fribidi/CMakeLists.txt b/thirdparty/fribidi/CMakeLists.txt index 238dccf4f..ff8f9a487 100644 --- a/thirdparty/fribidi/CMakeLists.txt +++ b/thirdparty/fribidi/CMakeLists.txt @@ -16,7 +16,7 @@ ep_get_source_dir(SOURCE_DIR) ep_get_binary_dir(BINARY_DIR) # Temporary, while waiting for https://github.com/fribidi/fribidi/pull/115 to be merged -set(PATCH_CMD sh -c "${ISED} \"s|^CFLAGS = |LDFLAGS = \\nCFLAGS = |\" gen.tab/Makefile.am") +set(PATCH_CMD patch -N -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/fribidi-pr115.patch) set(CFG_ENV_VAR "CC=\"${CC}\" CFLAGS=\"${CFLAGS}\" LDFLAGS=\"${LDFLAGS}\" ") set(CFG_OPTS "-q --prefix=${BINARY_DIR} --disable-static --enable-shared --host=\"${CHOST}\"") diff --git a/thirdparty/fribidi/fribidi-pr115.patch b/thirdparty/fribidi/fribidi-pr115.patch new file mode 100644 index 000000000..1d4682d23 --- /dev/null +++ b/thirdparty/fribidi/fribidi-pr115.patch @@ -0,0 +1,22 @@ +From 5855be47b2fe018363bd7dd1b64ea81f93c47f1e Mon Sep 17 00:00:00 2001 +From: Frans de Jonge +Date: Sun, 15 Sep 2019 19:58:24 +0200 +Subject: [PATCH] Use LDFLAGS_FOR_BUILD for cross-compilation + +Otherwise the regular LDFLAGS can wreak havoc. +--- + gen.tab/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gen.tab/Makefile.am b/gen.tab/Makefile.am +index fe3c80f..014c646 100644 +--- a/gen.tab/Makefile.am ++++ b/gen.tab/Makefile.am +@@ -26,6 +26,7 @@ gen_brackets_type_tab_CPPFLAGS = $(AM_CPPFLAGS) + CFLAGS_FOR_BUILD += -DHAVE_CONFIG_H -I$(top_builddir) -I$(top_builddir)/lib -I$(top_srcdir)/lib + CC = $(CC_FOR_BUILD) + CFLAGS = $(CFLAGS_FOR_BUILD) ++LDFLAGS = $(LDFLAGS_FOR_BUILD) + + CLEANFILES = $(EXTRA_PROGRAMS) + DISTCLEANFILES = diff --git a/thirdparty/leptonica/CMakeLists.txt b/thirdparty/leptonica/CMakeLists.txt index e2c265afd..cd22ea20c 100644 --- a/thirdparty/leptonica/CMakeLists.txt +++ b/thirdparty/leptonica/CMakeLists.txt @@ -32,11 +32,14 @@ else() set(PATCH_CMD "") endif() +# We apparently need a rebuild of the configure on macOS (https://github.com/koreader/koreader/issues/4448#issuecomment-522363325) +set(RECONF_CMD sh -c "autoreconf -fi") + include(ExternalProject) ExternalProject_Add( ${PROJECT_NAME} DOWNLOAD_COMMAND ${CMAKE_COMMAND} -P ${GIT_CLONE_SCRIPT_FILENAME} - PATCH_COMMAND ${PATCH_CMD} + PATCH_COMMAND ${PATCH_CMD} COMMAND ${RECONF_CMD} CONFIGURE_COMMAND "" # skip build and install, libk2pdfopt will build it BUILD_COMMAND ""