Skip to content
Browse files

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
  • Loading branch information...
1 parent 5ee073b commit 4fa1b0ca90357f0795c396474d0729125d6eb4ee @sjlombardo sjlombardo committed
Showing with 21 additions and 16 deletions.
  1. +20 −15 README.markdown
  2. +1 −1 openssl.xcodeproj/project.pbxproj
View
35 README.markdown
@@ -5,15 +5,8 @@ This is an XCode project skeleton structure that can be used to build a static
libcrypto.a library for use in Mac and iPhone projects.
It is specifically intended for use in building secure iPhone
-applications alongside [SQLCipher](http://www.zetetic.net/software/sqlcipher).
-
-openssl-xcode was developed by Stephen Lombardo at Zetetic LLC.
-
- sjlombardo at zetetic.net
- http://www.zetetic.net
-
-It was adapted for use with source archives by Michael Tyson of
-A Tasty Pixel (michael at atastypixel.com)
+applications alongside [SQLCipher](http://sqlcipher.net),
+but it can easily be used for other applications.
Usage
-----
@@ -23,11 +16,15 @@ In a normal case you would use it thusly:
1. Download the OpenSSL source code directly from
http://www.openssl.org/source/
2. Clone the openssl-xcode git repo to make a local copy
-3. Put the downloaded OpenSSL source tar.gz into the same folder
- as openssl.xcodeproj.
- The extracted OpenSSL distribution can also be placed in a folder called 'openssl'
- within the same folder as openssl.xcodeproj, or just extracted within the
- same folder as openssl.xcodeproj.
+3. Either:
+ a. Put the downloaded OpenSSL source tar.gz into the same folder
+ as openssl.xcodeproj.
+ b. Place an extracted OpenSSL distribution in a folder called 'openssl'
+ within the same folder as openssl.xcodeproj
+ c. Extracted the OpenSSL distribution directly into the same folder
+ as openssl.xcodeproj.
+ d. Setup a source tree definition in XCode for OPENSSL_SRC pointing the
+ folder containing openssl source code
Then, either open openssl.xcodeproj in XCode and initiate a build, or integrate
it within another project:
@@ -49,7 +46,9 @@ This project actually relies on the OpenSSL configure and make
system to build the libraries. However, it does attempt to automatically
detect and use the appropriate build settings for arch (i386/ppc/armv6),
build tools, and SDK directories. This makes it appropriate for inclusion
-as a project reference into an iPhone application project.
+as a project reference into an iPhone application project. This project will
+also check to see if the resulting crypto library is newer than the project
+Makefile to avoid time consuming rebuild cycles.
License
-------
@@ -80,3 +79,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Credits
+-------
+
+* openssl-xcode was developed by Stephen Lombardo at Zetetic LLC (sjlombardo at zetetic.net / http://www.zetetic.net)
+* adapted for use with source archives by Michael Tyson of A Tasty Pixel (michael at atastypixel.com)
+
View
2 openssl.xcodeproj/project.pbxproj
@@ -80,7 +80,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- 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\"";
+ 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\"";
};
/* End PBXShellScriptBuildPhase section */

0 comments on commit 4fa1b0c

Please sign in to comment.
Something went wrong with that request. Please try again.