Skip to content

Commit

Permalink
Added the script to make an iPhone Framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet authored and gabriel committed Aug 5, 2010
1 parent 943dacf commit 25c3a03
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 7 deletions.
22 changes: 22 additions & 0 deletions Project-IPhone/Framework.plist
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0
//EN" "http://www.apple.com/DTDs/PropertyList-
1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>MyLib</string>
<key>CFBundleIdentifier</key>
<string>com.MyLovelyDomain.MyLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
80 changes: 75 additions & 5 deletions Project-IPhone/GHUnitIPhone.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,17 @@
objects = {

/* Begin PBXAggregateTarget section */
006D780C120A93230053B72E /* Use "make 4_0" for iOS 4 builds */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 006D7811120A93330053B72E /* Build configuration list for PBXAggregateTarget "Use "make 4_0" for iOS 4 builds" */;
buildPhases = (
006D780B120A93230053B72E /* ShellScript */,
);
dependencies = (
);
name = "Use \"make 4_0\" for iOS 4 builds";
productName = "Use make 4_0 for iOS 4 builds";
};
00A953BF0FDA36FA006A80A6 /* CombineLibs (3.0) */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 00A953C50FDA36FA006A80A6 /* Build configuration list for PBXAggregateTarget "CombineLibs (3.0)" */;
Expand Down Expand Up @@ -471,6 +482,7 @@
003280F60FB0C712006350E7 /* GHUnitIPhoneTableViewDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GHUnitIPhoneTableViewDataSource.h; sourceTree = "<group>"; };
003280F70FB0C712006350E7 /* GHUnitIPhoneTableViewDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GHUnitIPhoneTableViewDataSource.m; sourceTree = "<group>"; };
006307B30F8E792F00C9602A /* Shared-iPhone.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Shared-iPhone.xcconfig"; sourceTree = "<group>"; };
006D7815120A93880053B72E /* iPhoneFramework.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = iPhoneFramework.sh; sourceTree = "<group>"; };
007730230F8D8DF400586577 /* GHAsyncTestCaseTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GHAsyncTestCaseTest.m; sourceTree = "<group>"; };
007730240F8D8DF400586577 /* GHRegisterTestCaseClassTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GHRegisterTestCaseClassTest.m; sourceTree = "<group>"; };
007730260F8D8DF400586577 /* GHSpecialTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GHSpecialTestCase.h; sourceTree = "<group>"; };
Expand All @@ -496,6 +508,7 @@
1D6058910D05DD3D006BFB54 /* Tests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tests.app; sourceTree = BUILT_PRODUCTS_DIR; };
32CA4F630368D1EE00C91783 /* Tests_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tests_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D9A2E33A11A6132C00F7FA51 /* Framework.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Framework.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -740,6 +753,7 @@
00A9533E0FDA2DD4006A80A6 /* Scripts */ = {
isa = PBXGroup;
children = (
006D7815120A93880053B72E /* iPhoneFramework.sh */,
00A9533F0FDA2DD4006A80A6 /* CombineLibs.sh */,
);
name = Scripts;
Expand Down Expand Up @@ -827,6 +841,7 @@
isa = PBXGroup;
children = (
8D1107310486CEB800E47090 /* Info.plist */,
D9A2E33A11A6132C00F7FA51 /* Framework.plist */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -998,7 +1013,14 @@
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GHUnitIPhone" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -1010,6 +1032,7 @@
0002874211814A1F00D74BBD /* GHUnitIPhone (Simulator-4.0) */,
0002877311814A5300D74BBD /* GHUnitIPhone (Device-4.0) */,
000287DE11814C2800D74BBD /* Tests (4.0) */,
006D780C120A93230053B72E /* Use "make 4_0" for iOS 4 builds */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -1048,6 +1071,19 @@
shellScript = ../Scripts/RunTests.sh;
showEnvVarsInLog = 0;
};
006D780B120A93230053B72E /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# shell script goes here\nexit 0";
};
00A953C40FDA36FA006A80A6 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -1059,7 +1095,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export FLAVOR=3_0\nsh ../Scripts/CombineLibs.sh";
shellScript = "export FLAVOR=3_0\nsh ../Scripts/CombineLibs.sh\nsh ../Scripts/iPhoneFramework.sh";
};
00C1A2F40F5286B100FCCA14 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -1306,59 +1342,84 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 00028740118149E700D74BBD /* iPhoneDevice-Debug-4_0.xcconfig */;
buildSettings = {
SDKROOT = iphoneos4.0;
SDKROOT = iphoneos4.1;
};
name = Debug;
};
000287A211814A5300D74BBD /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0002873E118149CE00D74BBD /* iPhoneDevice-Release-4_0.xcconfig */;
buildSettings = {
SDKROOT = iphoneos4.0;
SDKROOT = iphoneos4.1;
};
name = Release;
};
000287FE11814C2800D74BBD /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0002880E11814C8300D74BBD /* iPhoneTests-4_0.xcconfig */;
buildSettings = {
SDKROOT = iphoneos4.0;
SDKROOT = iphoneos4.1;
};
name = Debug;
};
000287FF11814C2800D74BBD /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 001ED7CE11728F780046CD38 /* iPhoneTests.xcconfig */;
buildSettings = {
SDKROOT = iphoneos4.0;
SDKROOT = iphoneos4.1;
};
name = Release;
};
006D780D120A93230053B72E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = "Use make 4_0 for iOS 4 builds";
};
name = Debug;
};
006D780E120A93230053B72E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
PRODUCT_NAME = "Use make 4_0 for iOS 4 builds";
ZERO_LINK = NO;
};
name = Release;
};
00A952F30FDA2B99006A80A6 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 001ED7AB11728BA30046CD38 /* iPhoneSimulator-Debug.xcconfig */;
buildSettings = {
ONLY_ACTIVE_ARCH = NO;
};
name = Debug;
};
00A952F40FDA2B99006A80A6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 001ED7AA11728A930046CD38 /* iPhoneSimulator-Release.xcconfig */;
buildSettings = {
ONLY_ACTIVE_ARCH = NO;
};
name = Release;
};
00A953250FDA2BB8006A80A6 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 001ED7AD11728CDE0046CD38 /* iPhoneDevice-Debug.xcconfig */;
buildSettings = {
ONLY_ACTIVE_ARCH = NO;
};
name = Debug;
};
00A953260FDA2BB8006A80A6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 001ED7AC11728C4C0046CD38 /* iPhoneDevice-Release.xcconfig */;
buildSettings = {
ONLY_ACTIVE_ARCH = NO;
};
name = Release;
};
Expand Down Expand Up @@ -1449,6 +1510,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
006D7811120A93330053B72E /* Build configuration list for PBXAggregateTarget "Use "make 4_0" for iOS 4 builds" */ = {
isa = XCConfigurationList;
buildConfigurations = (
006D780D120A93230053B72E /* Debug */,
006D780E120A93230053B72E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
00A952F20FDA2B99006A80A6 /* Build configuration list for PBXNativeTarget "GHUnitIPhone (Simulator-3.0)" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
1 change: 1 addition & 0 deletions Project-IPhone/Makefile
Expand Up @@ -9,6 +9,7 @@ default:
xcodebuild -target "GHUnitIPhone (Simulator-4.0)" -configuration Release build
xcodebuild -target "GHUnitIPhone (Device-4.0)" -configuration Release build
BUILD_DIR="build" BUILD_STYLE="Release" FLAVOR="4_0" GHUNIT_VERSION=$(version) sh ../Scripts/CombineLibs.sh
FLAVOR="4_0" sh ../Scripts/iPhoneFramework.sh

# If you need to clean a specific target/configuration: $(COMMAND) -target $(TARGET) -configuration DebugOrRelease -sdk $(SDK) clean
clean:
Expand Down
69 changes: 69 additions & 0 deletions Scripts/iPhoneFramework.sh
@@ -0,0 +1,69 @@
# Original Script by Pete Goodliffe
# from http://accu.org/index.php/journals/1594

# Modified by Juan Batiz-Benet to fit GHUnitIPhone

# Should define FLAVOR=2_1,2_1CL,3_0,3_0CL
# Define these to suit your nefarious purposes
FRAMEWORK_NAME=GHUnitIPhone${FLAVOR}
LIB_NAME=libGHUnitIPhone
FRAMEWORK_VERSION=A
FRAMEWORK_CURRENT_VERSION=${FLAVOR}
FRAMEWORK_COMPATIBILITY_VERSION=${FLAVOR}
BUILD_TYPE=Release

# Where we'll put the build framework.
# The script presumes we're in the project root
# directory. Xcode builds in "build" by default
FRAMEWORK_BUILD_PATH="build/Framework"

# Clean any existing framework that might be there
# already
echo "Framework: Cleaning framework..."
[ -d "$FRAMEWORK_BUILD_PATH" ] && \
rm -rf "$FRAMEWORK_BUILD_PATH"

# This is the full name of the framework we'll
# build
FRAMEWORK_DIR=$FRAMEWORK_BUILD_PATH/$FRAMEWORK_NAME.framework

# Build the canonical Framework bundle directory
# structure
echo "Framework: Setting up directories..."
mkdir -p $FRAMEWORK_DIR
mkdir -p $FRAMEWORK_DIR/Versions
mkdir -p $FRAMEWORK_DIR/Versions/$FRAMEWORK_VERSION
mkdir -p $FRAMEWORK_DIR/Versions/$FRAMEWORK_VERSION/Resources
mkdir -p $FRAMEWORK_DIR/Versions/$FRAMEWORK_VERSION/Headers

echo "Framework: Creating symlinks..."
ln -s $FRAMEWORK_VERSION $FRAMEWORK_DIR/Versions/Current
ln -s Versions/Current/Headers $FRAMEWORK_DIR/Headers
ln -s Versions/Current/Resources $FRAMEWORK_DIR/Resources
ln -s Versions/Current/$FRAMEWORK_NAME $FRAMEWORK_DIR/$FRAMEWORK_NAME

# Check that this is what your static libraries
# are called
ARM_FILES="build/$BUILD_TYPE-iphoneos/${LIB_NAME}Device${FLAVOR}.a"
I386_FILES="build/$BUILD_TYPE-iphonesimulator/${LIB_NAME}Simulator${FLAVOR}.a"

# The trick for creating a fully usable library is
# to use lipo to glue the different library
# versions together into one file. When an
# application is linked to this library, the
# linker will extract the appropriate platform
# version and use that.
# The library file is given the same name as the
# framework with no .a extension.
echo "Framework: Creating library..."
lipo \
-create \
-arch armv6 "$ARM_FILES" \
-arch i386 "$I386_FILES" \
-o "$FRAMEWORK_DIR/Versions/Current/$FRAMEWORK_NAME"

# Now copy the final assets over: your library
# header files and the plist file
echo "Framework: Copying assets into current version..."
cp ../Classes-IPhone/*.h $FRAMEWORK_DIR/Headers/
cp Framework.plist $FRAMEWORK_DIR/Resources/Info.plist
3 changes: 2 additions & 1 deletion XcodeConfig/Shared-IPhone.xcconfig
@@ -1,4 +1,5 @@
#include "Shared.xcconfig"

GCC_PREFIX_HEADER = GHUnitIPhone_Prefix.pch
ZERO_LINK = NO
ZERO_LINK = NO
IPHONEOS_DEPLOYMENT_TARGET = 3.0
2 changes: 1 addition & 1 deletion XcodeConfig/iPhoneSimulator-Release-4_0.xcconfig
@@ -1,4 +1,4 @@

#include "Shared-iPhone.xcconfig"

PRODUCT_NAME = GHUnitIPhoneSimulator4_0
PRODUCT_NAME = GHUnitIPhoneSimulator4_0

0 comments on commit 25c3a03

Please sign in to comment.