2019-05-02 17:45:07 +00:00
|
|
|
#########################################################################
|
|
|
|
# common include file for application Makefiles
|
|
|
|
#
|
|
|
|
# Makefile Common Usage:
|
|
|
|
# > make
|
|
|
|
# > make install
|
|
|
|
# > make remove
|
|
|
|
#
|
|
|
|
# By default, ZIP_EXCLUDE will exclude -x \*.pkg -x storeassets\* -x keys\* -x .\*
|
|
|
|
# If you define ZIP_EXCLUDE in your Makefile, it will override the default setting.
|
|
|
|
#
|
|
|
|
# To exclude different files from being added to the zipfile during packaging
|
|
|
|
# include a line like this:ZIP_EXCLUDE= -x keys\*
|
|
|
|
# that will exclude any file who's name begins with 'keys'
|
|
|
|
# to exclude using more than one pattern use additional '-x <pattern>' arguments
|
|
|
|
# ZIP_EXCLUDE= -x \*.pkg -x storeassets\*
|
|
|
|
#
|
2019-07-23 03:11:13 +00:00
|
|
|
# Important Notes:
|
2019-05-02 17:45:07 +00:00
|
|
|
# To use the "install" and "remove" targets to install your
|
|
|
|
# application directly from the shell, you must do the following:
|
|
|
|
#
|
|
|
|
# 1) Make sure that you have the curl command line executable in your path
|
2019-07-23 03:11:13 +00:00
|
|
|
# 2) Set the variable ROKU_DEV_TARGET in your environment to the IP
|
2019-05-02 17:45:07 +00:00
|
|
|
# address of your Roku box. (e.g. export ROKU_DEV_TARGET=192.168.1.1.
|
|
|
|
# Set in your this variable in your shell startup (e.g. .bashrc)
|
|
|
|
# 3) Set the variable ROKU_DEV_PASSWORD in your environment for the password
|
|
|
|
# associated with the rokudev account.
|
2019-07-23 03:11:13 +00:00
|
|
|
##########################################################################
|
2020-05-05 21:09:18 +00:00
|
|
|
|
2019-07-23 03:11:13 +00:00
|
|
|
DISTREL = $(shell pwd)/out
|
|
|
|
COMMONREL ?= $(shell pwd)/common
|
|
|
|
SOURCEREL = $(shell pwd)
|
2019-05-02 17:45:07 +00:00
|
|
|
|
|
|
|
ZIPREL = $(DISTREL)/apps
|
|
|
|
STAGINGREL = $(DISTREL)/staging
|
|
|
|
PKGREL = $(DISTREL)/packages
|
|
|
|
|
|
|
|
APPSOURCEDIR = source
|
|
|
|
IMPORTFILES = $(foreach f,$(IMPORTS),$(COMMONREL)/$f.brs)
|
|
|
|
IMPORTCLEANUP = $(foreach f,$(IMPORTS),$(APPSOURCEDIR)/$f.brs)
|
|
|
|
|
|
|
|
GITCOMMIT = $(shell git rev-parse --short HEAD)
|
|
|
|
BUILDDATE = $(shell date -u | awk '{ print $$2,$$3,$$6,$$4 }')
|
|
|
|
|
2019-10-05 04:53:40 +00:00
|
|
|
BRANDING_ROOT = https://raw.githubusercontent.com/jellyfin/jellyfin-ux/master/branding/SVG
|
|
|
|
ICON_SOURCE = icon-transparent.svg
|
|
|
|
BANNER_SOURCE = banner-dark.svg
|
|
|
|
OUTPUT_DIR = ./images
|
|
|
|
|
2019-05-02 17:45:07 +00:00
|
|
|
ifdef ROKU_DEV_PASSWORD
|
|
|
|
USERPASS = rokudev:$(ROKU_DEV_PASSWORD)
|
|
|
|
else
|
|
|
|
USERPASS = rokudev
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef ZIP_EXCLUDE
|
|
|
|
ZIP_EXCLUDE= -x \*.pkg -x storeassets\* -x keys\* -x \*/.\*
|
|
|
|
endif
|
|
|
|
|
|
|
|
HTTPSTATUS = $(shell curl --silent --write-out "\n%{http_code}\n" $(ROKU_DEV_TARGET))
|
|
|
|
|
|
|
|
ifeq "$(HTTPSTATUS)" " 401"
|
2020-03-18 00:13:12 +00:00
|
|
|
CURLCMD = curl -S --tcp-fastopen --connect-timeout 2 --max-time 30 --retry 5
|
2019-05-02 17:45:07 +00:00
|
|
|
else
|
2020-03-18 00:13:12 +00:00
|
|
|
CURLCMD = curl -S --tcp-fastopen --connect-timeout 2 --max-time 30 --retry 5 --user $(USERPASS) --digest
|
2019-05-02 17:45:07 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
home:
|
|
|
|
@echo "Forcing roku to main menu screen $(ROKU_DEV_TARGET)..."
|
|
|
|
curl -s -S -d '' http://$(ROKU_DEV_TARGET):8060/keypress/home
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
prep_staging:
|
|
|
|
@echo "*** Preparing Staging Area ***"
|
|
|
|
@echo " >> removing old application zip $(ZIPREL)/$(APPNAME).zip"
|
|
|
|
@if [ -e "$(ZIPREL)/$(APPNAME).zip" ]; \
|
|
|
|
then \
|
|
|
|
rm $(ZIPREL)/$(APPNAME).zip; \
|
|
|
|
fi
|
|
|
|
|
2019-07-23 03:11:13 +00:00
|
|
|
@echo " >> creating destination directory $(ZIPREL)"
|
2019-05-02 17:45:07 +00:00
|
|
|
@if [ ! -d $(ZIPREL) ]; \
|
|
|
|
then \
|
|
|
|
mkdir -p $(ZIPREL); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
@echo " >> setting directory permissions for $(ZIPREL)"
|
|
|
|
@if [ ! -w $(ZIPREL) ]; \
|
|
|
|
then \
|
|
|
|
chmod 755 $(ZIPREL); \
|
|
|
|
fi
|
|
|
|
|
2019-07-23 03:11:13 +00:00
|
|
|
@echo " >> creating destination directory $(STAGINGREL)"
|
2019-05-02 17:45:07 +00:00
|
|
|
@if [ -d $(STAGINGREL) ]; \
|
|
|
|
then \
|
|
|
|
find $(STAGINGREL) -delete; \
|
|
|
|
fi; \
|
|
|
|
mkdir -p $(STAGINGREL); \
|
|
|
|
chmod -R 755 $(STAGINGREL); \
|
|
|
|
|
2019-07-23 03:11:13 +00:00
|
|
|
echo " >> moving application to $(STAGINGREL)"
|
|
|
|
cp -r $(SOURCEREL)/source $(STAGINGREL)
|
|
|
|
cp -r $(SOURCEREL)/components $(STAGINGREL)
|
|
|
|
cp -r $(SOURCEREL)/images $(STAGINGREL)
|
2020-05-05 21:09:18 +00:00
|
|
|
cp -r $(SOURCEREL)/locale $(STAGINGREL)
|
2019-07-23 03:11:13 +00:00
|
|
|
cp $(SOURCEREL)/manifest $(STAGINGREL)/manifest
|
2019-05-02 17:45:07 +00:00
|
|
|
|
2019-07-23 03:11:13 +00:00
|
|
|
package: prep_staging
|
2019-05-02 17:45:07 +00:00
|
|
|
@echo "*** Creating $(APPNAME).zip ***"
|
|
|
|
@echo " >> copying imports"
|
|
|
|
@if [ "$(IMPORTFILES)" ]; \
|
|
|
|
then \
|
|
|
|
mkdir $(APPSOURCEDIR)/common; \
|
|
|
|
cp -f -p -v $(IMPORTFILES) $(APPSOURCEDIR)/common/; \
|
|
|
|
fi \
|
|
|
|
|
|
|
|
@echo " >> generating build info file"
|
2019-07-23 03:11:13 +00:00
|
|
|
mkdir -p $(STAGINGREL)/$(APPSOURCEDIR)
|
2019-05-02 17:45:07 +00:00
|
|
|
@if [ -e "$(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs" ]; \
|
|
|
|
then \
|
|
|
|
rm $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs; \
|
|
|
|
fi
|
|
|
|
echo " >> generating build info file";\
|
2019-07-23 03:11:13 +00:00
|
|
|
echo "Function BuildDate()" >> $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs
|
2019-05-02 17:45:07 +00:00
|
|
|
echo " return \"${BUILDDATE}\"" >> $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs
|
|
|
|
echo "End Function" >> $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs
|
|
|
|
echo "Function BuildCommit()" >> $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs
|
|
|
|
echo " return \"${GITCOMMIT}\"" >> $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs
|
|
|
|
echo "End Function" >> $(STAGINGREL)/$(APPSOURCEDIR)/buildinfo.brs
|
|
|
|
|
|
|
|
# zip .png files without compression
|
|
|
|
# do not zip up any files ending with '~'
|
2019-07-23 03:11:13 +00:00
|
|
|
@echo " >> creating application zip $(STAGINGREL)/../apps/$(APPNAME).zip"
|
2019-05-02 17:45:07 +00:00
|
|
|
@if [ -d $(STAGINGREL) ]; \
|
|
|
|
then \
|
|
|
|
cd $(STAGINGREL); \
|
|
|
|
(zip -0 -r "../apps/$(APPNAME).zip" . -i \*.png $(ZIP_EXCLUDE)); \
|
|
|
|
(zip -9 -r "../apps/$(APPNAME).zip" . -x \*~ -x \*.png $(ZIP_EXCLUDE)); \
|
|
|
|
cd $(SOURCEREL);\
|
|
|
|
else \
|
|
|
|
echo "Source for $(APPNAME) not found at $(STAGINGREL)"; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
@if [ "$(IMPORTCLEANUP)" ]; \
|
|
|
|
then \
|
|
|
|
echo " >> deleting imports";\
|
|
|
|
rm -r -f $(APPSOURCEDIR)/common; \
|
|
|
|
fi \
|
|
|
|
|
|
|
|
@echo "*** packaging $(APPNAME) complete ***"
|
|
|
|
|
|
|
|
prep_tests:
|
|
|
|
@mkdir -p $(STAGINGREL)/components/tests/; \
|
|
|
|
mkdir -p $(STAGINGREL)/source/tests/; \
|
|
|
|
cp -r $(SOURCEREL)/tests/components/* $(STAGINGREL)/components/tests/;\
|
|
|
|
cp -r $(SOURCEREL)/tests/source/* $(STAGINGREL)/source/tests/;\
|
2019-09-09 03:02:09 +00:00
|
|
|
./node_modules/.bin/rooibos-cli i tests/.rooibosrc.json
|
2019-07-23 03:11:13 +00:00
|
|
|
|
2019-10-07 04:23:48 +00:00
|
|
|
install: prep_staging package home
|
2019-05-02 17:45:07 +00:00
|
|
|
@echo "Installing $(APPNAME) to host $(ROKU_DEV_TARGET)"
|
|
|
|
@$(CURLCMD) --user $(USERPASS) --digest -F "mysubmit=Install" -F "archive=@$(ZIPREL)/$(APPNAME).zip" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "<font color" | sed "s/<font color=\"red\">//" | sed "s[</font>[["
|
|
|
|
|
|
|
|
remove:
|
|
|
|
@echo "Removing $(APPNAME) from host $(ROKU_DEV_TARGET)"
|
|
|
|
@if [ "$(HTTPSTATUS)" == " 401" ]; \
|
|
|
|
then \
|
|
|
|
$(CURLCMD) --user $(USERPASS) --digest -F "mysubmit=Delete" -F "archive=" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "<font color" | sed "s/<font color=\"red\">//" | sed "s[</font>[[" ; \
|
|
|
|
else \
|
|
|
|
curl -s -S -F "mysubmit=Delete" -F "archive=" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "<font color" | sed "s/<font color=\"red\">//" | sed "s[</font>[[" ; \
|
|
|
|
fi
|
|
|
|
|
2019-10-05 04:53:40 +00:00
|
|
|
get_images:
|
|
|
|
@if [ ! -d $(OUTPUT_DIR) ]; \
|
|
|
|
then \
|
|
|
|
mkdir -p $(OUTPUT_DIR); \
|
|
|
|
echo "Creating images folder"; \
|
|
|
|
fi
|
|
|
|
|
2019-10-07 04:23:48 +00:00
|
|
|
echo "Downloading SVG source files from $(BRANDING_ROOT)"
|
|
|
|
@wget $(BRANDING_ROOT)/$(ICON_SOURCE) > /dev/null
|
|
|
|
@wget $(BRANDING_ROOT)/$(BANNER_SOURCE) > /dev/null
|
|
|
|
echo "Finished downloading SVG files"
|
|
|
|
|
|
|
|
echo "Creating image files"
|
2019-10-05 04:53:40 +00:00
|
|
|
@convert -background "#000b25" -gravity center -scale 535x400 -extent 540x405 $(BANNER_SOURCE) $(OUTPUT_DIR)/channel-poster_fhd.png
|
2020-04-29 16:26:12 +00:00
|
|
|
@convert -background "#000b25" -gravity center -scale 275x205 -extent 336x210 $(BANNER_SOURCE) $(OUTPUT_DIR)/channel-poster_hd.png
|
|
|
|
@convert -background "#000b25" -gravity center -scale 182x135 -extent 246x140 $(BANNER_SOURCE) $(OUTPUT_DIR)/channel-poster_sd.png
|
2019-10-05 04:53:40 +00:00
|
|
|
|
|
|
|
@convert -background none -gravity center -scale 1000x48 -extent 180x48 $(BANNER_SOURCE) $(OUTPUT_DIR)/logo.png
|
|
|
|
|
|
|
|
@convert -background "#000b25" -gravity center -scale 540x540 -extent 1920x1080 $(BANNER_SOURCE) $(OUTPUT_DIR)/splash-screen_fhd.jpg
|
|
|
|
@convert -background "#000b25" -gravity center -scale 360x360 -extent 1280x720 $(BANNER_SOURCE) $(OUTPUT_DIR)/splash-screen_hd.jpg
|
|
|
|
@convert -background "#000b25" -gravity center -scale 240x240 -extent 720x480 $(BANNER_SOURCE) $(OUTPUT_DIR)/splash-screen_sd.jpg
|
2019-10-07 04:23:48 +00:00
|
|
|
echo "Finished creating image files"
|
|
|
|
|
2019-05-02 17:45:07 +00:00
|
|
|
screenshot:
|
|
|
|
SCREENSHOT_TIME=`date "+%s"`; \
|
|
|
|
curl -m 1 -o screenshot.jpg --user $(USERPASS) --digest "http://$(ROKU_DEV_TARGET)/pkgs/dev.jpg?time=$$SCREENSHOT_TIME" -H 'Accept: image/png,image/*;q=0.8,*/*;q=0.5' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|