How to build GLib for iOS

前端 未结 1 413
时光取名叫无心
时光取名叫无心 2020-12-03 09:02

I want to use lasem in my iOS App, but compiling lasem needs glib. How to build it?

I download glib-2.37.4 from https://git.gnome.org/browse/glib/refs/tags. I then u

相关标签:
1条回答
  • 2020-12-03 10:04

    Given that you have built libffi and proxy-libintl for iOS, and installed both those to the same PREFIX as this script uses, this will build GLib for you:

    #! /bin/bash
    
    export MINVER="5.1" # the minimum supported OS version
    export SDKVER="5.1" # SDK version
    export PREFIX="$HOME/built-for-ios" # where the library goes
    
    export DEVROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"
    export SDKROOT="${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk"
    export PKG_CONFIG_LIBDIR="${PREFIX}/lib/pkgconfig:${SDKROOT}/usr/lib/pkgconfig"
    export COMMON_FLAGS="-arch armv7 -isysroot ${SDKROOT}"
    export CPPFLAGS="-I${PREFIX}/include ${COMMON_FLAGS} -miphoneos-version-min=${MINVER}"
    export CFLAGS="${CPPFLAGS}"
    export LDFLAGS="-L${PREFIX}/lib ${COMMON_FLAGS} -Wl,-iphoneos_version_min,${MINVER}"
    export CC="${DEVROOT}/usr/bin/gcc"
    export CXX="${DEVROOT}/usr/bin/g++"
    export OBJC="${CC}"
    export LD="${CC}"
    
    [ ! -d "${PREFIX}" ] && mkdir -p "${PREFIX}"
    ./configure --prefix="${PREFIX}" \
    --build="x86_64-apple-darwin" \
    --host="arm-apple-darwin" \
    --enable-static \
    --disable-shared \
    glib_cv_stack_grows=no \
    glib_cv_uscore=no \
    ac_cv_func_posix_getgrgid_r=yes \
    ac_cv_func_posix_getpwuid_r=yes
    
    0 讨论(0)
提交回复
热议问题