Skip to content

Commit

Permalink
[fix] patch libtool version < 2.4.6 to generate lib without version s…
Browse files Browse the repository at this point in the history
…uffix for Android
  • Loading branch information
chrox authored and Frenzie committed Jun 7, 2017
1 parent 80ce401 commit 48a2ff5
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Makefile.third
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ $(GIF_LIB): $(THIRDPARTY_DIR)/giflib/CMakeLists.txt
cd $(GIF_BUILD_DIR) && \
$(CMAKE) -DCC="$(CC) $(if $(ANDROID),-DS_IREAD=S_IRUSR -DS_IWRITE=S_IWUSR,)" \
-DCFLAGS="$(CFLAGS)" -DLDFLAGS="$(LDFLAGS)" -DCHOST="$(CHOST)" \
$(if $(ANDROID),-DIS_ANDROID:BOOL=on,) \
$(CURDIR)/thirdparty/giflib && \
$(MAKE)
cp -fL $(GIF_DIR)/lib/$(notdir $(GIF_LIB)) $@
Expand Down Expand Up @@ -221,7 +220,6 @@ $(LIBGETTEXT): $(LIBICONV) $(THIRDPARTY_DIR)/gettext/CMakeLists.txt
cd $(GETTEXT_BUILD_DIR) && \
$(CMAKE) -DCC="$(CC) -std=gnu89" -DLIBICONV_PREFIX=$(LIBICONV_DIR) \
-DCHOST_OPTS="$(if $(EMULATE_READER),,--host=$(if $(ANDROID),arm-linux,$(CHOST)))" \
$(if $(ANDROID),-DIS_ANDROID:BOOL=on,) \
$(if $(ANDROID),-DNDK=$(NDK),) \
$(if $(ANDROID),-DNDKABI=$(NDKABI),) \
$(CURDIR)/thirdparty/gettext && \
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/czmq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ set(CFG_ENV_VAR "CC=\"${CC}\" LDFLAGS=\"${LDFLAGS}\" CFLAGS=\"-Wno-error ${CFLAG
set(CFG_OPTS "-q --prefix=${BINARY_DIR} --with-gnu-ld --with-libzmq=${ZMQ_DIR} --disable-static --enable-shared --host=${HOST}")
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")

if($ENV{ANDROID})
set(CFG_CMD "${CFG_CMD} && ${ISED} 's|\${shared_ext}\\\\\$major|\${shared_ext}|' libtool")
endif()

# hack to remove hardcoded rpath
set(SED_CMD1 sh -c "${ISED} 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"\"|g' libtool")
set(SED_CMD2 sh -c "${ISED} 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool")
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/freetype2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ set(CFG_ENV_VAR "CC=\"${CC}\" CXX=\"${CXX}\" CFLAGS=\"${CFLAGS}\" CXXFLAGS=\"${C
set(CFG_OPTS "-q --prefix=${BINARY_DIR} --disable-static --enable-shared --with-zlib=no --with-bzip2=no --with-png=no --with-harfbuzz=no --host=\"${CHOST}\"")
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")

if($ENV{ANDROID})
set(CFG_CMD "${CFG_CMD} && ${ISED} 's|\${shared_ext}\\\\\$major|\${shared_ext}|' libtool")
endif()

ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME
https://gitlab.com/koreader/freetype2.git
Expand Down
5 changes: 3 additions & 2 deletions thirdparty/gettext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ ep_get_source_dir(SOURCE_DIR)
ep_get_binary_dir(BINARY_DIR)

set(CFG_ENV_VAR "CC=\"${CC}\"")
if(${IS_ANDROID})
if($ENV{ANDROID})
# workaround of 'undefined reference to getdtablesize' for NDK-r11c
set(CFG_ENV_VAR "${CFG_ENV_VAR} LDFLAGS=-lc LIBS=${NDK}/platforms/android-${NDKABI}/arch-arm/usr/lib/libc.a")
endif()
set(CFG_OPTS "--with-threads=none --disable-acl --disable-curses --disable-openmp --disable-native-java --disable-java")
set(CFG_OPTS "${CFG_OPTS} --prefix=${BINARY_DIR} --with-libiconv-prefix=${LIBICONV_PREFIX}")
set(CFG_OPTS "${CFG_OPTS} --enable-shared=false --enable-static=true ${CHOST_OPTS}")
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")

# remove HAVE_PWD_H for android build
if(${IS_ANDROID})
if($ENV{ANDROID})
set(CFG_CMD "${CFG_CMD} && ${ISED} \"s|#define HAVE_PWD_H 1||\" gettext-tools/config.h")
endif()

Expand Down
4 changes: 3 additions & 1 deletion thirdparty/giflib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ ep_get_binary_dir(BINARY_DIR)
set(CFG_ENV_VAR "CC=\"${CC}\" CFLAGS=\"${CFLAGS}\" LDFLAGS=\"${LDFLAGS}\" ")
set(CFG_OPTS "-q --prefix=${BINARY_DIR} --disable-static --enable-shared --host=\"${CHOST}\"")
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")

# use limits.h instead of stdint.h for android build
if(${IS_ANDROID})
if($ENV{ANDROID})
set(CFG_CMD "${CFG_CMD} && ${ISED} \"s|stdint.h|limits.h|g\" ${SOURCE_DIR}/lib/openbsd-reallocarray.c")
set(CFG_CMD "${CFG_CMD} && ${ISED} 's|\${shared_ext}\\\\\$major|\${shared_ext}|' libtool")
endif()

ko_write_gitclone_script(
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/libjpeg-turbo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ if(${WITHOUT_SIMD})
endif(${WITHOUT_SIMD})
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")

if($ENV{ANDROID})
set(CFG_CMD "${CFG_CMD} && ${ISED} 's|\${shared_ext}\\\\\$major|\${shared_ext}|' libtool")
endif()

ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME
https://github.com/libjpeg-turbo/libjpeg-turbo.git
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/libpng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ set(CFG_ENV_VAR "CC=\"${CC}\" CXX=\"${CXX}\" CPPFLAGS=\"${CPPFLAGS}\" LDFLAGS=\"
set(CFG_OPTS "-q --prefix=${BINARY_DIR} --disable-static --enable-shared --host=\"${CHOST}\"")
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")

if($ENV{ANDROID})
set(CFG_CMD "${CFG_CMD} && ${ISED} 's|\${shared_ext}\\\\\$major|\${shared_ext}|' libtool")
endif()

ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME
https://github.com/glennrp/libpng.git
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/libzmq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ endif(${LEGACY})
set(CFG_CMD sh -c "${CFG_ENV_VAR} ${SOURCE_DIR}/configure ${CFG_OPTS}")
set(PATCH_CMD sh -c "${ISED} \"s|-lstdc++||g\" libtool")

if($ENV{ANDROID})
set(PATCH_CMD "${PATCH_CMD} && ${ISED} 's|\${shared_ext}\\\\\$major|\${shared_ext}|' libtool")
endif()

set(FORCE_DYNAMLIB_VERSION sed -i "s|-avoid-version||g" src/Makefile.am)
set(SKIP_TEST sed -i "s|tests||g" Makefile.am)
# clear build dir every time so make install won't fail
Expand Down

0 comments on commit 48a2ff5

Please sign in to comment.