Post

Telegram研究三:将源码由Bazel改为pod

命令格式:lipo -info [.a 文件] lipo -info ./Debug-iphoneos/libimsdk.a 命令格式:lipo -create [待合并的. a] [待合并的. a] -output [要生成的文件名] lipo -create ./Debug-iphonesimulator/libimsdk.a ./Debug-iphoneos/libimsdk.a -output ./libimsdk.a

简单的做法就是直接将工程编译后的产物拿来引用 一、需要研究如何将Telegram里的third-party里的三方库编译成pod库 webp mozjpeg libjxl

二、需要研究如何将Telegram里的submodules里的三方库编译成pod库 ffmpeg 使用ffmpeg-kit-ios-full代替 sqlchiper rlottie


最近在将Telegram改成pod引入时遇到的一些问题 target has transitive dependencies that include static binaries

以webp为例,podspec的写法 image.png

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Pod::Spec.new do |s|

    s.name         = "webp"
    s.version      = "1.0.0"
    s.authors      = { 'xxx' => 'xx@xx.dev'}
    s.summary      = 'xxxx'
    s.source        = { :git => "https://github.com/TextureGroup/Texture.git", :tag => s.version.to_s }
    
    s.license = 'MIT'
    s.homepage = 'http://www.example.com'
    s.requires_arc  = true
    s.ios.deployment_target = "12.0"
    # 使用编译后的内容
    s.public_header_files = ['Public/**/*.h']
    s.source_files  = ["Public/**/*.h"]
    # 依赖的静态库
    s.ios.vendored_libraries = 'Public/**/*.a'
    s.static_framework = true
    # s.ios.vendored_frameworks = 'xxx/xxx.framework'
    s.frameworks = "Foundation", "UIKit"
end

解决方案,修改Podfile的写法use_frameworks! :linkage => :static Podfile的写法

1
2
3
4
5
6
7
8
platform :ios, '12.0'
target 'StudyAsynDisplay' do
  use_frameworks! :linkage => :static
  # Pods for StudyAsynDisplay
  pod "webp", :path => 'LocalLib/webp'

end

This post is licensed under CC BY 4.0 by the author.