From 243ef8b8567f2d22b9289c621a0e43c08de4750a Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 11 Jun 2019 13:19:32 +0800 Subject: [PATCH 1/4] Rewrite the CocoaPods spec files, to declare the correct Public Headers for libwebp, fix the import issue when using `use_frameworks` --- libwebp.podspec | 50 +++++++++---------------------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/libwebp.podspec b/libwebp.podspec index 5e8018a..32ddd4e 100644 --- a/libwebp.podspec +++ b/libwebp.podspec @@ -15,48 +15,16 @@ Pod::Spec.new do |s| s.tvos.deployment_target = '9.0' s.watchos.deployment_target = '2.0' - s.pod_target_xcconfig = { - 'USER_HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_ROOT}/libwebp/**' + s.xcconfig = { + 'USER_HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_ROOT}/libwebp/ ${PODS_TARGET_SRCROOT}/' } + s.preserve_path = 'src' - s.subspec 'webp' do |ss| - ss.header_dir = 'webp' - ss.source_files = 'src/webp/*.h' - end + s.source_files = 'src/webp/*.{h,c}', 'src/utils/*.{h,c}', 'src/dsp/*.{h,c}', 'src/enc/*.{h,c}', 'src/dec/*.{h,c}', 'src/demux/*.{h,c}', 'src/mux/*.{h,c}' + s.public_header_files = 'src/webp/*.h' - s.subspec 'core' do |ss| - ss.source_files = [ - 'src/utils/*.{h,c}', - 'src/dsp/*.{h,c}', - 'src/enc/*.{h,c}', - 'src/dec/*.{h,c}' - ] - ss.dependency 'libwebp/webp' - end - - s.subspec 'utils' do |ss| - ss.dependency 'libwebp/core' - end - - s.subspec 'dsp' do |ss| - ss.dependency 'libwebp/core' - end - - s.subspec 'enc' do |ss| - ss.dependency 'libwebp/core' - end - - s.subspec 'dec' do |ss| - ss.dependency 'libwebp/core' - end - - s.subspec 'demux' do |ss| - ss.source_files = 'src/demux/*.{h,c}' - ss.dependency 'libwebp/core' - end - - s.subspec 'mux' do |ss| - ss.source_files = 'src/mux/*.{h,c}' - ss.dependency 'libwebp/core' - end + # fix #include cause 'Include of non-modular header inside framework module error' + s.prepare_command = <<-CMD + sed -i.bak 's///g' './src/webp/types.h' + CMD end From 32e2e9019c36c0a6d3e0e7e8e5bbe9c4ca8d07f7 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 11 Jun 2019 13:36:15 +0800 Subject: [PATCH 2/4] Use `pod_target_xcconfig` instead of `xcconfig`, to avoid override the user integrate project --- libwebp.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libwebp.podspec b/libwebp.podspec index 32ddd4e..46daa2f 100644 --- a/libwebp.podspec +++ b/libwebp.podspec @@ -15,7 +15,7 @@ Pod::Spec.new do |s| s.tvos.deployment_target = '9.0' s.watchos.deployment_target = '2.0' - s.xcconfig = { + s.pod_target_xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_ROOT}/libwebp/ ${PODS_TARGET_SRCROOT}/' } s.preserve_path = 'src' From 54129f7adb0adae66f0307bcab2c8f002776064e Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 11 Jun 2019 21:45:43 +0800 Subject: [PATCH 3/4] update podspec to support all 4 standalone components, including `enc`, `dec`, `demux` and `mux`, all of these subspecs can be compiled without extra dependency --- libwebp.podspec | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/libwebp.podspec b/libwebp.podspec index 46daa2f..7761b6d 100644 --- a/libwebp.podspec +++ b/libwebp.podspec @@ -19,9 +19,42 @@ Pod::Spec.new do |s| 'USER_HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_ROOT}/libwebp/ ${PODS_TARGET_SRCROOT}/' } s.preserve_path = 'src' + s.default_subspecs = 'dec', 'enc', 'demux', 'mux' - s.source_files = 'src/webp/*.{h,c}', 'src/utils/*.{h,c}', 'src/dsp/*.{h,c}', 'src/enc/*.{h,c}', 'src/dec/*.{h,c}', 'src/demux/*.{h,c}', 'src/mux/*.{h,c}' - s.public_header_files = 'src/webp/*.h' + # common code, used by actual subspecs + s.subspec 'core' do |ss| + ss.source_files = 'src/utils/*.{h,c}', 'src/dsp/*.{h,c}', 'src/webp/types.h', 'src/webp/format_constants.h' + ss.public_header_files = 'src/webp/types.h', 'src/webp/format_constants.h' + end + + # webp decoding + s.subspec 'dec' do |ss| + ss.dependency 'libwebp/core' + ss.source_files = 'src/dec/*.{h,c}', 'src/webp/decode.h' + ss.public_header_files = 'src/webp/decode.h' + end + + # webp encoding + s.subspec 'enc' do |ss| + ss.dependency 'libwebp/core' + ss.source_files = 'src/enc/*.{h,c}', 'src/webp/encode.h' + ss.public_header_files = 'src/webp/encode.h' + end + + # animated webp decoding + s.subspec 'demux' do |ss| + ss.dependency 'libwebp/dec' + ss.source_files = 'src/demux/*.{h,c}', 'src/webp/demux.h', 'src/webp/mux_types.h' + ss.public_header_files = 'src/webp/demux.h', 'src/webp/mux_types.h' + end + + # animated webp encoding + s.subspec 'mux' do |ss| + ss.dependency 'libwebp/enc' + ss.dependency 'libwebp/demux' + ss.source_files = 'src/mux/*.{h,c}', 'src/webp/mux.h' + ss.public_header_files = 'src/webp/mux.h' + end # fix #include cause 'Include of non-modular header inside framework module error' s.prepare_command = <<-CMD From 90d20c01513a46cfec3804045507522fb7334b43 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 12 Jun 2019 14:55:05 +0800 Subject: [PATCH 4/4] Fix the pod spec lint issue, change 4 components into 3, the `webp` subspec includes both WebP encoding && decoding --- libwebp.podspec | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/libwebp.podspec b/libwebp.podspec index 7761b6d..a1dd022 100644 --- a/libwebp.podspec +++ b/libwebp.podspec @@ -19,38 +19,23 @@ Pod::Spec.new do |s| 'USER_HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_ROOT}/libwebp/ ${PODS_TARGET_SRCROOT}/' } s.preserve_path = 'src' - s.default_subspecs = 'dec', 'enc', 'demux', 'mux' + s.default_subspecs = 'webp', 'demux', 'mux' - # common code, used by actual subspecs - s.subspec 'core' do |ss| - ss.source_files = 'src/utils/*.{h,c}', 'src/dsp/*.{h,c}', 'src/webp/types.h', 'src/webp/format_constants.h' - ss.public_header_files = 'src/webp/types.h', 'src/webp/format_constants.h' - end - - # webp decoding - s.subspec 'dec' do |ss| - ss.dependency 'libwebp/core' - ss.source_files = 'src/dec/*.{h,c}', 'src/webp/decode.h' - ss.public_header_files = 'src/webp/decode.h' - end - - # webp encoding - s.subspec 'enc' do |ss| - ss.dependency 'libwebp/core' - ss.source_files = 'src/enc/*.{h,c}', 'src/webp/encode.h' - ss.public_header_files = 'src/webp/encode.h' + # webp decoding && encoding + s.subspec 'webp' do |ss| + ss.source_files = 'src/webp/decode.h', 'src/webp/encode.h', 'src/webp/types.h', 'src/webp/mux_types.h', 'src/webp/format_constants.h', 'src/utils/*.{h,c}', 'src/dsp/*.{h,c}', 'src/dec/*.{h,c}', 'src/enc/*.{h,c}' + ss.public_header_files = 'src/webp/decode.h', 'src/webp/encode.h', 'src/webp/types.h', 'src/webp/mux_types.h', 'src/webp/format_constants.h' end # animated webp decoding s.subspec 'demux' do |ss| - ss.dependency 'libwebp/dec' - ss.source_files = 'src/demux/*.{h,c}', 'src/webp/demux.h', 'src/webp/mux_types.h' - ss.public_header_files = 'src/webp/demux.h', 'src/webp/mux_types.h' + ss.dependency 'libwebp/webp' + ss.source_files = 'src/demux/*.{h,c}', 'src/webp/demux.h' + ss.public_header_files = 'src/webp/demux.h' end # animated webp encoding s.subspec 'mux' do |ss| - ss.dependency 'libwebp/enc' ss.dependency 'libwebp/demux' ss.source_files = 'src/mux/*.{h,c}', 'src/webp/mux.h' ss.public_header_files = 'src/webp/mux.h'