forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.static
122 lines (108 loc) · 3.21 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
#
# 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
#
# BINTRAY_CACHE - Use cached builds from bintray
# BINTRAY_USER - The bintray user account for uploads
# BINTRAY_PASS - The bintray password
# BINTRAY_REPO - The repo to upload to
#
MAKEFILE ?= $(firstword $(MAKEFILE_LIST))
# ./configure override
BINTRAY_CACHE ?= $(CONFIG_BINTRAY_CACHE)
default: liball
# Setup environment for scripts
export ARCH
export CODENAME
export ROOTDIR
export BUILDDIR
export LIBDIR
export BINTRAY_CACHE
export BINTRAY_USER
export BINTRAY_PASS
export BINTRAY_REPO
# Download cache
.PHONY: libcacheget
libcacheget:
ifeq ($(BINTRAY_CACHE),yes)
@( $(ROOTDIR)/support/lib.sh download $(LIB_NAME) &&\
$(ROOTDIR)/support/lib.sh unpack $(LIB_NAME) ) || true
endif
# Upload
.PHONY: libcacheput
libcacheput: build
ifneq ($(BINTRAY_USER),)
@$(ROOTDIR)/support/lib.sh upload $(LIB_NAME) $(LIB_FILES)
endif
# Do it all
.PHONY: liball
liball: libcacheget libcacheput
# ############################################################################
# Helper routines
# ############################################################################
define DOWNLOAD
@mkdir -p $(LIB_ROOT)/build
@if test -z "$${TVHEADEND_FILE_CACHE}"; then \
printf "WGET $(1)\n"; \
wget --no-verbose -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!
# ############################################################################