我想编译libical并将其添加到我的Xcode项目中。
我已经阅读了自述文件,并在Terminal.app中运行了以下命令:
./configure和
./configure --prefix=/proj/local/我是否应该将编译后的.a文件放到可以拖放到项目中的某个位置?
发布于 2012-09-27 10:07:41
我是最初创建这些构建脚本的人...
http://code.google.com/p/mwiphonesdk/source/browse/trunk/iMADE/PrepTasks/05+Event+Calendar/Packers+Schedule/libical/build+scripts/
我现在已经更新了脚本,可以使用最新的iOS 6/Xcode4.5工具集。这是非常不同的,我已经将它设置为使用Clang。我尽我所能使这个脚本适应新的SDK版本。
http://www.smallsharptools.com/downloads/libical/
这些脚本应该放在libical文件夹的根目录下,并从那里运行。主脚本运行其他两个脚本来构建armv7和armv7s二进制文件,然后使用xcrun运行,将这些二进制文件组合成可用于iOS项目的胖二进制文件。
有一些重构可以很容易地完成,但我已经在上面花费了大量的时间。我希望这能帮助你利用这个库。
#!/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"发布于 2011-12-06 10:27:42
你要做的就是为模拟器和手机编译你的库。
1.创建两个新目标,一个用于iphone,另一个用于模拟器
2.compile
3.把它们和脂质结合起来。
此链接将为您提供所有具体的详细信息。How to make universal static libraries
发布于 2011-12-07 03:14:47
这个问题的其他答案对libical没有特别的帮助,因为它的配置脚本很挑剔。你需要有大量的环境变量。这些脚本已经为libical解决了所有这些问题。
http://code.google.com/p/mwiphonesdk/source/browse/trunk/iMADE/PrepTasks/05+Event+Calendar/Packers+Schedule/libical/build+scripts/
下载上述脚本,调整build_(platform).sh以找到正确的编译器和SDK文件夹。这将根据您的目标和您的Xcode开发人员工具的更新程度而变化。找到正确的值应该很容易,只需在相同的位置查找它们在系统上的调用。
输出将是一个带有模拟器和设备的二进制文件的胖".a“文件。
在这些文件消失的情况下,我收集了以下真正重要的文件(build_arm.sh,交叉编译):
#!/bin/sh
# Created by Robert Carlsen on 15.07.2009.
# build an arm / i386 / x64 lib of standard linux project
#
# adopted from: http://latenitesoft.blogspot.com/2008/10/iphone-programming-tips-building-unix.html
#
# copied from: http://robertcarlsen.net/2009/07/15/cross-compiling-for-iphone-dev-884
#
# configured for libical
#
# Note:
# To run with the iPhone the assembly just be a Universal binary (FAT) with i386 arch for the simulator
# and arm arch for the iPhone hardware which has the arm processor.
# set the prefix
PREFIX=${HOME}/Library/libical
OUTPUTDIR=../libical-build
export ARCH=armv6
export GCCARCH=arm-apple-darwin9
export GCCVERSION=4.2.1
# Select the desired iPhone SDK
export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS3.1.2.sdk
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"
# Set up relevant environment variables
export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/$GCCARCH/$GCCVERSION/include/ -I$SDKROOT/usr/include/"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
export CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L$SDKROOT/usr/lib/ "
CC=$DEVROOT/usr/bin/$GCCARCH-gcc-$GCCVERSION
CXX=$DEVROOT/usr/bin/$GCCARCH-g++-$GCCVERSION
HOST=arm-apple-darwin
if [ ! -f $CC ]
then
echo "C Compiler not found! - $CC"
exit
fi
if [ ! -f $CXX ]
then
echo "C++ Compiler not found! - $CXX"
exit
fi
# TODO: add custom flags as necessary for package
./configure --prefix=$PREFIX --disable-dependency-tracking CXX=$CXX CC=$CC LD=$DEVROOT/usr/bin/ld --host=$HOST
make -j4
# copy the files to the arch folder
mkdir -p $OUTPUTDIR
mkdir -p $OUTPUTDIR/$ARCH
cp `find . -name \*.a` $OUTPUTDIR/$ARCH/
lipo -info $OUTPUTDIR/$ARCH/*.a
echo $ARCH DONE
echo "See $OUTPUTDIR"https://stackoverflow.com/questions/7197955
复制相似问题