forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.static
129 lines (114 loc) · 3.53 KB
/
Makefile.static
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
#
# Copyright (C) 2008-2014 Tvheadend Foundation CIC
#
# This file is part of Tvheadend
#
# Tvheadend is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tvheadend is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Tvheadend. If not, see <http://www.gnu.org/licenses/>.
#
# For more details, including opportunities for alternative licensing,
# please read the LICENSE file.
#
# ############################################################################
# ############################################################################
# Generic makefile for handling static 3rd party libraries
# ############################################################################
#
# Required inputs
#
# LIB_NAME - The name of the library used in files uploaded/downloaded
# LIB_FILES - The files to be packaged
#
# Optional inputs
#
# PCLOUD_CACHE - Use cached builds from pcloud
# PCLOUD_USER - The pcloud user account for uploads
# PCLOUD_PASS - The pcloud password
# PCLOUD_BASEDIR - The base directory for uploads
# PCLOUD_HASHDIR - The public hash for the base directory for downloads
#
MAKEFILE ?= $(firstword $(MAKEFILE_LIST))
# ./configure override
PCLOUD_CACHE ?= $(CONFIG_PCLOUD_CACHE)
default: libcacheput
# Setup environment for scripts
export ARCH
export CODENAME
export ROOTDIR
export BUILDDIR
export LIBDIR
export PCLOUD_CACHE
export PCLOUD_USER
export PCLOUD_PASS
export PCLOUD_BASEDIR
export PCLOUD_HASHDIR
LIB_STATIC_STAMP := $(BUILDDIR)/$(LIB_NAME)_static_stamp
define LIBCACHEGET_TIMESTAMP
@touch $(LIB_STATIC_STAMP)
endef
# Download cache
.PHONY: libcacheget
libcacheget:
ifeq ($(PCLOUD_CACHE),yes)
@if ! test -f $(LIB_STATIC_STAMP); then\
( $(ROOTDIR)/support/lib.sh download $(LIB_NAME) &&\
$(ROOTDIR)/support/lib.sh unpack $(LIB_NAME) ) || true;\
touch $(LIB_STATIC_STAMP);\
fi
endif
# Download and Upload on demand
.PHONY: libcacheput
libcacheput: build
ifneq ($(PCLOUD_USER),)
@$(ROOTDIR)/support/lib.sh upload $(LIB_NAME) $(LIB_FILES)
endif
# ############################################################################
# Helper routines
# ############################################################################
define DOWNLOAD
@mkdir -p $(LIB_ROOT)/build
@if test -z "$${TVHEADEND_FILE_CACHE}"; then \
printf "WGET $(1)\n"; \
wget --no-verbose --no-check-certificate -O $(2) $(1); \
else \
file=$$(basename $(2)); \
cp "$$TVHEADEND_FILE_CACHE/$${file}" $(2); \
fi
@{ \
sum=$$(sha1sum $(2) | cut -d ' ' -f 1); \
printf "SHA1SUM test '$${sum}' == '$(3)': "; \
test "y$${sum}" = "y$(3)"; \
}
@echo "OK"
endef
define UNTAR
@{ \
printf "UNTAR $(1)\n"; \
tar x -C $(LIB_ROOT) -$(2)f $(LIB_ROOT)/$(1); \
}
endef
define PATCH
@{ \
cd $(LIB_ROOT)/$(1); \
for f in $(2); do \
p=$(ROOTDIR)/support/patches/$${f}; \
printf "PATCH $${p}\n"; \
patch -p0 -i $${p}; \
done \
}
endef
# ############################################################################
# Editor Configuration
#
# vim:sts=2:ts=2:sw=2:et!
# ############################################################################