-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
103 lines (83 loc) · 3.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
######################################################################
# simple makefile for sagetv-for-plexmediacenter
######################################################################
# dependency specification
SRC_DIR = src
BUILD_DIR = build
STAGE_DIR = $(BUILD_DIR)/stage
REL_VERSION = 8.3.1
REL_PHASE = beta
SCANNER_TV = $(STAGE_DIR)/plex/Scanners/Series
SCANNER_MOVIE = $(STAGE_DIR)/plex/Scanners/Movies
AGENT_DIR = $(STAGE_DIR)/plex/Plug-ins
SYNCTOOL_DIR = $(STAGE_DIR)/plex/synctool
INSTALL_DIR = $(STAGE_DIR)/install
AGENT_COMMON = plexlog.py config.py sagex.py plexapi.py spvideo.py
# cx freeze
PYTHON_DIR = c:/devtools/python27
PYTHON_EXE = $(PYTHON_DIR)/python.exe
CXFREEZE = $(PYTHON_EXE) $(PYTHON_DIR)/Scripts/cxfreeze
all: stage zip
stage: sagex scanner agent synctool installer
cp "readme.md" "$(STAGE_DIR)"
cp "changelog.txt" "$(STAGE_DIR)"
######################################################################
# simple makefile rules that copies files to the correct folder
# location for easy install on target machine
sagex:
@echo "*** building sagex ***"
mkdir -p $(STAGE_DIR)/sagetv/sagex/services
cp $(SRC_DIR)/sagetv/sagex-services/plex.js $(STAGE_DIR)/sagetv/sagex/services
scanner:
@echo "*** building scanners ***"
mkdir -p $(SCANNER_TV)/sageplex
mkdir -p $(SCANNER_MOVIE)/sageplex
# copy main scanner
cp "$(SRC_DIR)/plex/scanner/SageTV Scanner.py" "$(SCANNER_TV)"
cp "$(SRC_DIR)/plex/scanner/SageTV Movie Scanner.py" "$(SCANNER_MOVIE)"
# copy library to each scanner's sub folder
cp -r $(SRC_DIR)/plex/common/sageplex "$(SCANNER_TV)"
cp -r $(SRC_DIR)/plex/common/sageplex "$(SCANNER_MOVIE)"
# copy config file
cp $(SRC_DIR)/plex/sageplex_cfg.json $(STAGE_DIR)/plex
agent:
@echo "*** building agents ***"
mkdir -p $(AGENT_DIR)
# copy main agent folder
cp -r $(SRC_DIR)/plex/agent/BMTAgentTVShows.bundle $(AGENT_DIR)
# copy common code individually (skip __init__.py)
for f in $(AGENT_COMMON); do \
cp $(SRC_DIR)/plex/common/sageplex/$$f \
"$(AGENT_DIR)/BMTAgentTVShows.bundle/Contents/Code"; \
done
synctool:
@echo "*** building sync tool ***"
mkdir -p $(SYNCTOOL_DIR)/python
# copy main file
cp "$(SRC_DIR)/plex/tools/sync/sageplex_sync.py" "$(SYNCTOOL_DIR)/python"
# copy library to each scanner's sub folder
cp -r $(SRC_DIR)/plex/common/sageplex "$(SYNCTOOL_DIR)/python"
cd "$(SYNCTOOL_DIR)/python" && $(CXFREEZE) sageplex_sync.py --target-dir ../win32
# copy documentation
cp "wiki/synctool.md" "$(SYNCTOOL_DIR)/readme.md"
installer: pyinstall
pyinstall:
@echo "*** building pythin installer ***"
# copy main file
mkdir -p $(INSTALL_DIR)
cp "$(SRC_DIR)/install/install.txt" "$(STAGE_DIR)"
cp "$(SRC_DIR)/install/python/sageplex_install.py" "$(INSTALL_DIR)"
cd "$(INSTALL_DIR)" && $(CXFREEZE) sageplex_install.py --target-dir win32
# copy over bat files
cp "$(SRC_DIR)/install/python/run_install.bat" "$(STAGE_DIR)/install/win32"
cp "$(SRC_DIR)/install/python/run_uninstall.bat" "$(STAGE_DIR)/install/win32"
zip:
@echo "*** producing zipfile ***"
cd $(STAGE_DIR) && zip -9rX \
../sagetv-for-plexmediacenter-v$(REL_VERSION)-$(REL_PHASE).zip .
clean:
rm -rf $(BUILD_DIR)
rm -rf $(SRC_DIR)/plex/common/sageplex/*.pyc
######################################################################
# phony targets are unaffected by files with the same name
.PHONY : all clean sagex scanner agent zip