6 Commits 894d30a9a9 ... 8810f48f8a

Author SHA1 Message Date
  Philippe Coval 8810f48f8a gbs: Generate config/gbs.conf 7 years ago
  Philippe Coval 08ee7125d0 gbs: Relocate Tizen:2.3.1:Wearable 7 years ago
  Philippe Coval 0c85e6fdf6 gbs: Add possible Tizen:2.3.2:Wearable repo 7 years ago
  Philippe Coval 6a99f7f3a0 tizen-helper: No unp of fedora 7 years ago
  Philippe Coval cf9c86a960 app: Support emulator args 7 years ago
  Philippe Coval 6d6b1c16e2 app: Supporting webapp 7 years ago

+ 502 - 121
bin/mk-tizen-app.mk

@@ -1,35 +1,46 @@
 #!/usr/bin/make -f
+
 default: help
 	pwd
 
 license_delay?=10
 project_makefile?=./tizen.mk
-# TODO overload/update with your variables
+# TODO overload/update with your variables if needed
 cert?=tmp
 user?=${USER}
 name?=${user}
 url?=http://${user}.localhost
 email?=${user}@${user}.localhost
+sdbhost?=sdbhost
 
 # TODO: FIXME
-ifneq (${cert},tmp)
-cert_distributor_file=${HOME}/SamsungCertificate/${cert}/distributor.p12
-cert_author_file=${HOME}/SamsungCertificate/${cert}/author.p12
-endif
+samsung_cert_dir?=${HOME}/SamsungCertificate/${cert}
 
 cert_name?=${cert}
-cert_password?=${cert}
+cert_password?=password
 cert_alias?=${cert}
 cert_email?=${email}
 cert_dir?=${keystore_dir}/${cert_alias}
+cli_cert_dir?=${keystore_dir}/tmp
 cert_author_file?=${cert_dir}/author.p12
 cert_distributor_file?=${tizen_studio}/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.p12
 cert_ca_file?=${tizen_studio}/tools/certificate-generator/certificates/distributor/tizen-distributor-ca.cer
-workspace?=${HOME}/workspace/
-ide_profiles_file?=${tizen_data}/ide/keystore/profiles.xml
+# In Configuration, Set a default profile path to
+cli_cert_profiles_file?=${tizen_data}/ide/keystore/profiles.xml
+workspace?=${HOME}/workspace
+ide_cert_profiles_file?=${workspace}/.metadata/.plugins/org.tizen.common.sign/profiles.xml
+
 cert_profiles_file?=${cert_dir}/profiles.xml
-xml?=/home/developer/certificate-registration.xml
 
+# TODO: FIXME
+ifneq (${cert},tmp)
+cert_dir=${samsung_cert_dir}
+src_cert_profiles_file=${ide_cert_profiles_file}
+export cert_dir
+endif
+src_cert_profiles_file?=${cli_cert_profiles_file}
+
+target_home?=/home/developer
 
 # TODO: update to latest if stable
 tizen_studio_version?=1.0.1
@@ -38,42 +49,144 @@ tizen_studio_os?=$(shell /usr/bin/arch \
 tizen_studio_url?=http://download.tizen.org/sdk/Installer/tizen-studio_${tizen_studio_version}/web-cli_Tizen_Studio_${tizen_studio_version}_${tizen_studio_os}.bin
 tizen_studio_file?=$(shell basename -- "${tizen_studio_url}")
 tizen_package_manager?=${tizen_studio}/package-manager/package-manager-cli.bin
-tizen_studio_ide?=${tizen_studio}/ide/TizenStudio.sh
 tizen_studio?=${HOME}/tizen-studio
+tizen_ide?=${tizen_studio}/ide/TizenStudio.sh
 tizen_studio_log?=${tizen_studio}/tools/ide/ncli.log
 tizen_data?=${HOME}/tizen-studio-data
 keystore_dir?=${HOME}/tizen-studio-data/keystore
 tizen?=${tizen_studio}/tools/ide/bin/tizen
 sdb?=${tizen_studio}/tools/sdb
-tizen_profile?=tizen_${app_profile_version_alpha}_${app_profile}
 gbs_profile?=tizen_${app_profile_version_alpha}_${gbs_arch}
 
+project_type?=$(shell ls config.xml >/dev/null 2>&1 \
+ && echo "web" || echo "native")
 
+ifeq (${project_type}, native)
+project_type_first?=Native
 ### Native variables ###
 compiler?=gcc
-arch_familly?=arm
+#arch_family?=x86
+#arch_suffix?=i386
+arch_family?=arm
+arch_suffix?=${arch_family}
 build_configuration?=Release
 #build_configuration=Debug
 build_dir?=./${build_configuration}
-config_xml_file?=tizen-manifest.xml
+manifest_file?=tizen-manifest.xml
 
-app_package_name?=$(shell \
- xmllint --format ${config_xml_file} \
+package_name?=$(shell \
+ xmllint --format ${manifest_file} \
  | grep -o '<manifest .*'  \
  | grep -o 'package=.*'  | cut -d'"' -f2\
- || echo "TODO" \
+ || echo "org.example.main" \
 )
 
 app_package_version?=$(shell \
- xmllint --format ${config_xml_file} \
+ xmllint --format ${manifest_file} \
  | grep -o '<manifest .*'  \
  | grep -o ' version=.*'  | cut -d'"' -f2\
- || echo "TODO" \
+ || echo "0.0.0" \
 )
+
 # TODO:
+pkgid=${package_name}
 #app_package_version=1.0.0
 #app_package_exe?=main
-#app_package_name=com.example.${app_package_exe}
+#project_name=com.example.${app_package_exe}
+pkg_type?=tpk
+pkg_file?=${build_dir}/${package_name}-${app_package_version}-${arch_suffix}.tpk
+log_tag?=${project_name}
+
+# TODO: Error: <name> not pkg_id 
+project_name?=$(shell echo ${pkgid} | sed -e 's|.*\.\([^.]*\)|\1|g' )
+
+
+project_template?=basic-ui
+project_template_dir?=${tizen_studio}/platforms/tizen-${app_profile_version}/${app_profile}/samples/Template/Native/${project_template}
+ide_tizen_studio_package?=${app_profile_upcase}-${app_profile_version}-NativeAppDevelopment
+cli_tizen_studio_package?=${ide_tizen_studio_package}-CLI
+# MOBILE-2.4-NativeAppDevelopment-CLI : NativeToolchain-Gcc-4.9
+tizen_studio_toolchain_package?=NativeToolchain-Gcc-4.9
+
+#TODO: should be there if not you can create from this template
+define manifest
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="${app_package_name}" version="${app_package_version}">
+    <author email="${email}" href="${url}">${name}</author>
+    <description>${app_description}</description>
+    <profile name="${app_profile}"/>
+    <ui-application appid="${app_pacakage_name}" exec="${app_package_exe}" launch_mode="single" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+        <label>${app_label}</label>
+        <icon>${icon_file}</icon>
+    </ui-application>
+    <privileges>
+        <privilege>http://tizen.org/privilege/internet</privilege>
+    </privileges>
+    <feature name="http://tizen.org/feature/screen.size.all">true</feature>
+</manifest>
+endef
+export manifest
+
+else # web
+#TODO
+build_dir?=.
+
+define manifest
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"  id="http://example.com/main" version="1.0.0" viewmodes="maximized">
+  <tizen:application id="ComExample.main" package="ComExample" required_version="2.4"/>
+  <content src="${index_html_file}"/>
+  <feature name="http://tizen.org/feature/screen.size.all"/>
+  <name>main</name>
+    <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
+    <tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>
+    <tizen:privilege name="http://tizen.org/privilege/internet"/>
+  <tizen:setting context-menu="disable"/>
+  <tizen:profile name="mobile"/>
+</widget>
+endef
+export manifest
+
+manifest_file?=config.xml
+
+package_id?=$(shell \
+ xmllint --format ${manifest_file} \
+ | grep -o '<tizen:application .*'  \
+ | grep -o 'id=.*'  | cut -d'"' -f2\
+ || echo "OrgExample.main" \
+)
+
+pkgid=$(shell echo ${package_id} | cut -d. -f1)
+
+# TODO: Error: <name> not pkg_id 
+project_name?=$(shell echo ${pkgid} | sed -e 's|.*\([^.]*\)|\1|g' )
+
+app_package_version?=$(shell \
+ xmllint --format ${manifest_file} \
+ | grep -o '<widget .*'  \
+ | grep -o ' version=.*'  | cut -d'"' -f2\
+ || echo "1.0.0" \
+)
+
+package_name?=$(shell \
+ xmllint --format ${manifest_file} \
+ | grep -o '<name>.*</name>'  \
+ | sed -e 's|.*>\(.*\)<.*|\1|g' \
+ || echo "OrgExample" \
+)
+pkg_type?=wgt
+pkg_file?=${package_name}.${pkg_type}
+
+#pkgid?=ComExample
+index_html_file?=index.html
+
+config.xml:
+	-ls ${index_html_file}
+	echo $${manifest} > $@.tmp
+	xmllint --format $@.tmp > $@
+	rm $@.tmp
+
+endif
 
 # TODO:
 app_description?=TODO
@@ -82,26 +195,14 @@ app_profile?=mobile
 app_profile_upcase?=MOBILE
 app_profile_version?=2.4
 app_profile_version_alpha?=2_4
-app_project_type?=native
+tizen_profile?=${app_profile}-${app_profile_version}
 icon_file=icon.png
-tpk_file?=${build_dir}/${app_package_name}-${app_package_version}-${arch_familly}.tpk
-log_tag?=${app_package_name}
-
-
-ifeq (${app_project_type}, native)
-tizen_template?=basic-ui
-tizen_template_dir?=${tizen_studio}/platforms/tizen-${app_profile_version}/${app_profile}/samples/Template/Native/${tizen_template}
-tizen_studio_package_ide?=${app_profile_upcase}-${app_profile_version}-NativeAppDevelopment
-tizen_studio_package?=${tizen_studio_package_ide}-CLI
-tizen_studio_toolchain_package?=NativeToolchain-Gcc-4.9
-else
-#TODO
-endif
 
 export app_profile_version
 export app_profile
-export tizen_template
-export tizen_studio_package
+export project_template
+#TODO: needed?
+export cli_tizen_studio_package
 
 # TODO: if dependencies add them
 # srcs+=usr/lib usr/include
@@ -114,15 +215,36 @@ make?=${MAKE} -f ${self}
 export make
 
 date?=$(date -u %s)
+export cert_dir
+
 
 ### Generic Rules ###
+
+%: rule/%
+	echo "#@: $^"
+
+rule/tmp/rule/%: rule/%
+	echo "#@: $^"
+
+tmp/rule/%:
+	ls $@ || ${make} rule/$@
+	mkdir -p ${@D}
+	touch ${@}
+
 help: tizen/help rule/print tmp/rule/pre-check
 	pwd
 
+
 rule/print:
 	@echo "### Current configuration:"
-	@echo "# app_package_name=${app_package_name}"
+	@echo "# project_type=${project_type}"
+#
+	@echo "# package_name=${package_name}"
 	@echo "# app_package_version=${app_package_version}"
+	@echo "# pkgid=${pkgid}"
+	@echo "# project_name=${project_name}"
+	@echo "# pkg_file=${pkg_file}"
+#
 	@echo "# cert_author_file=${cert_author_file}"
 	@echo "# cert_distributor_file=${cert_distributor_file}"
 	@echo "# ide_profiles_file=${ide_profiles_file}"
@@ -130,7 +252,10 @@ rule/print:
 	@echo "# cert_ca_file=${cert_ca_file}"
 	@echo "# self=${self}"
 	@echo "# make=${make}"
-	@echo "# tizen_template_dir=${tizen_template_dir}"
+	@echo "# project_template_dir=${project_template_dir}"
+
+rule/type/%: rule/${project_type}/%
+	pwd
 
 tmp/rule/pre-check: rule/pre-check-host rule/pre-check-tizen
 	pwd
@@ -143,20 +268,20 @@ rule/pre-check-host:
 	which unzip
 	which wget
 
-rule/pre-check-tizen: ${tizen} ${tizen_template_dir}
+rule/pre-check-tizen: ${tizen} ${project_template_dir}
 	ls $<
 
 tizen/help: ${tizen}
 	${tizen}  cli-config -l
 
 all: ${all}
-	ls -l $<
+	ls -l -- $^
 
 ### Tizen sdb ###
 
 run-app:
-	${sdb} shell pkgcmd -l | grep ${app_package_name} || ${make} deploy
-	${sdb} shell open_app ${app_package_name}
+	${sdb} shell pkgcmd -l | grep ${package_name} || ${make} deploy
+	${sdb} shell open_app ${package_name}
 
 
 reboot:
@@ -190,6 +315,10 @@ connect-more:
 	${sdb} get-state | grep 'offline' && ${sdb} status-window || :
 	${sdb} shell id
 
+connect-host:
+	${sdb} connect ${sdbhost}
+
+
 ### Tizen Tools ###
 
 rule/tizen_studio: ${tizen}
@@ -209,157 +338,391 @@ rule/tizen_studio/install/tizen: tmp/${tizen_studio_file}
 	${<D}/${<F} --no-java-check --accept-license "${tizen_studio}"
 	ls "${tizen}"
 
-rule/tizen_studio/install: rule/tizen_studio/install/tizen ${tizen_template_dir}
+rule/tizen_studio/install: rule/tizen_studio/install/tizen ${project_template_dir}
 	pwd
 
+${tizen_package_manager}:
+	${make} rule/tizen_studio/install
+	ls -l $@
+
 tmp/${tizen_studio_file}:
 	mkdir -p ${@D}
 	wget -c -O "${@}" ${tizen_studio_url}
 
-rule/installed/%: ${tizen_package_manager}
+rule/tizen/installed/%: ${tizen_studio}/local/tmp/installed/%
+	ls $<
+
+rule/tizen/show-pkgs: ${tizen_package_manager}
+	${<} --no-java-check show-pkgs
+
+${tizen_studio}/local/tmp/installed/%: ${tizen_package_manager}
+	${<} --no-java-check show-pkgs | grep -- "^i .*${@F}" \
+ || ${make} rule/tizen/install/${@F}
+	mkdir -p ${@D}
+	touch $@
+
+rule/tizen/install/%: ${tizen_package_manager}
 	${<} --no-java-check show-pkgs | grep -- "${@F}"
 	${<} --no-java-check show-license ${@F}
 	@echo "# About to accept license, Press Ctrl+C now to reject it"
-	sleep 5
-	${<} --no-java-check show-pkgs | grep -- "^i[ \t]*${@F}" \
- || ${<} --no-java-check install ${@F} --accept-license
+	sleep ${license_delay}
+	${<} --no-java-check install ${@F} --accept-license
 
-${tizen_template_dir}:
-	${make} rule/installed/${tizen_studio_package}
+${project_template_dir}:
+	${make} rule/tizen/installed/${cli_tizen_studio_package}
 	ls ${@}
 
-rule/tizen_studio/installed: rule/installed/${tizen_studio_package} rule/installed/cert-add-on ${tizen_studio_ide}
-	pwd
+rule/tizen/cli: rule/tizen/show-pkgs \
+ rule/tizen/installed/cert-add-on \
+ rule/tizen/installed/${cli_tizen_studio_package}
+	ls -l -- ${tizen}
 
-${tizen_studio_ide}: ${project_makefile} \
- rule/installed/PlatformIDE \
- rule/installed/cert-add-on \
- rule/installed/${tizen_studio_ide_package} \
- rule/installed/${tizen_studio_toolchain_package}
-	ls $@
+rule/tizen/ide: rule/tizen/installed/${ide_tizen_studio_package} \
+ rule/tizen/ide/${project_type} \
+ rule/tizen/cli \
+ rule/tizen/installed/PlatformIDE
+	ls ${tizen_ide}
 
-rule/tizen_studio/cert: ${tizen_studio_ide}
-	@echo "https://wiki.tizen.org/wiki/SDK"
-	@echo '# tools / Certificate manager/'
-	@echo '# + / Samsung"
-	@echo '# Mobile / Wearable'
-	@echo '# new certificate profile : $name'
-	@echo '# Select an existing author'
-	@echo '# Your new distributor certificate is located in [$HOME/SamsungCertificate/$name]'
-	${@D}/${@F}
+rule/ide:
+#	ls ${tizen_ide} || make rule/tizen/ide
+	${tizen_ide}
+
+### Certificates ###
 
+${cert_author_file}:
+	${make} rule/tizen/cli-cert_author_file
+	ls $@
 
-${cert_author_file}: #${tizen}
+rule/tizen/cli-cert_author_file:
+	ls ${tizen} || ${make} ${tizen}
 	@echo "# About to generate: $@"
-	@mkdir -p  ${cert_dir}
+	@mkdir -p  ${cli_cert_dir}
 	${tizen} certificate \
- -a ${cert_alias} \
- -p ${cert_password} \
+ -a "${cert_alias}" \
+ -p "${cert_password}" \
  -n "${cert_name}" \
  -e "${cert_email}" \
  -- \
- ${cert_dir}
+ ${cli_cert_dir}
  #eol
-	file ${cert_author_file}
-
-security_profiles: ${ide_profiles_file}
-	${tizen} cli-config "profiles.path=$<"
+	ls -l -- ${cert_author_file}
+	${RM} -f ${ide_cert_profiles_file}
 
-${ide_profiles_file}: ${cert_profiles_file}
-	cp -v $< $@
+${cli_cert_profiles_file}: ${cert_author_file}
+	${make} rule/tizen/cli_cert_profile_file
+	ls -- $@
 
 ${cert_profiles_file}: ${cert_author_file}
-	-mv ${ide_profiles_file} ${ide_profiles_file}._${date}.tmp
+	ls -l -- $<
+	rm -f ${cert_profiles_file}
+	${tizen} cli-config "profiles.path=${cert_profiles_file}"
+#	-rm -v ${tizen_studio}/tools/.tizen-cli-config
+#	-rm -v ${cli_cert_profiles_file}
+#	-rm -v ${tizen_studio}/tools/ide/conf/profiles.xml
+	${tizen} cli-config -l
 	${tizen} security-profiles add \
  -f \
  -n "${cert_name}" \
  -a $< \
  -p "${cert_password}" \
  #eol
-	grep -- "${cert}" ${ide_profiles_file}
-	mkdir -p ${@D}
-	mv ${ide_profiles_file} $@
-	-cp -av ${cert_distributor_file} ${@D}
-	cp -av ${cert_ca_file} ${@D}
-	@echo "track this dir $@ (I use git)"
 
-rule/cert: ${tizen} ${ide_profiles_file} ${cert_author_file} ${cert_distributor_file}
-	grep "${cert}" ${ide_profiles_file} || ${make} rule/cert/clean rule/cert/ide
-	ls -l $^
+${cli_cert_dir}: ${cli_cert_profiles_file}
+	cp $< ${@D}/
+
+rule/tizen/cli_cert_profile_file: ${cert_profiles_file}
+	@echo "# Override"
+	cp -v ${cert_profiles_file} ${cli_cert_profiles_file}
+	${tizen} cli-config "profiles.path=${cli_cert_profiles_file}"
+	grep -- "${cert}" ${cli_cert_profiles_file}
+
+rule/tizen/cert-rm:
+	rm -v ${cert_author_file} ${cli_cert_profiles_file}
+
+rule/tizen/cert-cli: ${cli_cert_dir}
+	ls $<
+
+#	mv ${cli_profiles_file} $@
+#	-cp -av ${cert_distributor_file} ${@D}
+#	cp -av ${cert_ca_file} ${@D}
+#	ls -l -- $@
+#	@echo "track this dir $@ (I use git)"
+
+
+# ide
+
+todo/${ide_profiles_file}: ${cert_profiles_file}
+	ls -l -- $<
+	cp -v $< $@
+
+#${cert_dir}:
+#	${make} rule/tizen/cert-ide
 
-rule/cert/ide: ${ide_profiles_file}
+todo/rule/tizen/cert-prep:
+	ls ${samsung_cert_dir} 
+
+#${cert_profiles_file}: ${cli_cert_profiles_file} ${cert_dir}
+#	grep "${cert}" "${ide_cert_profiles_file}" && cp -v $< ${cert_dir}/ \
+# || ${make} rule/cert/cert-ide
+#	ls -l -- $@
+
+
+todo/rule/cert/profile_file: ${cli_cert_profiles_file}
+
+todo/rule/cert/ide_profile_file: ${ide_cert_profiles_file}
+	grep ${cert} $<
+	cp -v $< ${cert_dir}/
+	ls -l -- ${cert_profiles_file}
+
+todo/rule/cert: ${tizen} ${ide_profiles_file} ${cert_author_file} ${cert_distributor_file}
+	grep "${cert}" ${ide_profiles_file} \
+ || ${make} rule/cert/clean rule/cert/ide
+	ls -l -- ${cert_profiles_file}
+
+todo/rule/cert/ide: ${ide_profiles_file}
+
+#${cert_profiles_file}: ${src_cert_profiles_file}
+#	cp $< $@
+
+#${cert_profiles_file}: ${ide_cert_profiles_file}
+#	cp $< $@
+
+
+rule/cert/select: ${cli_cert_profiles_file} ${tizen}
+	${tizen} cli-config -l
+	${tizen} cli-config "profiles.path=$<"
+	${tizen} cli-config -l
+
+rule/cert/select-cli: ${cert_profiles_file} ${tizen}
+	cp -v ${cert_profiles_file} ${cli_cert_profiles_file} 
+	${make} rule/cert/select
+	grep "profile name=\"${cert}\"" ${cli_cert_profiles_file} 
+#	cp -a ${cli_cert_profiles_file} ${cert_profiles_file}
+
+rule/tizen/cert-select: ${cert_profiles_file} ${cert_dir}
+	grep "profile name=\"${cert}\"" "${cert_profiles_file}" \
+ || { rm -v ${cli_cert_profiles_file} && ${make} rule/cert/select-cli ; }
+	grep "profile name=\"${cert}\"" ${cert_profiles_file} 
+	ls $^
+
+rule/tizen/cert-replace: ${cert_profiles_file}
+	mkdir -p "${cli_cert_profiles_file}.tmp" #TODO
+	cp -av "${<}" ${cli_cert_profiles_file}
+	grep "profile name=\"${cert}\"" "$<"
+	${tizen} cli-config "profiles.path=${cli_cert_profiles_file}"
+
+rule/attempt:
+	${make} rule/run \
+|| rm -f ${cert_profiles_file}
+	${make} rule/tizen/cert-ide rule/run
 
 rule/cert/clean: ${tizen}
-	-mv -vf ${ide_profiles_file} ${ide_profiles_file}._${date}.tmp
+	-mv -vf ${ide_cert_profiles_file} ${ide_cert_profiles_file}._${date}.tmp
+	-mv -vf ${cli_cert_profiles_file} ${cli_cert_profiles_file}._${date}.tmp
+	rm -rf ${cert_dir}
 	rm -rf .sign ${build_dir} Debug Release
 
+rule/cert/check: ${sdb} rule/tizen/cert-select ${cert_profiles_file} rule/target/check
+	grep "profile name=\"${cert}\"" ${cert_profiles_file}
+
+rule/target/check:
+	@echo "$@: { TODO: sdb don't exit on failure"
+	${sdb} shell ls ${target_home}/certificate-registration.xml
+	${sdb} shell ls ${target_home}/*.xml
+	${sdb} shell ls ${target_home}/
+	${sdb} shell ls ${target_home}/sdk_tools/
+	@echo "$@: } failures can be ignored now"
+
+${workspace}: 
+	ls $@ || ${make} rule/tizen/workspace
+
+rule/tizen/workspace: ${tizen_studio}/ide/TizenStudio.sh rule/tizen/installed/cert-add-on
+	@echo "TODO"
+	${<}
+	ls -l -- $@
+
+rule/workspace: ${workspace}
+	ls -l -- $<
+
 
-rule/cert/check:
-	${sdb} shell cat  /home/developer/certificate-registration.xml
+rule/ide_cert_profiles_file: 
+	ls ${ide_cert_profiles_file} || ${make}  ${ide_cert_profiles_file}
+	ls $<
+
+${ide_cert_profiles_file}: tmp/rule/tizen/cert-ide ${cert_dir}
+	ls $@
 
+rule/tizen/cert-ide: ${tizen_ide} ${workspace}
+	@echo "# Please Install and Setup IDE SDK & cert-addons"
+	@echo "# https://wiki.tizen.org/wiki/SDK "
+	@echo "https://wiki.tizen.org/wiki/SDK"
+	@echo '# tools / Certificate manager/'
+	@echo '# + / Samsung'
+	@echo '# Mobile / Wearable'
+	@echo '# new certificate profile : $name'
+	@echo '# Select an existing author'
+	@echo '# Your new distributor certificate is located in [HOME/SamsungCertificate/name]'
+	${<D}/${<F}
+	ls -l -- ${ide_cert_profiles_file}
+	cp -v ${ide_cert_profiles_file} ${cert_dir}/
+	ls ${cert_profiles_file}
+	cp ${cert_profiles_file} ${cli_cert_profiles_file}
+	${make} rule/cleanall
+#TODO: try to run without certs first
+
+rule/cleanall:
+	rm -rf *.tpk *.wgt .buildResult
+	rm -rf author-signature.xml .buildResult .manifest.tmp signature1.xml
 
 ### Native rules ###
 
-rule/native/clean:
+ifeq (${project_type}, native)
+rule/${project_type}/clean:
 	rm -rf  tmp/rule
 
-rule/native/distclean:
+rule/${project_type}/distclean:
 	rm -rf *.tpk author-signature.xml .buildResult .manifest.tmp signature1.xml tmp
 
-rule/native/help:
-	echo "# app_package_version=${app_package_version}"
+Build:
+	mkdir -p tmp 
+	cd tmp && ${tizen} list ${project_type}-project 
+	cd tmp && ${tizen} create ${project_type}-project \
+ -p ${tizen_profile} -t ${project_template} -n ${project_name}
+	mv tmp/${project_name}/Build $@
 
-rule/native/build: ${tizen} ${tizen_template_dir} ${srcs}
+rule/${project_type}/build: Build ${tizen} ${project_template_dir} ${srcs} ${manifest_file} rule/${project_type}/import/clean 
 	@rm -rf ${build_dir}
 	-@mv ${tizen_studio_log} ${tizen_studio_log}._${date}.bak
-	${tizen} cli-config -l
 	@echo "# less ${tizen_studio_log} # on issues "
-	${tizen} build-native -a ${arch_familly} -c ${compiler} -C ${build_configuration} -- .
+	${tizen} build-native \
+ -a ${arch_family} -c ${compiler} -C ${build_configuration} -- ${CURDIR}
+	ls -l ${build_dir}/objs
+	cat ${build_dir}/build.info
 
-rule/native/package: rule/native/build rule/native/import/clean rule/cert security_profiles ${config_xml_file}
-	${tizen} package -t tpk -s ${cert} --  "${build_dir}"
-	ls -l "${build_dir}/"*.tpk
-
-rule/native/import/clean:
+rule/${project_type}/import/clean:
 	@echo "If some libs were imported inplace"
 	-rm -rf usr/lib/*.a lib/*.a lib/pkgconfig bin
 
-tpk: ${tpk_file}
-	ls -l -- $^
+rule/${project_type}/help:
+	echo "# app_package_version=${app_package_version}"
 
-${tpk_file}: rule/native/package
-	ls -l -- $@
+#rule/${project_type}/package: 
+#	ls -l -- $^
 
-undeploy:
-	-${sdb} shell pkgcmd -l -t tpk
-	-${sdb} shell pkgcmd -u -n ${app_package_name}
+#${pkg_file}: rule/${project_type}/package
+#	ls -l -- $@
+#TODO factorize
+#rule/${project_type}/package: rule/${project_type}/build rule/cert/check
+#TODO
+#	${tizen} package -t ${pkg_type} -s ${cert} --  "${build_dir}"
+#	ls -l -- "${build_dir}/"*.${pkg_type}
+
+# aliases
+
+#rule/tizen/ide/native: rule/tizen/ide rule/tizen/installed/MOBILE-2.4-NativeAppDevelopment
+
+rule/tizen/ide/native: rule/tizen/installed/NativeIDE \
+ rule/tizen/installed/${tizen_studio_toolchain_package}
+	pwd
 
-deploy: ${tpk_file}
+
+else # // wgt
+
+.buildResult: ${manifest_file} ${tizen} tmp/rule/tizen/install/NativeCLI
+	@echo "# TODO: check if $^ needed"
+	${tizen} build-${project_type} --exclude '.git/* tmp/*'
+	ls $@
+
+rule/${project_type}/build: .buildResult
+	ls $<
+
+rule/${project_type}/clean:
+	-rm -rf .buildResult
+	-rm -rf *.tmp author-signature.xml signature1.xml .manifest.tmp
+
+rule/${project_type}/distclean: rule/${project_type}/clean
+	-rm -rf *.wgt tmp
+endif
+
+#TODO factorize
+rule/${project_type}/package: rule/${project_type}/build rule/tizen/cert-replace
+	ls ${build_dir}
+	${tizen} cli-config -l
+	ls ${cert_dir}
+	-rm -rfv author-signature.xml signature1.xml
+	-rm -rfv .sign/*
+	${tizen} package -t ${pkg_type} -s "${cert}" -- "${build_dir}"
+	ls -l -- ${tizen_studio}/tools/ide/ncli.log
+	ls -l -- ${pkg_file}
+	touch ${pkg_file}
+
+undeploy:
+	-${sdb} shell pkgcmd -l -t ${pkg_type}
+	-${sdb} shell pkgcmd -u -n ${package_name}
 	-${sdb} shell rm /opt/usr/apps/tmp/${<F}
-	${tizen} install -n ${<F} -- ${CURDIR}/${<D}
+	${sdb} shell pkgcmd -l -t ${pkg_type} | grep "${package_name}" \
+ && exit 1 || exit 0
+
+
+redeploy: undeploy deploy
+	echo "# $@: $^ : done"
+
+
+tmp/rule/redeployed/${pkg_file}: ${pkg_file}
+	${make} redeploy
+	@mkdir -p ${@D}
+	touch $@
+
 
-tmp/rule/installed: ${tpk_file}
-	-${sdb} shell ls -l /opt/usr/apps/tmp/${<F}
-	${sdb} shell pkgcmd -l -t tpk | grep "${app_package_name}" \
- || ${make} deploy
+tmp/rule/deployed/${pkg_file}: redeploy
 	@mkdir -p ${@D}
 	touch $@
 
-rule/native/run: tmp/rule/installed
-	${tizen} run --pkgid ${app_package_name} -- .
+tmp/rule/deployed: tmp/rule/deployed/${pkg_file}
+	ls -l -- $<
 
-rule/native/check: ${tpk_file}
+rule/${project_type}/deployed: tmp/rule/deployed/${pkg_file}
+	echo "# $@: $^ : done"
+
+
+${pkg_file}: rule/${project_type}/package
+	ls -l $@
+
+rule/${project_type}/check: ${pkg_file}
 	unzip -t $<
-	ls -l ${CURDIR}/${<}
+	ls -l -- ${CURDIR}/${<}
 	md5sum ${CURDIR}/${<}
 
+rule/${project_type}/undeploy:
+	-${sdb} shell pkgcmd -l -t ${pkg_type}
+	-${sdb} shell pkgcmd -u -n ${pkgid}
+
+rule/${project_type}/deploy: ${pkg_file} rule/${project_type}/undeploy
+	-${sdb} shell rm /opt/usr/apps/tmp/${<F}
+	${tizen} install -n ${<F} -- ${CURDIR}/${<D}
+	${sdb} shell ls -l /opt/usr/apps/tmp/${<F}
+	-${sdb} shell pkgcmd -l -t ${pkg_type} | grep "${pkgid}"
+	${sdb} shell ls /opt/usr/apps/${package_name}
+	-${sdb} shell ls /opt/usr/apps/${package_name}/lib
+
+#rule/${project_type}/run: tmp/rule/deployed ${tizen}
+#	${tizen} run --pkgid "${project_name}" -- .
+
+rule/run: rule/type/deploy ${tizen}
+	${tizen} run --pkgid ${pkgid} -- .
+
+rule/distclean: rule/type/distclean
+
 ### Updated rules ####
-distclean: rule/${app_project_type}/distclean
+distclean: rule/${project_type}/distclean
 	pwd
 
-%: rule/${app_project_type}/%
+%: rule/${project_type}/%
 	pwd
 
+rule/package: ${pkg_file}
+	md5sum $<
+
 ### MISC ###
 
 shared/res/main.png: icon.png
@@ -415,3 +778,21 @@ rule/setup/fedora: /etc/fedora-release
  wget \
  zip \
  #eol
+
+
+#TODO
+rule/samsung:
+	ln -fs ~/SamsungCertificate/tmp-sam ~/tizen-studio-data/keystore/
+	cp ${cert_dir}/profiles.xml ${ide_cert_profiles_file}
+	${tizen} cli-config "profiles.path=${ide_cert_profiles_file}"
+
+rule/release: rule/distclean rule/run
+	md5sum ${pkg_file}
+
+tizen-manifest.xml:
+	@echo "# TODO: $@"
+	touch $@
+
+
+rule/sdb/%: ${sdb}
+	${<} ${@F}

+ 2 - 2
bin/tizen-helper.sh

@@ -52,13 +52,13 @@ EOF
 
 setup_fedora_()
 {
+    # TODO: use: dnf
     sudo yum install \
         curl \
         file \
         git \
         make \
         realpath \
-        unp \
         wget \
         zip \
         || die_ "TODO: missing tools"
@@ -68,7 +68,7 @@ setup_fedora_()
     url="http://download.tizen.org/tools/latest-release/${NAME}_${VERSION_ID}/tools.repo"
     sudo yum-config-manager --add-repo "${url}"
     sudo yum update
-    sudo yum install gbs
+    sudo yum install gbs sdb
 }
 
 

+ 29 - 14
config/gbs.conf

@@ -105,23 +105,22 @@ url=http://download.tizen.org/releases/2.3/2.3-wearable/tizen-2.3-wearable_20150
 #} Tizen:2.3:Wearable
 
 
-#{ Tizen:2.3.1:Wearable
+#{ Tizen:2.3.2:Wearable
 
-[profile.tizen_2_3_1_wearable_armv7l]
-repos=repo.tizen_2_3_1_wearable_armv7l
-buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_armv7l/
-
-[repo.tizen_2_3_1_wearable_armv7l]
-url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/target/packages/
+[profile.tizen_2_3_2_wearable_armv7l]
+repos=repo.tizen_2_3_2_wearable_armv7l
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_2_wearable_armv7l/
 
+[repo.tizen_2_3_2_wearable_armv7l]
+url=https://download.tizen.org/snapshots/2.3-wearable/common/latest/repos/target/packages/
 
-[profile.tizen_2_3_1_wearable_i586]
-repos=repo.tizen_2_3_1_wearable_i586
-buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_i586/
 
-[repo.tizen_2_3_1_wearable_i586]
-url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/emulator/packages
+[profile.tizen_2_3_2_wearable_i586]
+repos=repo.tizen_2_3_2_wearable_i586
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_2_wearable_i586/
 
+[repo.tizen_2_3_2_wearable_i586]
+url=https://download.tizen.org/snapshots/2.3-wearable/common/latest/repos/emulator/packages/
 
 #} Tizen:Wearable
 
@@ -187,6 +186,22 @@ buildroot=~/tmp/gbs/tmp-GBS-tizen_3_0_tv_i586
 url=http://download.tizen.org/releases/milestone/tizen/tv-3.0.m1/latest/repos/emulator32-wayland/packages/
 
 #} Tizen:3.0:TV
+[profile.tizen_2_3_1_wearable_i586]
+repos=repo.tizen_2_3_1_wearable_i586
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_i586/
+
+[repo.tizen_2_3_1_wearable_i586]
+url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/emulator/packages
+#{ Tizen:2.3.1:Wearable
+
+[profile.tizen_2_3_1_wearable_armv7l]
+repos=repo.tizen_2_3_1_wearable_armv7l
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_armv7l/
+
+[repo.tizen_2_3_1_wearable_armv7l]
+url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/target/packages/
+
+#} Tizen:Wearable
 [repo.tizen_base_aarch64]
 url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm64/packages/
 
@@ -301,7 +316,7 @@ repos=repo.tizen_base_weekly_armv7l,repo.tizen_common_weekly_armv7l
 buildroot=~/tmp/gbs/tmp-GBS-tizen_common_weekly_armv7l/
 
 [repo.tizen_common_weekly_armv7l]
-url=http://download.tizen.org/releases/weekly/tizen/common/tizen-common_20160609.3/repos/arm-wayland/packages/
+url=http://download.tizen.org/releases/weekly/tizen/common/latest/repos/arm-wayland/packages/
 [profile.tizen_common_weekly_i586]
 repos=repo.tizen_base_weekly_i586,repo.tizen_common_weekly_i586
 buildroot=~/tmp/gbs/tmp-GBS-tizen_common_weekly_i586/
@@ -313,7 +328,7 @@ repos=repo.tizen_base_weekly_x86_64,repo.tizen_common_weekly_x86_64
 buildroot=~/tmp/gbs/tmp-GBS-tizen_common_weekly_x86_64/
 
 [repo.tizen_common_weekly_x86_64]
-url=http://download.tizen.org/releases/weekly/tizen/common/tizen-common_20160609.3/repos/x86_64-wayland/packages/
+url=http://download.tizen.org/releases/weekly/tizen/common/latest/repos/x86_64-wayland/packages/
 [profile.tizen_mobile_weekly_i586]
 repos=repo.tizen_base_weekly_i586,repo.tizen_mobile_weekly_i586
 buildroot=~/tmp/gbs/tmp-GBS-tizen_mobile_weekly_i586/

+ 11 - 12
config/gbs/gbs.conf.in

@@ -105,23 +105,22 @@ url=http://download.tizen.org/releases/2.3/2.3-wearable/tizen-2.3-wearable_20150
 #} Tizen:2.3:Wearable
 
 
-#{ Tizen:2.3.1:Wearable
+#{ Tizen:2.3.2:Wearable
 
-[profile.tizen_2_3_1_wearable_armv7l]
-repos=repo.tizen_2_3_1_wearable_armv7l
-buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_armv7l/
+[profile.tizen_2_3_2_wearable_armv7l]
+repos=repo.tizen_2_3_2_wearable_armv7l
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_2_wearable_armv7l/
 
-[repo.tizen_2_3_1_wearable_armv7l]
-url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/target/packages/
+[repo.tizen_2_3_2_wearable_armv7l]
+url=https://download.tizen.org/snapshots/2.3-wearable/common/latest/repos/target/packages/
 
 
-[profile.tizen_2_3_1_wearable_i586]
-repos=repo.tizen_2_3_1_wearable_i586
-buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_i586/
-
-[repo.tizen_2_3_1_wearable_i586]
-url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/emulator/packages
+[profile.tizen_2_3_2_wearable_i586]
+repos=repo.tizen_2_3_2_wearable_i586
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_2_wearable_i586/
 
+[repo.tizen_2_3_2_wearable_i586]
+url=https://download.tizen.org/snapshots/2.3-wearable/common/latest/repos/emulator/packages/
 
 #} Tizen:Wearable
 

+ 6 - 0
config/gbs/url/https/build.tizen.org/Tizen/2.3.1/Wearable/emulator.conf.in

@@ -0,0 +1,6 @@
+[profile.tizen_2_3_1_wearable_i586]
+repos=repo.tizen_2_3_1_wearable_i586
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_i586/
+
+[repo.tizen_2_3_1_wearable_i586]
+url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/emulator/packages

+ 10 - 0
config/gbs/url/https/build.tizen.org/Tizen/2.3.1/Wearable/target.conf.in

@@ -0,0 +1,10 @@
+#{ Tizen:2.3.1:Wearable
+
+[profile.tizen_2_3_1_wearable_armv7l]
+repos=repo.tizen_2_3_1_wearable_armv7l
+buildroot=~/tmp/gbs/tmp-GBS-tizen_2_3_1_wearable_armv7l/
+
+[repo.tizen_2_3_1_wearable_armv7l]
+url=http://download.tizen.org/releases/2.3.1/2.3.1-wearable/common/latest/repos/target/packages/
+
+#} Tizen:Wearable