rtmp ios 编译脚本
来源:互联网 发布:制作工资表软件 编辑:程序博客网 时间:2024/06/14 18:39
github上有好几个,但是都需要做部分改动,
librtmp依赖OpenSSL,需要先编译OpenSSL,脚本如下
- build_ssl.sh
#!/bin/sh# Automatic build script for libssl and libcrypto # for iPhoneOS and iPhoneSimulator## Created by Felix Schulze on 16.12.10.# Copyright 2010 Felix Schulze. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.############################################################################# Change values here ## VERSION="1_0_2" # SDKVERSION="9.2" # # ############################################################################# ## Don't change anything under this line! ## ############################################################################CURRENTPATH=`pwd` ARCHS="i386 x86_64 armv7 armv7s arm64" DEVELOPER=`xcode-select -print-path`if [ ! -d "$DEVELOPER" ]; then echo "xcode path is not set correctly $DEVELOPER does not exist (most likely because of xcode > 4.3)" echo "run" echo "sudo xcode-select -switch <xcode path>" echo "for default installation:" echo "sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer" exit 1ficase $DEVELOPER in *\ * ) echo "Your Xcode path contains whitespaces, which is not supported." exit 1 ;;esaccase $CURRENTPATH in *\ * ) echo "Your path contains whitespaces, which is not supported by 'make install'." exit 1 ;;esacset -e if [ ! -e openssl-${VERSION}.zip ]; then echo "Downloading openssl-${VERSION}.zip" curl https://codeload.github.com/openssl/openssl/zip/OpenSSL_${VERSION} -o OpenSSL_${VERSION}.zipelse echo "Using openssl-${VERSION}.zip" # Remove the source directory if already exist rm -rf "${SRCPATH}/openssl-${VERSION}"fimkdir -p "${CURRENTPATH}/src" mkdir -p "${CURRENTPATH}/build" mkdir -p "${CURRENTPATH}/lib"# tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src"unzip OpenSSL_${VERSION}.zip -d "${CURRENTPATH}/src" cd ${CURRENTPATH}/src/openssl*${VERSION}for ARCH in ${ARCHS} do if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then PLATFORM="iPhoneSimulator" else sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="iPhoneOS" fi export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" export BUILD_TOOLS="${DEVELOPER}" echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please stand by..." export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" set +e if [[ "$VERSION" =~ 1_0_0 ]]; then ./Configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 elif [ "${ARCH}" == "x86_64" ]; then ./Configure darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 else ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 fi if [ $? != 0 ]; then echo "Problem while configure - Please check ${LOG}" exit 1 fi # add -isysroot to CC= sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=7.0 !" "Makefile" if [ "$1" == "verbose" ]; then make else make >> "${LOG}" 2>&1 fi if [ $? != 0 ]; then echo "Problem while make - Please check ${LOG}" exit 1 fi set -e make install >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1doneecho "Build library..." lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl.alipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto.amkdir -p ${CURRENTPATH}/include cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/openssl ${CURRENTPATH}/include/ echo "Building done." echo "Cleaning up..." rm -rf ${CURRENTPATH}/src/openssl*${VERSION} rm -r ${CURRENTPATH}/src echo "Done."
- build_rtmp.h
#!/bin/sh# build-librtmp.sh# Automated librtmp build script for iPhoneOS and iPhoneSimulator## Created by Min Kim on 10/1/13.# Copyright (c) 2013 iFactory Lab Limited. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.############################################################################# Change values here ## #SDKVERSION="9.2" # # ############################################################################# ## Don't change anything under this line! ## ############################################################################CURRENTPATH=`pwd` ARCHS="i386 x86_64 armv7 armv7s arm64" LIBRTMPREPO="git://git.ffmpeg.org/rtmpdump" BUILDPATH="${CURRENTPATH}/build" LIBPATH="${CURRENTPATH}/lib" INCLUDEPATH="${CURRENTPATH}/include" SRCPATH="${CURRENTPATH}/src" LIBRTMP="librtmp.a" DEVELOPER=`xcode-select -print-path`if [ ! -d "$DEVELOPER" ]; then echo "xcode path is not set correctly $DEVELOPER does not exist (most likely because of xcode > 4.3)" echo "run" echo "sudo xcode-select -switch <xcode path>" echo "for default installation:" echo "sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer" exit 1fi# Check whether openssl has already installed on the machine or not.# libcrypt.a / libssl.aset -e echo 'Check openssl installation' if [ -f "${LIBPATH}/libcrypto.a" ] && [ -f "${LIBPATH}/libssl.a" ] && [ -d "${INCLUDEPATH}/openssl" ]; then echo 'Openssl for iOS has already installed, no need to install openssl'else echo 'Openssl for iOS not found, will install openssl for iOS' ./build-libssl.sh echo 'Succeeded to install openssl'fi# Download librtmp source code from git repository# We assuem the user already installed git client.echo 'Clone librtmp git repository'# Remove the directory if already existrm -rf "${SRCPATH}/rtmpdump"git clone ${LIBRTMPREPO} src/rtmpdump cd "${SRCPATH}/rtmpdump/librtmp"LIBRTMP_REPO=""for ARCH in ${ARCHS} do if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then PLATFORM="iPhoneSimulator" else PLATFORM="iPhoneOS" fi export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" export BUILD_TOOLS="${DEVELOPER}" echo "Building librtmp for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please wait..." # add arch to CC= sed -ie "s!AR=\$(CROSS_COMPILE)ar!AR=/usr/bin/ar!" "Makefile" sed -ie "/CC=\$(CROSS_COMPILE)gcc/d" "Makefile" echo "CC=\$(CROSS_COMPILE)gcc -arch ${ARCH}" >> "Makefile" export CROSS_COMPILE="${DEVELOPER}/usr/bin/" export XCFLAGS="-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=7.0 -I${INCLUDEPATH} -arch ${ARCH}" if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then export XLDFLAGS="-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=7.0 -L${LIBPATH} -arch ${ARCH}" else export XLDFLAGS="-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=7.0 -L${LIBPATH} -arch ${ARCH}" fi OUTPATH="${BUILDPATH}/librtmp-${PLATFORM}${SDKVERSION}-${ARCH}.sdk" mkdir -p "${OUTPATH}" LOG="${OUTPATH}/build-librtmp.log" make SYS=darwin >> "${LOG}" 2>&1 make SYS=darwin prefix="${OUTPATH}" install >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1 LIBRTMP_REPO+="${OUTPATH}/lib/${LIBRTMP} "doneecho "Build universal library..." lipo -create ${LIBRTMP_REPO}-output ${LIBPATH}/${LIBRTMP}mkdir -p ${INCLUDEPATH} cp -R ${BUILDPATH}/librtmp-iPhoneSimulator${SDKVERSION}-i386.sdk/include/ ${INCLUDEPATH}/echo "Building done." echo "Cleaning up..."rm -rf ${SRCPATH}/rtmpdump echo "Done."
参考:
http://rtmpdump.mplayerhq.hu/
https://github.com/ifactorylab/librtmp-iOS
https://github.com/x2on/OpenSSL-for-iPhone
0 0
- rtmp ios 编译脚本
- iOS实现RTMP视频直播 IJKMediaFramework框架编译
- iOS 通用交叉编译脚本
- iOS中ffmpeg编译脚本
- libcurl for ios 编译脚本
- rtmp编译so
- X264+rtmp+facc编译
- IOS-Rtmp视频播放
- ios 编译protobuf.a库脚本
- windows 编译ffmpeg 播放 rtmp
- 编译配置nginx-rtmp-moule
- 编译nginx+rtmp排错
- 【编译脚本】macos下libfdk-aac三个ios平台最新的编译脚本i386 arm7 arm7s
- Curl for ios 的编译方法及脚本
- Poco C++ ios 和 android平台编译脚本
- freetype2.4.6在iOS上各版本的编译脚本
- 用Python编写IOS工程的自动编译脚本
- ios及android两个平台下x264编译脚本
- LeetCode:Binary Tree Zigzag Level Order Traversal
- iOS快速得到视图的width,height,x,y
- tar命令详解
- 本地如何搭建IPv6环境测试你的APP
- C语言:全局变量在多个c文件中公用的方法
- rtmp ios 编译脚本
- android基于JSON的短信备份功能
- SQLite语法学习
- 软件架构
- 连接oracle数据库出现oracle ORA-12526: TNS: 监听程序: 所有适用例程都处于受限模式
- 记录一下自己bashrc
- match_parent和fill_parent的区别
- 电商项目中库存管理(问答式)
- Java中Split函数的用法技巧