+PREFIX+="/usr"
+CXXFLAGS+=" -Wall -g -Os -fPIC"
+LDFLAGS+=" -Wl,--rpath=%{_libdir} "
+
+%if %{with wayland}
+CFLAGS+=" -DWAYLAND"
+CXXFLAGS+=" -DWAYLAND"
+configure_flags="--enable-wayland"
+
+# Need Ecore-Wayland2 when Tizen version is 5.x or greater
+%if 0%{?tizen_version_major} >= 5
+CFLAGS+=" -DECORE_WL2 -DEFL_BETA_API_SUPPORT"
+CXXFLAGS+=" -DECORE_WL2 -DEFL_BETA_API_SUPPORT"
+configure_flags+=" --enable-ecore-wayland2"
+%endif
+%endif
+
+# autogen
+libtoolize --force
+cd %{_builddir}/%{name}-%{version}/build/tizen
+autoreconf --install
+
+DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
+DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
+%if 0%{?tizen_platform_config_supported}
+TIZEN_PLATFORM_CONFIG_SUPPORTED="%{tizen_platform_config_supported}" ; export TIZEN_PLATFORM_CONFIG_SUPPORTED
+%endif
+
+# added for key grab binding only for tizen
+# Do not merge this on tizen branch!
+
+# Set up the build via configure.
+#######################################################################
+# If the profile is selected, the line below is repquired.
+# if mobile || "undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+%configure --prefix=$PREFIX --enable-profile=MOBILE \
+ --enable-tizen-major-version=%{tizen_version_major} \
+%if 0%{?enable_debug}
+ --enable-debug \
+%endif
+ $configure_flags --libdir=%{_libdir}
+
+# Build.
+make %{?jobs:-j%jobs}
+
+pushd %{_builddir}/%{name}-%{version}/build/tizen
+%make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
+popd
+
+pushd %{buildroot}%{_libdir}
+for FILE in libdali-csharp-binder*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.mobile"; done
+mv pkgconfig/dali-csharp-binder*pc %{_builddir}/%{name}-%{version}/build/tizen/
+popd
+
+make clean
+%endif
+
+#######################################################################
+# If the profile is selected, the line below is repquired.
+# if tv ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "common" && "%{?profile}" != "ivi" && "%{?profile}" != "mobile"
+%configure --prefix=$PREFIX --enable-profile=TV \
+ --enable-tizen-major-version=%{tizen_version_major} \
+%if 0%{?enable_debug}
+ --enable-debug \
+%endif
+ $configure_flags --libdir=%{_libdir}
+
+# Build.
+make %{?jobs:-j%jobs}
+
+pushd %{_builddir}/%{name}-%{version}/build/tizen
+%make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
+popd
+
+pushd %{buildroot}%{_libdir}
+for FILE in libdali-csharp-binder*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.tv"; done
+mv pkgconfig/dali-csharp-binder*pc %{_builddir}/%{name}-%{version}/build/tizen/
+popd
+
+make clean
+%endif
+
+#######################################################################
+# If the profile is selected, the line below is repquired.
+# if wearable || "undefined"
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+%configure --prefix=$PREFIX --enable-profile=WEARABLE \
+ --enable-tizen-major-version=%{tizen_version_major} \
+%if 0%{?enable_debug}
+ --enable-debug \
+%endif
+ $configure_flags --libdir=%{_libdir}
+
+# Build.
+make %{?jobs:-j%jobs}
+
+pushd %{_builddir}/%{name}-%{version}/build/tizen
+%make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
+popd
+
+pushd %{buildroot}%{_libdir}
+for FILE in libdali-csharp-binder*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.wearable"; done
+mv pkgconfig/dali-csharp-binder*pc %{_builddir}/%{name}-%{version}/build/tizen/
+popd
+
+make clean
+%endif
+
+#######################################################################
+# If the profile is selected, the line below is repquired.
+# if ivi ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "common" && "%{?profile}" != "mobile"
+%configure --prefix=$PREFIX --enable-profile=IVI \
+ --enable-tizen-major-version=%{tizen_version_major} \
+%if 0%{?enable_debug}
+ --enable-debug \
+%endif
+ $configure_flags --libdir=%{_libdir}
+
+# Build.
+make %{?jobs:-j%jobs}
+
+pushd %{_builddir}/%{name}-%{version}/build/tizen
+%make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
+popd
+
+pushd %{buildroot}%{_libdir}
+for FILE in libdali-csharp-binder*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.ivi"; done
+mv pkgconfig/dali-csharp-binder*pc %{_builddir}/%{name}-%{version}/build/tizen/
+popd
+
+make clean
+%endif
+
+#######################################################################
+# common
+# If the profile is selected, the line below is repquired.
+# if common ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "mobile"
+%configure --prefix=$PREFIX --enable-profile=COMMON \
+ --enable-tizen-major-version=%{tizen_version_major} \
+%if 0%{?enable_debug}
+ --enable-debug \
+%endif
+ $configure_flags --libdir=%{_libdir}
+
+# Build.
+make %{?jobs:-j%jobs}
+
+pushd %{_builddir}/%{name}-%{version}/build/tizen
+%make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
+popd
+
+pushd %{buildroot}%{_libdir}
+for FILE in libdali-csharp-binder*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
+mv pkgconfig/dali-csharp-binder*pc %{_builddir}/%{name}-%{version}/build/tizen/
+popd
+
+make clean
+%endif