init-ios.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #! /usr/bin/env bash
  2. #
  3. # Copyright (C) 2013-2015 Bilibili
  4. # Copyright (C) 2013-2015 Zhang Rui <bbcallen@gmail.com>
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. # IJK_FFMPEG_UPSTREAM=git://git.videolan.org/ffmpeg.git
  19. IJK_FFMPEG_UPSTREAM=https://github.com/Bilibili/FFmpeg.git
  20. IJK_FFMPEG_FORK=https://github.com/Bilibili/FFmpeg.git
  21. IJK_FFMPEG_COMMIT=ff3.4--ijk0.8.7--20180103--001
  22. IJK_FFMPEG_LOCAL_REPO=extra/ffmpeg
  23. IJK_GASP_UPSTREAM=https://github.com/Bilibili/gas-preprocessor.git
  24. # gas-preprocessor backup
  25. # https://github.com/Bilibili/gas-preprocessor.git
  26. if [ "$IJK_FFMPEG_REPO_URL" != "" ]; then
  27. IJK_FFMPEG_UPSTREAM=$IJK_FFMPEG_REPO_URL
  28. IJK_FFMPEG_FORK=$IJK_FFMPEG_REPO_URL
  29. fi
  30. if [ "$IJK_GASP_REPO_URL" != "" ]; then
  31. IJK_GASP_UPSTREAM=$IJK_GASP_REPO_URL
  32. fi
  33. set -e
  34. TOOLS=tools
  35. FF_ALL_ARCHS_IOS6_SDK="armv7 armv7s i386"
  36. FF_ALL_ARCHS_IOS7_SDK="armv7 armv7s arm64 i386 x86_64"
  37. FF_ALL_ARCHS_IOS8_SDK="armv7 arm64 i386 x86_64"
  38. FF_ALL_ARCHS=$FF_ALL_ARCHS_IOS8_SDK
  39. FF_TARGET=$1
  40. function echo_ffmpeg_version() {
  41. echo $IJK_FFMPEG_COMMIT
  42. }
  43. function pull_common() {
  44. git --version
  45. echo "== pull gas-preprocessor base =="
  46. sh $TOOLS/pull-repo-base.sh $IJK_GASP_UPSTREAM extra/gas-preprocessor
  47. echo "== pull ffmpeg base =="
  48. sh $TOOLS/pull-repo-base.sh $IJK_FFMPEG_UPSTREAM $IJK_FFMPEG_LOCAL_REPO
  49. }
  50. function pull_fork() {
  51. echo "== pull ffmpeg fork $1 =="
  52. sh $TOOLS/pull-repo-ref.sh $IJK_FFMPEG_FORK ios/ffmpeg-$1 ${IJK_FFMPEG_LOCAL_REPO}
  53. cd ios/ffmpeg-$1
  54. git checkout ${IJK_FFMPEG_COMMIT} -B ijkplayer
  55. cd -
  56. }
  57. function pull_fork_all() {
  58. for ARCH in $FF_ALL_ARCHS
  59. do
  60. pull_fork $ARCH
  61. done
  62. }
  63. function sync_ff_version() {
  64. sed -i '' "s/static const char \*kIJKFFRequiredFFmpegVersion\ \=\ .*/static const char *kIJKFFRequiredFFmpegVersion = \"${IJK_FFMPEG_COMMIT}\";/g" ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMoviePlayerController.m
  65. }
  66. #----------
  67. case "$FF_TARGET" in
  68. ffmpeg-version)
  69. echo_ffmpeg_version
  70. ;;
  71. armv7|armv7s|arm64|i386|x86_64)
  72. pull_common
  73. pull_fork $FF_TARGET
  74. ;;
  75. all|*)
  76. pull_common
  77. pull_fork_all
  78. ;;
  79. esac
  80. sync_ff_version