Make elementary compatible with Tizen 4.0 build env. 65/111365/2
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 29 Dec 2016 02:14:03 +0000 (11:14 +0900)
committerJee-Yong Um <jc9.um@samsung.com>
Mon, 23 Jan 2017 02:28:38 +0000 (18:28 -0800)
In Tizen 4.0 Unified Project, there will be no more
profile macro available.

However, in order to make it keep compatible with obsolete
build environment including the "GBM/private" build systems,
if profile macro is defined as tv/mobile/wearble, we will
disable the modification.

Note: this is a workaround until the correspondants refactor
this package so that Elemetnary uses "configuration" at
run/boot-time. Without this workaround, before getting such
a nice refactored code, this package will disrupt all the
other packages in Tizen 4.0 Unified build environment.
So, after refactoring, please remove what this patch does.
(or you may nudge me when it is done.)

Note2: There will be yet another workaround that removed
the need for "TIZEN_PROFILE_WEARABLE", which is the one
that abandoned some time ago. That workaround has the
same characteristic; it is to keep it compatible before
you've done with refactoring.

Change-Id: If27ffd0ed419882d533c46499d45d16cdd727a07
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
==================================================================

This patch has been modified since it was written first.
Fixes some incorrect conditional statements and handles private headers.

Signed-Off-By: Jee-Yong Um <jc9.um@samsung.com>
Change-Id: I1cc1eaf0ecbd01f52c793d37bb44b9580608c08d

packaging/elementary.spec

index cfd26f0c832c460feb04206e0c0d32c6f25cfc2b..15d3007c24b1a69aeea931061122dead2793e254 100644 (file)
@@ -1,3 +1,7 @@
+# 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
@@ -53,6 +57,14 @@ BuildRequires:  pkgconfig(icu-i18n)
 
 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
@@ -64,6 +76,32 @@ fine-grained library splitting means all of this is shared, just a new
 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
 
@@ -96,28 +134,73 @@ cp %{SOURCE1001} .
 
 %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}
@@ -125,6 +208,11 @@ cp %{SOURCE1001} .
 %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
 
@@ -151,6 +239,22 @@ 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