-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
102 lines (84 loc) · 2.53 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
SHELL := /bin/bash
#
# Define NPM and check if it is available on the system.
#
app_name=$(notdir $(CURDIR))
project_directory=$(CURDIR)/../$(app_name)
build_tools_directory=$(CURDIR)/build/tools
appstore_package_name=$(CURDIR)/build/dist/$(app_name)
composer=$(shell which composer 2> /dev/null)
occ=$(CURDIR)/../../occ
private_key=$(HOME)/.owncloud/certificates/$(app_name).key
certificate=$(HOME)/.owncloud/certificates/$(app_name).crt
sign=php -f $(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)"
sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)"
ifneq (,$(wildcard $(private_key)))
ifneq (,$(wildcard $(certificate)))
ifneq (,$(wildcard $(occ)))
CAN_SIGN=true
endif
endif
endif
PHPUNIT="$(PWD)/lib/composer/phpunit/phpunit/phpunit"
market_doc_files=LICENSE README.md
market_src_dirs=appinfo l10n js lib vendor
market_all_src=$(market_src_dirs) $(market_doc_files)
build_dir=build
dist_dir=$(build_dir)/dist
COMPOSER_BIN=$(build_dir)/composer.phar
# internal aliases
composer_deps=vendor/
composer_dev_deps=lib/composer/phpunit
#
# Catch-all rules
#
.PHONY: all
all: $(composer_dev_deps)
.PHONY: clean
clean: clean-composer-deps clean-dist clean-build
#
# Basic required tools
#
$(COMPOSER_BIN):
mkdir $(build_dir)
cd $(build_dir) && curl -sS https://getcomposer.org/installer | php
#
# ownCloud market PHP dependencies
#
$(composer_deps): $(COMPOSER_BIN) composer.json composer.lock
php $(COMPOSER_BIN) install --no-dev
$(composer_dev_deps): $(COMPOSER_BIN) composer.json composer.lock
php $(COMPOSER_BIN) install --dev
.PHONY: clean-composer-deps
clean-composer-deps:
rm -f $(COMPOSER_BIN)
rm -Rf $(composer_deps)
.PHONY: update-composer
update-composer: $(COMPOSER_BIN)
rm -f composer.lock
php $(COMPOSER_BIN) install --prefer-dist
#
# dist
#
$(dist_dir)/files_external_onedrive: $(composer_deps)
rm -Rf $@; mkdir -p $@
cp -R $(market_all_src) $@
find $@/vendor -type d -iname Test? -print | xargs rm -Rf
find $@/vendor -name travis -print | xargs rm -Rf
find $@/vendor -name doc -print | xargs rm -Rf
find $@/vendor -iname \*.sh -delete
find $@/vendor -iname \*.exe -delete
.PHONY: dist
dist: clean $(dist_dir)/files_external_onedrive
ifdef CAN_SIGN
$(sign) --path="$(appstore_package_name)"
else
@echo $(sign_skip_msg)
endif
tar -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name)
.PHONY: clean-dist
clean-dist:
rm -Rf $(dist_dir)
.PHONY: clean-build
clean-build:
rm -Rf $(build_dir)