forked from SynoCommunity/spksrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspksrc.cross-cc.mk
137 lines (109 loc) · 3.22 KB
/
spksrc.cross-cc.mk
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
135
136
# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk
# Configure the included makefiles
URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
NAME = $(PKG_NAME)
COOKIE_PREFIX = $(PKG_NAME)-
ifneq ($(PKG_DIST_FILE),)
DIST_FILE = $(DISTRIB_DIR)/$(PKG_DIST_FILE)
else
DIST_FILE = $(DISTRIB_DIR)/$(PKG_DIST_NAME)
endif
DIST_EXT = $(PKG_EXT)
ifneq ($(ARCH),)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
#####
ifneq ($(REQ_KERNEL),)
ifeq ($(ARCH),x64)
@$(error x64 arch cannot be used when REQ_KERNEL is set )
endif
endif
# Check if package supports ARCH
ifneq ($(UNSUPPORTED_ARCHS),)
ifneq (,$(findstring $(ARCH),$(UNSUPPORTED_ARCHS)))
@$(error Arch '$(ARCH)' is not a supported architecture )
endif
endif
# Check minimum DSM requirements of package
ifneq ($(REQUIRED_DSM),)
ifneq ($(REQUIRED_DSM),$(firstword $(sort $(TCVERSION) $(REQUIRED_DSM))))
@$(error Toolchain $(TCVERSION) is lower than required version in Makefile $(REQUIRED_DSM) )
endif
endif
#####
include ../../mk/spksrc.cross-env.mk
include ../../mk/spksrc.download.mk
include ../../mk/spksrc.depend.mk
checksum: download
include ../../mk/spksrc.checksum.mk
extract: checksum depend
include ../../mk/spksrc.extract.mk
patch: extract
include ../../mk/spksrc.patch.mk
configure: patch
include ../../mk/spksrc.configure.mk
compile: configure
include ../../mk/spksrc.compile.mk
install: compile
include ../../mk/spksrc.install.mk
.PHONY: cat_PLIST
cat_PLIST:
@for depend in $(DEPENDS) ; \
do \
$(MAKE) WORK_DIR=$(WORK_DIR) --no-print-directory -C ../../$$depend cat_PLIST ; \
done
@if [ -f PLIST ] ; \
then \
cat PLIST ; \
else \
$(MSG) "No PLIST for $(NAME)" >&2; \
fi
### Clean rules
smart-clean:
rm -rf $(WORK_DIR)/$(PKG_DIR)
rm -f $(WORK_DIR)/.$(COOKIE_PREFIX)*
clean:
rm -fr work work-*
all: install
.PHONY: $(DIGESTS_FILE)
$(DIGESTS_FILE): download
@$(MSG) "Generating digests for $(PKG_NAME)"
@rm -f $@ && touch -f $@
@for type in SHA1 SHA256 MD5; do \
localFile=$(PKG_DIST_FILE) ; \
if [ -z "$${localFile}" ]; then \
localFile=$(PKG_DIST_NAME) ; \
fi ; \
case $$type in \
SHA1|sha1) tool=sha1sum ;; \
SHA256|sha256) tool=sha256sum ;; \
MD5|md5) tool=md5sum ;; \
esac ; \
echo "$${localFile} $$type `$$tool $(DISTRIB_DIR)/$${localFile} | cut -d\" \" -f1`" >> $@ ; \
done
dependency-tree:
@echo `perl -e 'print "\\\t" x $(MAKELEVEL),"\n"'`+ $(NAME) $(PKG_VERS)
@for depend in $(BUILD_DEPENDS) $(DEPENDS) ; \
do \
$(MAKE) --no-print-directory -C ../../$$depend dependency-tree ; \
done
.PHONY: all-archs
all-archs: $(addprefix arch-,$(AVAILABLE_ARCHS))
arch-%:
@$(MSG) Building package for arch $*
-@MAKEFLAGS= $(MAKE) ARCH=$(basename $(subst -,.,$(basename $(subst .,,$*)))) TCVERSION=$(if $(findstring $*,$(basename $(subst -,.,$(basename $(subst .,,$*))))),$(DEFAULT_TC),$(notdir $(subst -,/,$*)))
.PHONY: kernel-required
kernel-required:
@if [ -n "$(REQ_KERNEL)" ]; then \
exit 1 ; \
fi
@for depend in $(BUILD_DEPENDS) $(DEPENDS) ; do \
if $(MAKE) --no-print-directory -C ../../$$depend kernel-required >/dev/null 2>&1 ; then \
exit 0 ; \
else \
exit 1 ; \
fi ; \
done