From 4530eb923516c54939449cd86ed81e8fae039d4a Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Tue, 14 Jan 2020 10:53:42 -0800 Subject: [PATCH] Release glog and DoubleConversion with different names Summary: This releases glog and DoubleConversion under "Flipper" preappended name as it solves the issues with Flipper integration with RN under use_frameworks! keyword. Reviewed By: passy Differential Revision: D19392941 fbshipit-source-id: ebdcdc23fcce45cec9bfc6d4f18c14a734caf24f --- Flipper.podspec | 2 +- FlipperKit.podspec | 4 +- docs/getting-started.md | 8 +-- iOS/Podspecs/Flipper-DoubleConversion.podspec | 22 +++++++ iOS/Podspecs/Flipper-Folly.podspec | 9 ++- iOS/Podspecs/Flipper-Glog.podspec | 38 +++++++++++ iOS/Podspecs/scripts/ios-configure-glog.sh | 63 +++++++++++++++++++ iOS/Sample/Sample.xcodeproj/project.pbxproj | 2 - .../SampleSwift.xcodeproj/project.pbxproj | 2 - iOS/Tutorial/Podfile | 4 +- 10 files changed, 136 insertions(+), 18 deletions(-) create mode 100644 iOS/Podspecs/Flipper-DoubleConversion.podspec create mode 100644 iOS/Podspecs/Flipper-Glog.podspec create mode 100644 iOS/Podspecs/scripts/ios-configure-glog.sh diff --git a/Flipper.podspec b/Flipper.podspec index 1f37cc73a..aae337207 100644 --- a/Flipper.podspec +++ b/Flipper.podspec @@ -26,5 +26,5 @@ Pod::Spec.new do |spec| spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "ARCHS" => "${ARCHS_STANDARD_64_BIT}", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Flipper-RSocket\" \"$(PODS_ROOT)/DoubleConversion\"" } + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Flipper-RSocket\" \"$(PODS_ROOT)/Flipper-DoubleConversion\"" } end diff --git a/FlipperKit.podspec b/FlipperKit.podspec index c647edcf4..84bc4856d 100644 --- a/FlipperKit.podspec +++ b/FlipperKit.podspec @@ -40,7 +40,7 @@ Pod::Spec.new do |spec| # by other FlipperKit source files ss.private_header_files = 'iOS/FlipperKit/CppBridge/**/*.h' ss.preserve_path = 'iOS/FlipperKit/CppBridge/**/*.h' - header_search_paths = "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/FlipperKit/iOS/**/\"" + header_search_paths = "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Flipper-DoubleConversion\" \"$(PODS_ROOT)/FlipperKit/iOS/**/\"" ss.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "ONLY_ACTIVE_ARCH": "YES", "DEFINES_MODULE" => "YES", @@ -55,7 +55,7 @@ Pod::Spec.new do |spec| # We set these files as private headers since they only need to be accessed # by other FlipperKit source files ss.private_header_files = 'iOS/FlipperKit/FBCxxFollyDynamicConvert/**/*.h' - header_search_paths = "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\"" + header_search_paths = "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Flipper-DoubleConversion\"" ss.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "ONLY_ACTIVE_ARCH": "YES", "DEFINES_MODULE" => "YES", diff --git a/docs/getting-started.md b/docs/getting-started.md index 73c5d45bc..85ac8e1bc 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -138,8 +138,8 @@ target 'MyApp' do # it's dependencies to be built as a static library and all other pods to # be dynamic. # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', - # 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', - # 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', + # 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion', + # 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', # 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native'] # # pre_install do |installer| @@ -201,8 +201,8 @@ target 'MyApp' do # it's dependencies to be built as a static library and all other pods to # be dynamic. # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', - # 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', - # 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', + # 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion', + # 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', # 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native'] # # pre_install do |installer| diff --git a/iOS/Podspecs/Flipper-DoubleConversion.podspec b/iOS/Podspecs/Flipper-DoubleConversion.podspec new file mode 100644 index 000000000..19257bc28 --- /dev/null +++ b/iOS/Podspecs/Flipper-DoubleConversion.podspec @@ -0,0 +1,22 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +Pod::Spec.new do |spec| + spec.name = 'Flipper-DoubleConversion' + spec.version = '1.1.7' + spec.license = { :type => 'MIT' } + spec.homepage = 'https://github.com/google/double-conversion' + spec.summary = 'Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles' + spec.authors = 'Google' + spec.prepare_command = 'mv src double-conversion' + spec.source = { :git => 'https://github.com/google/double-conversion.git', + :tag => "v1.1.6" } + spec.module_name = 'DoubleConversion' + spec.header_dir = 'double-conversion' + spec.source_files = 'double-conversion/*.{h,cc}' + spec.compiler_flags = '-Wno-unreachable-code' + spec.platforms = { :ios => "8.0", :tvos => "8.0" } + +end diff --git a/iOS/Podspecs/Flipper-Folly.podspec b/iOS/Podspecs/Flipper-Folly.podspec index 3201b993f..55e17c32d 100644 --- a/iOS/Podspecs/Flipper-Folly.podspec +++ b/iOS/Podspecs/Flipper-Folly.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |spec| spec.name = 'Flipper-Folly' - spec.version = '2.1.0' + spec.version = '2.1.1' spec.license = { :type => 'Apache License, Version 2.0' } spec.homepage = 'https://github.com/facebook/folly' spec.summary = 'An open-source C++ library developed and used at Facebook.' @@ -14,8 +14,8 @@ Pod::Spec.new do |spec| :tag => "v2019.03.25.00"} spec.module_name = 'folly' spec.dependency 'boost-for-react-native' - spec.dependency 'DoubleConversion' - spec.dependency 'glog' + spec.dependency 'Flipper-Glog' + spec.dependency 'Flipper-DoubleConversion' spec.dependency 'OpenSSL-Universal', '1.0.2.19' spec.dependency 'CocoaLibEvent', '~> 1.0' spec.compiler_flags = '-DFOLLY_HAVE_PTHREAD=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0 @@ -90,8 +90,7 @@ Pod::Spec.new do |spec| spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "ARCHS" => "${ARCHS_STANDARD_64_BIT}", "CLANG_CXX_LANGUAGE_STANDARD" => "c++11", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Flipper-DoubleConversion\"" } - # Pinning to the same version as React.podspec. spec.platforms = { :ios => "8.0"} end diff --git a/iOS/Podspecs/Flipper-Glog.podspec b/iOS/Podspecs/Flipper-Glog.podspec new file mode 100644 index 000000000..b3053d8b4 --- /dev/null +++ b/iOS/Podspecs/Flipper-Glog.podspec @@ -0,0 +1,38 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +Pod::Spec.new do |spec| + spec.name = 'Flipper-Glog' + spec.version = '0.3.6' + spec.license = { :type => 'Google', :file => 'COPYING' } + spec.homepage = 'https://github.com/google/glog' + spec.summary = 'Google logging module' + spec.authors = 'Google' + + spec.prepare_command = File.read("./scripts/ios-configure-glog.sh") + spec.source = { :git => 'https://github.com/google/glog.git', + :tag => "v0.3.5" } + spec.module_name = 'glog' + spec.header_dir = 'glog' + spec.source_files = 'src/glog/*.h', + 'src/demangle.cc', + 'src/logging.cc', + 'src/raw_logging.cc', + 'src/signalhandler.cc', + 'src/symbolize.cc', + 'src/utilities.cc', + 'src/vlog_is_on.cc' + # workaround for https://github.com/facebook/react-native/issues/14326 + spec.preserve_paths = 'src/*.h', + 'src/base/*.h' + spec.exclude_files = "src/windows/**/*" + spec.libraries = "stdc++" + spec.compiler_flags = '-Wno-shorten-64-to-32' + spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", + "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/src" } + + spec.platforms = { :ios => "8.0", :tvos => "8.0" } + +end diff --git a/iOS/Podspecs/scripts/ios-configure-glog.sh b/iOS/Podspecs/scripts/ios-configure-glog.sh new file mode 100644 index 000000000..4450d3016 --- /dev/null +++ b/iOS/Podspecs/scripts/ios-configure-glog.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +set -e + +PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}" +CURRENT_ARCH="${CURRENT_ARCH}" + +if [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then + # Xcode 10 beta sets CURRENT_ARCH to "undefined_arch", this leads to incorrect linker arg. + # it's better to rely on platform name as fallback because architecture differs between simulator and device + + if [[ "$PLATFORM_NAME" == *"simulator"* ]]; then + CURRENT_ARCH="x86_64" + else + CURRENT_ARCH="armv7" + fi +fi + +export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)" +export CXX="$CC" + +# Remove automake symlink if it exists +if [ -h "test-driver" ]; then + rm test-driver +fi + +./configure --host arm-apple-darwin + +# Fix build for tvOS +cat << EOF >> src/config.h +/* Add in so we have Apple Target Conditionals */ +#ifdef __APPLE__ +#include +#include +#endif +/* Special configuration for AppleTVOS */ +#if TARGET_OS_TV +#undef HAVE_SYSCALL_H +#undef HAVE_SYS_SYSCALL_H +#undef OS_MACOSX +#endif +/* Special configuration for ucontext */ +#undef HAVE_UCONTEXT_H +#undef PC_FROM_UCONTEXT +#if defined(__x86_64__) +#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip +#elif defined(__i386__) +#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip +#endif +EOF + +# Prepare exported header include +EXPORTED_INCLUDE_DIR="exported/glog" +mkdir -p exported/glog +cp -f src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/" +cp -f src/glog/logging.h "$EXPORTED_INCLUDE_DIR/" +cp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/" +cp -f src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/" +cp -f src/glog/vlog_is_on.h "$EXPORTED_INCLUDE_DIR/" diff --git a/iOS/Sample/Sample.xcodeproj/project.pbxproj b/iOS/Sample/Sample.xcodeproj/project.pbxproj index 8c34b675e..bd38e8289 100644 --- a/iOS/Sample/Sample.xcodeproj/project.pbxproj +++ b/iOS/Sample/Sample.xcodeproj/project.pbxproj @@ -410,7 +410,6 @@ "$(inherited)", "-ObjC", "-l\"c++\"", - "-l\"glog\"", "-l\"stdc++\"", "-framework", "\"CFNetwork\"", @@ -503,7 +502,6 @@ "$(inherited)", "-ObjC", "-l\"c++\"", - "-l\"glog\"", "-l\"stdc++\"", "-framework", "\"CFNetwork\"", diff --git a/iOS/SampleSwift/SampleSwift.xcodeproj/project.pbxproj b/iOS/SampleSwift/SampleSwift.xcodeproj/project.pbxproj index 2aa99988b..fb76eb4b4 100644 --- a/iOS/SampleSwift/SampleSwift.xcodeproj/project.pbxproj +++ b/iOS/SampleSwift/SampleSwift.xcodeproj/project.pbxproj @@ -362,7 +362,6 @@ "-l\"event_core\"", "-l\"event_extra\"", "-l\"event_pthreads\"", - "-l\"glog\"", "-l\"ssl\"", "-l\"stdc++\"", "-framework", @@ -415,7 +414,6 @@ "-l\"event_core\"", "-l\"event_extra\"", "-l\"event_pthreads\"", - "-l\"glog\"", "-l\"ssl\"", "-l\"stdc++\"", "-framework", diff --git a/iOS/Tutorial/Podfile b/iOS/Tutorial/Podfile index abdc8b3ed..d13a66919 100644 --- a/iOS/Tutorial/Podfile +++ b/iOS/Tutorial/Podfile @@ -18,8 +18,8 @@ target 'Tutorial' do # it's dependencies to be static and all other pods to # be dynamic. $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', - 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', - 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', + 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion', + 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native'] pre_install do |installer|