Skip to content

Commit a1fc4e4

Browse files
authored
macOS build fixes (koreader#996)
* Fix leptonica build on macOS * Switch to the proper fribidi patch Hopefully avoids sed shenanigans on macOS
1 parent d9a685c commit a1fc4e4

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

thirdparty/fribidi/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ep_get_source_dir(SOURCE_DIR)
1616
ep_get_binary_dir(BINARY_DIR)
1717

1818
# Temporary, while waiting for https://github.com/fribidi/fribidi/pull/115 to be merged
19-
set(PATCH_CMD sh -c "${ISED} \"s|^CFLAGS = |LDFLAGS = \\nCFLAGS = |\" gen.tab/Makefile.am")
19+
set(PATCH_CMD patch -N -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/fribidi-pr115.patch)
2020

2121
set(CFG_ENV_VAR "CC=\"${CC}\" CFLAGS=\"${CFLAGS}\" LDFLAGS=\"${LDFLAGS}\" ")
2222
set(CFG_OPTS "-q --prefix=${BINARY_DIR} --disable-static --enable-shared --host=\"${CHOST}\"")
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From 5855be47b2fe018363bd7dd1b64ea81f93c47f1e Mon Sep 17 00:00:00 2001
2+
From: Frans de Jonge <[email protected]>
3+
Date: Sun, 15 Sep 2019 19:58:24 +0200
4+
Subject: [PATCH] Use LDFLAGS_FOR_BUILD for cross-compilation
5+
6+
Otherwise the regular LDFLAGS can wreak havoc.
7+
---
8+
gen.tab/Makefile.am | 1 +
9+
1 file changed, 1 insertion(+)
10+
11+
diff --git a/gen.tab/Makefile.am b/gen.tab/Makefile.am
12+
index fe3c80f..014c646 100644
13+
--- a/gen.tab/Makefile.am
14+
+++ b/gen.tab/Makefile.am
15+
@@ -26,6 +26,7 @@ gen_brackets_type_tab_CPPFLAGS = $(AM_CPPFLAGS)
16+
CFLAGS_FOR_BUILD += -DHAVE_CONFIG_H -I$(top_builddir) -I$(top_builddir)/lib -I$(top_srcdir)/lib
17+
CC = $(CC_FOR_BUILD)
18+
CFLAGS = $(CFLAGS_FOR_BUILD)
19+
+LDFLAGS = $(LDFLAGS_FOR_BUILD)
20+
21+
CLEANFILES = $(EXTRA_PROGRAMS)
22+
DISTCLEANFILES =

thirdparty/leptonica/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ else()
3232
set(PATCH_CMD "")
3333
endif()
3434

35+
# We apparently need a rebuild of the configure on macOS (https://github.com/koreader/koreader/issues/4448#issuecomment-522363325)
36+
set(RECONF_CMD sh -c "autoreconf -fi")
37+
3538
include(ExternalProject)
3639
ExternalProject_Add(
3740
${PROJECT_NAME}
3841
DOWNLOAD_COMMAND ${CMAKE_COMMAND} -P ${GIT_CLONE_SCRIPT_FILENAME}
39-
PATCH_COMMAND ${PATCH_CMD}
42+
PATCH_COMMAND ${PATCH_CMD} COMMAND ${RECONF_CMD}
4043
CONFIGURE_COMMAND ""
4144
# skip build and install, libk2pdfopt will build it
4245
BUILD_COMMAND ""

0 commit comments

Comments
 (0)