OSDN Git Service

bdceeb77dc118a425de316836e93a8cd196dc89e
[newslash/newslash.git] / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/cdbs/1/rules/debhelper.mk
4
5 CORE=newslash-core
6 ASSETS=newslash-sradjp-assets
7 SRAD=newslash-sradjp
8 UTILS=newslash-utils
9 EXPORTER=newslash-prometheus-exporter
10 SEARCHD=newslash-searchd
11
12 SRCDIR=src/newslash_web
13 UTILSDIR=src/utils
14 CONFDIR=src/configs
15 CORE_DEST=$(CURDIR)/debian/$(CORE)/usr/share/newslash
16 CORE_ETC=$(CURDIR)/debian/$(CORE)/etc/newslash
17 EXPORTERDIR=src/prometheus-newslash-exporter
18 SEARCHD_DIR=src/ns_search
19
20 ASSETS_DEST=$(CURDIR)/debian/$(ASSETS)/usr/share/newslash
21 SRAD_DEST=$(CURDIR)/debian/$(SRAD)/usr/share/newslash
22 UTILS_DEST=$(CURDIR)/debian/$(UTILS)/usr/share/newslash-utils
23 EXPORTER_DEST=$(CURDIR)/debian/$(EXPORTER)/usr/share/newslash-prometheus-exporter
24 SEARCHD_DEST=$(CURDIR)/debian/$(SEARCHD)/usr/share/newslash-searchd
25 SEARCHD_ETC=$(CURDIR)/debian/$(SEARCHD)/etc/newslash
26
27 install/$(CORE)::
28         cd $(SRCDIR); \
29         find ./lib -name '*.pm' \
30           -exec install -pDm 644 {} $(CORE_DEST)/{} \;
31         cd $(SRCDIR); \
32         find ./external/perllib -name '*.pm' \
33           -exec install -pDm 644 {} $(CORE_DEST)/{} \;
34         install -pDm 755 $(SRCDIR)/script/newslash_web $(CORE_DEST)/script/newslash_web
35         install -pDm 755 $(SRCDIR)/script/newslash_eventd $(CORE_DEST)/script/newslash_eventd
36         install -pDm 755 $(SRCDIR)/script/newslash_feed_fetcher $(CORE_DEST)/script/newslash_feed_fetcher
37         mkdir -m 755 -p $(CORE_ETC)
38         install -pDm 644 $(CONFDIR)/newslash.conf.example $(CORE_ETC)/newslash.conf.example
39
40
41 install/$(ASSETS)::
42         cd $(SRCDIR); \
43         find ./templates -name '*.tt2' \
44           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
45         cd $(SRCDIR); \
46         find ./css ! -name '*~' ! -type l \
47           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
48         ln -sf ../external/bootstrap-3.3.7/less $(ASSETS_DEST)/css/bootstrap
49         cd $(SRCDIR); \
50         find ./public/img ! -name '*~' ! -type l \
51           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
52         cd $(SRCDIR); \
53         find ./public/jquery ! -name '*~' ! -type l \
54           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
55         cd $(SRCDIR); \
56         find ./public/js ! -name '*~' ! -type l \
57           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
58         cd $(SRCDIR); \
59         find ./public/vue ! -name '*~' ! -type l \
60           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
61         cd $(SRCDIR); \
62         find ./external/bootstrap-3.3.7 ! -name '*~' ! -type l \
63           -exec install -pDm 644 {} $(ASSETS_DEST)/{} \;
64         ln -sf ../../external/escape-html.js/js/escape-html.js $(ASSETS_DEST)/public/js/escape-html.js
65         ln -sf ../external/bootstrap-3.3.7/dist $(ASSETS_DEST)/public/bootstrap
66         ln -sf ../external/bootstrap-3.3.7/fonts $(ASSETS_DEST)/public/fonts
67         install -pDm 644 $(SRCDIR)/external/escape-html.js/js/escape-html.js $(ASSETS_DEST)/external/escape-html.js/js/escape-html.js
68         install -pDm 644 $(SRCDIR)/public/robots.txt $(ASSETS_DEST)/public/robots.txt
69         install -pDm 644 $(SRCDIR)/public/favicon.ico $(ASSETS_DEST)/public/
70         mkdir $(ASSETS_DEST)/public/css
71
72 install/$(SRAD)::
73         install -pDm 644 misc/newslash.service $(CURDIR)/debian/$(SRAD)/lib/systemd/system/newslash.service
74         install -pDm 644 misc/newslash-eventd.service $(CURDIR)/debian/$(SRAD)/lib/systemd/system/newslash-eventd.service
75 #       install -pDm 644 $(SRCDIR)/newslash-web.production.json $(SRAD_DEST)/newslash-web.production.json
76
77 # todo: restart systemd, add PIDFile dir
78
79 install/$(UTILS)::
80         mkdir -p -m 755 $(UTILS_DEST)/tools
81         mkdir -p -m 755 $(UTILS_DEST)/migration_scripts
82         cd $(UTILSDIR); \
83         find ./migration_scripts -name '*.pl' \
84           -exec install -pDm 644 {} $(UTILS_DEST)/{} \;
85         cd $(UTILSDIR); \
86         find ./migration_scripts -name '*.txt' \
87           -exec install -pDm 644 {} $(UTILS_DEST)/{} \;
88         cd $(UTILSDIR); \
89         find ./migration_scripts -name '*.json' \
90           -exec install -pDm 644 {} $(UTILS_DEST)/{} \;
91         cd $(UTILSDIR); \
92         find ./tools -name '*.pl' \
93           -exec install -pDm 644 {} $(UTILS_DEST)/{} \;
94
95 install/$(EXPORTER)::
96         install -pDm 755 $(EXPORTERDIR)/newslash-exporter.py $(EXPORTER_DEST)/newslash-exporter.py
97         install -pDm 644 $(EXPORTERDIR)/newslash-prometheus-exporter.service \
98           $(CURDIR)/debian/$(EXPORTER)/lib/systemd/system/newslash-prometheus-exporter.service
99
100 install/$(SEARCHD)::
101         mkdir -p -m 755 $(SEARCHD_DEST)/modules
102         mkdir -p -m 755 $(SEARCHD_ETC)
103         cd $(SEARCHD_DIR); for target in newslash_db newslash_searchd newslash_index lucene_wrapper; do \
104           mkdir -p $(SEARCHD_DEST)/modules/$$target ; \
105           find $$target -name '*.py' -exec install -pDm 644 {} $(SEARCHD_DEST)/modules/{} \; ; \
106           done
107         install -pDm 755 $(SEARCHD_DIR)/searchd.py $(SEARCHD_DEST)/modules/
108         install -pDm 755 $(SEARCHD_DIR)/searchd_cli.py $(SEARCHD_DEST)/modules/
109         install -pDm 644 $(SEARCHD_DIR)/searchd.conf.example $(SEARCHD_ETC)/
110         install -pDm 644 misc/newslash-searchd.service $(CURDIR)/debian/$(SEARCHD)/lib/systemd/system/newslash-searchd.service
111
112