License: Flora-1.1
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(evas)
-%if "%{?profile}" == "wearable"
+# For backward-compatibility and GBM build optimization
+# if wearable, "unified". common may be added after efl-ext is unified/refactored.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
BuildRequires: pkgconfig(syspopup-caller)
-%else
+%endif
+# For backward-compatibility and GBM build optimization
+# if mobile, tv, ivi, common, or "unified"
+%if "%{?profile}" != "wearable"
BuildRequires: pkgconfig(notification)
%endif
BuildRequires: pkgconfig(efl-extension)
BuildRequires: cmake
BuildRequires: gettext-devel
+Requires: %{name}-compat = %{version}-%{release}
+%if "%{?profile}" != "wearable"
+Recommends: %{name}-profile_common = %{version}-%{release}
+%endif
+
%description
bluetooth system-popup application (bluetooth system popup).
+%package profile_wearable
+Summary: bt-syspopup binary for wearable
+Provides: %{name}-compat = %{version}-%{release}
+Conflicts: %{name}-profile_common
+%description profile_wearable
+bluetooth system-popup application binary for Tizen wearable profile.
+
+%package profile_common
+Summary: bt-syspopup binary for common
+Provides: %{name}-compat = %{version}-%{release}
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_tv = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
+Conflicts: %{name}-profile_wearable
+%description profile_common
+bluetooth system-popup application binary for Tizen common profile.
+
%prep
%setup -q
%build
-%if "%{?profile}" == "wearable"
-export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE -DTIZEN_PROFILE_WEARABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
-export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
-%else
-export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DTIZEN_PROFILE_MOBILE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
-export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%endif
export CFLAGS+=" -fpie -fvisibility=hidden"
export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+export CFLAGS_BASE="$CFLAGS"
+export CXXFLAGS_BASE="$CXXFLAGS"
+export FFLAGS_BASE="$FFLAGS"
+
+# For backward-compatibility and GBM build optimization
+# if wearable, "unified". common may be added after efl-ext is unified/refactored.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+mkdir -p build_wearable
+pushd build_wearable
+export CFLAGS="$CFLAGS_BASE -DTIZEN_ENGINEER_MODE -DTIZEN_PROFILE_WEARABLE"
+export CXXFLAGS="$CXXFLAGS_BASE -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS_BASE -DTIZEN_ENGINEER_MODE"
+
+cmake .. \
+ -DCMAKE_INSTALL_PREFIX=%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup \
+%if %{with wayland}
+ -DWAYLAND_SUPPORT=On \
+%else
+ -DWAYLAND_SUPPORT=Off \
+%endif
+ #eol
+
+make %{?jobs:-j%jobs}
+
+%cmake .. \
+ -DTZ_SYS_RO_APP=%{TZ_SYS_RO_APP} \
+ -DTZ_SYS_SHARE=%{TZ_SYS_SHARE}
+make
+popd
+%endif
+
+# For backward-compatibility and GBM build optimization
+# if mobile, tv, ivi, common, or "unified"
+%if "%{?profile}" != "wearable"
+export CFLAGS="$CFLAGS_BASE -DTIZEN_DEBUG_ENABLE -DTIZEN_PROFILE_MOBILE"
+export CXXFLAGS="$CXXFLAGS_BASE -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS_BASE -DTIZEN_DEBUG_ENABLE"
cmake . \
-DCMAKE_INSTALL_PREFIX=%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup \
-DTZ_SYS_RO_APP=%{TZ_SYS_RO_APP} \
-DTZ_SYS_SHARE=%{TZ_SYS_SHARE}
make
+%endif
+
%install
rm -rf %{buildroot}
+# For backward-compatibility and GBM build optimization
+# if wearable, "unified". common may be added after efl-ext is unified/refactored.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+pushd build_wearable
%make_install
+popd
+pushd %{buildroot}%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/bin
+mv bt-syspopup bt-syspopup.wearable
+popd
+pushd %{buildroot}%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/res/edje
+mv custom_popup.edj custom_popup.edj.wearable
+popd
+%endif
+
+# For backward-compatibility and GBM build optimization
+# if mobile, tv, ivi, common, or "unified"
+%if "%{?profile}" != "wearable"
+%make_install
+%endif
%files
%manifest org.tizen.bt-syspopup.manifest
%defattr(-,root,root,-)
%{TZ_SYS_RO_PACKAGES}/org.tizen.bt-syspopup.xml
-%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/bin/bt-syspopup
-%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/res/edje/*.edj
%{TZ_SYS_SHARE}/icons/default/small/org.tizen.bt-syspopup.png
-%if "%{?profile}" == "wearable"
+
+# For backward-compatibility and GBM build optimization
+# if mobile, tv, ivi, common, or "unified"
+%if "%{?profile}" != "wearable"
+%files profile_common
+%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/bin/bt-syspopup
+%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/res/edje/custom_popup.edj
+%endif
+
+# For backward-compatibility and GBM build optimization
+# if wearable, "unified". common may be added after efl-ext is unified/refactored.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+%files profile_wearable
+%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/bin/bt-syspopup.wearable
+%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/res/edje/custom_popup.edj.wearable
%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/shared/res/tables/org.tizen.bt-syspopup_ChangeableColorTable.xml
%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/shared/res/tables/org.tizen.bt-syspopup_FontInfoTable.xml
%{TZ_SYS_RO_APP}/org.tizen.bt-syspopup/res/images/*