forked from julien-nc/phonetrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
134 lines (125 loc) · 4.23 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
app_name=phonetrack
app_version=$(version)
project_dir=.
build_dir=/tmp/build
sign_dir=/tmp/sign
cert_dir=$(HOME)/.nextcloud/certificates
webserveruser ?= www-data
occ_dir ?= /var/www/html/dev/server
build_tools_directory=$(CURDIR)/build/tools
npm=$(shell which npm 2> /dev/null)
composer=$(shell which composer 2> /dev/null)
all: build
.PHONY: build
build:
ifneq (,$(wildcard $(CURDIR)/composer.json))
make composer
endif
ifneq (,$(wildcard $(CURDIR)/package.json))
make npm
endif
.PHONY: dev
dev:
ifneq (,$(wildcard $(CURDIR)/composer.json))
make composer
endif
ifneq (,$(wildcard $(CURDIR)/package.json))
make npm-dev
endif
# Installs and updates the composer dependencies. If composer is not installed
# a copy is fetched from the web
.PHONY: composer
composer:
ifeq (, $(composer))
@echo "No composer command available, downloading a copy from the web"
mkdir -p $(build_tools_directory)
curl -sS https://getcomposer.org/installer | php
mv composer.phar $(build_tools_directory)
php $(build_tools_directory)/composer.phar install --prefer-dist
else
composer install --prefer-dist
endif
.PHONY: npm
npm:
$(npm) ci
$(npm) run build
rm -rf css/fontawesome-free ; mkdir -p css/fontawesome-free/css ; mkdir css/fontawesome-free/webfonts
cp node_modules/@fortawesome/fontawesome-free/css/all.min.css css/fontawesome-free/css/
cp node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid* css/fontawesome-free/webfonts/
cp node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular* css/fontawesome-free/webfonts/
cp node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands* css/fontawesome-free/webfonts/
.PHONY: npm-dev
npm-dev:
$(npm) ci
$(npm) run dev
rm -rf css/fontawesome-free ; mkdir -p css/fontawesome-free/css ; mkdir css/fontawesome-free/webfonts
cp node_modules/@fortawesome/fontawesome-free/css/all.min.css css/fontawesome-free/css/
cp node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid* css/fontawesome-free/webfonts/
cp node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular* css/fontawesome-free/webfonts/
cp node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands* css/fontawesome-free/webfonts/
clean:
sudo rm -rf $(build_dir)
sudo rm -rf $(sign_dir)
build_release: clean
mkdir -p $(sign_dir)
mkdir -p $(build_dir)
@rsync -a \
--exclude=.git \
--exclude=appinfo/signature.json \
--exclude=*.swp \
--exclude=build \
--exclude=.gitignore \
--exclude=.travis.yml \
--exclude=.scrutinizer.yml \
--exclude=CONTRIBUTING.md \
--exclude=composer.json \
--exclude=composer.lock \
--exclude=composer.phar \
--exclude=package.json \
--exclude=package-lock.json \
--exclude=js/node_modules \
--exclude=node_modules \
--exclude=src \
--exclude=translationfiles \
--exclude=webpack.* \
--exclude=/vite.* \
--exclude=.gitlab-ci.yml \
--exclude=crowdin.yml \
--exclude=tools \
--exclude=l10n/.tx \
--exclude=l10n/l10n.pl \
--exclude=l10n/templates \
--exclude=l10n/*.sh \
--exclude=l10n/[a-z][a-z] \
--exclude=l10n/[a-z][a-z]_[A-Z][A-Z] \
--exclude=l10n/no-php \
--exclude=makefile \
--exclude=screenshots \
--exclude=phpunit*xml \
--exclude=tests \
--exclude=/.idea \
--exclude=/.github \
--exclude=/.eslintrc.js \
--exclude=/stylelint.config.js \
--exclude=ci \
--exclude=vendor/bin \
--exclude=vendor/ \
--exclude=.l10nignore \
--exclude=psalm.xml \
--exclude=.php* \
$(project_dir) $(sign_dir)/$(app_name)
# generate info.xml with translations
cd $(sign_dir)/$(app_name)/l10n/descriptions && ./gen_info.xml.sh && mv info.xml ../../appinfo/
@if [ -f $(cert_dir)/$(app_name).key ]; then \
sudo chown $(webserveruser) $(sign_dir)/$(app_name)/appinfo ;\
sudo -u $(webserveruser) php $(occ_dir)/occ integrity:sign-app --privateKey=$(cert_dir)/$(app_name).key --certificate=$(cert_dir)/$(app_name).crt --path=$(sign_dir)/$(app_name)/ ;\
sudo chown -R $(USER) $(sign_dir)/$(app_name)/appinfo ;\
else \
echo "!!! WARNING signature key not found" ;\
fi
tar -czf $(build_dir)/$(app_name)-$(app_version).tar.gz \
-C $(sign_dir) $(app_name)
@if [ -f $(cert_dir)/$(app_name).key ]; then \
echo NEXTCLOUD------------------------------------------ ;\
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(app_version).tar.gz | openssl base64 | tee $(build_dir)/sign.txt ;\
fi