Sample cURL application built using CLI tools
This article shows how to build sample application based on url2file cURL demo using command-line tools.
It is assumed that you have already installed Samsung Customized Emscripten SDK as described in WebAssembly/Getting Started
You have installed either
Tizen Studio with CLI(command line interface). See Quick-Start Gudie
You can also clone whole repository from github.com.
Download CA certificates extracted from Mozilla:
curl -O https://curl.haxx.se/ca/cacert.pem
Compile url2file.c demo
emcc -o url2file.html -Os -s ENVIRONMENT_MAY_BE_TIZEN -s USE_CURL=1 --proxy-to-worker --preload-file cacert.pem url2file.c
Reduce size of generated WebAssembly module. This will reduce memory consumption of WebAssembly module compilation on Samsung Smart TV.
Name of the output, this will make that Emscripten will generate url2file.wasm, url2file.js and url2file.html
Flag indicating that we want to use Samsung Tizen Emscripten extensions available on Samsung Smart TV. This flag is necessary to use POSIX sockets APIs in your application.
Flag indicating that we want to build and use cURL library provided with Samsung Customized Emscripten. Note that during 1st build full library is being built, so compilation may take a while. However after 1st build cURL library is cached. See more on details on Emscripten Ports
This flag is needed to run
main()function of your application in a Web Worker, because Samsung Tizen Sockets Extensions can only be used in a Web Worker.
This option allows your application to read cacert.pem file using standard C APIs
Implicitly enabled options:
Flag enabling SSL library (libssl) from OpenSSL libraries. This flags is implicitly turned on by
Flag enabling use crypto library (libcrypto) from OpenSSL libraries. This flags is implicitly turned on by
Flag enabling use of zlib compression library. This flag is implicitly turned on by
Further information regarding Emscripten build options can be found on Emscripten Compiler Frontend (emcc)
Download config.xml to the same directory where the demo was built.
- this application needs
- content src attribute points to "url2file.html" instead of standard
index.html, as this is what was generated by emcc.
More information regarding the config.xml file format can be found on Tizen Developers
- this application needs
Sign and pack widget using Tizen CLI interface:
tizen package -t wgt -s <YOUR_CERTIFICATE_PROFILE_NAME> -- .
Guide showing how to create certificate profile can be found at Creating Certificates
More information regarding Tizen CLI interface can be found at Command Line Interface Commands
Set your TV into developer mode as described in TV Device
Connect to the TV using sdb:
sdb connect <TV_IP>
SDB command and its options are described on Connecting Devices over Smart Development Bridge
List connected devices:
List of devices attached 192.168.13.2:26101 device 0
Install widget on the TV:
tizen install -n url2file.wgt -t 0
0is taken from last column of
sdb devicescommand output.
Run widget on the TV:
tizen run -p url2file00.curl -t 0