Skip to content

Instantly share code, notes, and snippets.

@below
Forked from rtcexpert/libSRTP_build.sh
Last active April 25, 2022 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save below/d53a0564fd5e92111f9c1131539e7217 to your computer and use it in GitHub Desktop.
Save below/d53a0564fd5e92111f9c1131539e7217 to your computer and use it in GitHub Desktop.
build libSRTP script for iOS.
dobuild() {
export CC="$(xcrun -find -sdk ${SDK} cc)"
# export CXX="$(xcrun -find -sdk ${SDK} cxx)"
export CPP="$(xcrun -find -sdk ${SDK} cpp)"
export CFLAGS="${HOST_FLAGS} ${OPT_FLAGS}"
export CXXFLAGS="${HOST_FLAGS} ${OPT_FLAGS}"
export LDFLAGS="${HOST_FLAGS}"
./configure --host=${CHOST} --prefix=${PREFIX} --enable-openssl --with-openssl-dir="../openssl/"
make
}
SDK="iphoneos"
ARCH_FLAGS="-arch armv7"
HOST_FLAGS="${ARCH_FLAGS} -miphoneos-version-min=8.0 -isysroot $(xcrun -sdk ${SDK} --show-sdk-path)"
CHOST="arm-apple-darwin"
dobuild
mv libsrtp2.a libsrtp_armv7.a
make clean
SDK="iphoneos"
ARCH_FLAGS="-arch arm64"
HOST_FLAGS="${ARCH_FLAGS} -miphoneos-version-min=8.0 -isysroot $(xcrun -sdk ${SDK} --show-sdk-path)"
CHOST="arm-apple-darwin"
dobuild
mv libsrtp2.a libsrtp_armv64.a
make clean
SDK="iphonesimulator"
ARCH_FLAGS="-arch i386"
HOST_FLAGS="${ARCH_FLAGS} -mios-simulator-version-min=8.0 -isysroot $(xcrun -sdk ${SDK} --show-sdk-path)"
CHOST="i386-apple-darwin"
dobuild
mv libsrtp2.a libsrtp_i386.a
make clean
SDK="iphonesimulator"
ARCH_FLAGS="-arch x86_64"
HOST_FLAGS="${ARCH_FLAGS} -mios-simulator-version-min=8.0 -isysroot $(xcrun -sdk ${SDK} --show-sdk-path)"
CHOST="x86_64-apple-darwin"
dobuild
mv libsrtp2.a libsrtp_x86_64.a
make clean
# Create one library for the simulator, and one library for the device
mkdir -p iphonesimulator
lipo -create libsrtp_x86_64.a libsrtp_i386.a libsrtp_armv64_iphonesimulator.a -output iphonesimulator/libsrtp2.a
mkdir -p iphoneos
lipo -create libsrtp_armv64.a libsrtp_armv7.a -output iphoneos/libsrtp2.a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment