Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
use system libiconv on ios/tvos, fixes #230
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Jan 8, 2020
2 parents 7d97477 + dfdadf6 commit ab0ecc6
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 501 deletions.
149 changes: 77 additions & 72 deletions build/ios-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,69 +25,69 @@ get_library_name() {
4) echo "gnutls" ;;
5) echo "lame" ;;
6) echo "libass" ;;
7) echo "libiconv" ;;
8) echo "libtheora" ;;
9) echo "libvorbis" ;;
10) echo "libvpx" ;;
11) echo "libwebp" ;;
12) echo "libxml2" ;;
13) echo "opencore-amr" ;;
14) echo "shine" ;;
15) echo "speex" ;;
16) echo "wavpack" ;;
17) echo "kvazaar" ;;
18) echo "x264" ;;
19) echo "xvidcore" ;;
20) echo "x265" ;;
21) echo "libvidstab" ;;
22) echo "libilbc" ;;
23) echo "opus" ;;
24) echo "snappy" ;;
25) echo "soxr" ;;
26) echo "libaom" ;;
27) echo "chromaprint" ;;
28) echo "twolame" ;;
29) echo "sdl" ;;
30) echo "tesseract" ;;
31) echo "openh264" ;;
32) echo "giflib" ;;
33) echo "jpeg" ;;
34) echo "libogg" ;;
35) echo "libpng" ;;
36) echo "libuuid" ;;
37) echo "nettle" ;;
38) echo "tiff" ;;
39) echo "expat" ;;
40) echo "libsndfile" ;;
41) echo "leptonica" ;;
42) echo "ios-zlib" ;;
43) echo "ios-audiotoolbox" ;;
44) echo "ios-coreimage" ;;
45) echo "ios-bzip2" ;;
46) echo "ios-videotoolbox" ;;
47) echo "ios-avfoundation" ;;
7) echo "libtheora" ;;
8) echo "libvorbis" ;;
9) echo "libvpx" ;;
10) echo "libwebp" ;;
11) echo "libxml2" ;;
12) echo "opencore-amr" ;;
13) echo "shine" ;;
14) echo "speex" ;;
15) echo "wavpack" ;;
16) echo "kvazaar" ;;
17) echo "x264" ;;
18) echo "xvidcore" ;;
19) echo "x265" ;;
20) echo "libvidstab" ;;
21) echo "libilbc" ;;
22) echo "opus" ;;
23) echo "snappy" ;;
24) echo "soxr" ;;
25) echo "libaom" ;;
26) echo "chromaprint" ;;
27) echo "twolame" ;;
28) echo "sdl" ;;
29) echo "tesseract" ;;
30) echo "openh264" ;;
31) echo "giflib" ;;
32) echo "jpeg" ;;
33) echo "libogg" ;;
34) echo "libpng" ;;
35) echo "libuuid" ;;
36) echo "nettle" ;;
37) echo "tiff" ;;
38) echo "expat" ;;
39) echo "libsndfile" ;;
40) echo "leptonica" ;;
41) echo "ios-zlib" ;;
42) echo "ios-audiotoolbox" ;;
43) echo "ios-coreimage" ;;
44) echo "ios-bzip2" ;;
45) echo "ios-videotoolbox" ;;
46) echo "ios-avfoundation" ;;
47) echo "ios-libiconv" ;;
esac
}

get_package_config_file_name() {
case $1 in
1) echo "freetype2" ;;
5) echo "libmp3lame" ;;
8) echo "theora" ;;
9) echo "vorbis" ;;
10) echo "vpx" ;;
12) echo "libxml-2.0" ;;
13) echo "opencore-amrnb" ;;
21) echo "vidstab" ;;
26) echo "aom" ;;
27) echo "libchromaprint" ;;
29) echo "sdl2" ;;
33) echo "libjpeg" ;;
34) echo "ogg" ;;
36) echo "uuid" ;;
38) echo "libtiff-4" ;;
40) echo "sndfile" ;;
41) echo "lept" ;;
7) echo "theora" ;;
8) echo "vorbis" ;;
9) echo "vpx" ;;
11) echo "libxml-2.0" ;;
12) echo "opencore-amrnb" ;;
20) echo "vidstab" ;;
25) echo "aom" ;;
26) echo "libchromaprint" ;;
28) echo "sdl2" ;;
32) echo "libjpeg" ;;
33) echo "ogg" ;;
35) echo "uuid" ;;
37) echo "libtiff-4" ;;
39) echo "sndfile" ;;
40) echo "lept" ;;
*) echo $(get_library_name $1)
esac
}
Expand All @@ -100,20 +100,20 @@ get_static_archive_name() {
case $1 in
5) echo "libmp3lame.a" ;;
6) echo "libass.a" ;;
10) echo "libvpx.a" ;;
12) echo "libxml2.a" ;;
21) echo "libvidstab.a" ;;
22) echo "libilbc.a" ;;
26) echo "libaom.a" ;;
28) echo "libtwolame.a" ;;
29) echo "libSDL2.a" ;;
30) echo "libtesseract.a" ;;
32) echo "libgif.a" ;;
34) echo "libogg.a" ;;
35) echo "libpng.a" ;;
36) echo "libuuid.a" ;;
40) echo "libsndfile.a" ;;
41) echo "liblept.a" ;;
9) echo "libvpx.a" ;;
11) echo "libxml2.a" ;;
20) echo "libvidstab.a" ;;
21) echo "libilbc.a" ;;
25) echo "libaom.a" ;;
27) echo "libtwolame.a" ;;
28) echo "libSDL2.a" ;;
29) echo "libtesseract.a" ;;
31) echo "libgif.a" ;;
33) echo "libogg.a" ;;
34) echo "libpng.a" ;;
35) echo "libuuid.a" ;;
39) echo "libsndfile.a" ;;
40) echo "liblept.a" ;;
*) echo lib$(get_library_name $1).a
esac
}
Expand Down Expand Up @@ -615,10 +615,10 @@ EOF
}

create_libiconv_package_config() {
local LIB_ICONV_VERSION="$1"
local LIB_ICONV_VERSION=$(grep '_LIBICONV_VERSION' ${SDK_PATH}/usr/include/iconv.h | grep -Eo '0x.*' | grep -Eo '.* ')

cat > "${INSTALL_PKG_CONFIG_DIR}/libiconv.pc" << EOF
prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/libiconv
prefix=${SDK_PATH}/usr
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Expand Down Expand Up @@ -1067,6 +1067,7 @@ set_toolchain_clang_paths() {
export INSTALL_PKG_CONFIG_DIR="${BASEDIR}/prebuilt/$(get_target_build_directory)/pkgconfig"
export ZLIB_PACKAGE_CONFIG_PATH="${INSTALL_PKG_CONFIG_DIR}/zlib.pc"
export BZIP2_PACKAGE_CONFIG_PATH="${INSTALL_PKG_CONFIG_DIR}/bzip2.pc"
export LIB_ICONV_PACKAGE_CONFIG_PATH="${INSTALL_PKG_CONFIG_DIR}/libiconv.pc"

if [ ! -d ${INSTALL_PKG_CONFIG_DIR} ]; then
mkdir -p ${INSTALL_PKG_CONFIG_DIR}
Expand All @@ -1076,6 +1077,10 @@ set_toolchain_clang_paths() {
create_zlib_package_config
fi

if [ ! -f ${LIB_ICONV_PACKAGE_CONFIG_PATH} ]; then
create_libiconv_package_config
fi

if [ ! -f ${BZIP2_PACKAGE_CONFIG_PATH} ]; then
create_bzip2_package_config
fi
Expand Down
26 changes: 12 additions & 14 deletions build/ios-ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ do
FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libass)"
CONFIGURE_POSTFIX+=" --enable-libass"
;;
libiconv)
FFMPEG_CFLAGS+=" $(pkg-config --cflags libiconv)"
FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libiconv)"
CONFIGURE_POSTFIX+=" --enable-iconv"
;;
libilbc)
FFMPEG_CFLAGS+=" $(pkg-config --cflags libilbc)"
FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libilbc)"
Expand Down Expand Up @@ -315,28 +310,31 @@ do
*-zlib)
CONFIGURE_POSTFIX+=" --enable-zlib"
;;
*-libiconv)
CONFIGURE_POSTFIX+=" --enable-iconv"
;;
esac
;;
esac
else

# THE FOLLOWING LIBRARIES SHOULD BE EXPLICITLY DISABLED TO PREVENT AUTODETECT
if [[ ${library} -eq 8 ]]; then
CONFIGURE_POSTFIX+=" --disable-iconv"
elif [[ ${library} -eq 30 ]]; then
if [[ ${library} -eq 29 ]]; then
CONFIGURE_POSTFIX+=" --disable-sdl2"
elif [[ ${library} -eq 43 ]]; then
elif [[ ${library} -eq 42 ]]; then
CONFIGURE_POSTFIX+=" --disable-zlib"
elif [[ ${library} -eq 44 ]]; then
elif [[ ${library} -eq 43 ]]; then
CONFIGURE_POSTFIX+=" --disable-audiotoolbox"
elif [[ ${library} -eq 45 ]]; then
elif [[ ${library} -eq 44 ]]; then
CONFIGURE_POSTFIX+=" --disable-coreimage"
elif [[ ${library} -eq 46 ]]; then
elif [[ ${library} -eq 45 ]]; then
CONFIGURE_POSTFIX+=" --disable-bzlib"
elif [[ ${library} -eq 47 ]]; then
elif [[ ${library} -eq 46 ]]; then
CONFIGURE_POSTFIX+=" --disable-videotoolbox"
elif [[ ${library} -eq 48 ]]; then
elif [[ ${library} -eq 47 ]]; then
CONFIGURE_POSTFIX+=" --disable-avfoundation"
elif [[ ${library} -eq 48 ]]; then
CONFIGURE_POSTFIX+=" --disable-iconv"
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion build/ios-fontconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fi
./configure \
--prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \
--with-pic \
--with-libiconv-prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/libiconv \
--with-libiconv-prefix=${SDK_PATH}/usr \
--with-expat=${BASEDIR}/prebuilt/$(get_target_build_directory)/expat \
--without-libintl-prefix \
--enable-static \
Expand Down
4 changes: 2 additions & 2 deletions build/ios-gnutls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ COMMON_CFLAGS=$(get_cflags ${LIB_NAME})
COMMON_CXXFLAGS=$(get_cxxflags ${LIB_NAME})
COMMON_LDFLAGS=$(get_ldflags ${LIB_NAME})

export CFLAGS="${COMMON_CFLAGS} -I${BASEDIR}/prebuilt/$(get_target_build_directory)/libiconv/include"
export CFLAGS="${COMMON_CFLAGS} -I${SDK_PATH}/usr/include"
export CXXFLAGS="${COMMON_CXXFLAGS}"
export LDFLAGS="${COMMON_LDFLAGS} -L${BASEDIR}/prebuilt/$(get_target_build_directory)/libiconv/lib"
export LDFLAGS="${COMMON_LDFLAGS} -L${SDK_PATH}/usr/lib"

export NETTLE_CFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/nettle/include"
export NETTLE_LIBS="-L${BASEDIR}/prebuilt/$(get_target_build_directory)/nettle/lib -lnettle -L${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/lib -lgmp"
Expand Down
2 changes: 1 addition & 1 deletion build/ios-lame.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
--prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \
--with-pic \
--with-sysroot=${SDK_PATH} \
--with-libiconv-prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/libiconv \
--with-libiconv-prefix=${SDK_PATH}/usr \
--enable-static \
--disable-shared \
--disable-fast-install \
Expand Down
64 changes: 0 additions & 64 deletions build/ios-libiconv.sh

This file was deleted.

2 changes: 2 additions & 0 deletions build/ios-libvorbis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ ${SED_INLINE} 's/-force_cpusubtype_ALL//g' ${BASEDIR}/src/${LIB_NAME}/configure

PKG_CONFIG= ./configure \
--prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \
--with-ogg-includes=${BASEDIR}/prebuilt/$(get_target_build_directory)/libogg/include \
--with-ogg-libraries=${BASEDIR}/prebuilt/$(get_target_build_directory)/libogg/lib \
--with-pic \
--with-sysroot=${SDK_PATH} \
--enable-static \
Expand Down
2 changes: 1 addition & 1 deletion build/ios-libxml2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ autoreconf_library ${LIB_NAME}
--with-pic \
--with-sysroot=${SDK_PATH} \
--with-zlib \
--with-iconv=${BASEDIR}/prebuilt/$(get_target_build_directory)/libiconv \
--with-iconv=${SDK_PATH}/usr \
--with-sax1 \
--without-python \
--without-debug \
Expand Down
2 changes: 1 addition & 1 deletion build/ios-mobile-ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if [[ ${RECONF_mobile_ffmpeg} -eq 1 ]]; then
fi

VIDEOTOOLBOX_SUPPORT_FLAG=""
if [[ ${47} -eq 1 ]]; then
if [[ ${46} -eq 1 ]]; then
VIDEOTOOLBOX_SUPPORT_FLAG="--enable-videotoolbox"
fi

Expand Down
Loading

0 comments on commit ab0ecc6

Please sign in to comment.