+# Do not let auto-provides searches for the workaround extension.
+# This is to be removed after the supposed refactoring that unifies the whole source code.
+%global __provides_exclude_from ^(.*\\.mobile)$
+
%define dbus_unavailable 1
%bcond_with wayland
Recommends: %{name}-locale = %{version}
+Provides: %{name}-profile_common = %{version}-%{release}
+Provides: %{name}-profile_tv = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
+%if "%{?profile}" == "mobile" || "%{?profile}" == "wearable"
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_wearable = %{version}-%{release}
+%endif
+
%description
Elementary is a widget set. It is a new-style of widget set much more canvas
object based than anything else. Why not ETK? Why not EWL? Well they both
widget "personality" is on top. And that is... Elementary, my dear watson.
Elementary.
+# This subpackage is a workaround to support Tizen mobile/wearable functionalities in
+# Tizen 4.0 Unified environment where all the profiles coexist in one repository.
+# With the supposed refactoring efforts, this must be removed afterwards.
+# This is simply for the backward compatibility during the refactoring efforts.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
+# If it is common/tv/ivi/"unified"
+%package extension-mobile
+Summary: EFL elementary extension for mobile/wearable profile workaround
+Requires: %{name} = %{version}-%{release}
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_wearable = %{version}-%{release}
+%description extension-mobile
+This is a workaround for Tizen mobile/wearable that uses different set of library
+source code. This extension will overwrite the library .so files of default
+%{name} package to fit Tizen mobile/wearable.
+Note that after the supposed refactoring that is going to unify the source code
+across all Tizen profiles, this extension is no longer required once the
+src/mobile_lib directory becomes empty.
+Because this package overwrites .so files of %{name}, uninstalling this while
+keeping %{name} does not have effects of the uninstall. You will need to
+reinstall %{name} after uninstalling this in order to use the default %{name}
+after installing this.
+
+%endif
+
+
%package examples
Summary: EFL elementary examples
%build
-# Patch profile dependency widgets
-%if "%{profile}" == "mobile"
- cp %{_builddir}/%{buildsubdir}/src/mobile_lib/* %{_builddir}/%{buildsubdir}/src/lib
-%else
- %if "%{profile}" == "wearable"
- cp %{_builddir}/%{buildsubdir}/src/mobile_lib/* %{_builddir}/%{buildsubdir}/src/lib
- export CFLAGS+=" -DTIZEN_PROFILE_WEARABLE"
+# This subpackage is a workaround to support Tizen mobile/wearable functionalities in
+# Tizen 4.0 Unified environment where all the profiles coexist in one repository.
+# With the supposed refactoring efforts, this must be removed afterwards.
+# This is simply for the backward compatibility during the refactoring efforts.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
+ cp %{_builddir}/%{buildsubdir}/src/lib/elc_ctxpopup.c %{_builddir}/%{buildsubdir}/src/lib/elc_ctxpopup.c.orig
+ cp %{_builddir}/%{buildsubdir}/src/lib/elm_widget_ctxpopup.h %{_builddir}/%{buildsubdir}/src/lib/elm_widget_ctxpopup.h.orig
+ cp %{_builddir}/%{buildsubdir}/src/lib/elm_genlist.c %{_builddir}/%{buildsubdir}/src/lib/elm_genlist.c.orig
+ cp %{_builddir}/%{buildsubdir}/src/lib/elm_widget_genlist.h %{_builddir}/%{buildsubdir}/src/lib/elm_widget_genlist.h.orig
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elc_ctxpopup.c %{_builddir}/%{buildsubdir}/src/lib
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elm_widget_ctxpopup.h %{_builddir}/%{buildsubdir}/src/lib
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elm_genlist.c %{_builddir}/%{buildsubdir}/src/lib
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elm_widget_genlist.h %{_builddir}/%{buildsubdir}/src/lib
+
+# Create .mobile file required for the workaround extension
+ %autogen --disable-static \
+ %if %{with wayland}
+ --enable-ecore-wayland \
+ %endif
+ %if !%{with x}
+ --disable-ecore-x \
+ %endif
+ --with-elementary-base-dir="share/.elementary" \
+ %if %dbus_unavailable
+ --disable-build-examples
+ %else
+ --enable-build-examples
%endif
-%endif
-%autogen --disable-static \
-%if %{with wayland}
- --enable-ecore-wayland \
-%endif
-%if !%{with x}
- --disable-ecore-x \
+ %__make %{?_smp_mflags}
+ mkdir -p mobile_libs
+
+ /bin/sh ./libtool --mode=install /usr/bin/install -c src/lib/libelementary.la %{_builddir}/%{buildsubdir}/mobile_libs/
+ mv mobile_libs/libelementary.so.%{version} mobile_libs/libelementary.so.%{version}.mobile
+
+# Let's hope make do not build unaffected files.
+ cp %{_builddir}/%{buildsubdir}/src/lib/elc_ctxpopup.c.orig %{_builddir}/%{buildsubdir}/src/lib/elc_ctxpopup.c
+ cp %{_builddir}/%{buildsubdir}/src/lib/elm_widget_ctxpopup.h.orig %{_builddir}/%{buildsubdir}/src/lib/elm_widget_ctxpopup.h
+ cp %{_builddir}/%{buildsubdir}/src/lib/elm_genlist.c.orig %{_builddir}/%{buildsubdir}/src/lib/elm_genlist.c
+ cp %{_builddir}/%{buildsubdir}/src/lib/elm_widget_genlist.h.orig %{_builddir}/%{buildsubdir}/src/lib/elm_widget_genlist.h
+# If it is common/tv/ivi/"unified"
%endif
- --with-elementary-base-dir="share/.elementary" \
-%if %dbus_unavailable
- --disable-build-examples
-%else
- --enable-build-examples
+
+
+
+# Patch profile dependency widgets
+%if "%{?profile}" == "mobile" || "%{?profile}" == "wearable"
+# Modifing devel packages is prohibited. Copy .c and private .h files only.
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elc_ctxpopup.c %{_builddir}/%{buildsubdir}/src/lib
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elm_widget_ctxpopup.h %{_builddir}/%{buildsubdir}/src/lib
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elm_genlist.c %{_builddir}/%{buildsubdir}/src/lib
+ cp %{_builddir}/%{buildsubdir}/src/mobile_lib/elm_widget_genlist.h %{_builddir}/%{buildsubdir}/src/lib
+
+# With the workaround enabled, we've already done "autogen"
+ %autogen --disable-static \
+ %if %{with wayland}
+ --enable-ecore-wayland \
+ %endif
+ %if !%{with x}
+ --disable-ecore-x \
+ %endif
+ --with-elementary-base-dir="share/.elementary" \
+ %if %dbus_unavailable
+ --disable-build-examples
+ %else
+ --enable-build-examples
+ %endif
%endif
%__make %{?_smp_mflags}
%install
%make_install
+# With the workaround extension
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
+ install -m 0755 mobile_libs/libelementary.so.%{version}.mobile %{buildroot}%{_libdir}
+%endif
+
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m 0644 %SOURCE100 %{buildroot}%{_tmpfilesdir}/elementary.conf
%exclude %{_datadir}/elementary/config/
+# This subpackage is a workaround to support Tizen mobile/wearable functionalities in
+# Tizen 4.0 Unified environment where all the profiles coexist in one repository.
+# With the supposed refactoring efforts, this must be removed afterwards.
+# This is simply for the backward compatibility during the refactoring efforts.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
+# If it is common/tv/ivi/"unified"
+%post extension-mobile
+mv %{_libdir}/libelementary.so.%{version}.mobile %{_libdir}/libelementary.so.%{version}
+/sbin/ldconfig
+%postun extension-mobile -p /sbin/ldconfig
+%files extension-mobile
+%manifest %{name}.manifest
+# 4 files (elc_ctxpopup.c, elm_widget_ctxpopup.h, elm_genlist.c and elm_widget_genlist.h in mobile_lib) affects libelementary
+%{_libdir}/libelementary.so.%{version}.mobile
+%endif
+
%if ! %dbus_unavailable
%files examples
%manifest %{name}.manifest