1# sites.mk - Popular master sites.
2#
3# Sites_MAINTAINER=		ports@MidnightBSD.org
4#
5# This file does not have any designated maintainer, so feel free to
6# commit to it yourself.  However, it is generally a good idea to
7# notify the principal maintainer in case you have a change to one of
8# the software environments (KDE, GNOME, etc.).
9#
10# Also, this file is included from bsd.port.mk for all invocations, so
11# committing a syntax error to this file is a cardinal sin, and will
12# be punished accordingly.  DO NOT COMMIT SOMETHING YOU HAVEN'T TESTED.
13# You have been warned. :)
14#
15# Note: because it is included for all invocations, please keep the size
16# of this file manageable.  If a distfile is unfetchable from the first
17# few dozen locations, it is unlikely to be fetchable from any past that,
18# and those fetch failures will simply waste time and bandwidth.  Please
19# pick a globally representative subset.
20#
21# Note: all entries should terminate with a slash.
22
23# Where to put distfiles that don't have any other master site
24.if !defined(IGNORE_MASTER_SITE_LOCAL)
25MASTER_SITE_LOCAL+= \
26	https://discovery.midnightbsd.org/ftp/mports/distfiles/%SUBDIR%/  \
27	https://ftp1.midnightbsd.org/mports/distfiles/%SUBDIR%/ \
28	ftp://ftp3.MidnightBSD.org/pub/MidnightBSD/mports/distfiles/%SUBDIR%/ \
29	ftp://ftp1.MidnightBSD.org/pub/MidnightBSD/mports/distfiles/%SUBDIR%/
30
31MASTER_SITE_PORTS_JP+= \
32	ftp://ports.jp.FreeBSD.org/pub/FreeBSD-jp/ports-jp/LOCAL_PORTS/%SUBDIR%/ \
33	ftp://ftp4.jp.FreeBSD.org/pub/FreeBSD-jp/ports-jp/LOCAL_PORTS/%SUBDIR%/ \
34	ftp://ftp.ics.es.osaka-u.ac.jp/pub/mirrors/FreeBSD-jp/ports-jp/LOCAL_PORTS/%SUBDIR%/
35.endif
36
37##
38##	KEEP THIS LIST SORTED
39##
40
41.if !defined(IGNORE_MASTER_SITE_AFTERSTEP)
42MASTER_SITE_AFTERSTEP+= \
43	ftp://ftp.afterstep.org/%SUBDIR%/
44.endif
45
46.if !defined(IGNORE_MASTER_SITE_ALSA)
47MASTER_SITE_ALSA+= \
48	http://alsa.cybermirror.org/%SUBDIR%/ \
49	ftp://ftp.alsa-project.org/pub/%SUBDIR%/
50.endif
51
52.if !defined(IGNORE_MASTER_SITE_APACHE)
53MASTER_SITE_APACHE+= \
54	https://dlcdn.apache.org/%SUBDIR%/ \
55	https://ftp.wayne.edu/apache/%SUBDIR%/ \
56	https://mirror.its.dal.ca/apache/%SUBDIR%/ \
57	http://mirror.cogentco.com/pub/apache/%SUBDIR%/ \
58	http://mirror.navercorp.com/apache/%SUBDIR%/ \
59	http://miroir.univ-lorraine.fr/apache/%SUBDIR%/
60.endif
61
62.if !defined(IGNORE_MASTER_SITE_APACHE_COMMONS_BINARIES)
63MASTER_SITE_APACHE_COMMONS_BINARIES+= \
64	${MASTER_SITE_APACHE:S,%SUBDIR%,commons/&/binaries,}
65.endif
66
67.if !defined(IGNORE_MASTER_SITE_APACHE_COMMONS_SOURCE)
68MASTER_SITE_APACHE_COMMONS_SOURCE+= \
69	${MASTER_SITE_APACHE:S,%SUBDIR%,commons/&/source,}
70.endif
71
72.if !defined(IGNORE_MASTER_SITE_APACHE_HTTPD)
73MASTER_SITE_APACHE_HTTPD+= \
74	${MASTER_SITE_APACHE:S,%SUBDIR%,httpd/&,}
75.endif
76
77.if !defined(IGNORE_MASTER_SITE_APACHE_JAKARTA)
78MASTER_SITE_APACHE_JAKARTA+= \
79	${MASTER_SITE_APACHE:S,%SUBDIR%,jakarta/&,}
80.endif
81
82.if !defined(IGNORE_MASTER_SITE_APACHE_TOMCAT)
83MASTER_SITE_APACHE_TOMCAT+= \
84	${MASTER_SITE_APACHE:S,%SUBDIR%,tomcat/&,}
85.endif
86
87.if !defined(IGNORE_MASTER_SITE_APACHE_XML)
88MASTER_SITE_APACHE_XML+= \
89	${MASTER_SITE_APACHE:S,%SUBDIR%,xml/&,}
90.endif
91
92.if !defined(IGNORE_MASTER_SITE_BERLIOS)
93MASTER_SITE_BERLIOS+= \
94	${MASTER_SITE_SOURCEFORGE}
95.endif
96
97.if !defined(IGNORE_MASTER_SITE_COMP_SOURCES)
98MASTER_SITE_COMP_SOURCES+= \
99	http://ftp.isc.org/pub/usenet/comp.sources.%SUBDIR%/ \
100	http://ftp.funet.fi/pub/archive/comp.sources.%SUBDIR%/ \
101	http://ftp.fi.netbsd.org/pub/misc/archive/comp.sources.%SUBDIR%/
102.endif
103
104.if !defined(IGNORE_MASTER_SITE_CRAN)
105MASTER_SITE_CRAN+= \
106	https://cloud.r-project.org/%SUBDIR%/ \
107	https://stat.ethz.ch/CRAN/%SUBDIR%/ \
108	http://cran.utstat.utoronto.ca/%SUBDIR%/ \
109	https://cran.csiro.au/%SUBDIR%/ \
110	https://mirrors.tuna.tsinghua.edu.cn/CRAN/%SUBDIR%/ \
111	https://mirror.las.iastate.edu/CRAN/%SUBDIR%/ \
112	https://cran.ma.imperial.ac.uk/%SUBDIR%/
113.endif
114
115.if !defined(IGNORE_MASTER_SITE_CRAN_ARCHIVE)
116MASTER_SITE_CRAN_ARCHIVE+= ${MASTER_SITE_CRAN:S,$,Archive/${PORTNAME}/,}
117.endif
118
119.if !defined(IGNORE_MASTER_SITE_CRATESIO)
120MASTER_SITE_CRATESIO+=	https://crates.io/api/v1/crates/%SUBDIR%/download?dummy=/
121.endif
122
123.if !defined(IGNORE_MASTER_SITE_DEBIAN)
124MASTER_SITE_DEBIAN+=	http://deb.debian.org/debian/%SUBDIR%/
125.  for country in am au at by be br bg ca cl cn hr cz dk fi fr de hk hu is it \
126		  jp kr lt md nl nc nz no pl pt ru sk si es se ch tw uk us
127MASTER_SITE_DEBIAN+=	http://ftp.${country}.debian.org/debian/%SUBDIR%/
128.  endfor
129.endif
130
131.if !defined(IGNORE_MASTER_SITE_DEBIAN_POOL)
132MASTER_SITE_DEBIAN_POOL+= \
133	${MASTER_SITE_DEBIAN:C|(/%SUBDIR%/)|/pool/main/${PORTNAME:C/^(.).*$/\1/}/${PORTNAME}/|}
134.endif
135
136.if !defined(IGNORE_MASTER_SITE_ECLIPSE)
137MASTER_SITE_ECLIPSE+= \
138	https://ftp-stud.hs-esslingen.de/pub/Mirrors/eclipse/%SUBDIR%/ \
139	https://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/%SUBDIR%/
140.endif
141
142# List: https://www.exim.org/mirmon/ftp_mirrors.html
143.if !defined(IGNORE_MASTER_SITE_EXIM)
144MASTER_SITE_EXIM+= \
145	https://exim.mirror.globo.tech/exim/%SUBDIR%/ \
146	https://mirror.easyname.at/exim-ftp/exim/%SUBDIR%/ \
147	https://www.mirrorservice.org/sites/ftp.exim.org/pub/exim/%SUBDIR%/ \
148	https://exim.mirror.iphh.net/ftp/exim/%SUBDIR%/ \
149	http://ftp.carnet.hr/misc/exim/exim/%SUBDIR%/ \
150	http://ftp.kaist.ac.kr/exim/exim/%SUBDIR%/ \
151	http://sunsite.icm.edu.pl/pub/unix/mail/exim/exim/%SUBDIR%/ \
152	https://ftp.exim.org/pub/exim/%SUBDIR%/
153.endif
154
155.if !defined(IGNORE_MASTER_SITE_CENTOS_LINUX)
156MASTER_SITE_CENTOS_LINUX+= \
157	http://vault.centos.org/%SUBDIR%/:DEFAULT,aarch64,amd64,i386,SOURCE
158.endif
159
160.if !defined(IGNORE_MASTER_SITE_EPEL)
161MASTER_SITE_EPEL+= \
162	https://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/%SUBDIR%/:DEFAULT,amd64 \
163	https://dl.fedoraproject.org/pub/epel/6/i386/Packages/%SUBDIR%/:DEFAULT,i386 \
164	https://dl.fedoraproject.org/pub/epel/6/SRPMS/Packages/%SUBDIR%/:SOURCE \
165	http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/%SUBDIR%/:DEFAULT,amd64 \
166	http://dl.fedoraproject.org/pub/epel/6/i386/Packages/%SUBDIR%/:DEFAULT,i386 \
167	http://dl.fedoraproject.org/pub/epel/6/SRPMS/Packages/%SUBDIR%/:SOURCE
168.endif
169
170.if !defined(IGNORE_MASTER_SITE_EPEL7)
171MASTER_SITE_EPEL7+= \
172	https://archives.fedoraproject.org/pub/archive/epel/7/aarch64/Packages/%SUBDIR%/:DEFAULT,aarch64 \
173	https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/%SUBDIR%/:DEFAULT,amd64 \
174	https://archives.fedoraproject.org/pub/archive/epel/7/SRPMS/Packages/%SUBDIR%/:SOURCE \
175	http://archives.fedoraproject.org/pub/archive/epel/7/aarch64/Packages/%SUBDIR%/:DEFAULT,aarch64 \
176	http://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/%SUBDIR%/:DEFAULT,amd64 \
177	http://archives.fedoraproject.org/pub/archive/epel/7/SRPMS/Packages/%SUBDIR%/:SOURCE
178.endif
179
180.if !defined(IGNORE_MASTER_SITE_EPEL9)
181MASTER_SITE_EPEL9+= \
182	https://dl.fedoraproject.org/pub/epel/9/Everything/aarch64/Packages/%SUBDIR%/:DEFAULT,aarch64 \
183	https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/%SUBDIR%/:DEFAULT,amd64 \
184	https://dl.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/%SUBDIR%/:SOURCE
185.endif
186
187.if !defined(IGNORE_MASTER_SITE_ROCKY_LINUX)
188MASTER_SITE_ROCKY_LINUX+= \
189	https://dl.rockylinux.org/pub/rocky/%SUBDIR%/:DEFAULT,aarch64,amd64,SOURCE \
190	https://dl.rockylinux.org/vault/rocky/%SUBDIR%/:DEFAULT,aarch64,amd64,SOURCE
191.endif
192
193.if !defined(IGNORE_MASTER_SITE_FEDORA_LINUX)
194MASTER_SITE_FEDORA_LINUX+= \
195	https://archives.fedoraproject.org/pub/archive/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE \
196	https://archives.fedoraproject.org/pub/archive/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE \
197	ftp://ftp.pbone.net/vol4/archive.fedoraproject.org/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE \
198	ftp://ftp.gmd.de/archives.fedoraproject.org/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE \
199	ftp://mirror.fraunhofer.de/archives.fedoraproject.org/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE \
200	ftp://ftp-mirror.bi.fraunhofer.de/archives.fedoraproject.org/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE
201.endif
202
203.if !defined(IGNORE_MASTER_SITE_RPMFUSION9)
204MASTER_SITE_RPMFUSION9+= \
205	https://ftp.icm.edu.pl/pub/Linux/dist/rpmfusion/free/el/updates/9/aarch64/%SUBDIR%/:DEFAULT,aarch64 \
206	https://ftp.icm.edu.pl/pub/Linux/dist/rpmfusion/free/el/updates/9/x86_64/%SUBDIR%/:DEFAULT,amd64 \
207	https://ftp.icm.edu.pl/pub/Linux/dist/rpmfusion/free/el/updates/9/SRPMS/%SUBDIR%/:DEFAULT,SOURCE
208.endif
209
210.if !defined(IGNORE_MASTER_SITE_FARSIGHT)
211MASTER_SITE_FARSIGHT+= \
212	https://dl.farsightsecurity.com/dist/%SUBDIR%/
213.endif
214
215.if !defined(IGNORE_MASTER_SITE_FESTIVAL)
216MASTER_SITE_FESTIVAL+= \
217	http://www.festvox.org/packed/festival/%SUBDIR%/ \
218	http://www.cstr.ed.ac.uk/downloads/festival/%SUBDIR%/
219.endif
220
221.if !defined(IGNORE_MASTER_SITE_FESTIVAL_OGI)
222MASTER_SITE_FESTIVAL_OGI+= \
223	http://www.cslu.ogi.edu/tts/download/data/
224.endif
225
226.if !defined(IGNORE_MASTER_SITE_FREEBSD_LOCAL)
227MASTER_SITE_FREEBSD_LOCAL+=	\
228	http://distcache.FreeBSD.org/local-distfiles/%SUBDIR%/ \
229	http://distcache.us-east.FreeBSD.org/local-distfiles/%SUBDIR%/ \
230	http://distcache.eu.FreeBSD.org/local-distfiles/%SUBDIR%/ \
231	http://distcache.us-west.FreeBSD.org/local-distfiles/%SUBDIR%/
232.endif
233
234#
235# FreeBSD mirror sites
236#
237# For the full list, see the Handbook:
238#
239#    https://docs.FreeBSD.org/en/books/handbook/mirrors/#mirrors-ftp
240#
241.if !defined(IGNORE_MASTER_SITE_FREEBSD_ORG)
242MASTER_SITE_FREEBSD_ORG+= \
243	https://download.FreeBSD.org/%SUBDIR%/ \
244	ftp://ftp.FreeBSD.org/pub/FreeBSD/%SUBDIR%/ \
245	ftp://ftp.se.FreeBSD.org/pub/FreeBSD/%SUBDIR%/ \
246	ftp://ftp.jp.FreeBSD.org/pub/FreeBSD/%SUBDIR%/ \
247	ftp://ftp.uk.FreeBSD.org/pub/FreeBSD/%SUBDIR%/ \
248	ftp://ftp.ru.FreeBSD.org/pub/FreeBSD/%SUBDIR%/
249.endif
250
251.if !defined(IGNORE_MASTER_SITE_FRUGALWARE)
252MASTER_SITE_FRUGALWARE+= \
253	ftp://ftp7.frugalware.org/pub/frugalware/frugalware-stable/source/%SUBDIR%/ \
254	ftp://ftp6.frugalware.org/mirrors/linux/frugalware/frugalware-stable/source/%SUBDIR%/ \
255	ftp://ftp12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-stable/source/%SUBDIR%/
256.endif
257
258.if !defined(IGNORE_MASTER_SITE_GCC)
259MASTER_SITE_GCC+= \
260	https://mirrors.kernel.org/sourceware/gcc/%SUBDIR%/ \
261	https://ftp-stud.hs-esslingen.de/pub/Mirrors/sourceware.org/gcc/%SUBDIR%/ \
262	https://ftp.funet.fi/pub/mirrors/sourceware.org/pub/gcc/%SUBDIR%/ \
263	https://ftp.mpi-inf.mpg.de/pub/gnu/mirror/gcc.gnu.org/pub/gcc/%SUBDIR%/ \
264	https://mirrorservice.org/sites/sourceware.org/pub/gcc/%SUBDIR%/ \
265	http://mirror.koddos.net/gcc/%SUBDIR%/ \
266	http://ftp.ntua.gr/pub/gnu/gcc/%SUBDIR%/ \
267	http://gcc.gnu.org/pub/gcc/%SUBDIR%/
268.endif
269
270.if !defined(IGNORE_MASTER_SITE_GENTOO)
271MASTER_SITE_GENTOO+= \
272	https://mirror.leaseweb.com/gentoo/%SUBDIR%/ \
273	https://mirror.rackspace.com/gentoo/%SUBDIR%/ \
274	https://mirror.init7.net/gentoo/%SUBDIR%/ \
275	https://mirrors.rit.edu/gentoo/%SUBDIR%/ \
276	http://ftp.iij.ad.jp/pub/linux/gentoo/%SUBDIR%/ \
277	http://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/%SUBDIR%/ \
278	http://ftp.uni-hannover.de/gentoo/%SUBDIR%/ \
279	http://gentoo-mirror.flux.utah.edu/%SUBDIR%/
280.endif
281
282# Keep this before USE_GITHUB
283.if !empty(MASTER_SITES:M*/github.com/*/archive/*)
284DEV_WARNING+=	"MASTER_SITES contains ${MASTER_SITES:M*/github.com/*/archive/*}, please use USE_GITHUB instead."
285.endif
286
287.if !defined(IGNORE_MASTER_SITE_GITHUB)
288#
289# In order to use GitHub your port must define USE_GITHUB and the following
290# variables:
291#
292# GH_ACCOUNT    - account name of the GitHub user hosting the project
293#                 default: ${PORTNAME}
294#
295# GH_PROJECT    - name of the project on GitHub
296#                 default: ${PORTNAME}
297#
298# GH_TAGNAME    - name of the tag to download (2.0.1, hash, ...)
299#                 Using the name of a branch here is incorrect. It is
300#                 possible to do GH_TAGNAME= GIT_HASH to do a snapshot.
301#                 default: ${DISTVERSIONFULL}
302#
303# GH_SUBDIR     - directory relative to WRKSRC where to move this distfile's
304#                 content after extracting.
305#
306# GH_TUPLE      - above shortened to account:project:tagname[:group][/subdir]
307#
308.  if defined(USE_GITHUB)
309.    if defined(GH_TAGNAME) && ${GH_TAGNAME} == master
310IGNORE?=	Using master as GH_TAGNAME is invalid. \
311		Must use a tag or commit hash so the upstream does \
312		not "reroll" as soon as the branch is updated
313.    endif
314.    if defined(GH_TUPLE)
315.      for _tuple in ${GH_TUPLE}
316_t_tmp=${_tuple}
317.        if ${_t_tmp:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\4@:S/://:C/[a-zA-Z0-9_.+-]//g}
318check-makevars::
319	@${ECHO_MSG} "The ${_tuple} GH_TUPLE line has"
320	@${ECHO_MSG} "a tag containing something else than [a-zA-Z0-9_.+-]"
321	@${FALSE}
322.        endif
323.      endfor
324GH_ACCOUNT+=	${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\1\4@}
325GH_PROJECT+=	${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\2\4@}
326GH_TAGNAME+=	${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\3\4@}
327GH_SUBDIR+=	${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\6\4@:M/*:S/^\///}
328.    endif
329# We are cheating and using backend URLS for GitHub here. See ports/194898
330# comment #15 for explanation as to why and how to deal with it if it breaks.
331MASTER_SITE_GITHUB+=		https://codeload.github.com/%SUBDIR%
332MASTER_SITE_GITHUB_CLOUD+=	https://cloud.github.com/downloads/%SUBDIR%
333
334.    if ( !defined(MASTER_SITES) || !${MASTER_SITES:MGH} && !${MASTER_SITES:MGHC} ) && !${USE_GITHUB:Mnodefault}
335MASTER_SITES+=	GH
336.    endif
337GH_ACCOUNT_DEFAULT=	${PORTNAME}
338GH_ACCOUNT?=	${GH_ACCOUNT_DEFAULT}
339GH_PROJECT_DEFAULT=	${PORTNAME}
340GH_PROJECT?=	${GH_PROJECT_DEFAULT}
341# Use full PREFIX/SUFFIX and converted DISTVERSION
342GH_TAGNAME_DEFAULT=	${DISTVERSIONFULL}
343GH_TAGNAME?=	${GH_TAGNAME_DEFAULT}
344# Iterate over GH_ACCOUNT, GH_PROJECT, GH_TAGNAME and GH_SUBDIR to extract groups
345_GITHUB_GROUPS= DEFAULT
346.    for _gh_v in GH_ACCOUNT GH_PROJECT GH_TAGNAME GH_SUBDIR
347.      for _v_ex in ${${_gh_v}}
348_GH_GROUPS=	${_v_ex:S/^${_v_ex:C@:[^/:]+$@@}//:S/^://}
349.        if !empty(_GH_GROUPS)
350.          for _group in ${_GH_GROUPS:S/,/ /g}
351.            if ${_group} == all || ${_group} == ALL || ${_group} == default
352check-makevars::
353		@${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be"
354		@${ECHO_MSG} "used in group definitions. Please fix your ${_gh_v}"
355		@${FALSE}
356.            endif
357.            if !${_GITHUB_GROUPS:M${_group}}
358_GITHUB_GROUPS+=	${_group}
359.            endif
360${_gh_v}_${_group}=	${_v_ex:C@^(.*):[^/:]+$@\1@}
361.          endfor
362.        else
363${_gh_v}_DEFAULT=	${_v_ex:C@^(.*):[^/:]+$@\1@}
364.        endif
365.      endfor
366.    endfor
367# Put the default values back into the variables so that the *default* behavior
368# is not changed.
369GH_ACCOUNT:=	${GH_ACCOUNT_DEFAULT}
370GH_PROJECT:=	${GH_PROJECT_DEFAULT}
371GH_TAGNAME:=	${GH_TAGNAME_DEFAULT}
372GH_SUBDIR:=	${GH_SUBDIR_DEFAULT}
373.    if defined(GH_TAGNAME)
374# If you change either of the _SANITIZED or _EXTRACT variables, please keep the
375# changes in sync with the GH_TAGNAME_${_group}_* variables 50 lines below.
376GH_TAGNAME_SANITIZED=	${GH_TAGNAME:S,/,-,g}
377# GitHub silently converts tags starting with v to not have v in the filename
378# and extraction directory.  It also replaces + with -.
379GH_TAGNAME_EXTRACT=	${GH_TAGNAME_SANITIZED:C/^[vV]([0-9])/\1/:S/+/-/g:C/--*/-/g}
380.    endif
381# This new scheme rerolls distfiles. Also ensure they are renamed to avoid
382# conflicts. Use _GITHUB_REV in case github changes their zipping or structure
383# which has happened before.
384_GITHUB_REV=	0
385_GITHUB_EXTRACT_SUFX=	.tar.gz
386# Put the DEFAULT distfile first
387_GITHUB_CLONE_DIR?=	${WRKDIR}/git-clone
388_PORTS_DIRECTORIES+=	${_GITHUB_CLONE_DIR}
389.    if !${USE_GITHUB:Mnodefault} && empty(MASTER_SITES:MGHC)
390# GH_TAGNAME defaults to DISTVERSIONFULL; Avoid adding DISTVERSIONFULL in twice
391.      if ${GH_TAGNAME} != ${DISTVERSIONFULL}
392DISTNAME=	${GH_ACCOUNT}-${GH_PROJECT}-${DISTVERSIONFULL}-${GH_TAGNAME_SANITIZED}
393.      else
394DISTNAME=	${GH_ACCOUNT}-${GH_PROJECT}-${GH_TAGNAME_SANITIZED}
395.      endif
396DISTNAME_DEFAULT:=	${DISTNAME}_GH${_GITHUB_REV}
397DISTFILE_DEFAULT=	${DISTNAME_DEFAULT}${_GITHUB_EXTRACT_SUFX}
398DISTNAME:=	${DISTNAME_DEFAULT}
399DISTFILES+=	${DISTFILE_DEFAULT}
400git-clone: git-clone-DEFAULT
401git-clone-DEFAULT: ${_GITHUB_CLONE_DIR}
402	@git clone https://github.com/${GH_ACCOUNT_DEFAULT}/${GH_PROJECT_DEFAULT}.git ${_GITHUB_CLONE_DIR}/${GH_PROJECT_DEFAULT}
403	@${ECHO_MSG} "Cloned the default github repository into ${_GITHUB_CLONE_DIR}/${GH_PROJECT_DEFAULT}" | ${FMT_80}
404.    endif
405.    if !empty(GH_SUBDIR)
406_SITES_extract:=	690:post-extract-gh-DEFAULT
407post-extract-gh-DEFAULT:
408	@${RMDIR} ${WRKSRC}/${GH_SUBDIR_DEFAULT} 2>/dev/null || :
409	@${MKDIR} ${WRKSRC}/${GH_SUBDIR_DEFAULT:H} 2>/dev/null || :
410	@${LN} -s ${GH_SUBDIR_DEFAULT:C/[^\/]//g:C/\//..\//g:S/^$/./} ${WRKSRC}/${GH_SUBDIR_DEFAULT}
411.    endif
412# If there are non default groups
413.    if !empty(_GITHUB_GROUPS:NDEFAULT)
414# Then for each of the remaining groups, add DISTFILES and MASTER_SITES
415# entries with the correct group and create {WRKSRC,DISTNAME,DISTFILES}_group
416# helper variables.
417.      for _group in ${_GITHUB_GROUPS:NDEFAULT}
418GH_ACCOUNT_${_group}?=	${GH_ACCOUNT_DEFAULT}
419GH_PROJECT_${_group}?=	${GH_PROJECT_DEFAULT}
420GH_TAGNAME_${_group}?=	${GH_TAGNAME_DEFAULT}
421# If you change either of the _SANITIZED or _EXTRACT variables, please keep the
422# changes in sync with the GH_TAGNAME_* variables 50 lines above.
423GH_TAGNAME_${_group}_SANITIZED=	${GH_TAGNAME_${_group}:S,/,-,g}
424GH_TAGNAME_${_group}_EXTRACT=	${GH_TAGNAME_${_group}_SANITIZED:C/^[vV]([0-9])/\1/:S/+/-/g:C/--*/-/g}
425_GH_TUPLE_OUT:=	${_GH_TUPLE_OUT} ${GH_ACCOUNT_${_group}}:${GH_PROJECT_${_group}}:${GH_TAGNAME_${_group}}:${_group}/${GH_SUBDIR_${_group}}
426DISTNAME_${_group}:=	${GH_ACCOUNT_${_group}}-${GH_PROJECT_${_group}}-${GH_TAGNAME_${_group}_SANITIZED}
427DISTFILE_${_group}:=	${DISTNAME_${_group}}_GH${_GITHUB_REV}${_GITHUB_EXTRACT_SUFX}
428DISTFILES:=	${DISTFILES} ${DISTFILE_${_group}}:${_group}
429MASTER_SITES:=	${MASTER_SITES} ${MASTER_SITE_GITHUB:S@%SUBDIR%@${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}/tar.gz/${GH_TAGNAME_${_group}}?dummy=/:${_group}@}
430WRKSRC_${_group}:=	${WRKDIR}/${GH_PROJECT_${_group}}-${GH_TAGNAME_${_group}_EXTRACT}
431.        if !empty(GH_SUBDIR_${_group})
432# In order to sort the subdir extraction so that foo/bar is moved in before
433# foo/bar/baz, we count the number of / in the path and use it to order the
434# targets.  This handles up to 9 levels.  The max as of r463123 is 4.
435_SITES_extract:=	${_SITES_extract} 69${GH_SUBDIR_${_group}:C=[^/]+= =g:[#]}:post-extract-gh-${_group}
436post-extract-gh-${_group}:
437	@${RMDIR} ${WRKSRC}/${GH_SUBDIR_${_group}} 2>/dev/null || :
438	@${MKDIR} ${WRKSRC}/${GH_SUBDIR_${_group}:H} 2>/dev/null || :
439	@${MV} ${WRKSRC_${_group}} ${WRKSRC}/${GH_SUBDIR_${_group}}
440	@${LN} -s ${WRKSRC:T}/${GH_SUBDIR_${_group}} ${WRKSRC_${_group}}
441.        endif
442git-clone: git-clone-${_group}
443git-clone-${_group}: ${_GITHUB_CLONE_DIR}
444	@git clone https://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}.git ${_GITHUB_CLONE_DIR}/${GH_PROJECT_${_group}}
445	@${ECHO_MSG} "Cloned the ${_group} github repository into ${_GITHUB_CLONE_DIR}/${GH_PROJECT_${_group}}" | ${FMT_80}
446.      endfor
447.    endif
448convert-to-gh-tuple:
449	@${ECHO_MSG} ${GH_ACCOUNT}:${GH_PROJECT}:${GH_TAGNAME} ${_GH_TUPLE_OUT:S/\/$//}
450WWW?=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/
451.  endif # defined(USE_GITHUB)
452.endif # !defined(IGNORE_MASTER_SITE_GITHUB)
453
454# Keep this before USE_GITLAB
455# first try to detect when fetch was called by makesum, which passes
456# MASTER_SITES and would cause a bogus warning here.
457.if !(make(fetch) && !empty(NO_CHECKSUM) && !empty(DISABLE_SIZE))
458.  if !empty(MASTER_SITES:M*//*/*/*/-/archive/${DISTVERSIONFULL}/)
459DEV_WARNING+=	"MASTER_SITES contains ${MASTER_SITES:M*//*/*/*/-/archive/${DISTVERSIONFULL}/}, please use USE_GITLAB instead."
460.  endif
461.endif
462
463.if !defined(IGNORE_MASTER_SITE_GITLAB)
464#
465# In order to use GitLab your port must define USE_GITLAB and the following
466# variables:
467#
468# GL_SITE       - site URL hosting GitLab and the project
469#                 default: https://gitlab.com
470#
471# GL_ACCOUNT    - account name of the GitLab user hosting the project
472#                 default: ${PORTNAME}
473#
474# GL_PROJECT    - name of the project on GitLab
475#                 default: ${PORTNAME}
476#
477# GL_TAGNAME    - name of the tag to download (2.0.1, hash, ...)
478#                 Using the name of a branch here is incorrect. It is
479#                 possible to do GL_TAGNAME= GIT_HASH to do a snapshot.
480#                 default: ${DISTVERSIONFULL}
481#
482# GL_SUBDIR     - directory relative to WRKSRC where to move this distfile's
483#                 content after extracting.
484#
485# GL_TUPLE      - above shortened to [site[:port][/webroot]:]account:project:tagname:group[/subdir]
486#
487.  if defined(USE_GITLAB)
488.    if !defined(GL_TAGNAME) && defined(GL_COMMIT)
489GL_TAGNAME=	${GL_COMMIT}
490DEV_WARNING+=	"GL_COMMIT is deprecated, please use GL_TAGNAME instead"
491.    endif
492.    if defined(GL_TUPLE)
493.      for _tuple in ${GL_TUPLE}
494.        if ${_tuple:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\7@:S/^://:C/[a-zA-Z0-9_.+-]//g}
495check-makevars::
496	@${ECHO_MSG} "The ${_tuple}"
497	@${ECHO_MSG} "GL_TUPLE is improperly formatted or, the tagname"
498	@${ECHO_MSG} "section contains something other than [a-zA-Z0-9_.+-]"
499	@${FALSE}
500.        endif
501.      endfor
502GL_SITE+=	${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\1\8@:S@::@:@}
503GL_ACCOUNT+=	${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\5\8@}
504GL_PROJECT+=	${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\6\8@}
505GL_TAGNAME+=	${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\7\8@}
506GL_SUBDIR+=	${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\9\8@:M/*:S/^\///}
507.    endif
508
509.    if empty(USE_GITLAB:Mnodefault)
510MASTER_SITES+=	${GL_SITE}/${GL_ACCOUNT}/${GL_PROJECT}/-/archive/${GL_TAGNAME:C@^[a-f0-9]{40}$@\0.tar.gz?dummy=@}/
511.    endif
512GL_SITE_DEFAULT=	https://gitlab.com
513GL_SITE?=	${GL_SITE_DEFAULT}
514GL_ACCOUNT_DEFAULT=	${PORTNAME}
515GL_ACCOUNT?=	${GL_ACCOUNT_DEFAULT}
516GL_PROJECT_DEFAULT=	${PORTNAME}
517GL_PROJECT?=	${GL_PROJECT_DEFAULT}
518GL_TAGNAME_DEFAULT=	${DISTVERSIONFULL}
519GL_TAGNAME?=	${GL_TAGNAME_DEFAULT}
520_GITLAB_GROUPS=	DEFAULT
521.    for _gl_v in GL_SITE GL_ACCOUNT GL_PROJECT GL_TAGNAME GL_SUBDIR
522.      for _v_ex in ${${_gl_v}}
523_GL_GROUPS=	${_v_ex:S/^${_v_ex:C@:[^/:]+$@@}//:S/^://}
524.        if !empty(_GL_GROUPS)
525.          for _group in ${_GL_GROUPS:S/,/ /g}
526.            if ${_group} == all || ${_group} == ALL || ${_group} == default
527check-makevars::
528		@${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be"
529		@${ECHO_MSG} "used in group definitions. Please fix your ${_gl_v}"
530		@${FALSE}
531.            endif
532.            if !${_GITLAB_GROUPS:M${_group}}
533_GITLAB_GROUPS+=	${_group}
534.            endif
535${_gl_v}_${_group}=	${_v_ex:C@^(.*):[^/:]+$@\1@}
536.          endfor
537.        else
538${_gl_v}_DEFAULT=	${_v_ex:C@^(.*):[^/:]+$@\1@}
539.        endif
540.      endfor
541.    endfor
542GL_SITE:=	${GL_SITE_DEFAULT}
543GL_ACCOUNT:=	${GL_ACCOUNT_DEFAULT}
544GL_PROJECT:=	${GL_PROJECT_DEFAULT}
545GL_TAGNAME:=	${GL_TAGNAME_DEFAULT}
546GL_SUBDIR:=	${GL_SUBDIR_DEFAULT}
547
548_GITLAB_REV=	0
549
550_GITLAB_EXTRACT_SUFX=		.tar.gz
551_GITLAB_TAG_EXTRACT_SUFX=	.tar.bz2
552
553_GITLAB_CLONE_DIR?=	${WRKDIR}/git-clone
554_PORTS_DIRECTORIES+=	${_GITLAB_CLONE_DIR}
555.    if !${USE_GITLAB:Mnodefault}
556.      if ${GL_TAGNAME:C/^[a-f0-9]{40}$//}
557DISTNAME:=	${GL_PROJECT}-${GL_TAGNAME}
558DISTFILES+=	${DISTNAME}${_GITLAB_TAG_EXTRACT_SUFX}
559.      else
560DISTNAME:=	${GL_ACCOUNT}-${GL_PROJECT}-${GL_TAGNAME}_GL${_GITLAB_REV}
561DISTFILES+=	${DISTNAME}${_GITLAB_EXTRACT_SUFX}
562.      endif
563git-clone: git-clone-DEFAULT
564git-clone-DEFAULT: ${_GITLAB_CLONE_DIR}
565	@git clone ${GL_SITE_DEFAULT}/${GL_ACCOUNT_DEFAULT}/${GL_PROJECT_DEFAULT}.git ${_GITLAB_CLONE_DIR}/${GL_PROJECT_DEFAULT}
566	@${ECHO_MSG} "Cloned the default GitLab repository into ${_GITLAB_CLONE_DIR}/${GL_PROJECT_DEFAULT}" | ${FMT_80}
567.    endif
568.    if !empty(GL_SUBDIR)
569_SITES_extract:=	69${GL_SUBDIR_${_group}:C=[^/]+= =g:[#]}:post-extract-gl-DEFAULT
570post-extract-gl-DEFAULT:
571	@${RMDIR} ${WRKSRC}/${GL_SUBDIR_DEFAULT} 2>/dev/null || :
572	@${MKDIR} ${WRKSRC}/${GL_SUBDIR_DEFAULT:H} 2>/dev/null || :
573	@${LN} -s ${GL_SUBDIR_DEFAULT:C/[^\/]//g:C/\//..\//g:S/^$/./} ${WRKSRC}/${GL_SUBDIR_DEFAULT}
574.    endif
575.    if !empty(_GITLAB_GROUPS:NDEFAULT)
576.      for _group in ${_GITLAB_GROUPS:NDEFAULT}
577# We set GL_SITE earlier, we need to verify it's not empty
578.        if empty(GL_SITE_${_group})
579GL_SITE_${_group}=	${GL_SITE_DEFAULT}
580.        endif
581GL_ACCOUNT_${_group}?=	${GL_ACCOUNT_DEFAULT}
582GL_PROJECT_${_group}?=	${GL_PROJECT_DEFAULT}
583
584_GL_TUPLE_OUT:=	${_GL_TUPLE_OUT} ${GL_SITE_${_group}}:${GL_ACCOUNT_${_group}}:${GL_PROJECT_${_group}}:${GL_TAGNAME_${_group}}:${_group}/${GL_SUBDIR_${_group}}
585.        if ${GL_TAGNAME_${_group}:C/^[a-f0-9]{40}$//}
586DISTNAME_${_group}:=	${GL_PROJECT_${_group}}-${GL_TAGNAME_${_group}}
587DISTFILE_${_group}:=	${DISTNAME_${_group}}${_GITLAB_TAG_EXTRACT_SUFX}
588MASTER_SITES:=	${MASTER_SITES} ${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}/-/archive/${GL_TAGNAME_${_group}}/:${_group}
589.        else
590DISTNAME_${_group}:=	${GL_ACCOUNT_${_group}}-${GL_PROJECT_${_group}}-${GL_TAGNAME_${_group}}_GL${_GITLAB_REV}
591DISTFILE_${_group}:=	${DISTNAME_${_group}}${_GITLAB_EXTRACT_SUFX}
592MASTER_SITES:=	${MASTER_SITES} ${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}/-/archive/${GL_TAGNAME_${_group}}.tar.gz?dummy=/:${_group}
593.        endif
594DISTFILES:=	${DISTFILES} ${DISTFILE_${_group}}:${_group}
595WRKSRC_${_group}:=	${WRKDIR}/${GL_PROJECT_${_group}}-${GL_TAGNAME_${_group}}
596.        if !empty(GL_SUBDIR_${_group})
597_SITES_extract:=	${_SITES_extract} 690:post-extract-gl-${_group}
598post-extract-gl-${_group}:
599	@${RMDIR} ${WRKSRC}/${GL_SUBDIR_${_group}} 2>/dev/null || :
600	@${MKDIR} ${WRKSRC}/${GL_SUBDIR_${_group}:H} 2>/dev/null || :
601	@${MV} ${WRKSRC_${_group}} ${WRKSRC}/${GL_SUBDIR_${_group}}
602	@${LN} -s ${WRKSRC:T}/${GL_SUBDIR_${_group}} ${WRKSRC_${_group}}
603.        endif
604git-clone: git-clone-${_group}
605git-clone-${_group}: ${_GITLAB_CLONE_DIR}
606	@git clone ${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}.git ${_GITLAB_CLONE_DIR}/${GL_PROJECT_${_group}}
607	@${ECHO_MSG} "Cloned the ${_group} GitLab repository into ${_GITLAB_CLONE_DIR}/${GL_PROJECT_${_group}}" | ${FMT_80}
608.      endfor
609.    endif
610WWW?=	https://gitlab.com/${GL_ACCOUNT}/${GL_PROJECT}/
611.  endif # defined(USE_GITLAB)
612.endif # !defined(IGNORE_MASTER_SITE_GITLAB)
613
614.if !defined(IGNORE_MASTER_SITE_GNOME)
615.  if defined(DISTVERSION) && ${DISTVERSION:M[0-9]*}
616_version_major=	${DISTVERSION:C|^([0-9]+).*|\1|}
617_version_minor=	${DISTVERSION:C|^([0-9]+)\.([0-9]+).*|\2|}
618
619.    if ${_version_major} >= 10
620_gnome_ver=	${_version_major}
621.    else
622_gnome_ver=	${_version_major}.${_version_minor}
623.    endif
624.  endif
625
626_GNOME_PATH=	%SUBDIR%/${_gnome_ver}
627
628MASTER_SITE_GNOME+= \
629	https://download.gnome.org/${_GNOME_PATH}/
630.endif
631
632.if !defined(IGNORE_MASTER_SITE_GIMP)
633MASTER_SITE_GIMP+= \
634	https://ftp.gwdg.de/pub/misc/grafik/%SUBDIR%/ \
635	https://www.mirrorservice.org/sites/ftp.gimp.org/pub/%SUBDIR%/ \
636	https://download.gimp.org/pub/%SUBDIR%/
637.endif
638
639.if !defined(IGNORE_MASTER_SITE_GNU)
640MASTER_SITE_GNU+= \
641	https://ftpmirror.gnu.org/%SUBDIR%/ \
642	https://mirrors.kernel.org/gnu/%SUBDIR%/ \
643	https://mirror.netcologne.de/gnu/%SUBDIR%/ \
644	https://www.nic.funet.fi/pub/gnu/gnu/%SUBDIR%/ \
645	http://mirror.navercorp.com/gnu/%SUBDIR%/ \
646	http://ftp.halifax.rwth-aachen.de/gnu/%SUBDIR%/ \
647	ftp://mirrors.rit.edu/gnu/%SUBDIR%/ \
648	ftp://ftp.fu-berlin.de/unix/gnu/%SUBDIR%/ \
649	ftp://ftp.mirrorservice.org/sites/ftp.gnu.org/gnu/%SUBDIR%/ \
650	https://ftp.gnu.org/gnu/%SUBDIR%/
651.endif
652
653# List: https://gnupg.org/download/mirrors.html (contains stale information)
654.if !defined(IGNORE_MASTER_SITE_GNUPG)
655MASTER_SITE_GNUPG+= \
656	https://mirrors.dotsrc.org/gcrypt/%SUBDIR%/ \
657	https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/%SUBDIR%/ \
658	http://www.ring.gr.jp/pub/net/gnupg/%SUBDIR%/ \
659	https://gnupg.org/ftp/gcrypt/%SUBDIR%/
660.endif
661
662.if !defined(IGNORE_MASTER_SITE_GNUSTEP)
663MASTER_SITE_GNUSTEP+= \
664	ftp://ftp.gnustep.org/pub/gnustep/%SUBDIR%/ \
665	http://ftp.gnustep.org/pub/gnustep/%SUBDIR%/
666.endif
667
668.if !defined(IGNORE_MASTER_SITE_GNU_ALPHA)
669MASTER_SITE_GNU_ALPHA+= \
670	https://alpha.gnu.org/gnu/%SUBDIR%/ \
671	ftp://spinellicreations.com/alpha/gnu/%SUBDIR%/ \
672	http://www.nic.funet.fi/pub/gnu/alpha/gnu/%SUBDIR%/ \
673	http://mirror.thecodefactory.org/gnualpha/%SUBDIR%/ \
674	https://www.mirrorservice.org/sites/alpha.gnu.org/gnu/%SUBDIR%/ \
675	http://gnu.c3sl.ufpr.br/alpha/%SUBDIR%/ \
676	https://mirror.cedia.org.ec/gnualpha/%SUBDIR%/ \
677	http://gnu-alpha.mirrors.hostinginnederland.nl/%SUBDIR%/ \
678	https://gnualpha.uib.no/%SUBDIR%/ \
679	https://mirrors.fe.up.pt/pub/gnu-alpha/%SUBDIR%/ \
680	http://mirror.lihnidos.org/GNU/alpha/gnu/%SUBDIR%/ \
681	https://alpha-gnu-org.ip-connect.vn.ua/%SUBDIR%/
682.endif
683
684.if !defined(IGNORE_MASTER_SITE_HACKAGE)
685MASTER_SITE_HACKAGE+= \
686	https://hackage.haskell.org/package/ \
687	http://hackage.haskell.org/package/
688.endif
689
690.if !defined(IGNORE_MASTER_SITE_IDSOFTWARE)
691MASTER_SITE_IDSOFTWARE+= \
692	https://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/%SUBDIR%/ \
693	https://ftp.fu-berlin.de/pc/games/idgames/idstuff/%SUBDIR%/ \
694	https://ftp.gamers.org/pub/idgames/idstuff/%SUBDIR%/ \
695	ftp://ftp.omen.net.au/games/idstuff/%SUBDIR%/
696.endif
697
698.if !defined(IGNORE_MASTER_SITE_ISC)
699MASTER_SITE_ISC+= \
700	https://ftp.isc.org/isc/%SUBDIR%/ \
701	ftp://ftp.isc.org/isc/%SUBDIR%/ \
702	ftp://ftp.ciril.fr/pub/isc/%SUBDIR%/ \
703	ftp://ftp.freenet.de/pub/ftp.isc.org/isc/%SUBDIR%/ \
704	ftp://ftp.iij.ad.jp/pub/network/isc/%SUBDIR%/ \
705	ftp://ftp.u-aizu.ac.jp/pub/net/isc/%SUBDIR%/ \
706	ftp://ftp.task.gda.pl/mirror/ftp.isc.org/isc/%SUBDIR%/ \
707	ftp://ftp.mirrorservice.org/sites/ftp.isc.org/isc/%SUBDIR%/ \
708	ftp://ftp.nominum.com/pub/isc/%SUBDIR%/ \
709	ftp://ftp.ripe.net/mirrors/sites/ftp.isc.org/isc/%SUBDIR%/ \
710	ftp://ftp.ntua.gr/pub/net/isc/isc/%SUBDIR%/ \
711	ftp://ftp.funet.fi/pub/mirrors/ftp.isc.org/isc/%SUBDIR%/
712.endif
713
714.if !defined(IGNORE_MASTER_SITE_KDE)
715MASTER_SITE_KDE+= \
716	https://download.kde.org/%SUBDIR%/
717.endif
718
719.if !defined(IGNORE_MASTER_SITE_LIBREOFFICE_DEV)
720MASTER_SITE_LIBREOFFICE_DEV+= \
721	https://dev-www.libreoffice.org/src/%SUBDIR%/
722.endif
723
724.if !defined(IGNORE_MASTER_SITE_MATE)
725MASTER_SITE_MATE+= \
726	https://pub.mate-desktop.org/releases/%SUBDIR%/
727.endif
728
729.if !defined(IGNORE_MASTER_SITE_MOZDEV)
730MASTER_SITE_MOZDEV+= \
731	http://mirrors.ibiblio.org/mozdev.org/%SUBDIR%/
732.endif
733
734.if !defined(IGNORE_MASTER_SITE_MOZILLA)
735MASTER_SITE_MOZILLA+= \
736	https://download.cdn.mozilla.net/pub/%SUBDIR%/ \
737	https://archive.mozilla.org/pub/%SUBDIR%/
738.endif
739
740.if !defined(IGNORE_MASTER_SITE_MOZILLA_ADDONS)
741MASTER_SITE_MOZILLA_ADDONS+= \
742	http://kyoto-mz-dl.sinet.ad.jp/pub/mozilla.org/%SUBDIR%/
743.endif
744
745.if !defined(IGNORE_MASTER_SITE_MYSQL)
746MASTER_SITE_MYSQL+= \
747	https://dev.mysql.com/get/Downloads/%SUBDIR%/
748.endif
749
750.if !defined(IGNORE_MASTER_SITE_NETBSD)
751MASTER_SITE_NETBSD+= \
752	https://ftp.netbsd.org/pub/pkgsrc/distfiles/%SUBDIR%/ \
753	http://ftp.fr.netbsd.org/pub/pkgsrc/%SUBDIR%/ \
754	ftp://ftp2.fr.netbsd.org/pub/pkgsrc/%SUBDIR%/ \
755	ftp://ftp3.de.netbsd.org/pub/pkgsrc/%SUBDIR%/ \
756	ftp://ftp2.jp.netbsd.org/pub/pkgsrc/%SUBDIR%/ \
757	ftp://ftp7.jp.netbsd.org/pub/pkgsrc/%SUBDIR%/
758.endif
759
760.if !defined(IGNORE_MASTER_SITE_NETLIB)
761MASTER_SITE_NETLIB+= \
762	http://www.netlib.org/%SUBDIR%/ \
763	ftp://ftp.irisa.fr/pub/netlib/%SUBDIR%/ \
764	http://netlib.sandia.gov/%SUBDIR%/
765.endif
766
767.if !defined(IGNORE_MASTER_SITE_NVIDIA)
768MASTER_SITE_NVIDIA+= \
769	https://jp.download.nvidia.com/%SUBDIR%/ \
770	http://us.download.nvidia.com/%SUBDIR%/ \
771	https://tw.download.nvidia.com/%SUBDIR%/ \
772	http://download.nvidia.com/%SUBDIR%/ \
773	https://http.download.nvidia.com/%SUBDIR%/ \
774	ftp://download.nvidia.com/%SUBDIR%/ \
775	ftp://download1.nvidia.com/%SUBDIR%/
776.endif
777
778.if !defined(IGNORE_MASTER_SITE_OPENBSD)
779MASTER_SITE_OPENBSD+= \
780	https://cdn.openbsd.org/pub/OpenBSD/%SUBDIR%/ \
781	https://cloudflare.cdn.openbsd.org/pub/OpenBSD/%SUBDIR%/ \
782	https://ftp.OpenBSD.org/pub/OpenBSD/%SUBDIR%/ \
783	https://ftp.eu.openbsd.org/pub/OpenBSD/%SUBDIR%/ \
784	https://ftp.usa.openbsd.org/pub/OpenBSD/%SUBDIR%/ \
785	https://mirror.leaseweb.com/pub/OpenBSD/%SUBDIR%/ \
786	https://mirror.aarnet.edu.au/pub/OpenBSD/%SUBDIR%/
787.endif
788
789.if !defined(IGNORE_MASTER_SITE_OPENOFFICE)
790MASTER_SITE_OPENOFFICE+=	\
791	http://mirrors.isc.org/pub/openoffice/ \
792	http://ftp.stardiv.de/pub/OpenOffice.org/ \
793	http://openoffice.mirrors.ilisys.com.au/ \
794	ftp://ftp.pucpr.br/openoffice/ \
795	http://www.ibiblio.org/pub/mirrors/openoffice/ \
796	ftp://ftp.ussg.iu.edu/pub/openoffice/ \
797	http://openoffice.mirrors.pair.com/ftp/ \
798	http://gd.tuwien.ac.at/office/openoffice/ \
799	http://ftp.belnet.be/pub/mirror/ftp.openoffice.org/ \
800	ftp://ftp.kulnet.kuleuven.ac.be/pub/mirror/openoffice.org/ \
801	http://ftp.sh.cvut.cz/MIRRORS/OpenOffice/ \
802	ftp://ftp.funet.fi/pub/mirrors/openoffice.org/ \
803	ftp://openoffice.cict.fr/openoffice/ \
804	http://ftp.club-internet.fr/pub/OpenOffice/ \
805	ftp://sunsite.informatik.rwth-aachen.de/pub/mirror/OpenOffice/ \
806	ftp://ftp.tu-chemnitz.de/pub/openoffice/ \
807	ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/ftp.openoffice.org/ \
808	ftp://ftp.join.uni-muenster.de/pub/software/OpenOffice/ \
809	http://ftp.ntua.gr/pub/OpenOffice/ \
810	http://ftp.fsf.hu/OpenOffice.org/ \
811	http://ftp.rhnet.is/pub/OpenOffice/ \
812	http://na.mirror.garr.it/mirrors/openoffice/ \
813	http://vlaai.snt.utwente.nl/pub/software/openoffice/ \
814	http://niihau.student.utwente.nl/openoffice/ \
815	http://borft.student.utwente.nl/openoffice/ \
816	http://ftp.iasi.roedu.net/mirrors/openoffice.org/ \
817	ftp://ftp.arnes.si/packages/OpenOffice.org/ \
818	ftp://ftp.saix.net/pub/OpenOffice.org/ \
819	http://ftp.rediris.es/ftp/mirror/openoffice.org/ \
820	http://ftp.sunet.se/pub/Office/OpenOffice.org/ \
821	ftp://mirror.switch.ch/mirror/OpenOffice/ \
822	http://mirror.pacific.net.au/openoffice/ \
823	http://komo.vlsm.org/openoffice/ \
824	ftp://ftp.t.ring.gr.jp/pub/misc/openoffice/ \
825	http://mymirror.asiaosc.org/openoffice/ \
826	ftp://ftp.kr.freebsd.org/pub/openoffice/ \
827	http://www.fs.tum.de/~mrauch/OpenOffice/download/
828.endif
829
830# Reference: https://osdn.net/docs/FileRelease_Guide#h2-Release.20File.20URL.20Formats
831.if !defined(IGNORE_MASTER_SITE_OSDN)
832MASTER_SITE_OSDN+= \
833	https://osdn.net/dl/%SUBDIR%/
834.endif
835
836.if !defined(IGNORE_MASTER_SITE_OSDN_CHAMBER)
837MASTER_SITE_OSDN_CHAMBER+= \
838	https://osdn.net/downloads/users/%SUBDIR%/
839.endif
840
841# From https://osdn.net/docs/FileRelease_Guide#h2-Direct.20Download
842#   "Currently, when a release-file URL is accessed from wget, curl,
843#   libwww-perl, PowerShell, apt, dnf, or other package management
844#   tools, downloading of the file will begin right away without
845#   having to go via html page."
846# Unfortunately fetch(1) isn't included in such user agents. Therefore
847# add --user-agent option to FETCH_ARGS so access is considered as
848# that of ftp/curl.
849.if !empty(MASTER_SITES:M*OSDN*) || !empty(PATCH_SITES:M*OSDN*)
850FETCH_ARGS+=	--user-agent=curl/7.68.0
851.endif
852
853.if !defined(IGNORE_MASTER_SITE_OSSP)
854MASTER_SITE_OSSP+= \
855	http://ftp.ntua.gr/pub/utils/ossp/%SUBDIR%/ \
856	ftp://ftp.ntua.gr/pub/utils/ossp/%SUBDIR%/
857.endif
858
859.if !defined(IGNORE_MASTER_SITE_PACKETSTORM)
860MASTER_SITE_PACKETSTORM+= \
861	https://dl.packetstormsecurity.net/%SUBDIR%/
862.endif
863
864.if !defined(IGNORE_MASTER_SITE_PERL_CPAN)
865
866_PERL_CPAN_SORT?= modules/by-module
867
868# Please add URI to MASTER_SITE_PERL_CPAN_BY instead of this one.
869MASTER_SITE_PERL_CPAN?=
870
871MASTER_SITE_PERL_CPAN_BY+= \
872	https://cpan.metacpan.org/%CPANSORT%/%SUBDIR%/ \
873	https://cpan.metacpan.org/modules/by-module/%SUBDIRPLUS%/ \
874	https://www.cpan.org/%CPANSORT%/%SUBDIR%/ \
875	ftp://ftp.cpan.org/pub/CPAN/%CPANSORT%/%SUBDIR%/ \
876	http://ftp.jaist.ac.jp/pub/CPAN/%CPANSORT%/%SUBDIR%/ \
877	ftp://ftp.mirrorservice.org/sites/cpan.perl.org/CPAN/%CPANSORT%/%SUBDIR%/ \
878	ftp://ftp.auckland.ac.nz/pub/perl/CPAN/%CPANSORT%/%SUBDIR%/ \
879	http://backpan.perl.org/%CPANSORT%/%SUBDIR%/ \
880	ftp://ftp.funet.fi/pub/languages/perl/CPAN/%CPANSORT%/%SUBDIR%/ \
881	http://ftp.twaren.net/Unix/Lang/CPAN/%CPANSORT%/%SUBDIR%/ \
882	ftp://ftp.cpan.org/pub/CPAN/modules/by-module/%SUBDIRPLUS%/
883
884_PERL_CPAN_FLAG=${MASTER_SITE_SUBDIR:C/(CPAN):.*$/\1/}
885_PERL_CPAN_ID=	${MASTER_SITE_SUBDIR:C/^CPAN:(.)(.)(.*)$/\1\/\1\2\/\1\2\3/}
886
887.  if !empty(_PERL_CPAN_ID) && ${_PERL_CPAN_FLAG:tl} == "cpan"
888    _PERL_CPAN_SORT=authors/id/${_PERL_CPAN_ID}
889    MASTER_SITE_PERL_CPAN=${MASTER_SITE_PERL_CPAN_BY:S/%CPANSORT%/${_PERL_CPAN_SORT}/:S/%SUBDIR%\///:S/%SUBDIRPLUS%\//${PORTNAME:C/-.*//}\//}
890.  else
891    MASTER_SITE_PERL_CPAN=${MASTER_SITE_PERL_CPAN_BY:S/%CPANSORT%/${_PERL_CPAN_SORT}/:S/%SUBDIRPLUS%\///}
892.  endif
893
894.endif
895
896#
897# PostgreSQL master site
898#
899.if !defined(IGNORE_MASTER_SITE_PGSQL)
900MASTER_SITE_PGSQL+= \
901	https://ftp.postgresql.org/pub/%SUBDIR%/
902.endif
903
904# Currently MyraCloud is blocking fetch. Hence add php Github distributions
905# untill it is fixed.
906.if !defined(IGNORE_MASTER_SITE_PHP)
907MASTER_SITE_PHP+= \
908	https://www.php.net/distributions/ \
909	https://raw.githubusercontent.com/php/web-php-distributions/master/
910.endif
911
912.if !defined(IGNORE_MASTER_SITE_PYPI)
913MASTER_SITE_PYPI+= \
914	https://files.pythonhosted.org/packages/%SUBDIR%/ \
915	https://pypi.org/packages/%SUBDIR%/
916.endif
917
918.if !defined(IGNORE_MASTER_SITE_PYTHON)
919MASTER_SITE_PYTHON+= \
920	https://www.python.org/%SUBDIR%/
921.endif
922
923.if !defined(IGNORE_MASTER_SITE_QMAIL)
924MASTER_SITE_QMAIL+= \
925	http://qmail.glasswings.com.au/%SUBDIR%/ \
926	http://qmail.psshee.com/%SUBDIR%/ \
927	http://www.agria.hu/qmail/%SUBDIR%/ \
928	http://qmail.omnis.ch/%SUBDIR%/ \
929	http://www.qmail.org/%SUBDIR%/
930.endif
931
932.if !defined(IGNORE_MASTER_SITE_QT)
933MASTER_SITE_QT+= \
934	https://download.qt.io/%SUBDIR%/ \
935	http://master.qt.io/%SUBDIR%/ \
936	https://www.mirrorservice.org/sites/download.qt-project.org/%SUBDIR%/ \
937	http://www.nic.funet.fi/pub/mirrors/download.qt-project.org/%SUBDIR%/ \
938	https://ftp.jaist.ac.jp/pub/qtproject/%SUBDIR%/
939.endif
940
941.if !defined(IGNORE_MASTER_SITE_RUBY)
942MASTER_SITE_RUBY+= \
943	https://cache.ruby-lang.org/pub/ruby/%SUBDIR%/ \
944	ftp://ftp.fu-berlin.de/unix/languages/ruby/%SUBDIR%/ \
945	ftp://ftp.kr.FreeBSD.org/pub/ruby/%SUBDIR%/ \
946	ftp://ftp.iDaemons.org/pub/mirror/ftp.ruby-lang.org/ruby/%SUBDIR%/
947.endif
948
949# See http://rubygems.org/pages/about
950.if !defined(IGNORE_MASTER_SITE_RUBYGEMS)
951MASTER_SITE_RUBYGEMS+= \
952	https://rubygems.org/downloads/
953.endif
954
955.if !defined(IGNORE_MASTER_SITE_SAMBA)
956MASTER_SITE_SAMBA+= \
957	https://ftp.samba.org/pub/%SUBDIR%/
958.endif
959
960# List:	https://download-mirror.savannah.gnu.org/releases/00_MIRRORS.html
961.if !defined(IGNORE_MASTER_SITE_SAVANNAH)
962MASTER_SITE_SAVANNAH+= \
963	https://download.savannah.gnu.org/releases/%SUBDIR%/ \
964	https://nongnu.uib.no/%SUBDIR%/ \
965	https://mirror.kumi.systems/nongnu/%SUBDIR%/ \
966	https://mirrors.up.pt/pub/nongnu/%SUBDIR%/ \
967	http://nongnu.askapache.com/%SUBDIR%/ \
968	http://mirror.netcologne.de/savannah/%SUBDIR%/ \
969	http://mirror.csclub.uwaterloo.ca/nongnu/%SUBDIR%/ \
970	http://mirror.easyname.at/nongnu/%SUBDIR%/ \
971	https://download-mirror.savannah.gnu.org/releases/%SUBDIR%/
972.endif
973
974# List:		https://sourceforge.net/p/forge/documentation/Mirrors/
975# Updated:	2022-11-26
976.if !defined(IGNORE_MASTER_SITE_SOURCEFORGE)
977.  for p in https http
978MASTER_SITE_SOURCEFORGE+= ${p}://downloads.sourceforge.net/project/%SUBDIR%/
979.    for m in cfhcable cytranet deac-ams deac-fra deac-riga excellmedia \
980	freefr gigenet ixpeering jaist kumisystems liquidtelecom \
981	nchc netactuate netcologne onboardcloud phoenixnap \
982	razaoinfo sinalbr sitsa tenet ufpr versaweb
983MASTER_SITE_SOURCEFORGE+= ${p}://${m}.dl.sourceforge.net/project/%SUBDIR%/
984.    endfor
985.  endfor
986.endif
987
988.if !defined(IGNORE_MASTER_SITE_SOURCEWARE)
989MASTER_SITE_SOURCEWARE+= \
990	https://mirrors.kernel.org/sourceware/%SUBDIR%/ \
991	https://ftp-stud.hs-esslingen.de/pub/Mirrors/sourceware.org/%SUBDIR%/ \
992	https://ftp.funet.fi/pub/mirrors/sourceware.org/pub/%SUBDIR%/ \
993	https://mirrorservice.org/sites/sourceware.org/pub/%SUBDIR%/
994.endif
995
996.if !defined(IGNORE_MASTER_SITE_SUDO)
997MASTER_SITE_SUDO+= \
998	https://www.sudo.ws/sudo/dist/ \
999	http://ftp.arcane-networks.fr/pub/mirrors/sudo/ \
1000	http://sudo.p8ra.de/sudo/dist/ \
1001	http://sudo.cybermirror.org/ \
1002	http://sudo-ftp.basemirror.de/ \
1003	http://ftp.twaren.net/Unix/Security/Sudo/ \
1004	ftp://ftp.sudo.ws/pub/sudo/ \
1005	ftp://plier.ucar.edu/pub/sudo/ \
1006	ftp://obsd.isc.org/pub/sudo/ \
1007	ftp://ftp.uwsg.indiana.edu/pub/security/sudo/ \
1008	ftp://ftp.tuwien.ac.at/utils/admin-tools/sudo/ \
1009	ftp://sunsite.ualberta.ca/pub/Mirror/sudo/ \
1010	ftp://zoot.tele.dk/pub/sudo/ \
1011	ftp://ftp.in2p3.fr/pub/sudo/ \
1012	ftp://ftp.arcane-networks.fr/pub/mirrors/sudo/ \
1013	ftp://ftp.usbm.de/pub/sudo/ \
1014	ftp://ftp.cs.tu-berlin.de/pub/misc/sudo/ \
1015	ftp://ftp.informatik.uni-hamburg.de/pub/os/unix/utils/sudo/ \
1016	ftp://ftp.st.ryukoku.ac.jp/pub/security/tool/sudo/ \
1017	ftp://ftp.cin.nihon-u.ac.jp/pub/misc/sudo/ \
1018	ftp://sunsite.icm.edu.pl/packages/sudo/ \
1019	ftp://mirror.cdmon.com/pub/sudo/ \
1020	ftp://ftp.twaren.net/Unix/Security/Sudo/
1021.endif
1022
1023.if !defined(IGNORE_MASTER_SITE_SUNSITE)
1024MASTER_SITE_SUNSITE+= \
1025	https://www.ibiblio.org/pub/Linux/%SUBDIR%/ \
1026	http://www.gtlib.gatech.edu/pub/Linux/%SUBDIR%/ \
1027	ftp://ftp.icm.edu.pl/pub/Linux/sunsite/%SUBDIR%/ \
1028	ftp://ftp.sun.ac.za/pub/mirrors/sunsite.unc.edu/pub/Linux/%SUBDIR%/
1029.endif
1030
1031.if !defined(IGNORE_MASTER_SITE_TCLTK)
1032MASTER_SITE_TCLTK+= \
1033	ftp://ftp.tcl.tk/pub/tcl/%SUBDIR%/ \
1034	ftp://ftp.mirrorservice.org/sites/ftp.tcl.tk/pub/tcl/%SUBDIR%/ \
1035	ftp://ftp.funet.fi/pub/languages/tcl/tcl/%SUBDIR%/
1036.endif
1037
1038.if !defined(IGNORE_MASTER_SITE_TEX)
1039MASTER_SITE_TEX+= \
1040	https://mirror.ctan.org/%SUBDIR%/
1041.endif
1042
1043.if !defined(IGNORE_MASTER_SITE_TEX_CTAN)
1044MASTER_SITE_TEX_CTAN+= \
1045	https://ftp.tu-chemnitz.de/pub/tug/historic/%SUBDIR%/ \
1046	https://pi.kwarc.info/historic/%SUBDIR%/ \
1047	https://mirrors.tuna.tsinghua.edu.cn/tex-historic-archive/%SUBDIR%/ \
1048	https://mirror.nju.edu.cn/tex-historic/%SUBDIR%/ \
1049	https://ftp.math.utah.edu/pub/tex/historic/%SUBDIR%/
1050.endif
1051
1052# Derived from: https://www.torproject.org/getinvolved/mirrors.html.en
1053# Please do not blindly follow and add URLs from the above list
1054.if !defined(IGNORE_MASTER_SITE_TOR)
1055MASTER_SITE_TOR+= \
1056		https://dist.torproject.org/%SUBDIR%/ \
1057		https://archive.torproject.org/tor-package-archive/%SUBDIR%/ \
1058		ftp://ftp.bit.nl/mirror/tor/%SUBDIR%/ \
1059		https://cyberside.net.ee/sibul/dist/%SUBDIR%/ \
1060		https://ftp.bit.nl/mirror/tor/%SUBDIR%/ \
1061		http://mirror.hessmo.com/tor/dist/%SUBDIR%/ \
1062		http://mirror.host4site.co.il/torproject.org/dist/%SUBDIR%/ \
1063		http://mirror.open-networx.org/torproject.org/dist/%SUBDIR%/ \
1064		http://mirror.tor.hu/dist/%SUBDIR%/ \
1065		http://mirrors.chaos-darmstadt.de/tor-mirror/dist/%SUBDIR%/ \
1066		http://theonionrouter.com/dist/%SUBDIR%/ \
1067		http://tor.amorphis.eu/dist/%SUBDIR%/ \
1068		http://tor.askapache.com/dist/%SUBDIR%/ \
1069		http://tor.beme-it.de/dist/%SUBDIR%/ \
1070		http://tor.borgmann.tv/dist/%SUBDIR%/ \
1071		http://tor.cyberarmy.at/dist/%SUBDIR%/ \
1072		http://tor.dont-know-me.at/dist/%SUBDIR%/ \
1073		http://tor.factor.cc/dist/%SUBDIR%/ \
1074		http://tor.idnr.ws/dist/%SUBDIR%/ \
1075		http://tor.kamagurka.org/dist/%SUBDIR%/ \
1076		http://tor.spline.de/dist/%SUBDIR%/ \
1077		http://tor.vesta.nu/dist/%SUBDIR%/ \
1078		http://torproj.xpdm.us/dist/%SUBDIR%/ \
1079		http://torproject.nwlinux.us/dist/%SUBDIR%/ \
1080		https://torproject.ph3x.at/dist/%SUBDIR%/ \
1081		http://www.oignon.net/dist/%SUBDIR%/ \
1082		http://www.torproject.org.nyud.net/dist/%SUBDIR%/ \
1083		http://www.torproject.us/dist/%SUBDIR%/
1084.endif
1085
1086.if !defined(IGNORE_MASTER_SITE_WINDOWMAKER)
1087MASTER_SITE_WINDOWMAKER+= \
1088	ftp://ftp.windowmaker.info/pub/%SUBDIR%/ \
1089	ftp://ftp.uvsq.fr/pub/X11/window-managers/windowmaker/%SUBDIR%/
1090.endif
1091
1092.if !defined(IGNORE_MASTER_SITE_XCONTRIB)
1093MASTER_SITE_XCONTRIB+= \
1094	ftp://ftp.gwdg.de/pub/x11/x.org/contrib/%SUBDIR%/
1095.endif
1096
1097.if !defined(IGNORE_MASTER_SITE_XFCE)
1098_XFCE_PATH=	${DISTNAME:S/-${DISTVERSIONFULL}//:tl}/${DISTVERSION:C/^([0-9]+\.[0-9]+).*/\1/}
1099
1100MASTER_SITE_XFCE+= \
1101	https://archive.xfce.org/src/%SUBDIR%/${_XFCE_PATH}/ \
1102	https://mirror.netcologne.de/xfce/src/%SUBDIR%/${_XFCE_PATH}/ \
1103	https://ftp.cixug.es/xfce/src/%SUBDIR%/${_XFCE_PATH}/ \
1104	https://archive.be.xfce.org/src/%SUBDIR%/${_XFCE_PATH}/ \
1105	https://archive.al-us.xfce.org/src/%SUBDIR%/${_XFCE_PATH}/
1106.endif
1107
1108.if !defined(IGNORE_MASTER_SITE_XORG)
1109MASTER_SITE_XORG+= \
1110	https://xorg.freedesktop.org/releases/%SUBDIR%/ \
1111	https://mirror.csclub.uwaterloo.ca/x.org/%SUBDIR%/ \
1112	https://artfiles.org/x.org/pub/%SUBDIR%/ \
1113	https://ftp.gwdg.de/pub/x11/x.org/pub/%SUBDIR%/ \
1114	https://mirrors.ircam.fr/pub/x.org/%SUBDIR%/ \
1115	https://www.mirrorservice.org/sites/ftp.x.org/pub/%SUBDIR%/ \
1116	https://ftp.yz.yamagata-u.ac.jp/pub/X11/x.org/%SUBDIR%/ \
1117	http://ftp.kaist.ac.kr/x.org/%SUBDIR%/
1118.endif
1119
1120.if !defined(IGNORE_MASTER_SITE_KERNEL_ORG)
1121MASTER_SITE_KERNEL_ORG+= \
1122	https://cdn.kernel.org/pub/%SUBDIR%/ \
1123	https://www.kernel.org/pub/%SUBDIR%/ \
1124	https://mirrors.mit.edu/kernel/%SUBDIR%/ \
1125	http://ftp.nara.wide.ad.jp/pub/kernel.org/%SUBDIR%/ \
1126	http://ftp.yandex.ru/pub/%SUBDIR%/ \
1127	ftp://ftp.ntu.edu.tw/%SUBDIR%/ \
1128	ftp://ftp.riken.jp/Linux/kernel.org/%SUBDIR%/
1129.endif
1130
1131.if !defined(IGNORE_MASTER_SITE_ZI)
1132MASTER_SITE_ZI+= \
1133	https://ftpmirror.your.org/pub/zi/%SUBDIR%/ \
1134	https://mirrors.rit.edu/zi/%SUBDIR%/ \
1135	https://www.zi0r.com/mirrors/%SUBDIR%/ \
1136	${MASTER_SITE_FREEBSD_LOCAL:S/%SUBDIR%/zi/}
1137.endif
1138
1139# Macro magic
1140
1141MASTER_SITES_ABBREVS=	CPAN:PERL_CPAN \
1142			GH:GITHUB \
1143			GHC:GITHUB_CLOUD \
1144			LODEV:LIBREOFFICE_DEV \
1145			NL:NETLIB \
1146			RG:RUBYGEMS \
1147			SF:SOURCEFORGE
1148MASTER_SITES_SUBDIRS=	APACHE_COMMONS_BINARIES:${PORTNAME:S,commons-,,} \
1149			APACHE_COMMONS_SOURCE:${PORTNAME:S,commons-,,} \
1150			APACHE_JAKARTA:${PORTNAME:S,-,/,}/source \
1151			BERLIOS:${PORTNAME:tl}.berlios \
1152			CRATESIO:${PORTNAME}/${DISTVERSIONFULL} \
1153			DEBIAN:pool/main/${PORTNAME:C/^((lib)?.).*$/\1/}/${PORTNAME} \
1154			FARSIGHT:${PORTNAME} \
1155			FESTIVAL:${PORTVERSION} \
1156			GCC:releases/${DISTNAME} \
1157			GENTOO:distfiles \
1158			GIMP:${PORTNAME}/${PORTVERSION:R}/ \
1159			GITHUB:${GH_ACCOUNT}/${GH_PROJECT}/tar.gz/${GH_TAGNAME}?dummy=/ \
1160			GITHUB_CLOUD:${GH_ACCOUNT}/${GH_PROJECT}/ \
1161			GNOME:sources/${DISTNAME:S/-${DISTVERSIONFULL}$//} \
1162			GNU:${PORTNAME} \
1163			GNUPG:${PORTNAME} \
1164			GNU_ALPHA:${PORTNAME} \
1165			LIBREOFFICE_DEV:${PORTNAME} \
1166			MATE:${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/} \
1167			MOZDEV:${PORTNAME:tl} \
1168			NETLIB:${PORTNAME} \
1169			PERL_CPAN:${PORTNAME:C/-.*//} \
1170			PYPI:source/${DISTNAME:C/(.).*/\1/}/${DISTNAME:S/-${DISTVERSIONFULL}$//} \
1171			QT:archive/qt/${PORTVERSION:R} \
1172			SAMBA:${PORTNAME} \
1173			SAVANNAH:${PORTNAME:tl} \
1174			SOURCEFORGE:${PORTNAME:tl}/${PORTNAME:tl}/${PORTVERSION} \
1175			XFCE:xfce
1176
1177.if defined(MASTER_SITES) && ${MASTER_SITES:N*\:/*}
1178
1179.  for _site__ in ${MASTER_SITES}
1180_site_=${_site__}
1181.    if ${_site_:M*\:/*}
1182MASTER_SITES_EXP+=	${_site_}
1183MASTER_SITES_EXP:=	${MASTER_SITES_EXP}
1184.    else
1185_site_urlpath_=	${_site_:C@^(.*):[^/:]+$@\1@}
1186.      if ${_site_urlpath_:M*/*}
1187_site_url_=		${_site_urlpath_:C@^([^/]+)/.*$@\1@}
1188_site_subdir_=	${_site_urlpath_:S/^${_site_urlpath_:C@^([^/]+)/.*$@\1@}//:S!^/!!:S!/$!!}
1189.      else
1190_site_url_=		${_site_urlpath_}
1191.undef _site_subdir_
1192.      endif
1193_site_group_=	${_site_:S/^${_site_:C@^(.*):[^/:]+$@\1@}//:S/^://}
1194.      for _abbrev_ in ${MASTER_SITES_ABBREVS}
1195.        if ${_site_url_} == ${_abbrev_:C/:.*//}
1196_site_url_=	${_abbrev_:C/.*://}
1197.        endif
1198.      endfor
1199.      if !defined(MASTER_SITE_SUBDIR)
1200.        for _subdir_ in ${MASTER_SITES_SUBDIRS}
1201.          if ${_site_url_} == ${_subdir_:C/:.*//}
1202_site_subdir_?=	${_subdir_:C/.*://}
1203.          endif
1204.        endfor
1205.      endif
1206.      ifdef MASTER_SITE_${_site_url_}
1207.        ifdef _site_subdir_
1208MASTER_SITES_EXP+=	${MASTER_SITE_${_site_url_}:S^%SUBDIR%^${_site_subdir_}^:S/$/:${_site_group_}/:S/:$//}
1209.        else
1210MASTER_SITES_EXP+=	${MASTER_SITE_${_site_url_}:S/$/:${_site_group_}/:S/:$//}
1211.        endif
1212MASTER_SITES_EXP:=	${MASTER_SITES_EXP}
1213.      endif
1214.    endif
1215.  endfor
1216MASTER_SITES=	${MASTER_SITES_EXP}
1217
1218.endif
1219
1220.if defined(PATCH_SITES) && ${PATCH_SITES:N*\:/*}
1221
1222.  for _site__ in ${PATCH_SITES}
1223_site_=${_site__}
1224.    if ${_site_:M*\:/*}
1225PATCH_SITES_EXP+=	${_site_}
1226PATCH_SITES_EXP:=	${PATCH_SITES_EXP}
1227.    else
1228_site_urlpath_=	${_site_:C@^(.*):[^/:]+$@\1@}
1229.      if ${_site_urlpath_:M*/*}
1230_site_url_=		${_site_urlpath_:C@^([^/]+)/.*$@\1@}
1231_site_subdir_=	${_site_urlpath_:S/^${_site_urlpath_:C@^([^/]+)/.*$@\1@}//:S!^/!!:S!/$!!}
1232.      else
1233_site_url_=		${_site_urlpath_}
1234.undef _site_subdir_
1235.      endif
1236_site_group_=	${_site_:S/^${_site_:C@^(.*):[^/:]+$@\1@}//:S/^://}
1237.      for _abbrev_ in ${MASTER_SITES_ABBREVS}
1238.        if ${_site_url_} == ${_abbrev_:C/:.*//}
1239_site_url_=	${_abbrev_:C/.*://}
1240.        endif
1241.      endfor
1242.      if !defined(MASTER_SITE_SUBDIR)
1243.        for _subdir_ in ${MASTER_SITES_SUBDIRS}
1244.          if ${_site_url_} == ${_subdir_:C/:.*//}
1245_site_subdir_?=	${_subdir_:C/.*://}
1246.          endif
1247.        endfor
1248.      endif
1249.      ifdef MASTER_SITE_${_site_url_}
1250.        ifdef _site_subdir_
1251PATCH_SITES_EXP+=	${MASTER_SITE_${_site_url_}:S^%SUBDIR%^${_site_subdir_}^:S/$/:${_site_group_}/:S/:$//}
1252.        else
1253PATCH_SITES_EXP+=	${MASTER_SITE_${_site_url_}:S/$/:${_site_group_}/:S/:$//}
1254.        endif
1255PATCH_SITES_EXP:=	${PATCH_SITES_EXP}
1256.      endif
1257.    endif
1258.  endfor
1259PATCH_SITES=	${PATCH_SITES_EXP}
1260
1261.endif
1262