Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Claudiu-Vlad Ursache
committed
Aug 12, 2013
0 parents
commit 7ebaf87
Showing
5 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Thanks for considering a contribution to the project. | ||
|
||
# How to contribute | ||
|
||
Fork this repository, make it better and send a pull request! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013 Claudiu-Vlad Ursache | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
|
||
![Raphaelios - A collection of build scripts for adding iOS support to useful libraries](http://f.cl.ly/items/1B2i0e0h062M32100r3X/raphaelios_github_header.png) | ||
|
||
Raphaelios is a collection of build scripts for adding iOS support to useful libraries. | ||
|
||
Building fresh copies of C libraries with iOS support can be a lot of hassle. Raphaelios tries to make this easier by providing a go-to place for drop-in scripts that need little configuration. | ||
|
||
## Example usage with openssl | ||
|
||
- Download the ```openssl``` source ([http://www.openssl.org/source/](http://www.openssl.org/source/)) | ||
- Download ```build-openssl.sh``` and place it in the same directory as the source ([https://github.com/Raphaelios/raphaelios-scripts/blob/master/openssl/build-openssl.sh](https://github.com/Raphaelios/raphaelios-scripts/blob/master/openssl/build-openssl.sh)) | ||
- Run ```build-openssl.h``` | ||
- Include the resulting .a files in your XCode project | ||
- Set the ```Header Search Paths``` to look for the newly created header files | ||
- You're done! | ||
|
||
As a quick alternative, you can give the example project a try [https://github.com/Raphaelios/raphaelios-openssl-example](https://github.com/Raphaelios/raphaelios-openssl-example) | ||
|
||
![Raphaelios embedding openssl in iOS app example](http://f.cl.ly/items/3D2t0x1Y1Y0D142G3c0a/raphaelios_openssl_example_xcode.png) | ||
|
||
|
||
## Requirements | ||
|
||
- XCode Command Line Tools ([http://developer.apple.com/downloads/](http://developer.apple.com/downloads/)) | ||
- perl | ||
|
||
## Contact | ||
|
||
Claudiu-Vlad Ursache | ||
|
||
- [https://github.com/ursachec](https://github.com/ursachec) | ||
- [https://twitter.com/ursachec](https://twitter.com/ursachec) | ||
- [http://cvursache.com](http://cvursache.com) | ||
|
||
## License | ||
|
||
Raphaelios is available under the MIT license. See the LICENSE file for more info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
set -u | ||
|
||
# Setup architectures, library name and other vars + cleanup from previous runs | ||
ARCHS=("armv7s" "armv7" "i386") | ||
SDKS=("iphoneos" "iphoneos" "macosx") | ||
LIB_NAME="libevent-2.0.21-stable" | ||
TEMP_LIB_PATH="/tmp/${LIB_NAME}" | ||
DEPENDENCIES_DIR="/Users/claudiu-vladursache/temp-libevent/dependencies" | ||
LIB_DEST_DIR="lib" | ||
HEADER_DEST_DIR="include/libevent" | ||
rm -rf "${HEADER_DEST_DIR}" "${LIB_DEST_DIR}" "${TEMP_LIB_PATH}*" "${LIB_NAME}" | ||
|
||
# Unarchive library, then configure and make for specified architectures | ||
configure_make() | ||
{ | ||
ARCH=$1; GCC=$2; SDK_PATH=$3; | ||
LOG_FILE="${TEMP_LIB_PATH}-${ARCH}.log" | ||
tar xfz "${LIB_NAME}.tar"; | ||
pushd .; cd "${LIB_NAME}"; | ||
|
||
mkdir -p "${TEMP_LIB_PATH}-${ARCH}" | ||
|
||
./configure --disable-shared --enable-static --disable-debug-mode --host=arm-apple-darwin11 \ | ||
--prefix="${TEMP_LIB_PATH}-${ARCH}" \ | ||
CC="${GCC}" &> "${LOG_FILE}" | ||
|
||
make -j2 &> "${LOG_FILE}"; | ||
make install &> "${LOG_FILE}"; | ||
|
||
popd; rm -rf "${LIB_NAME}"; | ||
} | ||
for ((i=0; i < ${#ARCHS[@]}; i++)) | ||
do | ||
SDK_PATH=$(xcrun -sdk ${SDKS[i]} --show-sdk-path) | ||
GCC=$(xcrun -sdk ${SDKS[i]} -find gcc) | ||
configure_make "${ARCHS[i]}" "${GCC}" "${SDK_PATH}" | ||
done | ||
|
||
# Combine libraries for different architectures into one | ||
# Use .a files from the temp directory by providing relative paths | ||
create_lib() | ||
{ | ||
LIB_SRC=$1; LIB_DST=$2; | ||
LIB_PATHS=( "${ARCHS[@]/#/${TEMP_LIB_PATH}-}" ) | ||
LIB_PATHS=( "${LIB_PATHS[@]/%//${LIB_SRC}}" ) | ||
lipo ${LIB_PATHS[@]} -create -output "${LIB_DST}" | ||
} | ||
mkdir "${LIB_DEST_DIR}"; | ||
create_lib "lib/libevent.a" "${LIB_DEST_DIR}/libevent.a" | ||
create_lib "lib/libevent_core.a" "${LIB_DEST_DIR}/libevent_core.a" | ||
create_lib "lib/libevent_extra.a" "${LIB_DEST_DIR}/libevent_extra.a" | ||
create_lib "lib/libevent_openssl.a" "${LIB_DEST_DIR}/libevent_openssl.a" | ||
create_lib "lib/libevent_pthreads.a" "${LIB_DEST_DIR}/libevent_pthreads.a" | ||
|
||
# Copy header files + final cleanups | ||
cp -R "${TEMP_LIB_PATH}-${ARCHS[0]}/include" "${HEADER_DEST_DIR}" | ||
rm -rf "${TEMP_LIB_PATH}-*" "{LIB_NAME}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
set -u | ||
|
||
# Setup architectures, library name and other vars + cleanup from previous runs | ||
ARCHS=("armv7s" "armv7" "i386") | ||
SDKS=("iphoneos" "iphoneos" "macosx") | ||
LIB_NAME="openssl-1.0.1e" | ||
TEMP_LIB_PATH="/tmp/${LIB_NAME}" | ||
LIB_DEST_DIR="lib" | ||
HEADER_DEST_DIR="include" | ||
rm -rf "${HEADER_DEST_DIR}" "${LIB_DEST_DIR}" "${TEMP_LIB_PATH}*" "${LIB_NAME}" | ||
|
||
# Unarchive library, then configure and make for specified architectures | ||
configure_make() | ||
{ | ||
ARCH=$1; GCC=$2; SDK_PATH=$3; | ||
LOG_FILE="${TEMP_LIB_PATH}-${ARCH}.log" | ||
tar xfz "${LIB_NAME}.tar.gz" | ||
pushd .; cd "${LIB_NAME}"; | ||
|
||
./Configure BSD-generic32 --openssldir="${TEMP_LIB_PATH}-${ARCH}" &> "${LOG_FILE}" | ||
perl -i -pe "s|^CC= gcc|CC= ${GCC} -arch ${ARCH}|g" Makefile | ||
perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDK_PATH} \$1|g" Makefile | ||
|
||
make &> "${LOG_FILE}"; make install &> "${LOG_FILE}"; | ||
popd; rm -rf "${LIB_NAME}"; | ||
} | ||
for ((i=0; i < ${#ARCHS[@]}; i++)) | ||
do | ||
SDK_PATH=$(xcrun -sdk ${SDKS[i]} --show-sdk-path) | ||
GCC=$(xcrun -sdk ${SDKS[i]} -find gcc) | ||
configure_make "${ARCHS[i]}" "${GCC}" "${SDK_PATH}" | ||
done | ||
|
||
# Combine libraries for different architectures into one | ||
# Use .a files from the temp directory by providing relative paths | ||
create_lib() | ||
{ | ||
LIB_SRC=$1; LIB_DST=$2; | ||
LIB_PATHS=( "${ARCHS[@]/#/${TEMP_LIB_PATH}-}" ) | ||
LIB_PATHS=( "${LIB_PATHS[@]/%//${LIB_SRC}}" ) | ||
lipo ${LIB_PATHS[@]} -create -output "${LIB_DST}" | ||
} | ||
mkdir "${LIB_DEST_DIR}"; | ||
create_lib "lib/libcrypto.a" "${LIB_DEST_DIR}/libcrypto.a" | ||
create_lib "lib/libssl.a" "${LIB_DEST_DIR}/libssl.a" | ||
|
||
# Copy header files + final cleanups | ||
mkdir -p "${HEADER_DEST_DIR}" | ||
cp -R "${TEMP_LIB_PATH}-${ARCHS[0]}/include" "${HEADER_DEST_DIR}" | ||
rm -rf "${TEMP_LIB_PATH}-*" "{LIB_NAME}" |