tools.mak 5.28 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
# Copyright (C) 2003-2011 the VideoLAN team
#
# This file is under the same license as the vlc package.

include packages.mak

#
# common rules
#

11
12
13
AUTOCONF=$(PREFIX)/bin/autoconf
export AUTOCONF

14
15
16
17
18
19
20
ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
download = curl -f -L -- "$(1)" > "$@"
else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
download = rm -f $@.tmp && \
	wget --passive -c -p -O $@.tmp "$(1)" && \
	touch $@.tmp && \
	mv $@.tmp $@
21
22
23
24
25
else ifeq ($(which fetch >/dev/null 2>&1 || echo FAIL),)
download = rm -f $@.tmp && \
	fetch -p -o $@.tmp "$(1)" && \
	touch $@.tmp && \
	mv $@.tmp $@
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
else
download = $(error Neither curl nor wget found!)
endif

UNPACK = $(RM) -R $@ \
    $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzf $(f)) \
    $(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \
    $(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \
    $(foreach f,$(filter %.zip,$^), && unzip $(f))

UNPACK_DIR = $(basename $(basename $(notdir $<)))
APPLY = (cd $(UNPACK_DIR) && patch -p1) <
MOVE = mv $(UNPACK_DIR) $@ && touch $@

#
# package rules
#

Rafaël Carré's avatar
Rafaël Carré committed
44
45
46
# yasm

yasm-$(YASM_VERSION).tar.gz:
47
	$(call download,$(YASM_URL))
Rafaël Carré's avatar
Rafaël Carré committed
48
49
50
51
52
53
54
55
56
57
58
59
60

yasm: yasm-$(YASM_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.yasm: yasm
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .yasm
CLEAN_PKG += yasm
DISTCLEAN_PKG += yasm-$(YASM_VERSION).tar.gz

61
62
63
# cmake

cmake-$(CMAKE_VERSION).tar.gz:
64
	$(call download,$(CMAKE_URL))
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

cmake: cmake-$(CMAKE_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.cmake: cmake
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .cmake
CLEAN_PKG += cmake
DISTCLEAN_PKG += cmake-$(CMAKE_VERSION).tar.gz

# libtool

libtool-$(LIBTOOL_VERSION).tar.gz:
81
	$(call download,$(LIBTOOL_URL))
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

libtool: libtool-$(LIBTOOL_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.libtool: libtool
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	ln -sf libtool $(PREFIX)/bin/glibtool
	ln -sf libtoolize $(PREFIX)/bin/glibtoolize
	touch $@

CLEAN_PKG += libtool
DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
CLEAN_FILE += .libtool

97
98
99
# GNU tar (with xz support)

tar-$(TAR_VERSION).tar.bz2:
100
	$(call download,$(TAR_URL))
101
102
103
104
105

tar: tar-$(TAR_VERSION).tar.bz2
	$(UNPACK)
	$(MOVE)

106
.tar: tar
107
108
109
110
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_PKG += tar
111
DISTCLEAN_PKG += tar-$(TAR_VERSION).tar.bz2
112
113
CLEAN_FILE += .tar

114
115
116
# xz

xz-$(XZ_VERSION).tar.bz2:
117
	$(call download,$(XZ_URL))
118
119
120
121
122

xz: xz-$(XZ_VERSION).tar.bz2
	$(UNPACK)
	$(MOVE)

123
.xz: xz
124
125
126
127
128
129
130
131
132
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_PKG += xz
DISTCLEAN_PKG += xz-$(XZ_VERSION).tar.bz2
CLEAN_FILE += .xz

# autoconf

133
autoconf-$(AUTOCONF_VERSION).tar.gz:
134
	$(call download,$(AUTOCONF_URL))
135

136
autoconf: autoconf-$(AUTOCONF_VERSION).tar.gz
137
138
139
	$(UNPACK)
	$(MOVE)

140
.autoconf: autoconf .pkg-config
141
142
143
144
145
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .autoconf
CLEAN_PKG += autoconf
146
DISTCLEAN_PKG += autoconf-$(AUTOCONF_VERSION).tar.gz
147
148
149
150

# automake

automake-$(AUTOMAKE_VERSION).tar.gz:
151
	$(call download,$(AUTOMAKE_URL))
152
153
154
155
156
157
158
159
160
161
162
163
164

automake: automake-$(AUTOMAKE_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.automake: automake .autoconf
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .automake
CLEAN_PKG += automake
DISTCLEAN_PKG += automake-$(AUTOMAKE_VERSION).tar.gz

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# m4

m4-$(M4_VERSION).tar.gz:
	$(call download,$(M4_URL))

m4: m4-$(M4_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.m4: m4 .autoconf
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .m4
CLEAN_PKG += m4
DISTCLEAN_PKG += m4-$(M4_VERSION).tar.gz

182
183
184
# pkg-config

pkg-config-$(PKGCFG_VERSION).tar.gz:
185
	$(call download,$(PKGCFG_URL))
186

187
pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
188
	$(UNPACK)
189
	mv pkg-config-lite-$(PKGCFG_VERSION) pkg-config-$(PKGCFG_VERSION)
190
191
192
193
194
195
196
197
198
199
	$(MOVE)

.pkg-config: pkgconfig
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
	touch $@

CLEAN_FILE += .pkg-config
CLEAN_PKG += pkgconfig
DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# openssl
# we need to use -j1 here, since otherwise compilation fails (at least on Darwin)

openssl-$(OPENSSL_VERSION).tar.gz:
	$(call download,$(OPENSSL_URL))

openssl: openssl-$(OPENSSL_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.openssl: openssl
	(cd openssl; ./config --prefix=$(PREFIX) no-shared no-zlib && make -j1 && make test && make install)
	touch $@

CLEAN_FILE += .openssl
CLEAN_PKG += openssl
DISTCLEAN_PKG += openssl-$(OPENSSL_VERSION).tar.gz

218
# gas-preprocessor
219
gas-preprocessor-$(GAS_VERSION).tar.gz:
220
221
	$(call download,$(GAS_URL))

222
gas: gas-preprocessor-$(GAS_VERSION).tar.gz
223
224
225
226
	$(UNPACK)
	$(MOVE)

.gas: gas
227
	cp gas/gas-preprocessor.pl build/bin/
228
229
230
231
232
233
	touch $@

CLEAN_FILE += .gas
CLEAN_PKG += gas
DISTCLEAN_PKG += yuvi-gas-preprocessor-$(GAS_VERSION).tar.gz

nkoriyama's avatar
nkoriyama committed
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# Ragel State Machine Compiler
ragel-$(RAGEL_VERSION).tar.gz:
	$(call download,$(RAGEL_URL))

ragel: ragel-$(RAGEL_VERSION).tar.gz
	$(UNPACK)
	$(MOVE)

.ragel: ragel
	(cd ragel; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
	touch $@

CLEAN_FILE += .ragel
CLEAN_PKG += ragel
DISTCLEAN_PKG += ragel-$(RAGEL_VERSION).tar.gz

250
251
252
253
254
255
256
257
258
259
260
#
#
#

clean:
	rm -fr $(CLEAN_FILE) $(CLEAN_PKG) build/

distclean: clean
	rm -fr $(DISTCLEAN_PKG)

.PHONY: all clean distclean