2 #===============================================================================
3 # Author: Pete Goodliffe
4 # Copyright: (c) Copyright 2009 Pete Goodliffe
5 # Licence: Please feel free to use this, with attribution
6 #===============================================================================
8 #VERSION_IOS="${MAJOR_VERSION}.${MINOR_VERSION}.${RELEASE_NUMBER}.${BUILD_NUMBER}"
12 OUTDIR=$PWD/out/darwin
16 LIPO="xcrun -sdk iphoneos lipo"
20 FRAMEWORK_NAME=iotivity-csdk
22 FRAMEWORK_CURRENT_VERSION=${VERSION_IOS}
23 FRAMEWORK_COMPATIBILITY_VERSION=${VERSION_IOS}
24 FRAMEWORKDIR=out/darwin
26 FRAMEWORK_BUNDLE=$FRAMEWORKDIR/$FRAMEWORK_NAME.framework
27 rm -rf $FRAMEWORK_BUNDLE
29 echo "Framework: Setting up directories..."
30 mkdir -p $FRAMEWORK_BUNDLE
31 mkdir -p $FRAMEWORK_BUNDLE/Versions
32 mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION
33 mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Resources
34 mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Headers
35 mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Documentation
37 echo "Framework: Creating symlinks..."
38 ln -s $FRAMEWORK_VERSION $FRAMEWORK_BUNDLE/Versions/Current
39 ln -s Versions/Current/Headers $FRAMEWORK_BUNDLE/Headers
40 ln -s Versions/Current/Resources $FRAMEWORK_BUNDLE/Resources
41 ln -s Versions/Current/Documentation $FRAMEWORK_BUNDLE/Documentation
42 ln -s Versions/Current/$FRAMEWORK_NAME $FRAMEWORK_BUNDLE/$FRAMEWORK_NAME
43 FRAMEWORK_INSTALL_NAME=$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/$FRAMEWORK_NAME
54 echo "Extracting libraries..."
62 echo "extracting $ARCH"
63 mkdir $OUTDIR/objs/$ARCH
64 lipolite $OUTDIR/objs/$ARCH "$OUTDIR/$ARCH/$BUILD/$LIBCOAP.a"
65 lipolite $OUTDIR/objs/$ARCH "$OUTDIR/$ARCH/$BUILD/$SDKLIB.a"
66 ar -r $OUTDIR/objs/$ARCH.a $OUTDIR/objs/$ARCH/*.o
70 echo "Lipoing library into $FRAMEWORK_INSTALL_NAME..."
71 cp $OUTDIR/objs/x86_64.a "$FRAMEWORK_INSTALL_NAME"
75 # -arch armv7 "$OUTDIR/objs/armv7.a" \
76 # -arch armv7s "$OUTDIR/objs/armv7s.a" \
77 # -arch arm64 "$OUTDIR/objs/arm64.a" \
78 # -arch i386 "$OUTDIR/objs/i386.a" \
79 # -arch x86_64 "$OUTDIR/objs/x86_64.a" \
80 # -output "$FRAMEWORK_INSTALL_NAME" \
81 # || abort "Lipo $1 failed"
84 find $OUTDIR/objs -name "*.o" | xargs rm
86 echo "Framework: Copying includes..."
87 cp -r resource/csdk/stack/include/*.h $FRAMEWORK_BUNDLE/Headers
88 cp -r resource/c_common/ocrandom/include/*.h $FRAMEWORK_BUNDLE/Headers
89 cp -r resource/c_common/oic_malloc/include/*.h $FRAMEWORK_BUNDLE/Headers
91 echo "Framework: Creating plist..."
92 cat > $FRAMEWORK_BUNDLE/Resources/Info.plist <<EOF
93 <?xml version="1.0" encoding="UTF-8"?>
94 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
97 <key>CFBundleDevelopmentRegion</key>
98 <string>English</string>
99 <key>CFBundleExecutable</key>
100 <string>${FRAMEWORK_NAME}</string>
101 <key>CFBundleIdentifier</key>
102 <string>org.iotivity</string>
103 <key>CFBundleInfoDictionaryVersion</key>
105 <key>CFBundlePackageType</key>
106 <string>FMWK</string>
107 <key>CFBundleSignature</key>
108 <string>????</string>
109 <key>CFBundleVersion</key>
110 <string>${FRAMEWORK_CURRENT_VERSION}</string>
116 echo " ================================================================="