%description
UI gadget about the bluetooth
+%ifarch %{ix86} x86_64
+%package extension-emulator
+Summary: UI gadget about the bluetooth for emulator
+Requires: %{name} = %{version}-%{release}
+%description extension-emulator
+UI gadget about the bluetooth for emulator
+%endif // ifarch %{ix86} x86_64
+
%prep
%setup -q
LDFLAGS="$LDFLAGS -Wl,-z -Wl,nodelete"
-%if "%{?_with_emulator}" == "1"
-export CFLAGS="$CFLAGS -DTIZEN_TEST_EMUL"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_TEST_EMUL"
-export FFLAGS="$FFLAGS -DTIZEN_TEST_EMUL"
-%endif
-
-export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
-export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-export LDFLAGS
+export CFLAGS_BASE="${CFALGS}"
+export CXXFLAGS_BASE="${CXXFLAGS}"
+export FFLAGS_BASE="${FFLAGS}"
# Uncomment to disable BT_HOG of mobile. (refer to the end of common/include/bt-util.h)
# Without TIZEN_FEATURE_DISBALE_BT_HOG, BT_HOG is enabled for mobile.
#export CFLAGS+=" -DTIZEN_FEATURE_DISABLE_BT_HOG"
+# extension-emulator
+%ifarch %{ix86} x86_64
+export CFLAGS="${CFLAGS_BASE} -DTIZEN_TEST_EMUL"
+export CXXFLAGS="${CXXFLAGS_BASE} -DTIZEN_TEST_EMUL"
+export FFLAGS="${FFLAGS_BASE} -DTIZEN_TEST_EMUL"
+
+mkdir -p build_emulator
+pushd build_emulator
+# TV profile does not have contacts-service2.
+# Do not build for unified environment if it is TV.
+# ==> The usage of "profile" in this spec file is allowed only for excluding TV profile
+# from unified building.
+%if "%{?profile}" != "tv"
+%cmake .. -DCMAKE_INSTALL_PREFIX=%{_ugdir}/
+%else
+%cmake .. -DTIZEN_WITHOUT_CONTACTS="1" -DCMAKE_INSTALL_PREFIX=%{_ugdir}/
+%endif
+popd
+%endif // ifarch %{ix86} x86_64
+
+# non-emulator
+export CFLAGS="${CFLAGS_BASE} -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="${CXXFLAGS_BASE} -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="${FFLAGS_BASE} -DTIZEN_DEBUG_ENABLE"
# TV profile does not have contacts-service2.
# Do not build for unified environment if it is TV.
%install
rm -rf %{buildroot}
+# extension-emulator
+%ifarch %{ix86} x86_64
+pushd build_emulator
+%make_install
+popd
+pushd %{buildroot}%{_ugdir}/lib/
+for FILE in libug-setting-bluetooth-efl.so*; do mv "${FILE}" "${FILE}.emulator"; done
+popd
+%endif // ifarch %{ix86} x86_64
+
+# non-emulator
%make_install
%files
%exclude %{_ugdir}/res/tables/ug-setting-bluetooth-efl/ug-bluetooth-efl_ChangeableColorTable.xml
%exclude %{_ugdir}/res/tables/ug-setting-bluetooth-efl/ug-bluetooth-efl_FontInfoTable.xml
%{_ugdir}/lib/libug-setting-bluetooth-efl.so.*
+%exclude %{_ugdir}/lib/libug-setting-bluetooth-efl.so.emulator
+%exclude %{_ugdir}/lib/libug-setting-bluetooth-efl.so.*.emulator
+
+%ifarch %{ix86} x86_64
+%post extension-emulator
+pushd %{_ugdir}/lib/
+for FILE in libug-setting-bluetooth-efl.so*.emulator; do mv "${FILE}" "${FILE%.emulator}"; done
+popd
+/sbin/ldconfig
+%preun extension-emulator
+pushd %{_ugdir}/lib/
+for FILE in libug-setting-bluetooth-efl.so*; do mv "${FILE}" "${FILE}.emulator"; done
+popd
+%postun extension-emulator -p /sbin/ldconfig
+%files extension-emulator
+%manifest ug-bluetooth-efl.manifest
+%{_ugdir}/lib/libug-setting-bluetooth-efl.so.emulator
+%{_ugdir}/lib/libug-setting-bluetooth-efl.so.*.emulator
+%endif // ifarch %{ix86} x86_64