Skip to content

Commit

Permalink
feat: added Dockerfile to install in samsung tv
Browse files Browse the repository at this point in the history
  • Loading branch information
dragondgold committed Aug 11, 2023
1 parent 27fb9ee commit 83f1276
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 25 deletions.
97 changes: 97 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update && apt-get install -y \
cmake \
expect \
git \
ninja-build \
python2 \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*

# Some of Samsung scripts make reference to python,
# but Ubuntu only provides /usr/bin/python2.
RUN ln -sf /usr/bin/python2 /usr/bin/python

# Use a non-root user from here on
RUN useradd -m -s /bin/bash moonlight
USER moonlight
WORKDIR /home/moonlight

# Install Tizen Studio
# get file: web-cli_Tizen_Studio_5.0_ubuntu-64.bin
RUN wget -nv -O web-cli_Tizen_Studio_5.0_ubuntu-64.bin 'https://download.tizen.org/sdk/Installer/tizen-studio_5.0/web-cli_Tizen_Studio_5.0_ubuntu-64.bin'
RUN chmod a+x web-cli_Tizen_Studio_5.0_ubuntu-64.bin
RUN ./web-cli_Tizen_Studio_5.0_ubuntu-64.bin --accept-license /home/moonlight/tizen-studio
ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH}

# Prepare Tizen signing cerficates
RUN tizen certificate \
-a Moonlight \
-f Moonlight \
-p 1234
RUN tizen security-profiles add \
-n Moonlight \
-a /home/moonlight/tizen-studio-data/keystore/author/Moonlight.p12 \
-p 1234

# Workaround to package applications without gnome-keyring
# These steps must be repeated each time prior to packaging an application.
# See <https://developer.tizen.org/forums/sdk-ide/pwd-fle-format-profile.xml-certificates>
RUN sed -i 's|/home/moonlight/tizen-studio-data/keystore/author/Moonlight.pwd||' /home/moonlight/tizen-studio-data/profile/profiles.xml
RUN sed -i 's|/home/moonlight/tizen-studio-data/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.pwd|tizenpkcs12passfordsigner|' /home/moonlight/tizen-studio-data/profile/profiles.xml

# Install Samsung Emscripten SDK
# get file: emscripten-1.39.4.7-linux64.zip
RUN wget -nv -O emscripten-1.39.4.7-linux64.zip 'https://developer.samsung.com/smarttv/file/a5013a65-af11-4b59-844f-2d34f14d19a9'
RUN unzip emscripten-1.39.4.7-linux64.zip
WORKDIR emscripten-release-bundle/emsdk
RUN ./emsdk activate latest-fastcomp
WORKDIR ../..

# Build moonlight
COPY . ./moonlight-chrome-tizen

RUN cmake \
-DCMAKE_TOOLCHAIN_FILE=/home/moonlight/emscripten-release-bundle/emsdk/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-G Ninja \
-S moonlight-chrome-tizen \
-B build
RUN cmake --build build
RUN cmake --install build --prefix build

RUN cp moonlight-chrome-tizen/icons/icon.png build/widget/

# Package and sign application
# Effectively runs `tizen package -t wgt -- build/widget`,
# but uses an expect cmdfile to automate the password prompt.
RUN echo \
'set timeout -1\n' \
'spawn tizen package -t wgt -- build/widget\n' \
'expect "Author password:"\n' \
'send -- "1234\\r"\n' \
'expect "Yes: (Y), No: (N) ?"\n' \
'send -- "N\\r"\n' \
'expect eof\n' \
| expect

# Optional; remove unneed files
RUN mv build/widget/MoonlightWasm.wgt .
# RUN sdb connect 192.168.0.228
# RUN tizen install -n MoonlightWasm.wgt -t QN55Q65BAGC
#RUN rm -rf \
# build \
# emscripten-1.39.4.7-linux64.zip \
# emscripten-release-bundle \
# moonlight-chrome-tizen \
# tizen-package-expect.sh \
# web-cli_Tizen_Studio_5.0_ubuntu-64.bin \
# .emscripten \
# .emscripten_cache \
# .emscripten_cache.lock \
# .emscripten_ports \
# .emscripten_sanity \
# .wget-hsts
71 changes: 46 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
# Moonlight for ChromeOS
# Moonlight for Tizen
An easy method for building Moonlight for Samsung TV

[Moonlight for ChromeOS](https://moonlight-stream.org) is an open source client for NVIDIA GameStream, as used by the NVIDIA Shield.

Moonlight for ChromeOS allows you to stream your full collection of games from your powerful desktop to another PC or laptop running ChromeOS.

For Windows, Mac, and Linux, we recommend running the [new PC port](https://github.com/moonlight-stream/moonlight-qt) for maximum performance.

Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS/tvOS](https://github.com/moonlight-stream/moonlight-ios).

Check out [the Moonlight wiki](https://github.com/moonlight-stream/moonlight-docs/wiki) for more detailed project information, setup guide, or troubleshooting steps.

[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/w716mt9ulyww68c5/branch/master?svg=true)](https://ci.appveyor.com/project/cgutman/moonlight-chrome/branch/master)

[![Moonlight for ChromeOS](https://moonlight-stream.org/images/chrome_webstore.png)](https://chrome.google.com/webstore/detail/moonlight-game-streaming/gemamigbbenahjlfnmlfdjhdnkpbkfjj)
## Credits
- Moonlight developers: https://moonlight-stream.org
- Samsung developers: https://github.com/SamsungDForum/moonlight-chrome
- This Dockerfile and support files have been adapted from [jellyfin-docker-tizen](https://github.com/babagreensheep/jellyfin-tizen-docker)
- Dockerfile readapted for my repository tizen from [pablojrl123](https://github.com/pablojrl123/moonlight-tizen-docker)

## Building
1. Install the Chrome Native Client SDK and download the current Pepper SDK
2. Set the `NACL_SDK_ROOT` environment variable to your Pepper SDK folder. If you need more detailed instructions, see [here](https://github.com/google/pepper.js/wiki/Getting-Started)
3. Run `git submodule update --init --recursive` from within `moonlight-chrome/`
4. Run `make` from within the `moonlight-chrome/` repo

## Testing
1. Open the Extensions page in Chrome
2. Check the 'Developer mode' option
3. Click 'Load unpacked extension' and point it at your built moonlight-chrome repo
4. Run Moonlight from the extensions page
5. If making changes, make sure to click the Reload button on the Extensions page
1. Enable developer mode on the TV (more information on [official Samsung guide](https://developer.samsung.com/smarttv/develop/getting-started/using-sdk/tv-device.html)):
- Go to Apps.
- Press `12345` on the remote; a dialog should pop up.
- Set `Developer mode` to `On`; fill in the IP of the Docker host.
- Power off and power on the TV as instructed; go once again to Apps.
- Depending on your model, a "DEVELOP MODE" or similar message might appear.

2. Build the application within a Docker image:
```
docker build -t moonlight-tizen .
```
This will take a while.
3. Deploy the application to the TV:
- Run and enter a container; the container will be removed automatically on exit:
```
docker run -it --rm moonlight-tizen
```
- Connect to your TV over Smart Development Bridge:
```sh
sdb connect YOUR_TV_IP
```
- Confirm that you are connected, take note of the device ID:
```
sdb devices
```
The device ID will be the last column, something like `UE65NU7400`.
- Install the package:
```sh
tizen install -n MoonlightWasm.wgt -t DEVICE_ID
```
Moonlight should now appear in your Recent Apps - or similar page - on your TV.
- Exit the container:
```sh
exit
```
- (Optional) Remove the Docker image:
```sh
docker image rm moonlight-tizen
```

0 comments on commit 83f1276

Please sign in to comment.