Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4fa1b0c

Browse files
committed
Merge source archive changes with local enhancements
- allow use of OPENSSL_SRC source tree to identify location of openssl sources - compare timestamps between compiled library and source makefile, and only rebuild if the makefile is newer, preventing needless recompiles, but allowing the project to pick up and use changes to the openssl sources - updates to usage instructions and credits in readme
1 parent 5ee073b commit 4fa1b0c

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

README.markdown

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@ This is an XCode project skeleton structure that can be used to build a static
55
libcrypto.a library for use in Mac and iPhone projects.
66

77
It is specifically intended for use in building secure iPhone
8-
applications alongside [SQLCipher](http://www.zetetic.net/software/sqlcipher).
9-
10-
openssl-xcode was developed by Stephen Lombardo at Zetetic LLC.
11-
12-
sjlombardo at zetetic.net
13-
http://www.zetetic.net
14-
15-
It was adapted for use with source archives by Michael Tyson of
16-
A Tasty Pixel (michael at atastypixel.com)
8+
applications alongside [SQLCipher](http://sqlcipher.net),
9+
but it can easily be used for other applications.
1710

1811
Usage
1912
-----
@@ -23,11 +16,15 @@ In a normal case you would use it thusly:
2316
1. Download the OpenSSL source code directly from
2417
http://www.openssl.org/source/
2518
2. Clone the openssl-xcode git repo to make a local copy
26-
3. Put the downloaded OpenSSL source tar.gz into the same folder
27-
as openssl.xcodeproj.
28-
The extracted OpenSSL distribution can also be placed in a folder called 'openssl'
29-
within the same folder as openssl.xcodeproj, or just extracted within the
30-
same folder as openssl.xcodeproj.
19+
3. Either:
20+
a. Put the downloaded OpenSSL source tar.gz into the same folder
21+
as openssl.xcodeproj.
22+
b. Place an extracted OpenSSL distribution in a folder called 'openssl'
23+
within the same folder as openssl.xcodeproj
24+
c. Extracted the OpenSSL distribution directly into the same folder
25+
as openssl.xcodeproj.
26+
d. Setup a source tree definition in XCode for OPENSSL_SRC pointing the
27+
folder containing openssl source code
3128

3229
Then, either open openssl.xcodeproj in XCode and initiate a build, or integrate
3330
it within another project:
@@ -49,7 +46,9 @@ This project actually relies on the OpenSSL configure and make
4946
system to build the libraries. However, it does attempt to automatically
5047
detect and use the appropriate build settings for arch (i386/ppc/armv6),
5148
build tools, and SDK directories. This makes it appropriate for inclusion
52-
as a project reference into an iPhone application project.
49+
as a project reference into an iPhone application project. This project will
50+
also check to see if the resulting crypto library is newer than the project
51+
Makefile to avoid time consuming rebuild cycles.
5352

5453
License
5554
-------
@@ -80,3 +79,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8079
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
8180
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8281

82+
Credits
83+
-------
84+
85+
* openssl-xcode was developed by Stephen Lombardo at Zetetic LLC (sjlombardo at zetetic.net / http://www.zetetic.net)
86+
* adapted for use with source archives by Michael Tyson of A Tasty Pixel (michael at atastypixel.com)
87+

openssl.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
);
8181
runOnlyForDeploymentPostprocessing = 0;
8282
shellPath = /bin/sh;
83-
shellScript = "if [ -f \"$CONFIGURATION_BUILD_DIR/libcrypto.a\" ]; then\n\texit 0;\nfi\n\nOPENSSL_SRCROOT=\"$SRCROOT/openssl\"\nif [ ! -d \"$OPENSSL_SRCROOT\" ]; then\n OPENSSL_SRCROOT=\"$SRCROOT\"\nfi;\n\nSRC_ARCHIVE=`ls openssl*tar.gz 2>/dev/null`\nif [ -f \"$SRC_ARCHIVE\" ]; then\n\tOPENSSL_SRCROOT=\"$PROJECT_TEMP_DIR/openssl\"\n\tif [ ! -d \"$OPENSSL_SRCROOT\" ]; then\n\t\techo \"Extracting $SRC_ARCHIVE...\"\n\t\tmkdir \"$OPENSSL_SRCROOT\"\n\t\ttar -C \"$OPENSSL_SRCROOT\" --strip-components=1 -zxf \"$SRC_ARCHIVE\" || exit 1\n\t\tcp -RL \"$OPENSSL_SRCROOT/include\" \"$CONFIGURATION_BUILD_DIR\"\n\tfi\nfi\n\nif [ \"$SDKROOT\" != \"\" ]; then\n\tISYSROOT=\"-isysroot $SDKROOT\"\nfi\n\nOPENSSL_OPTIONS=\"no-krb5 no-gost\"\n\ncd \"$OPENSSL_SRCROOT\"\n\n## this is a universal build\nif [ \"$ARCHS_STANDARD_32_BIT\" = \"i386 ppc\" ]; then\n\n\tBUILDARCH=\"ppc\"\n\techo \"***** BUILDING UNIVERSAL ARCH $BUILDARCH ******\"\n\tmake clean\n\t./config no-asm $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\tASM_DEF=\"-UOPENSSL_BN_ASM_PART_WORDS\"\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc-4.2 CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tcp libcrypto.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libcrypto.a\n\tcp libssl.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libssl.a\n\t\n\tBUILDARCH=\"i386\"\n\techo \"***** BUILDING UNIVERSAL ARCH $BUILDARCH ******\"\n\tmake clean\n\t./config $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\tASM_DEF=\"-DOPENSSL_BN_ASM_PART_WORDS\"\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc-4.2 CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tcp libcrypto.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libcrypto.a\n\tcp libssl.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libssl.a\n\tmkdir -p \"$CONFIGURATION_BUILD_DIR\"\n\tlipo -create \"$CONFIGURATION_TEMP_DIR\"/*-libcrypto.a -output \"$CONFIGURATION_BUILD_DIR/libcrypto.a\"\n \tlipo -create \"$CONFIGURATION_TEMP_DIR\"/*-libssl.a -output \"$CONFIGURATION_BUILD_DIR/libssl.a\"\nelse\n\tBUILDARCH=$ARCHS\n\techo \"***** BUILDING ARCH $BUILDARCH ******\"\n\tmake clean\n\n\tif [ \"$BUILDARCH\" = \"i386\" ]; then\n\t\t./config $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\t\tASM_DEF=\"-DOPENSSL_BN_ASM_PART_WORDS\"\n else\n\t\t./config no-asm $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\t\tASM_DEF=\"-UOPENSSL_BN_ASM_PART_WORDS\"\n fi\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc-4.2 CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tmkdir -p \"$CONFIGURATION_BUILD_DIR\"\n\tcp libcrypto.a \"$CONFIGURATION_BUILD_DIR\"\n\tcp libssl.a \"$CONFIGURATION_BUILD_DIR\"\nfi\n\nranlib \"$CONFIGURATION_BUILD_DIR/libcrypto.a\"\nranlib \"$CONFIGURATION_BUILD_DIR/libssl.a\"";
83+
shellScript = "## Determine the appropriate openssl source path to use\n## Introduced by michaeltyson, adapted to account for OPENSSL_SRC build path\n\n# locate src archive file if present\nSRC_ARCHIVE=`ls openssl*tar.gz 2>/dev/null`\n\n# if there is an openssl directory immediately under the openssl.xcode source \n# folder then build there\nif [ -d \"$SRCROOT/openssl\" ]; then\n\tOPENSSL_SRC=\"$SRCROOT/openssl\"\n# else, if there is a openssl.tar.gz in the directory, expand it to openssl\n# and use it\nelif [ -f \"$SRC_ARCHIVE\" ]; then\n\tOPENSSL_SRC=\"$PROJECT_TEMP_DIR/openssl\"\n\tif [ ! -d \"$OPENSSL_SRC\" ]; then\n\t\techo \"extracting $SRC_ARCHIVE...\"\n\t\tmkdir \"$OPENSSL_SRC\"\n\t\ttar -C \"$OPENSSL_SRC\" --strip-components=1 -zxf \"$SRC_ARCHIVE\" || exit 1\n\t\tcp -RL \"$OPENSSL_SRC/include\" \"$CONFIGURATION_BUILD_DIR\"\n\tfi\n# else, if $OPENSSL_SRC is not already defined (i.e. by prerequisites for SQLCipher XCode config)\n# then assume openssl is in the current directory\nelif [ ! -d \"$OPENSSL_SRC\" ]; then\n\tOPENSSL_SRC=\"$SRCROOT\"\nfi\n\necho \"using $OPENSSL_SRC for openssl source code\"\n\n# check whether the timestamp on the libcrypto.a is newer than the make file in the openss home directory\nif [ \"$CONFIGURATION_BUILD_DIR/libcrypto.a\" -nt \"$OPENSSL_SRC/Makefile\" ]; then\n\techo \"$CONFIGURATION_BUILD_DIR/libcrypto.a is newer than $OPENSSL_SRC/Makefile - skipping build\"\n\texit 0;\nfi\n\nif [ \"$SDKROOT\" != \"\" ]; then\n\tISYSROOT=\"-isysroot $SDKROOT\"\nfi\n\nOPENSSL_OPTIONS=\"no-krb5 no-gost\"\n\ncd \"$OPENSSL_SRC\"\n\n## this is a universal build\nif [ \"$ARCHS_STANDARD_32_BIT\" = \"i386 ppc\" ]; then\n\n\tBUILDARCH=\"ppc\"\n\techo \"***** BUILDING UNIVERSAL ARCH $BUILDARCH ******\"\n\tmake clean\n\t./config no-asm $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\tASM_DEF=\"-UOPENSSL_BN_ASM_PART_WORDS\"\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc-4.2 CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tcp libcrypto.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libcrypto.a\n\tcp libssl.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libssl.a\n\t\n\tBUILDARCH=\"i386\"\n\techo \"***** BUILDING UNIVERSAL ARCH $BUILDARCH ******\"\n\tmake clean\n\t./config $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\tASM_DEF=\"-DOPENSSL_BN_ASM_PART_WORDS\"\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc-4.2 CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tcp libcrypto.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libcrypto.a\n\tcp libssl.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libssl.a\n\tmkdir -p \"$CONFIGURATION_BUILD_DIR\"\n\tlipo -create \"$CONFIGURATION_TEMP_DIR\"/*-libcrypto.a -output \"$CONFIGURATION_BUILD_DIR/libcrypto.a\"\n\tlipo -create \"$CONFIGURATION_TEMP_DIR\"/*-libssl.a -output \"$CONFIGURATION_BUILD_DIR/libssl.a\"\nelse\n\tBUILDARCH=$ARCHS\n\techo \"***** BUILDING ARCH $BUILDARCH ******\"\n\tmake clean\n\n\tif [ \"$BUILDARCH\" = \"i386\" ]; then\n\t\t./config $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\t\tASM_DEF=\"-DOPENSSL_BN_ASM_PART_WORDS\"\n else\n\t\t./config no-asm $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\t\tASM_DEF=\"-UOPENSSL_BN_ASM_PART_WORDS\"\n\tfi\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc-4.2 CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tmkdir -p \"$CONFIGURATION_BUILD_DIR\"\n\tcp libcrypto.a \"$CONFIGURATION_BUILD_DIR\"\n\tcp libssl.a \"$CONFIGURATION_BUILD_DIR\"\nfi\n\nranlib \"$CONFIGURATION_BUILD_DIR/libcrypto.a\"\nranlib \"$CONFIGURATION_BUILD_DIR/libssl.a\"";
8484
};
8585
/* End PBXShellScriptBuildPhase section */
8686

0 commit comments

Comments
 (0)