tools.mak 6.63 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
ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
15
download = curl -f -L -- "$(1)" > "$@.tmp" && touch $@.tmp && mv $@.tmp $@
16 17 18 19 20
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
else
download = $(error Neither curl nor wget found!)
endif

30
download_pkg = $(call download,$(VIDEOLAN)/$(2)/$(lastword $(subst /, ,$(@)))) || \
31 32
	( $(call download,$(1)) && echo "Please upload package $(lastword $(subst /, ,$(@))) to our FTP" )  \
	&& sha512sum --check --ignore-missing SHA512SUMS
33

34 35 36 37 38 39 40 41 42 43 44 45 46 47
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
48 49 50
# yasm

yasm-$(YASM_VERSION).tar.gz:
51
	$(call download_pkg,$(YASM_URL),yasm)
Rafaël Carré's avatar
Rafaël Carré committed
52 53 54 55 56 57

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

.yasm: yasm
58
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
Rafaël Carré's avatar
Rafaël Carré committed
59 60 61 62 63 64
	touch $@

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

65 66 67
# cmake

cmake-$(CMAKE_VERSION).tar.gz:
68
	$(call download_pkg,$(CMAKE_URL),cmake)
69 70 71 72 73 74

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

.cmake: cmake
75
	(cd $<; ./configure --prefix=$(PREFIX) $(CMAKEFLAGS) && $(MAKE) && $(MAKE) install)
76 77 78 79 80 81 82 83 84
	touch $@

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

# libtool

libtool-$(LIBTOOL_VERSION).tar.gz:
85
	$(call download_pkg,$(LIBTOOL_URL),libtool)
86 87 88

libtool: libtool-$(LIBTOOL_VERSION).tar.gz
	$(UNPACK)
89
	$(APPLY) libtool-2.4.2-bitcode.patch
90
	$(APPLY) libtool-2.4.2-san.patch
91 92
	$(MOVE)

93
.libtool: libtool .automake
94
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
95 96 97 98 99 100 101 102
	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

103 104 105
# GNU tar (with xz support)

tar-$(TAR_VERSION).tar.bz2:
106
	$(call download_pkg,$(TAR_URL),tar)
107 108 109 110 111

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

112
.tar: tar
113
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
114 115 116
	touch $@

CLEAN_PKG += tar
117
DISTCLEAN_PKG += tar-$(TAR_VERSION).tar.bz2
118 119
CLEAN_FILE += .tar

120 121 122
# xz

xz-$(XZ_VERSION).tar.bz2:
123
	$(call download_pkg,$(XZ_URL),xz)
124 125 126 127 128

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

129
.xz: xz
130
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install && rm $(PREFIX)/lib/pkgconfig/liblzma.pc)
131 132 133 134 135 136 137 138
	touch $@

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

# autoconf

139
autoconf-$(AUTOCONF_VERSION).tar.gz:
140
	$(call download_pkg,$(AUTOCONF_URL),autoconf)
141

142
autoconf: autoconf-$(AUTOCONF_VERSION).tar.gz
143 144 145
	$(UNPACK)
	$(MOVE)

146
.autoconf: autoconf .pkg-config
147
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
148 149 150 151
	touch $@

CLEAN_FILE += .autoconf
CLEAN_PKG += autoconf
152
DISTCLEAN_PKG += autoconf-$(AUTOCONF_VERSION).tar.gz
153 154 155 156

# automake

automake-$(AUTOMAKE_VERSION).tar.gz:
157
	$(call download_pkg,$(AUTOMAKE_URL),automake)
158 159 160 161 162 163

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

.automake: automake .autoconf
164
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
165 166 167 168 169 170
	touch $@

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

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
171 172 173
# m4

m4-$(M4_VERSION).tar.gz:
174
	$(call download_pkg,$(M4_URL),m4)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
175 176 177 178 179

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

180
.m4: m4
181
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
182 183 184 185 186 187
	touch $@

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

188 189 190
# pkg-config

pkg-config-$(PKGCFG_VERSION).tar.gz:
191
	$(call download_pkg,$(PKGCFG_URL),pkgconfiglite)
192

193
pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
194
	$(UNPACK)
195
	mv pkg-config-lite-$(PKGCFG_VERSION) pkg-config-$(PKGCFG_VERSION)
196 197 198
	$(MOVE)

.pkg-config: pkgconfig
199
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
200 201 202 203 204 205
	touch $@

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

206
# gas-preprocessor
207
gas-preprocessor-$(GAS_VERSION).tar.gz:
208
	$(call download_pkg,$(GAS_URL),gas-preprocessor)
209

210
gas: gas-preprocessor-$(GAS_VERSION).tar.gz
211 212 213 214
	$(UNPACK)
	$(MOVE)

.gas: gas
215
	mkdir -p $(PREFIX)/bin
216
	cp gas/gas-preprocessor.pl $(PREFIX)/bin/
217 218 219 220
	touch $@

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

Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
223 224
# Ragel State Machine Compiler
ragel-$(RAGEL_VERSION).tar.gz:
225
	$(call download_pkg,$(RAGEL_URL),ragel)
Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
226 227 228

ragel: ragel-$(RAGEL_VERSION).tar.gz
	$(UNPACK)
229
	$(APPLY) ragel-6.8-javacodegen.patch
Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
230 231
	$(MOVE)

232

Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
233
.ragel: ragel
234
	(cd ragel; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
235 236 237 238 239 240
	touch $@

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

Sean McGovern's avatar
Sean McGovern committed
241 242 243
# GNU sed

sed-$(SED_VERSION).tar.bz2:
244
	$(call download_pkg,$(SED_URL),sed)
Sean McGovern's avatar
Sean McGovern committed
245 246 247 248 249 250 251 252 253 254 255 256 257

sed: sed-$(SED_VERSION).tar.bz2
	$(UNPACK)
	$(MOVE)

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

CLEAN_PKG += sed
DISTCLEAN_PKG += sed-$(SED_VERSION).tar.bz2
CLEAN_FILE += .sed

258 259 260
# Apache ANT

apache-ant-$(ANT_VERSION).tar.bz2:
261
	$(call download_pkg,$(ANT_URL),ant)
262 263 264 265 266 267

ant: apache-ant-$(ANT_VERSION).tar.bz2
	$(UNPACK)
	$(MOVE)

.ant: ant
268 269
	(mkdir -p $(PREFIX)/bin && cp $</bin/* $(PREFIX)/bin/)
	(mkdir -p $(PREFIX)/lib && cp $</lib/* $(PREFIX)/lib/)
270 271 272 273 274 275
	touch $@

CLEAN_PKG += ant
DISTCLEAN_PKG += apache-ant-$(ANT_VERSION).tar.bz2
CLEAN_FILE += .ant

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
276 277 278

# Protobuf Protoc

279
protobuf-$(PROTOBUF_VERSION).tar.gz:
280
	$(call download_pkg,$(PROTOBUF_URL),protobuf)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
281

282
protobuf: protobuf-$(PROTOBUF_VERSION).tar.gz
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
283 284 285 286
	$(UNPACK)
	$(MOVE)

.protoc: protobuf
287
	(cd $< && ./configure --prefix="$(PREFIX)" --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
288
	(find $(PREFIX) -name 'protobuf*.pc' -exec rm -f {} \;)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
289 290 291
	touch $@

CLEAN_PKG += protobuf
292
DISTCLEAN_PKG += protobuf-$(PROTOBUF_VERSION).tar.gz
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
293 294
CLEAN_FILE += .protoc

295 296 297 298
#
#
#

299 300
fetch-all: $(DISTCLEAN_PKG)

301 302 303 304 305 306 307
clean:
	rm -fr $(CLEAN_FILE) $(CLEAN_PKG) build/

distclean: clean
	rm -fr $(DISTCLEAN_PKG)

.PHONY: all clean distclean
308 309

.DELETE_ON_ERROR: