Remove Profile Build Dependency 45/92545/5 accepted/tizen/common/20170113.183956 accepted/tizen/mobile/20170113.224905 accepted/tizen/wearable/20170113.224924 submit/tizen/20170113.070309
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 17 Oct 2016 10:01:21 +0000 (10:01 +0000)
committerGeunSun Lee <gs86.lee@samsung.com>
Fri, 30 Dec 2016 04:16:48 +0000 (20:16 -0800)
This commit completely removes the build dependencies
on Tizen profile.

Note:

1. This commit is for Tizen 4.0
delay SR/merge this commit until re-branching out 3.0

2. When maintainers submit SR, they need to submit
JIRA-TRE issues of the followings:

  - Add starter-profile_common for common profile
  - Add starter-profile_mobile for mobile profile
  - Add starter-profile_wearable for wearable profile

Note that you should NOT remove starter from the current
meta when you add these starter-profile_*

Change-Id: I523490432dabe11f9b4a9705adfc55a8e35caede
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/starter.spec

index 866a4bc..6dcdf1a 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:          starter
 Summary:       This is a core application
-Version:       0.5.52
+Version:       0.5.53
 Release:       1
 Group:         Applications/Core Applications
 License:       Apache-2.0
@@ -56,6 +56,8 @@ BuildRequires:  edje-bin
 BuildRequires:  gettext
 BuildRequires:  gettext-tools
 Requires(post): /usr/bin/vconftool
+Requires:      %{name}-compat = %{version}-%{release}
+Recommends:    %{name}-compat-profile_common
 
 %if !%{with wayland}
 BuildRequires:  pkgconfig(utilX)
@@ -64,6 +66,35 @@ BuildRequires:  pkgconfig(utilX)
 %description
 This is for managing life-cycle of core applications.
 
+%package profile_common
+Summary:       Starter binary for common profile
+Provides:      %{name}-compat = %{version}-%{release}
+Provides:      %{name}-profile_tv = %{version}-%{release}
+Provides:      %{name}-profile_ivi = %{version}-%{release}
+Conflicts:     %{name}-profile_mobile
+Conflicts:     %{name}-profile_wearable
+%description profile_common
+Starter has different build options and source codes for each profile.
+This is for common/tv/ivi.
+
+%package profile_mobile
+Summary:       Starter binary for mobile profile
+Provides:      %{name}-compat = %{version}-%{release}
+Conflicts:     %{name}-profile_common
+Conflicts:     %{name}-profile_wearable
+%description profile_mobile
+Starter has different build options and source codes for each profile.
+This is for mobile.
+
+%package profile_wearable
+Summary:       Starter binary for wearable profile
+Provides:      %{name}-compat = %{version}-%{release}
+Conflicts:     %{name}-profile_common
+Conflicts:     %{name}-profile_mobile
+%description profile_wearable
+Starter has different build options and source codes for each profile.
+This is for wearable.
+
 %prep
 %setup -q
 
@@ -74,28 +105,11 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 %endif
 
-%if "%{profile}" == "common"
-%define TIZEN_PROFILE_NAME "COMMON"
-export CFLAGS="$CFLAGS -DTIZEN_PROFILE_COMMON"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_PROFILE_COMMON"
-%endif
-
-%if "%{profile}" == "mobile"
-%define TIZEN_PROFILE_NAME "MOBILE"
-export CFLAGS="$CFLAGS -DTIZEN_PROFILE_MOBILE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_PROFILE_MOBILE"
-%endif
-
-%if "%{profile}" == "wearable"
-%define TIZEN_PROFILE_NAME "WEARABLE"
-export CFLAGS="$CFLAGS -DTIZEN_PROFILE_WEARABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_PROFILE_WEARABLE"
-%endif
-
 %ifarch %{arm}
 export CFLAGS="$CFLAGS -DTIZEN_ARCH_ARM"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_ARCH_ARM"
 %else
+# TODO: x86/64 != EMULATOR. Please fix it with consulting from SDK (changseok oh)
 export CFLAGS="$CFLAGS -DTIZEN_ARCH_EMULATOR"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_ARHC_EMULATOR"
 %endif
@@ -104,7 +118,6 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_ARHC_EMULATOR"
 export CFLAGS="$CFLAGS -DTIZEN_ARCH_ARM64"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_ARCH_ARM64"
 %endif
-
 %if %{with wayland}
 export WAYLAND_SUPPORT=On
 export X11_SUPPORT=Off
@@ -113,26 +126,69 @@ export WAYLAND_SUPPORT=Off
 export X11_SUPPORT=On
 %endif
 
-cmake . -DTIZEN_PROFILE_NAME=%{TIZEN_PROFILE_NAME} -DCMAKE_INSTALL_PREFIX=%{_prefix} -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
+export CFLAGS_COMMON="$CFLAGS"
+export CXXFLAGS_COMMON="$CXXFLAGS"
 
+# wearable
+export CFLAGS="$CFLAGS_COMMON -DTIZEN_PROFILE_WEARABLE"
+export CXXFLAGS="$CXXFLAGS_COMMON -DTIZEN_PROFILE_WEARABLE"
+mkdir -p build_wearable
+pushd build_wearable
+cmake .. -DTIZEN_PROFILE_NAME=WEARABLE -DCMAKE_INSTALL_PREFIX=%{_prefix}/wearable/ -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
+make
+popd
+
+# mobile
+export CFLAGS="$CFLAGS_COMMON -DTIZEN_PROFILE_MOBILE"
+export CXXFLAGS="$CXXFLAGS_COMMON -DTIZEN_PROFILE_MOBILE"
+mkdir -p build_mobile
+pushd build_mobile
+cmake .. -DTIZEN_PROFILE_NAME=MOBILE -DCMAKE_INSTALL_PREFIX=%{_prefix}/mobile/ -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
+make
+popd
+
+# common
+export CFLAGS="$CFLAGS_COMMON -DTIZEN_PROFILE_COMMON"
+export CXXFLAGS="$CXXFLAGS_COMMON -DTIZEN_PROFILE_COMMON"
+mkdir -p build_common
+pushd build_common
+cmake .. -DTIZEN_PROFILE_NAME=COMMON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
 make
+popd
 
 %install
-rm -rf %{buildroot}
+pushd build_wearable
 %make_install
+popd
+
+pushd build_mobile
+%make_install
+popd
+
+pushd build_common
+%make_install
+popd
+
+# Remove commonly used parts (locale)
+rm -Rf %{buildroot}%{_prefix}/mobile/share/locale
+rm -Rf %{buildroot}%{_prefix}/wearable/share/locale
+
+# Rename for subpackages, resolved by post scripts
+mv %{buildroot}%{_prefix}/mobile/bin/starter %{buildroot}%{_prefix}/bin/starter.mobile
+mv %{buildroot}%{_prefix}/wearable/bin/starter %{buildroot}%{_prefix}/bin/starter.wearable
 
 mkdir -p %{buildroot}%{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
 
-%if "%{profile}" == "common"
+# Files for !(mobile or wearable)
 mkdir -p %{buildroot}%{__usrdir}/default.target.wants
-install -m 0644 %SOURCE2 %{buildroot}%{__usrdir}/starter.service
+install -m 0644 %SOURCE2 %{buildroot}%{__usrdir}/starter.service.common
+# .common is to be renamed by %post script.
 install -m 0644 %SOURCE3 %{buildroot}%{__usrdir}/starter.path
 ln -s ../starter.path %{buildroot}%{__usrdir}/default.target.wants/starter.path
-%else
+# Files for mobile or wearable
 mkdir -p %{buildroot}%{__usrdir}/basic.target.wants
 install -m 0644 %SOURCE1 %{buildroot}%{__usrdir}/starter.service
 ln -s ../starter.service %{buildroot}%{__usrdir}/basic.target.wants/starter.service
-%endif
 
 mkdir -p %{buildroot}/usr/share/license
 cp -f LICENSE %{buildroot}/usr/share/license/%{name}
@@ -145,18 +201,42 @@ install starter.upgrade.sh -D %{buildroot}%{_datadir}/upgrade/scripts/500.starte
 %post
 sync
 
+%post profile_common
+mv %{__usrdir}/starter.service.common %{__usrdir}/starter.service
+%preun profile_common
+mv %{__usrdir}/starter.service %{__usrdir}/starter.service.common
+
+%post profile_mobile
+mv %{_bindir}/starter.mobile %{_bindir}/starter
+%preun profile_mobile
+mv %{_bindir}/starter %{_bindir}/starter.mobile
+
+%post profile_wearable
+mv %{_bindir}/starter.wearable %{_bindir}/starter
+%preun profile_wearable
+mv %{_bindir}/starter %{_bindir}/starter.wearable
+
 
 %files -f %{name}.lang
 %manifest starter.manifest
 %defattr(-,root,root,-)
+/usr/share/license/%{name}
+# Upgrade script
+%{_datadir}/upgrade/scripts/500.starter.upgrade.sh
+
+%files profile_common
 %{_bindir}/starter
-%{__usrdir}/starter.service
-%if "%{profile}" == "common"
 %{__usrdir}/starter.path
 %{__usrdir}/default.target.wants/starter.path
-%else
+%{__usrdir}/starter.service.common
+
+%files profile_mobile
+%{_bindir}/starter.mobile
 %{__usrdir}/basic.target.wants/starter.service
-%endif
-/usr/share/license/%{name}
-# Upgrade script
-%{_datadir}/upgrade/scripts/500.starter.upgrade.sh
+%{__usrdir}/starter.service
+
+%files profile_wearable
+%{_bindir}/starter.wearable
+%{__usrdir}/basic.target.wants/starter.service
+%{__usrdir}/starter.service
+