构建iconv

2024年6月19日 0 By Majjcom

Android

ndk版本在25左右构建通过

ICONV_PREFIX=/usr/local/iconv-android
ANDROID_NDK=/path/to/ndk/xx.xxx.xxxxxx
ANDROID_ARCH=aarch64
ANDROID_API=21
ANDROID_HOST=$ANDROID_ARCH-linux-android$ANDROID_API
ANDROID_SYSROOT=$ANDROID_NDK/toolchains/llvm/prebuilt/windows-x86_64/sysroot

PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/windows-x86_64/bin:$PATH

./configure --host=$ANDROID_HOST \
--with-sysroot=$ANDROID_SYSROOT \
--prefix=$ICONV_PREFIX \
--enable-static \
--disable-shared \
CC=$ANDROID_HOST-clang \
CXX=$ANDROID_HOST-clang++

Windows

使用MSYS2环境

WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt'
WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\'
INCLUDE="${WindowsCrtIncludeDir};$INCLUDE"
LIB="${WindowsCrtLibDir}x64;$LIB"

WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\'
WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\'
INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE"
LIB="${WindowsSdkLibDir}x64;$LIB"
VSINSTALLDIR='D:\Program Files\Microsoft Visual Studio\2022\Professional'
VCINSTALLDIR="${VSINSTALLDIR}"'\VC'
PATH=cygpath -u "${VCINSTALLDIR}"/bin/amd64:"$PATH"
INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}"
LIB="${VCINSTALLDIR}"'\lib\amd64;'"${LIB}"

#export INCLUDE LIB

win32_target=_WIN32_WINNT_WIN8
ICONV_PREFIX=/usr/local/libiconv

./configure \
--host=x86_64-w64-mingw32 \
--prefix=$ICONV_PREFIX \
--enable-static \
--disable-shared \
CC="/path/to/build-aux/compile cl -nologo" \
CFLAGS="-MT" \
CXX="/path/to/build-aux/compile cl -nologo" \
CXXFLAGS="-MT" \
CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc32/include" \
LDFLAGS="-L$ICONV_PREFIX/lib" \
LD="link" \
NM="dumpbin -symbols" \
STRIP=":" \
AR="/path/to/build-aux/ar-lib lib" \
RANLIB=":"