Switch off ASan for update_db 35/127735/5
authorSlava Barinov <v.barinov@samsung.com>
Fri, 16 Sep 2016 14:24:28 +0000 (17:24 +0300)
committerKunhoon Baik <knhoon.baik@samsung.com>
Thu, 8 Jun 2017 00:00:43 +0000 (00:00 +0000)
Sanitized binary cannot be built with '-static' since Address Sanitizer intercepts function calls from libraries.

Thus, system-info is built in both Address Sanitizer On environment and Address Sanitizer Off environment. Then, system-info-update-db built without sanitized build option is installed.

Change-Id: I16a09d0555252cac0d717068560d99f06d0c12d3
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
CMakeLists.txt
packaging/capi-system-info.spec

index 5793d7a044eeafe877ad4b1b53e9200ea9ceaacf..68bb0c2b2a26dfdaf917b7b97dfdf0376cc1ad8d 100644 (file)
@@ -80,7 +80,12 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/system_info_intf.h DESTINATION
 
 ADD_SUBDIRECTORY(src/tizenid)
 ADD_SUBDIRECTORY(src/init_db)
+
+OPTION(BUILD_UPDATE_DB "Build update_db tool" ON)
+
+IF(BUILD_UPDATE_DB)
 ADD_SUBDIRECTORY(src/update_db)
+ENDIF(BUILD_UPDATE_DB)
 
 #Upgrade script
 CONFIGURE_FILE(
index e3a26c8fe90e3a76929b7d112ad20fd7ceed47d4..54127d6ef4e05b6e4ee01a3ce3532bfb0ee1ae70 100644 (file)
@@ -52,20 +52,36 @@ cp %{SOURCE1001} .
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-
-%cmake . -DCONFIG_FILE_PATH=%{config_file_path} \
-                -DINFO_FILE_PATH=%{info_file_path} \
-                -DMAJORVER=${MAJORVER} \
-                -DFULLVER=%{version} \
-                -DSHARED_PATH=%{sysinfo_shared_path} \
-                -DTIZEN_ID_PATH=%{tizen_id_path} \
-                -DDB_PATH=%{db_path} \
-                -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path}
-
+CMAKE_OPTS="-DCONFIG_FILE_PATH=%{config_file_path} \
+            -DINFO_FILE_PATH=%{info_file_path} \
+           -DMAJORVER=${MAJORVER} \
+           -DFULLVER=%{version} \
+           -DSHARED_PATH=%{sysinfo_shared_path} \
+           -DTIZEN_ID_PATH=%{tizen_id_path} \
+           -DDB_PATH=%{db_path} \
+           -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
+           %{?asan:-DBUILD_UPDATE_DB=OFF}"
+
+mkdir build && cd build
+%cmake .. ${CMAKE_OPTS}
+
+# Address Sanitizer can't be applied to static binaries, so update_db should be
+# excluded from ASan build. So the update_db is rebuilt without forced ASan
+# options after the rest of package is ready
+%__make %{?_smp_mflags}
+%{?asan:
+mkdir -p %{_builddir}/update_db && pushd %{_builddir}/update_db
+/usr/bin/gcc-unforce-options
+%cmake %{_builddir}/%{name}-%{version} ${CMAKE_OPTS} -DBUILD_UPDATE_DB=ON
 %__make %{?_smp_mflags}
+popd
+}
 
 %install
+pushd build
 %make_install
+popd
+%{?asan:pushd %{_builddir}/update_db/src/update_db && %make_install && popd}
 mkdir -p %{buildroot}/etc
 cp -f script/make_info_file.sh %{buildroot}/etc/make_info_file.sh