Remove Profile Build Dependency 77/92077/1
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 13 Oct 2016 07:23:49 +0000 (07:23 +0000)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 13 Oct 2016 07:27:02 +0000 (07:27 +0000)
This commit completely removes the build dependencies
on Tizen profile.

Note:

1. This commit is not required for Tizen 3.0 release,
but for later Tizen versions. If maintainers do not feel
comfortable because of the release schedule, maintainers
may delay SR/merge this commit.

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: I9542adfc0883fe96733c7518aeb42f88783248b9
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/starter.spec

index fb51bdb..84cce02 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
@@ -55,6 +55,7 @@ BuildRequires:  edje-bin
 BuildRequires:  gettext
 BuildRequires:  gettext-tools
 Requires(post): /usr/bin/vconftool
+Requires:      %{name}-compat = %{version}
 
 %if !%{with wayland}
 BuildRequires:  pkgconfig(utilX)
@@ -63,6 +64,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
+Provides:      %{name}-profile_tv
+Provides:      %{name}-profile_ivi
+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
+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
+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
 
@@ -73,28 +103,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
@@ -103,7 +116,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
@@ -112,26 +124,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}
@@ -144,18 +199,42 @@ install starter.upgrade.sh -D %{buildroot}%{_datadir}/upgrade/scripts/starter.up
 %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/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/starter.upgrade.sh
+%{__usrdir}/starter.service
+
+%files profile_wearable
+%{_bindir}/starter.wearable
+%{__usrdir}/basic.target.wants/starter.service
+%{__usrdir}/starter.service
+