Skip to content

Commit

Permalink
macOS build fixes (#996)
Browse files Browse the repository at this point in the history
* Fix leptonica build on macOS
* Switch to the proper fribidi patch
Hopefully avoids sed shenanigans on macOS
  • Loading branch information
NiLuJe committed Oct 21, 2019
1 parent d9a685c commit a1fc4e4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion thirdparty/fribidi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"")
Expand Down
22 changes: 22 additions & 0 deletions thirdparty/fribidi/fribidi-pr115.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From 5855be47b2fe018363bd7dd1b64ea81f93c47f1e Mon Sep 17 00:00:00 2001
From: Frans de Jonge <fransdejonge@gmail.com>
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 =
5 changes: 4 additions & 1 deletion thirdparty/leptonica/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit a1fc4e4

Please sign in to comment.