BuildRequires: gettext
BuildRequires: ninja
BuildRequires: python
-BuildRequires: model-build-features
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(bundle)
%description
Crosswalk Runtime and AppShell for Tizen 3.0 and later
+# If it is unified or wearable, create circular-display extension
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+%package extension-circle
+Summary: Extension for Crosswalk-Tizen with Circular Displays (Tizen Wearable)
+Requires: %{name} = %{version}-%{release}
+%description extension-circle
+Extension for Crosswalk-Tizen with Circular Displays of Tizen Wearable Profile.
+You need to install %{name} before installing this extension.
+%endif
+
%prep
%setup -q
# Not required anymore
#GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_manual_rotate_support=%{?tizen_feature_manual_rotate_support}"
-# TODO: do not use model_build_feature.
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_model_formfactor=%{?model_build_feature_formfactor}"
-
# Extension Path
GYP_OPTIONS="$GYP_OPTIONS -Dextension_path=%{extension_path}"
# Tizen product tv
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_product_tv=%{!?TIZEN_PRODUCT_TV:0}"
+GYP_OPTIONS_BASE="$GYP_OPTIONS"
+
+# TODO: do not use model_build_feature.
+GYP_OPTIONS="$GYP_OPTIONS_BASE -Dtizen_model_formfactor=rectangle"
+
+echo "PROFILE = %{?profile}"
+
+# If it is unified or wearable, create circular-display extension
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+# TODO: do not use model_build_feature.
+GYP_OPTIONS="$GYP_OPTIONS_BASE -Dtizen_model_formfactor=circle"
+mkdir -p build_circle
+./tools/gyp/gyp $GYP_OPTIONS xwalk_tizen.gyp
+ninja -C out/Default %{?_smp_mflags}
+mkdir -p out/Circle
+mv out/Default/xwalk_runtime out/Circle/
+%endif
+
# Build
./tools/gyp/gyp $GYP_OPTIONS xwalk_tizen.gyp
ninja -C out/Default %{?_smp_mflags}
install -p -m 755 out/Default/xwalk_runtime %{buildroot}%{_bindir}
ln -s %{_bindir}/xwalk_runtime %{buildroot}%{_bindir}/wrt
ln -s %{_bindir}/xwalk_runtime %{buildroot}%{_bindir}/wrt-client
+# If it is unified or wearable, create circular-display extension
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+install -p -m 755 out/Circle/xwalk_runtime %{buildroot}%{_bindir}/xwalk_runtime.circle
+%endif
# xwalk extension shared
install -p -m 644 out/Default/lib/libxwalk_extension_shared.so %{buildroot}%{_libdir}
%attr(755,root,root) %{_bindir}/wrt-upgrade
%attr(755,root,root) %{_datadir}/upgrade/scripts/720.wrt.upgrade.sh
%caps(cap_sys_admin,cap_setgid=ei) %{_bindir}/wrt-loader
+
+# If it is unified or wearable, create circular-display extension
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+%post extension-circle
+ln -sf xwalk_runtime.circle %{_bindir}/xwalk_runtime
+%preun extension-circle
+echo "You need to reinstall %{name} if you want to let %{name} behave correctly after uninstalling this package."
+%files extension-circle
+%attr(755,root,root) %{_bindir}/xwalk_runtime.circle
+%endif