Compiling libical

前端 未结 4 1622
故里飘歌
故里飘歌 2020-12-29 17:42

I would like to compile libical and add it to my Xcode project.

I have read the README file and run the following commands in Terminal.app:

./configu         


        
4条回答
  •  星月不相逢
    2020-12-29 17:49

    I am the person who originally created those build scripts located here...

    http://code.google.com/p/mwiphonesdk/source/browse/trunk/iMADE/PrepTasks/05+Event+Calendar/Packers+Schedule/libical/build+scripts/

    I have now updated the scripts to work with the latest iOS 6/Xcode 4.5 toolset. It is quite different and I have set it to use Clang. I did what I could to make this script adapt to new SDK releases.

    http://www.smallsharptools.com/downloads/libical/

    The scripts should be placed in the root of the libical folder and run from there. The main script runs the other 2 scripts to build the armv7 and armv7s binaries and then uses xcrun to run lipo for iphoneos to combine these binaries into a fat binary which can be used for an iOS project.

    There are some refactorings which could easily be done but I have already spent a ton of time on it already. I hope this helps you make use of the library.

    #!/bin/sh
    
    # SEE: http://www.smallsharptools.com/downloads/libical/
    
    PATH="`xcode-select -print-path`/usr/bin:/usr/bin:/bin"
    
    # set the prefix
    PREFIX=${HOME}/Library/libical
    OUTPUTDIR=../libical-build
    
    export ARCH=armv7
    
    # Select the desired iPhone SDK
    export SDKVER="6.0"
    export DEVROOT=`xcode-select --print-path`
    export SDKROOT=$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk
    export IOSROOT=$DEVROOT/Platforms/iPhoneOS.platform
    
    # Includes
    # find $DEVROOT -type d -name include|grep -i iphone|grep -i arm-apple-darwin|grep -vi install-tools|grep -vi simulator
    
    # $SDKROOT/usr/include
    # $DEVROOT/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include
    
    if [ ! -d $DEVROOT ]
    then
            echo "Developer Root not found! - $DEVROOT"
            exit
    fi
    
    echo "DEVROOT = $DEVROOT"
    
    if [ ! -d $SDKROOT ]
    then
            echo "SDK Root not found! - $SDKROOT"
            exit
    fi
    
    echo "SDKROOT = $SDKROOT"
    
    if [ ! -d $IOSROOT ]
    then
            echo "iOS Root not found! - $IOSROOT"
            exit
    fi
    
    echo "IOSROOT = $IOSROOT"
    
    # finding ld
    # find $DEVROOT -type f -name ld|grep -i iphone
    
    # Set up relevant environment variables 
    export CPPFLAGS="-arch $ARCH -I$SDKROOT/usr/include -I$IOSROOT/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include"
    export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
    export CXXFLAGS="$CFLAGS"
    export LDFLAGS="-L$SDKROOT/usr/lib/ -arch $ARCH"
    
    export CLANG=$DEVROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    
    #export CC=$IOSROOT/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
    #export CXX=$IOSROOT/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2
    
    export CC=$CLANG
    export CXX=$CLANG
    export LD=$IOSROOT/Developer/usr/bin/ld
    export AR=$IOSROOT/Developer/usr/bin/ar 
    export AS=$IOSROOT/Developer/usr/bin/as 
    export LIBTOOL=$IOSROOT/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool 
    export STRIP=$IOSROOT/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip 
    export RANLIB=$IOSROOT/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib
    
    HOST=arm-apple-darwin10
    
    if [ ! -f $CC ]
    then
            echo "C Compiler not found! - $CC"
            exit
    fi
    
    if [ ! -f $CXX ]
    then
            echo "C++ Compiler not found! - $CXX"
            exit
    fi
    
    if [ ! -f $LD ]
    then
            echo "Linker not found! - $LD"
            exit
    fi
    
    if [ -d $OUTPUTDIR/$ARCH ]
    then
            rm -rf $OUTPUTDIR/$ARCH
    fi
    
    find . -name \*.a -exec rm {} \;
    
    make clean
    
    ./configure --prefix=$PREFIX --disable-dependency-tracking --host $HOST CXX=$CXX CC=$CC LD=$LD AR=$AR AS=$AS LIBTOOL=$LIBTOOL STRIP=$STRIP RANLIB=$RANLIB
    
    make -j4
    
    # copy the files to the arch folder
    
    mkdir -p $OUTPUTDIR
    mkdir -p $OUTPUTDIR/$ARCH
    
    cp `find . -name \*.a` $OUTPUTDIR/$ARCH/
    
    xcrun -sdk iphoneos lipo -info $OUTPUTDIR/$ARCH/*.a
    
    echo $ARCH DONE
    
    echo "See $OUTPUTDIR"
    

提交回复
热议问题