Ensure TPKP related stuff is only built if the package is available 30/56130/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 4 Jan 2016 17:20:22 +0000 (17:20 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 4 Jan 2016 17:51:54 +0000 (17:51 +0000)
Change-Id: I90af1793b158e03b6f6c859a904242641c4f8a05

build/tizen/adaptor/Makefile.am
build/tizen/configure.ac
platform-abstractions/tizen/resource-loader/network/file-download.cpp

index c0aeb94..17a344d 100644 (file)
@@ -324,7 +324,8 @@ libdali_adaptor_la_CXXFLAGS = \
                       $(TTS_CFLAGS) \
                       $(LIBDRM_CFLAGS) \
                       $(LIBEXIF_CFLAGS) \
-                      $(LIBCURL_CFLAGS)
+                      $(LIBCURL_CFLAGS) \
+                      $(TPKP_CURL_CFLAGS)
 
 # Todo, as soon as common repos are updated on build server remove this.
 if !COMMON_PROFILE
@@ -347,6 +348,7 @@ libdali_adaptor_la_LIBADD = \
                       $(LIBEXIF_LIBS) \
                       $(LIBCURL_LIBS) \
                       $(HARFBUZZ_LIBS) \
+                      $(TPKP_CURL_LIBS) \
                       -lgif \
                       -lpthread \
                       -lturbojpeg
@@ -424,9 +426,6 @@ endif
 if UBUNTU_PROFILE
 libdali_adaptor_la_LIBADD += -ljpeg
 CFLAGS += -fPIC
-else
-libdali_adaptor_la_CXXFLAGS += $(TPKP_CURL_CFLAGS)
-libdali_adaptor_la_LIBADD += $(TPKP_CURL_LIBS)
 endif
 
 tizenadaptorpublicapidir = $(devincludepath)/dali/public-api
index 39d4976..c4b9daf 100644 (file)
@@ -78,6 +78,11 @@ if test "x$eldbus_available" = "xyes"; then
 fi
 AC_SUBST(DALI_ELDBUS_AVAILABLE)
 
+PKG_CHECK_MODULES(TPKP_CURL, tpkp-curl, [ tpkp_curl_available=yes ], [ tpkp_curl_available=no ] )
+
+if test "x$tpkp_curl_available" = "xyes"; then
+  DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DTPK_CURL_ENABLED "
+fi
 
 AC_ARG_ENABLE([feedback],
               [AC_HELP_STRING([ --enable-feedback],
@@ -246,8 +251,6 @@ PKG_CHECK_MODULES(DLOG, dlog)
 PKG_CHECK_MODULES(SENSOR, sensor)
 PKG_CHECK_MODULES(TTS, tts)
 PKG_CHECK_MODULES(VCONF, vconf)
-PKG_CHECK_MODULES(TPKP_CURL, tpkp-curl)
-
 if test "x$enable_efl" = "xyes"; then
 if test "x$with_tizen_2_2_compatibility" = "xno"; then
 PKG_CHECK_MODULES(CAPI_SYSTEM_INFO, capi-system-info)
index 362fb7f..0352421 100755 (executable)
@@ -25,9 +25,9 @@
 // INTERNAL INCLUDES
 #include "portable/file-closer.h"
 
-#ifndef DALI_PROFILE_UBUNTU
+#ifdef TPK_CURL_ENABLED
 #include <tpkp_curl.h>
-#endif // DALI_PROFILE_UBUNTU
+#endif // TPK_CURL_ENABLED
 
 using namespace Dali::Integration;
 
@@ -59,10 +59,10 @@ void ConfigureCurlOptions( CURL* curl_handle, const std::string& url )
   curl_easy_setopt( curl_handle, CURLOPT_HEADER, INCLUDE_HEADER );
   curl_easy_setopt( curl_handle, CURLOPT_NOBODY, EXCLUDE_BODY );
 
-#ifndef DALI_PROFILE_UBUNTU
+#ifdef TPK_CURL_ENABLED
   // Apply certificate pinning on Tizen
   curl_easy_setopt( curl_handle, CURLOPT_SSL_CTX_FUNCTION, tpkp_curl_ssl_ctx_callback );
-#endif // DALI_PROFILE_UBUNTU
+#endif // TPK_CURL_ENABLED
 }
 
 // Without a write function or a buffer (file descriptor) to write to, curl will pump out
@@ -163,10 +163,10 @@ bool Network::DownloadRemoteFileIntoMemory( const std::string& url,
   // clean up session
   curl_easy_cleanup( curl_handle );
 
-#ifndef DALI_PROFILE_UBUNTU
+#ifdef TPK_CURL_ENABLED
   // Clean up tpkp(the module for certificate pinning) resources on Tizen
   tpkp_curl_cleanup();
-#endif // DALI_PROFILE_UBUNTU
+#endif // TPK_CURL_ENABLED
 
   return result;
 }