summaryrefslogtreecommitdiff
path: root/Makefile.fetch
blob: 87c8b8a21d39f69e728cf15a7657f8366a5f82e3 (plain)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

fetch_LOGFILE := $(TARFILE_LOCATION)/fetch.log

ifneq (,$(WGET))
define fetch_Download__wget_command
&& $(WGET) --progress=dot:mega -Q 0 -P "." -l 0 -nd -nH -N $1/$2 2>&1 | tee -a $(fetch_LOGFILE) && [ $$PIPESTATUS -eq 0 ]
endef

else
define fetch_Download__wget_command
&& echo fetching $2 && $(CURL) -O $1/$2 2>&1 | tee -a $(fetch_LOGFILE) && [ $$PIPESTATUS -eq 0 ]
endef

endif

ifneq (,$(MD5SUM))
define fetch_Download__checksum_command
&& SUM=`$(MD5SUM) $1 | sed "s/ .*//"` \
&& if test "$$SUM" != "$2"; then \
	echo ERROR: expected checksum for $1 is $2 2>&1 | tee -a $(fetch_LOGFILE); \
	false; \
fi
endef

else
fetch_Download__checksum_command :=

endif

# fetch__Download_item url tarball-name md5sum
define fetch__Download_item
$(if $(wildcard $(TARFILE_LOCATION)/$2),, \
cd $(TARFILE_LOCATION)/tmp \
$(call fetch_Download__wget_command,$1,$2) \
$(if $3,$(call fetch_Download__checksum_command,$2,$3)) \
&& mv $2 ../ \
)

endef

# fetch_Download__is_checksum checksum
define fetch_Download__is_checksum
$(filter 32,$(words $(shell echo $(1) | sed -e 's/./& /g')))
endef

define fetch_Download__subst_var
$(subst _DLL,_MD5SUM,$(subst _TARBALL,_MD5SUM,$(subst _PACK,_MD5SUM,$(1))))
endef

# fetch_Download_item url variable-name
define fetch_Download_item
$(if $(strip $($(2))),,$(error fetch__Download_item: $(2) is empty))
$(if $(filter undefined,$(origin $(call fetch_Download__subst_var,$(2)))),\
	$(if $(call fetch_Download__is_checksum,$(firstword $(subst -, ,$($(2))))),\
		$(call fetch__Download_item,$1,$($2),$(firstword $(subst -, ,$($(2))))),\
		$(error "fetch_Download_item: no checksum found for $($(2)). Please define $(call fetch_Download__subst_var,$(2)) in download.lst.") \
	),\
	$(call fetch__Download_item,$(1),$($2),$($(call fetch_Download__subst_var,$(2)))) \
)

endef

# fetch_Download_item url tarball-name
define fetch_Download_item_unchecked
$(call fetch__Download_item,$1,$2)

endef

fetch_BUILD_TYPE := $(sort $(BUILD_TYPE))
ifneq ($(CROSS_COMPILING),)
fetch_BUILD_TYPE := $(sort $(fetch_BUILD_TYPE) $(shell . $(SRCDIR)/bin/get_config_variables --build BUILD_TYPE && echo $$BUILD_TYPE))
endif

# Return variable-name if this tarball should be fetched.
#
# This function is used for tarballs predefined in download.lst.
#
# fetch_Optional build-type variable-name
define fetch_Optional
$(if $(filter ALL,$(DO_FETCH_TARBALLS))$(filter $1,$(fetch_BUILD_TYPE)),$2)
endef

# Return variable-name if this pack should be fetched.
#
# This function is used for packs defined by configure.
#
# fetch_Optional_pack variable-name
define fetch_Optional_pack
$(if $(strip $($(1))),$(1))
endef

download: $(WORKDIR)/download

$(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)/Makefile.fetch
	-@mkdir -p $(TARFILE_LOCATION)/tmp
	@date >> $(fetch_LOGFILE)
	$(foreach item, \
		$(call fetch_Optional,ABW,ABW_TARBALL) \
		$(call fetch_Optional,APACHE_COMMONS,APACHE_COMMONS_CODEC_TARBALL) \
		$(call fetch_Optional,APACHE_COMMONS,APACHE_COMMONS_HTTPCLIENT_TARBALL) \
		$(call fetch_Optional,APACHE_COMMONS,APACHE_COMMONS_LANG_TARBALL) \
		$(call fetch_Optional,APACHE_COMMONS,APACHE_COMMONS_LOGGING_TARBALL) \
		$(call fetch_Optional,APR,APR_TARBALL) \
		$(call fetch_Optional,APR,APR_UTIL_TARBALL) \
		$(call fetch_Optional,BOOST,BOOST_TARBALL) \
		$(call fetch_Optional,BSH,BSH_TARBALL) \
		$(call fetch_Optional,BZIP2,BZIP2_TARBALL) \
		$(call fetch_Optional,CAIRO,CAIRO_TARBALL) \
		$(call fetch_Optional,CAIRO,PIXMAN_TARBALL) \
		$(call fetch_Optional,CDR,CDR_TARBALL) \
		$(call fetch_Optional,CLUCENE,CLUCENE_TARBALL) \
		$(call fetch_Optional,CMIS,CMIS_TARBALL) \
		$(call fetch_Optional,COINMP,COINMP_TARBALL) \
		$(call fetch_Optional,COLLADA2GLTF,COLLADA2GLTF_TARBALL) \
		$(call fetch_Optional,CPPUNIT,CPPUNIT_TARBALL) \
		$(call fetch_Optional,CT2N,CT2N_TARBALL) \
		$(call fetch_Optional,CURL,CURL_TARBALL) \
		$(call fetch_Optional,EBOOK,EBOOK_TARBALL) \
		$(call fetch_Optional,EPM,EPM_TARBALL) \
		$(call fetch_Optional,ETONYEK,ETONYEK_TARBALL) \
		$(call fetch_Optional,EXPAT,EXPAT_TARBALL) \
		$(call fetch_Optional,FIREBIRD,FIREBIRD_TARBALL) \
		$(call fetch_Optional,FONTCONFIG,FONTCONFIG_TARBALL) \
		$(call fetch_Optional,FREEHAND,FREEHAND_TARBALL) \
		$(call fetch_Optional,FREETYPE,FREETYPE_TARBALL) \
		$(call fetch_Optional,GLEW,GLEW_TARBALL) \
		$(call fetch_Optional,GLM,GLM_TARBALL) \
		$(call fetch_Optional_pack,GOOGLE_DOCS_EXTENSION_PACK) \
		$(call fetch_Optional,GRAPHITE,GRAPHITE_TARBALL) \
		$(call fetch_Optional,HARFBUZZ,HARFBUZZ_TARBALL) \
		$(call fetch_Optional,HSQLDB,HSQLDB_TARBALL) \
		$(call fetch_Optional,HUNSPELL,HUNSPELL_TARBALL) \
		$(call fetch_Optional,HYPHEN,HYPHEN_TARBALL) \
		$(call fetch_Optional,ICU,ICU_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_FLOW_ENGINE_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_FLUTE_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBBASE_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBFONTS_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBFORMULA_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBLAYOUT_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBLOADER_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBREPOSITORY_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBSERIALIZER_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBXML_TARBALL) \
		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_SAC_TARBALL) \
		$(call fetch_Optional,JPEG,JPEG_TARBALL) \
		$(call fetch_Optional,JPEG_TURBO,JPEG_TURBO_TARBALL) \
		$(call fetch_Optional,LANGUAGETOOL,LANGUAGETOOL_TARBALL) \
		$(call fetch_Optional,LCMS2,LCMS2_TARBALL) \
		$(call fetch_Optional,LIBATOMIC_OPS,LIBATOMIC_OPS_TARBALL) \
		$(call fetch_Optional,LIBEOT,LIBEOT_TARBALL) \
		$(call fetch_Optional,LIBEXTTEXTCAT,LIBEXTTEXTCAT_TARBALL) \
		$(call fetch_Optional,LIBLANGTAG,LANGTAGREG_TARBALL) \
		$(call fetch_Optional,LIBLANGTAG,LIBLANGTAG_TARBALL) \
		$(call fetch_Optional,LIBPNG,PNG_TARBALL) \
		$(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \
		LIBXMLSEC_TARBALL \
		$(call fetch_Optional,LIBXSLT,LIBXSLT_TARBALL) \
		$(call fetch_Optional,LPSOLVE,LPSOLVE_TARBALL) \
		$(call fetch_Optional,MARIADB,MARIADB_TARBALL) \
		$(call fetch_Optional,MDDS,MDDS_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_CALADEA_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_CARLITO_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_DEJAVU_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_GENTIUM_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_LIBERATION_NARROW_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_LIBERATION_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_LINLIBERTINEG_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_OPENSANS_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_PTSERIF_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_SOURCECODE_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_SOURCESANS_TARBALL) \
		$(call fetch_Optional,MSPUB,MSPUB_TARBALL) \
		$(call fetch_Optional,MWAW,MWAW_TARBALL) \
		$(call fetch_Optional,MYSQLCPPCONN,MYSQLCPPCONN_TARBALL) \
		$(call fetch_Optional,MYTHES,MYTHES_TARBALL) \
		$(call fetch_Optional,NEON,NEON_TARBALL) \
		$(call fetch_Optional,NSS,NSS_TARBALL) \
		$(call fetch_Optional_pack,NUMBERTEXT_EXTENSION_PACK) \
		$(call fetch_Optional,ODFGEN,ODFGEN_TARBALL) \
		$(call fetch_Optional,OPENCOLLADA,OPENCOLLADA_TARBALL) \
		$(call fetch_Optional,OPENLDAP,OPENLDAP_TARBALL) \
		$(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \
		$(call fetch_Optional,ORCUS,ORCUS_TARBALL) \
		$(call fetch_Optional,OWNCLOUD_ANDROID_LIB,OWNCLOUD_ANDROID_LIB_TARBALL) \
		$(call fetch_Optional,PAGEMAKER,PAGEMAKER_TARBALL) \
		$(call fetch_Optional,POPPLER,POPPLER_TARBALL) \
		$(call fetch_Optional,POSTGRESQL,POSTGRESQL_TARBALL) \
		$(call fetch_Optional,PYTHON,PYTHON_TARBALL) \
		$(call fetch_Optional,REDLAND,RAPTOR_TARBALL) \
		$(call fetch_Optional,REDLAND,RASQAL_TARBALL) \
		$(call fetch_Optional,REDLAND,REDLAND_TARBALL) \
		$(call fetch_Optional,REVENGE,REVENGE_TARBALL) \
		$(call fetch_Optional,RHINO,RHINO_TARBALL) \
		$(call fetch_Optional,RHINO,SWING_TARBALL) \
		$(call fetch_Optional,SERF,SERF_TARBALL) \
		$(call fetch_Optional,UCPP,UCPP_TARBALL) \
		$(call fetch_Optional,VIGRA,VIGRA_TARBALL) \
		$(call fetch_Optional,VISIO,VISIO_TARBALL) \
		$(call fetch_Optional,WPD,WPD_TARBALL) \
		$(call fetch_Optional,WPG,WPG_TARBALL) \
		$(call fetch_Optional,WPS,WPS_TARBALL) \
		$(call fetch_Optional,XSLTML,XSLTML_TARBALL) \
		$(call fetch_Optional,ZLIB,ZLIB_TARBALL) \
	,$(call fetch_Download_item,http://dev-www.libreoffice.org/src,$(item)))
	$(foreach item, \
		$(call fetch_Optional,DBGHELP,DBGHELP_DLL) \
		$(call fetch_Optional,ODK,UNOWINREG_DLL) \
	,$(call fetch_Download_item,http://dev-www.libreoffice.org/extern,$(item)))
	$(foreach item, \
		$(call fetch_Optional_pack,BARCODE_EXTENSION_PACK) \
		$(call fetch_Optional_pack,DIAGRAM_EXTENSION_PACK) \
		$(call fetch_Optional_pack,HUNART_EXTENSION_PACK) \
		$(call fetch_Optional_pack,OOOP_FONTS_PACK) \
		$(call fetch_Optional_pack,OOOP_GALLERY_PACK) \
		$(call fetch_Optional_pack,OOOP_SAMPLES_PACK) \
		$(call fetch_Optional_pack,OOOP_TEMPLATES_PACK) \
		$(call fetch_Optional_pack,SUNTEMPLATES_DE_PACK) \
		$(call fetch_Optional_pack,SUNTEMPLATES_EN_US_PACK) \
		$(call fetch_Optional_pack,SUNTEMPLATES_ES_PACK) \
		$(call fetch_Optional_pack,SUNTEMPLATES_FR_PACK) \
		$(call fetch_Optional_pack,SUNTEMPLATES_HU_PACK) \
		$(call fetch_Optional_pack,SUNTEMPLATES_IT_PACK) \
		$(call fetch_Optional_pack,TYPO_EXTENSION_PACK) \
		$(call fetch_Optional_pack,VALIDATOR_EXTENSION_PACK) \
		$(call fetch_Optional_pack,WATCH_WINDOW_EXTENSION_PACK) \
	,$(call fetch_Download_item,http://ooo.itc.hu/oxygenoffice/download/libreoffice,$(item)))
	$(foreach item, \
		$(call fetch_Optional,MOZ,$(MOZ_ZIP_INC)) \
		$(call fetch_Optional,MOZ,$(MOZ_ZIP_LIB)) \
		$(call fetch_Optional,MOZ,$(MOZ_ZIP_RUNTIME)) \
	,$(call fetch_Download_item_unchecked,http://dev-www.libreoffice.org/mozilla,$(item)))
	$(if $(call fetch_Optional,LIBGLTF,LIBGLTF_TARBALL) \
	, $(call fetch_Download_item,http://dev-www.libreoffice.org/src/libgltf,$(call fetch_Optional,LIBGLTF,LIBGLTF_TARBALL)))
	@mkdir -p $(dir $@) && touch $@

# vim: set noet sw=4 ts=4: