%setup -q -n %{name}-%{version}
%build
- export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
- export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
- export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
- export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
- export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
- export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE -DTIZEN_DEBUG_ENABLE -fvisibility=hidden"
+ export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE -DTIZEN_DEBUG_ENABLE -fvisibility=hidden -fvisibility-inlines-hidden"
+ export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE -DTIZEN_DEBUG_ENABLE"
-%if "%{?profile}" == "mobile"
-CFLAGS+=" -D_MOBILE";
-CXXFLAGS+=" -D_MOBILE";
+export CFLAGSBASE="$CFLAGS"
+export CXXFLAGSBASE="$CXXFLAGS"
+
+rm -rf CMakeFiles
+rm -rf CMakeCache.txt
+
+# This if/endif is for GBM build optimization. This usage does not affect
+# The unified build (profile is undefined) as it will return TRUE always.
+%if "%{?profile}"!="tv" && "%{?profile}"!="wearable"
+mkdir -p build_mobile
+CFLAGS="$CFLAGSBASE -D_MOBILE"
+CXXFLAGS="$CXXFLAGSBASE -D_MOBILE"
+
+pushd build_mobile
+cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+ -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \
+ -DTZ_SYS_RO_ICONS=%TZ_SYS_RO_ICONS
+make %{?jobs:-j%jobs}
+popd
%endif
-%if "%{?profile}" == "wearable"
-CFLAGS+=" -D_WEARABLE";
-CXXFLAGS+=" -D_WEARABLE";
-%if "%{model_build_feature_formfactor}" == "circle"
-CFLAGS+=" -D_CIRCLE";
-CXXFLAGS+=" -D_CIRCLE";
+# This if/endif is for GBM build optimization. This usage does not affect
+# The unified build (profile is undefined) as it will return TRUE always.
+%if "%{?profile}"!="tv" && "%{?profile}"!="mobile"
+mkdir -p build_wearable_rectangle
+
+CFLAGS="$CFLAGSBASE -D_WEARABLE"
+CXXFLAGS="$CXXFLAGSBASE -D_WEARABLE"
+pushd build_wearable_rectangle
+cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+ -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \
+ -DTZ_SYS_RO_ICONS=%TZ_SYS_RO_ICONS
+make %{?jobs:-j%jobs}
+popd
+
+# Because circle breaks CAPI compatibility, it should be built for
+# wearable and "unified (undefined)"
+%if "%{?profile}"!="tv" && "%{?profile}"!="mobile" && "%{?profile}"!="ivi" && "%{?profile}"!="common"
+mkdir -p build_wearable_circle
+CFLAGS="$CFLAGSBASE -D_WEARABLE -D_CIRCLE"
+CXXFLAGS="$CXXFLAGSBASE -D_WEARABLE -D_CIRCLE"
+pushd build_wearable_circle
+cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+ -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \
+ -DTZ_SYS_RO_ICONS=%TZ_SYS_RO_ICONS
+make %{?jobs:-j%jobs}
+popd
%endif
%endif