tools.mak 5.21 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

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

.yasm: yasm
54
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
Rafaël Carré's avatar
Rafaël Carré committed
55 56 57 58 59 60
	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

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

.cmake: cmake
71
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
72 73 74 75 76 77 78 79 80
	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

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

.libtool: libtool
88
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
89 90 91 92 93 94 95 96
	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
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
108 109 110
	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
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
125 126 127 128 129 130 131 132
	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
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
142 143 144 145
	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

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

.automake: automake .autoconf
158
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
159 160 161 162 163 164
	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
# m4

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

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

174
.m4: m4
175
	(cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
176 177 178 179 180 181
	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
	$(MOVE)

.pkg-config: pkgconfig
193
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
194 195 196 197 198 199
	touch $@

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

200
# gas-preprocessor
201
gas-preprocessor-$(GAS_VERSION).tar.gz:
202 203
	$(call download,$(GAS_URL))

204
gas: gas-preprocessor-$(GAS_VERSION).tar.gz
205 206 207 208
	$(UNPACK)
	$(MOVE)

.gas: gas
209
	cp gas/gas-preprocessor.pl build/bin/
210 211 212 213 214 215
	touch $@

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

Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
216 217 218 219 220 221
# Ragel State Machine Compiler
ragel-$(RAGEL_VERSION).tar.gz:
	$(call download,$(RAGEL_URL))

ragel: ragel-$(RAGEL_VERSION).tar.gz
	$(UNPACK)
222
	$(APPLY) ragel-6.8-javacodegen.patch
Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
223 224
	$(MOVE)

225

Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
226
.ragel: ragel
227
	(cd ragel; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
Naohiro KORIYAMA's avatar
Naohiro KORIYAMA committed
228 229 230 231 232 233
	touch $@

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

Sean McGovern's avatar
Sean McGovern committed
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
# GNU sed

sed-$(SED_VERSION).tar.bz2:
	$(call download,$(SED_URL))

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

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

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

distclean: clean
	rm -fr $(DISTCLEAN_PKG)

.PHONY: all clean distclean