Warning, /education/kstars/packaging/android/3rdparty/libraw.patch is written in an unsupported language. File is not indexed.
0001 diff --git a/CMakeLists.txt b/CMakeLists.txt 0002 index 47f3869..f5df332 100644 0003 --- a/CMakeLists.txt 0004 +++ b/CMakeLists.txt 0005 @@ -114,9 +114,16 @@ INCLUDE(MacroLogFeature) 0006 INCLUDE(MacroOptionalFindPackage) 0007 INCLUDE(MacroJPEG) 0008 0009 +IF("${CMAKE_TOOLCHAIN_FILE}" MATCHES "android.toolchain.cmake$") 0010 + include(${CMAKE_TOOLCHAIN_FILE}) 0011 +ENDIF() 0012 +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/android-hack) 0013 + 0014 # Math library check 0015 0016 -IF(NOT WIN32) 0017 +IF("${CMAKE_TOOLCHAIN_FILE}" MATCHES "android.toolchain.cmake$") 0018 + set(MATH_LIBRARY -lm) # toolchain-android.cmake can't find libm.so 0019 +ELSEIF(NOT WIN32) 0020 FIND_LIBRARY(MATH_LIBRARY m) 0021 ENDIF() 0022 0023 @@ -183,6 +183,8 @@ 0024 # For registration to libraw_config.h 0025 MACRO_BOOL_TO_01(JPEG8_FOUND LIBRAW_USE_DNGLOSSYCODEC) 0026 0027 +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing") 0028 + 0029 # OpenMP library check 0030 0031 SET(OPENMP_FOUND false) 0032 diff --git a/android-hack/swab.h b/android-hack/swab.h 0033 new file mode 100644 0034 index 0000000..061c61e 0035 --- /dev/null 0036 +++ b/android-hack/swab.h 0037 @@ -0,0 +1,7 @@ 0038 + 0039 +#pragma once 0040 + 0041 +#include <stdint.h> 0042 +#include <sys/types.h> 0043 + 0044 +void swab(const void *from, void*to, ssize_t n); 0045 diff --git a/src/libraw_cxx.cpp b/src/libraw_cxx.cpp 0046 index c977302..2112ba8 100644 0047 --- a/src/libraw_cxx.cpp 0048 +++ b/src/libraw_cxx.cpp 0049 @@ -16,6 +16,10 @@ it under the terms of the one of two licenses as you choose: 0050 0051 */ 0052 0053 +#ifdef __ANDROID__ 0054 +#include <swab.h> 0055 +#endif 0056 + 0057 #include <math.h> 0058 #include <errno.h> 0059 #include <float.h> 0060 diff --git a/internal/dcraw_common.cpp b/internal/dcraw_common.cpp 0061 index 608641a..0f991e4 100644 0062 --- a/internal/dcraw_common.cpp 0063 +++ b/internal/dcraw_common.cpp 0064 @@ -19,6 +19,24 @@ it under the terms of the one of two licenses as you choose: 0065 */ 0066 0067 0068 +#ifdef __ANDROID__ 0069 + 0070 +#include <sys/types.h> 0071 +#include <stdint.h> 0072 +#include <asm/byteorder.h> 0073 + 0074 +void swab(const void *p_src_, void *p_dst_, ssize_t n) { 0075 + const uint8_t *p_src = (const uint8_t *)p_src_; 0076 + uint8_t *p_dst = (uint8_t *)p_dst_; uint8_t tmp; ssize_t i; 0077 + 0078 + if (n < 0) return; 0079 + for (i = 0; i < n - 1; i += 2) { 0080 + tmp = p_src[i + 0]; p_dst[i + 0] = p_src[i + 1]; 0081 + p_dst[i + 1] = tmp; 0082 + } 0083 +} 0084 +#endif 0085 + 0086 #include <math.h> 0087 #define CLASS LibRaw:: 0088 #include "libraw/libraw_types.h"