Makefile.fetch 9.87 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
# -*- 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
14
&& bash -c '$(WGET) --progress=dot:mega -Q 0 -P "." -l 0 -nd -nH -N --no-use-server-timestamps $1/$2 2>&1 | tee -a $(fetch_LOGFILE) && [ $$PIPESTATUS -eq 0 ]'
15 16 17 18
endef

else
define fetch_Download__wget_command
Andras Timar's avatar
Andras Timar committed
19
&& echo fetching $2 && bash -c '$(CURL) -L -O $1/$2 2>&1 | tee -a $(fetch_LOGFILE) && [ $$PIPESTATUS -eq 0 ]'
20 21 22 23
endef

endif

24
ifneq (,$(SHA256SUM))
25
define fetch_Download__checksum_command
26
&& SUM=`$(SHA256SUM) $1 | sed "s/ .*//"` \
27 28 29 30 31 32 33 34 35 36 37
&& 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

38
# fetch__Download_item url tarball-name sha256sum
39
define fetch__Download_item
40 41 42
$(if $(wildcard $(TARFILE_LOCATION)/$2),, \
cd $(TARFILE_LOCATION)/tmp \
$(call fetch_Download__wget_command,$1,$2) \
43
$(if $3,$(call fetch_Download__checksum_command,$2,$3)) \
44 45 46 47 48
&& mv $2 ../ \
)

endef

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

54
define fetch_Download__subst_var
55
$(subst _TTF,_SHA256SUM,$(subst _DLL,_SHA256SUM,$(subst _TARBALL,_SHA256SUM,$(subst _PACK,_SHA256SUM,$(subst _JAR,_SHA256SUM,$(1))))))
56 57
endef

58
# fetch_Download_item url variable-name
59
define fetch_Download_item
60
$(if $(strip $($(2))),,$(error fetch__Download_item: $(2) is empty))
61
$(if $(filter undefined,$(origin $(call fetch_Download__subst_var,$(2)))),\
62
	$(error "fetch_Download_item: no checksum found for $($(2)). Please define $(call fetch_Download__subst_var,$(2)) in download.lst."),\
63
	$(call fetch__Download_item,$(1),$($2),$($(call fetch_Download__subst_var,$(2)))) \
64
)
65 66 67

endef

68 69 70
# fetch_Download_item url tarball-name
define fetch_Download_item_unchecked
$(call fetch__Download_item,$1,$2)
71 72 73

endef

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

79 80 81 82 83
# 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
84
define fetch_Optional
85
$(if $(filter ALL,$(DO_FETCH_TARBALLS))$(filter $1,$(fetch_BUILD_TYPE)),$2)
86 87
endef

88 89 90 91 92 93 94 95 96
# 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

97
download: $(WORKDIR)/download
98

99
$(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(SRCDIR)/Makefile.fetch
Tor Lillqvist's avatar
Tor Lillqvist committed
100
	-@mkdir -p $(TARFILE_LOCATION)/tmp
101
	@date >> $(fetch_LOGFILE)
102
	$(foreach item, \
Fridrich Štrba's avatar
Fridrich Štrba committed
103
		$(call fetch_Optional,ABW,ABW_TARBALL) \
104
		$(call fetch_Optional,APACHE_COMMONS,APACHE_COMMONS_LOGGING_TARBALL) \
David Tardon's avatar
David Tardon committed
105 106
		$(call fetch_Optional,APR,APR_TARBALL) \
		$(call fetch_Optional,APR,APR_UTIL_TARBALL) \
107
		$(call fetch_Optional,BOOST,BOOST_TARBALL) \
108
		$(call fetch_Optional,BREAKPAD,BREAKPAD_TARBALL) \
109
		$(call fetch_Optional,BSH,BSH_TARBALL) \
110
		$(call fetch_Optional,BZIP2,BZIP2_TARBALL) \
111
		$(call fetch_Optional,CAIRO,CAIRO_TARBALL) \
David Tardon's avatar
David Tardon committed
112 113
		$(call fetch_Optional,CAIRO,PIXMAN_TARBALL) \
		$(call fetch_Optional,CDR,CDR_TARBALL) \
114
		$(call fetch_Optional,CLUCENE,CLUCENE_TARBALL) \
115
		$(call fetch_Optional,LIBCMIS,LIBCMIS_TARBALL) \
David Tardon's avatar
David Tardon committed
116
		$(call fetch_Optional,COINMP,COINMP_TARBALL) \
117 118 119
		$(call fetch_Optional,CPPUNIT,CPPUNIT_TARBALL) \
		$(call fetch_Optional,CT2N,CT2N_TARBALL) \
		$(call fetch_Optional,CURL,CURL_TARBALL) \
David Tardon's avatar
David Tardon committed
120
		$(call fetch_Optional,EBOOK,EBOOK_TARBALL) \
121
		$(call fetch_Optional,EPM,EPM_TARBALL) \
122
		$(call fetch_Optional,EPUBGEN,EPUBGEN_TARBALL) \
David Tardon's avatar
David Tardon committed
123
		$(call fetch_Optional,ETONYEK,ETONYEK_TARBALL) \
124
		$(call fetch_Optional,EXPAT,EXPAT_TARBALL) \
David Tardon's avatar
David Tardon committed
125
		$(call fetch_Optional,FIREBIRD,FIREBIRD_TARBALL) \
126
		$(call fetch_Optional,FONTCONFIG,FONTCONFIG_TARBALL) \
David Tardon's avatar
David Tardon committed
127
		$(call fetch_Optional,FREEHAND,FREEHAND_TARBALL) \
128
		$(call fetch_Optional,FREETYPE,FREETYPE_TARBALL) \
129
		$(call fetch_Optional,EPOXY,EPOXY_TARBALL) \
130
		$(call fetch_Optional,GLM,GLM_TARBALL) \
131
		$(call fetch_Optional,GPGMEPP,GPGME_TARBALL) \
David Tardon's avatar
David Tardon committed
132 133
		$(call fetch_Optional,GRAPHITE,GRAPHITE_TARBALL) \
		$(call fetch_Optional,HARFBUZZ,HARFBUZZ_TARBALL) \
134
		$(call fetch_Optional,HSQLDB,HSQLDB_TARBALL) \
135 136
		$(call fetch_Optional,HUNSPELL,HUNSPELL_TARBALL) \
		$(call fetch_Optional,HYPHEN,HYPHEN_TARBALL) \
David Tardon's avatar
David Tardon committed
137
		$(call fetch_Optional,ICU,ICU_TARBALL) \
Eike Rathke's avatar
Eike Rathke committed
138
		$(call fetch_Optional,ICU,ICU_DATA_TARBALL) \
139 140 141 142 143 144 145 146 147 148 149
		$(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) \
150
		$(call fetch_Optional,LIBJPEG_TURBO,LIBJPEG_TURBO_TARBALL) \
151 152
		$(call fetch_Optional,LANGUAGETOOL,LANGUAGETOOL_TARBALL) \
		$(call fetch_Optional,LCMS2,LCMS2_TARBALL) \
David Tardon's avatar
David Tardon committed
153
		$(call fetch_Optional,LIBATOMIC_OPS,LIBATOMIC_OPS_TARBALL) \
154
		$(call fetch_Optional,LIBASSUAN,LIBASSUAN_TARBALL) \
David Tardon's avatar
David Tardon committed
155
		$(call fetch_Optional,LIBEOT,LIBEOT_TARBALL) \
156
		$(call fetch_Optional,LIBEXTTEXTCAT,LIBEXTTEXTCAT_TARBALL) \
157
		$(call fetch_Optional,LIBGPGERROR,LIBGPGERROR_TARBALL) \
David Tardon's avatar
David Tardon committed
158
		$(call fetch_Optional,LIBLANGTAG,LANGTAGREG_TARBALL) \
159
		$(call fetch_Optional,LIBLANGTAG,LIBLANGTAG_TARBALL) \
160
		$(call fetch_Optional,LIBNUMBERTEXT,LIBNUMBERTEXT_TARBALL) \
161
		$(call fetch_Optional,LIBPNG,LIBPNG_TARBALL) \
Wastack's avatar
Wastack committed
162
		$(call fetch_Optional,LIBTOMMATH,LIBTOMMATH_TARBALL) \
163
		$(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \
164
		$(call fetch_Optional,XMLSEC,XMLSEC_TARBALL) \
165 166
		$(call fetch_Optional,LIBXSLT,LIBXSLT_TARBALL) \
		$(call fetch_Optional,LPSOLVE,LPSOLVE_TARBALL) \
167
		$(call fetch_Optional,LXML,LXML_TARBALL) \
168
		$(call fetch_Optional,MARIADB_CONNECTOR_C,MARIADB_CONNECTOR_C_TARBALL) \
169
		$(call fetch_Optional,MDDS,MDDS_TARBALL) \
170
		$(call fetch_Optional,MDNSRESPONDER,MDNSRESPONDER_TARBALL) \
David Tardon's avatar
David Tardon committed
171 172 173 174 175 176 177 178 179
		$(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_SOURCECODE_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_SOURCESANS_TARBALL) \
180
		$(call fetch_Optional,MORE_FONTS,FONT_SOURCESERIF_TARBALL) \
181
		$(call fetch_Optional,MORE_FONTS,FONT_EMOJIONE_COLOR_TARBALL) \
182
		$(call fetch_Optional,MORE_FONTS,FONT_NOTO_TARBALL) \
183 184 185
		$(call fetch_Optional,MORE_FONTS,FONT_CULMUS_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_LIBRE_HEBREW_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_ALEF_TARBALL) \
186 187 188 189
		$(call fetch_Optional,MORE_FONTS,FONT_AMIRI_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_KACST_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_REEM_TARBALL) \
		$(call fetch_Optional,MORE_FONTS,FONT_SCHEHERAZADE_TARBALL) \
David Tardon's avatar
David Tardon committed
190 191
		$(call fetch_Optional,MSPUB,MSPUB_TARBALL) \
		$(call fetch_Optional,MWAW,MWAW_TARBALL) \
192 193 194 195
		$(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) \
David Tardon's avatar
David Tardon committed
196
		$(call fetch_Optional,ODFGEN,ODFGEN_TARBALL) \
197 198 199
		$(call fetch_Optional,OPENLDAP,OPENLDAP_TARBALL) \
		$(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \
		$(call fetch_Optional,ORCUS,ORCUS_TARBALL) \
200
		$(call fetch_Optional,OWNCLOUD_ANDROID_LIB,OWNCLOUD_ANDROID_LIB_TARBALL) \
201
		$(call fetch_Optional,PAGEMAKER,PAGEMAKER_TARBALL) \
Caolán McNamara's avatar
Caolán McNamara committed
202
		$(call fetch_Optional,PDFIUM,PDFIUM_TARBALL) \
203 204 205
		$(call fetch_Optional,POPPLER,POPPLER_TARBALL) \
		$(call fetch_Optional,POSTGRESQL,POSTGRESQL_TARBALL) \
		$(call fetch_Optional,PYTHON,PYTHON_TARBALL) \
Aleksas Pantechovskis's avatar
Aleksas Pantechovskis committed
206
		$(call fetch_Optional,QXP,QXP_TARBALL) \
207 208 209
		$(call fetch_Optional,REDLAND,RAPTOR_TARBALL) \
		$(call fetch_Optional,REDLAND,RASQAL_TARBALL) \
		$(call fetch_Optional,REDLAND,REDLAND_TARBALL) \
David Tardon's avatar
David Tardon committed
210
		$(call fetch_Optional,REVENGE,REVENGE_TARBALL) \
211 212
		$(call fetch_Optional,RHINO,RHINO_TARBALL) \
		$(call fetch_Optional,RHINO,SWING_TARBALL) \
David Tardon's avatar
David Tardon committed
213
		$(call fetch_Optional,SERF,SERF_TARBALL) \
osnola's avatar
osnola committed
214
		$(call fetch_Optional,STAROFFICE,STAROFFICE_TARBALL) \
215
		$(if $(filter WNT,$(OS)),TWAIN_DSM_TARBALL) \
216
		$(call fetch_Optional,UCPP,UCPP_TARBALL) \
David Tardon's avatar
David Tardon committed
217
		$(call fetch_Optional,VISIO,VISIO_TARBALL) \
218 219 220 221 222
		$(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) \
Aleksas Pantechovskis's avatar
Aleksas Pantechovskis committed
223
		$(call fetch_Optional,ZMF,ZMF_TARBALL) \
224
	,$(call fetch_Download_item,https://dev-www.libreoffice.org/src,$(item)))
225
	$(foreach item, \
226
		$(call fetch_Optional,ODK,UNOWINREG_DLL) \
227
		$(call fetch_Optional,OPENSYMBOL,OPENSYMBOL_TTF) \
228
		$(call fetch_Optional,ODFVALIDATOR,ODFVALIDATOR_JAR) \
229
		$(call fetch_Optional,OFFICEOTRON,OFFICEOTRON_JAR) \
230
	,$(call fetch_Download_item,https://dev-www.libreoffice.org/extern,$(item)))
231
	@mkdir -p $(dir $@) && touch $@
232
	@mkdir -p $(dir $@)/Executable
233 234

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