%define app_dir out/gen/app
%define crosswalk_extensions_service tizen-extensions-crosswalk-service
+# The d2d is public feature
+%if "%{?tizen_profile_name}" != "tv" && "%{?profile}" != "wearable" && "%{?_with_da_profile}" != "1"
+ %define _use_d2d 1
+%endif
BuildRequires: pkgconfig(chromium-efl)
BuildRequires: pkgconfig(dlog)
%endif
-%if 0%{?_use_tpk}
+%if 0%{?_use_tpk} || 0%{?_use_d2d}
%if "%{?profile}" == "tv"
BuildRequires: app-signer
%endif
%define _tizen_version %{tizen_version_major}%{tizen_version_minor}
%define _pkgid org.tizen.%{name}
+%define __pkgid %{_pkgid}
%if 0%{?_use_tpk}
# The tv profile has a different tpk generation policy.
# 2 types(update, upgrade) of tpk can be generated and used simultaneously.
# is generated by default.
%if "%{?profile}" == "tv"
%if "%{?tpktype}" == "upgrade" || (0%{!?tpktype:1} && %{_tizen_version} < 60)
- %define _tpkid %{_pkgid}-upgrade
+ %define __pkgid %{_pkgid}-upgrade
%endif
%endif
- %if 0%{!?_tpkid:1}
- %define _tpkid %{_pkgid}
- %endif
-
- # WRTjs TPK install directory
- %global WRTJS_TPK_DIR /tmp
- # Directory for WRTjs tizen application package
- %global WRTJS_APP_DIR %{TZ_SYS_RO_APP}/%{_tpkid}
%endif
+# Generated app directory
+%global GENERATED_APP_DIR /tmp/%{name}
+# Directory for WRTjs tizen application package
+%global WRTJS_APP_DIR %{TZ_SYS_RO_APP}/%{__pkgid}
%prep
%setup -q
%endif
sed -e 's#@TIZEN_VERSION@#%{tizen_version_major}.%{tizen_version_minor}#g' \
-e 's#@WRTJS_VERSION@#%{version}#g' \
- -e 's#@PACKAGE_ID@#%{_tpkid}#g' \
+ -e 's#@PACKAGE_ID@#%{__pkgid}#g' \
packaging/%{_manifestname}.xml.in \
> packaging/tizen-manifest-tpk.xml
%endif
%ifarch x86_64
%define ARCHITECTURE x86_64
%endif
+
%define _resourcedir /usr/share/wrt/app
+install -d %{GENERATED_APP_DIR}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/aul
install -d %{buildroot}%{_resourcedir}
install -d %{buildroot}%{WRTJS_APP_DIR}
-%if 0%{?__package_signing}
- install -m 0644 tizen/downloadable/vd_sign/author-signature.xml %{buildroot}%{WRTJS_APP_DIR}
- install -m 0644 tizen/downloadable/vd_sign/signature1.xml %{buildroot}%{WRTJS_APP_DIR}
-%else
- %define tizen_sign 1
- %define tizen_sign_base %{WRTJS_APP_DIR}
- %define tizen_sign_level platform
- %define tizen_author_sign 1
- %define tizen_dist_sign 1
+%if 0%{?_use_tpk}
+ %if 0%{?__package_signing}
+ install -m 0644 tizen/downloadable/vd_sign/author-signature.xml %{buildroot}%{WRTJS_APP_DIR}
+ install -m 0644 tizen/downloadable/vd_sign/signature1.xml %{buildroot}%{WRTJS_APP_DIR}
+ %else
+ %define tizen_sign 1
+ %define tizen_sign_base %{WRTJS_APP_DIR}
+ %define tizen_sign_level platform
+ %define tizen_author_sign 1
+ %define tizen_dist_sign 1
+ %endif
%endif
%if "%{?profile}" == "tv"
# The debugsources.list is needed by __spec_install_post to generate tpk file
# but it's missing in the build process. So, the temporary file is touched.
touch debugsources.list
- %define _tpk_file_name %{_tpkid}-%{version}-v%{tizen_version_major}.%{tizen_version_minor}.%{repo_name}.%{ARCHITECTURE}
+ %define _tpk_file_name %{__pkgid}-%{version}-v%{tizen_version_major}.%{tizen_version_minor}.%{repo_name}.%{ARCHITECTURE}.tpk
%define __tpk_install_post \
- tizen/build/build_tpk.sh %{buildroot}%{WRTJS_APP_DIR} %{WRTJS_TPK_DIR} %{_tpk_file_name} %{_tpkid} %{?profile}
+ tizen/build/build_app.sh %{GENERATED_APP_DIR} wrtjs_tpk_root %{_tpk_file_name} tpk %{?profile}
%define __spec_install_post \
%{?__tpk_install_post} \
%{nil}
echo "No TPK generation"
%endif
+%if 0%{?_use_d2d}
+ %define _d2d_file_name GlobalDeviceWebServer.wgt
+ tizen/build/build_app.sh %{GENERATED_APP_DIR} d2d_wgt_root %{_d2d_file_name} wgt %{?profile}
+ mv %{GENERATED_APP_DIR}/%{_d2d_file_name} %{buildroot}%{WRTJS_APP_DIR}
+%endif
+
%pre
if (( $(rpm -q chromium-efl | wc -l) > 1 )); then
echo -e "\033[31m*****************************************************"
fi
%post
+%if 0%{?_use_d2d}
+ echo "* Install D2D Server..."
+ pkgcmd -i -p %{WRTJS_APP_DIR}/%{_d2d_file_name}
+ rm -f %{WRTJS_APP_DIR}/%{_d2d_file_name}
+%endif
%postun
+%if 0%{?_use_d2d}
+ %define _d2d_pkgid 9z6IujVul3
+ if [[ "$(app_launcher -l | grep %{_d2d_pkgid})" != "" ]]; then
+ echo "* Uninstall D2D Server..."
+ pkgcmd -u -n %{_d2d_pkgid}
+ fi
+%endif
%clean
rm -fr %{buildroot}
%files
%manifest packaging/wrtjs.manifest
%license LICENSE
+%if 0%{?_use_d2d}
+ %{WRTJS_APP_DIR}/%{_d2d_file_name}
+%endif
%if "%{?tizen_profile_name}" != "tv"
%caps(cap_setgid,cap_sys_admin=ei) %{_bindir}/wrt-loader
%else
--- /dev/null
+#!/bin/bash
+
+output_path=${1}
+source_dir_name=${2}
+source_path=${output_path}/${source_dir_name}
+file_name=${3}
+file_extension=${4}
+profile=${5}
+
+echo "Start $0..."
+echo "ARGS=$@"
+echo "PWD=$PWD"
+echo "output_path=$output_path"
+echo "source_path=$source_path"
+echo "file_name=$file_name"
+echo "profile=$profile"
+
+if [ "${file_extension}" == "tpk" ]; then
+ # Upgradable WRTjs
+ rm -rf ${source_path}
+ install -d ${source_path}/shared/res/wrt
+ install -d ${source_path}/license
+ install -m 0644 packaging/tizen-manifest-tpk.xml ${source_path}/tizen-manifest.xml
+ install -m 0644 LICENSE ${source_path}/license
+ cp -rf out/gen/app ${source_path}/shared/res/wrt/app
+elif [ "${file_extension}" == "wgt" ]; then
+ # D2D Server
+ cp -rf d2d_app ${source_path}
+ rm -rf ${source_path}/.project ${source_path}/.tproject
+else
+ echo "Please add proper file extension."
+ exit 1
+fi
+
+# Test signing
+/usr/bin/hash-signer.sh -a -d -p platform -b ${output_path} ${source_dir_name}
+
+pushd ${source_path}
+echo "* zip"
+zip -yr $file_name *
+mv $file_name ../
+popd
+
+# tpkresigning from app-signer package
+if [ "${profile}" == "tv" ]; then
+ tpkresigner -a -d -p platform -n %{4} ${output_path}/${file_name}
+fi
+ls ${output_path}
+rm -rf ${source_path}
+
+echo "Finished $0"