@@ -4,12 +4,14 @@ require_relative './scripts/rnaa_utils'
44package_json = JSON . parse ( File . read ( File . join ( __dir__ , "package.json" ) ) )
55
66$new_arch_enabled = ENV [ 'RCT_NEW_ARCH_ENABLED' ] == '1'
7+ $RN_AUDIO_API_FFMPEG_DISABLED = ENV [ 'DISABLE_AUDIOAPI_FFMPEG' ] . nil? ? false : ENV [ 'DISABLE_AUDIOAPI_FFMPEG' ] == '1' # false by default
78
89folly_flags = "-DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32"
910fabric_flags = $new_arch_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''
1011version_flag = "-DAUDIOAPI_VERSION=#{ package_json [ 'version' ] } "
1112
1213worklets_preprocessor_flag = check_if_worklets_enabled ( ) ? '-DRN_AUDIO_API_ENABLE_WORKLETS=1' : ''
14+ ffmpeg_flag = $RN_AUDIO_API_FFMPEG_DISABLED ? '-DRN_AUDIO_API_FFMPEG_DISABLED=1' : ''
1315
1416Pod ::Spec . new do |s |
1517 s . name = "RNAudioAPI"
@@ -24,6 +26,7 @@ Pod::Spec.new do |s|
2426
2527 s . subspec "audioapi" do |ss |
2628 ss . source_files = "common/cpp/audioapi/**/*.{cpp,c,h,hpp}"
29+ ss . exclude_files = $RN_AUDIO_API_FFMPEG_DISABLED ? [ "common/cpp/audioapi/libs/ffmpeg/**" ] : [ ]
2730 ss . header_dir = "audioapi"
2831 ss . header_mappings_dir = "common/cpp/audioapi"
2932
@@ -57,7 +60,7 @@ Pod::Spec.new do |s|
5760 external_dir_relative = "common/cpp/audioapi/external"
5861 lib_dir = "$(PROJECT_DIR)/#{ rn_audio_dir_relative } /#{ external_dir_relative } /$(PLATFORM_NAME)"
5962
60- s . ios . vendored_frameworks = [
63+ s . ios . vendored_frameworks = $RN_AUDIO_API_FFMPEG_DISABLED ? [ ] : [
6164 'common/cpp/audioapi/external/ffmpeg_ios/libavcodec.xcframework' ,
6265 'common/cpp/audioapi/external/ffmpeg_ios/libavformat.xcframework' ,
6366 'common/cpp/audioapi/external/ffmpeg_ios/libavutil.xcframework' ,
@@ -75,10 +78,9 @@ s.pod_target_xcconfig = {
7578 $(PODS_TARGET_SRCROOT)/#{ external_dir_relative } /include
7679 $(PODS_TARGET_SRCROOT)/#{ external_dir_relative } /include/opus
7780 $(PODS_TARGET_SRCROOT)/#{ external_dir_relative } /include/vorbis
78- $(PODS_TARGET_SRCROOT)/#{ external_dir_relative } /ffmpeg_include
79- ] . join ( " " ) ,
80- 'OTHER_CFLAGS' => "$(inherited) #{ folly_flags } #{ fabric_flags } #{ version_flag } #{ worklets_preprocessor_flag } " ,
81- 'OTHER_CPLUSPLUSFLAGS' => "$(inherited) #{ folly_flags } #{ fabric_flags } #{ version_flag } #{ worklets_preprocessor_flag } " ,
81+ ] . concat ( $RN_AUDIO_API_FFMPEG_DISABLED ? [ ] : [ "$(PODS_TARGET_SRCROOT)/#{ external_dir_relative } /ffmpeg_include" ] ) . join ( " " ) ,
82+ 'OTHER_CFLAGS' => "$(inherited) #{ folly_flags } #{ fabric_flags } #{ version_flag } #{ worklets_preprocessor_flag } #{ ffmpeg_flag } " ,
83+ 'OTHER_CPLUSPLUSFLAGS' => "$(inherited) #{ folly_flags } #{ fabric_flags } #{ version_flag } #{ worklets_preprocessor_flag } #{ ffmpeg_flag } " ,
8284}
8385
8486s . user_target_xcconfig = {
0 commit comments