summaryrefslogtreecommitdiffstats
path: root/source.mk
blob: 6f24951cdf1abb265f7a1c84507e68b14a9e8222 (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
non_free_files = \
	gcc/doc/fsf-funding.7 \
	gcc/doc/g++.1 \
	gcc/doc/gcc.1 \
	gcc/doc/gcc.info \
	gcc/doc/gccint.info \
	gcc/doc/gccint.texi \
	gcc/doc/gcc.texi \
	gcc/doc/gcov.1 \
	gcc/doc/gcov.texi \
	gcc/doc/gfortran.1 \
	gcc/doc/include/funding.texi \
	gcc/doc/invoke.texi \
	gcc/fortran/gfc-internals.texi \
	gcc/fortran/gfortran.info \
	gcc/fortran/gfortran.texi \
	gcc/fortran/intrinsic.texi \
	gcc/fortran/invoke.texi \
	libgomp/libgomp.info \
	libgomp/libgomp.texi
needed_files = \
	gcc/doc/gcc.texi \
	gcc/doc/invoke.texi \
	gcc/doc/gcov.texi \
	gcc/doc/include/funding.texi \
	gcc/doc/gccint.texi \
	libgomp/libgomp.texi

upstream_name = gcc-$$(printf '%s\n' '$(OPK_SOURCE_VERSION_UPSTREAM)' | \
	sed 's/^\([0-9a-z.~-][0-9a-z.~-]*\)+sip[1-9][0-9]*.*$$/\1/')
upstream_archive = $(upstream_name).tar.bz2
upstream_url = http://ftp.gnu.org/gnu/gcc/$(upstream_name)/$(upstream_archive)
source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.bz2
gcc_keys = 745C015A B75C61B8 902C9419 F71EDF1C FC26A641 C3C45C06

$(source_archive):
	wget "$(upstream_url)"
	if gpg --version >/dev/null 2>&1; then \
		wget "$(upstream_url).sig" && \
		{ \
			[ -e ../gcc-keyring.gpg ] || \
			gpg --keyring ../gcc-keyring.gpg --no-default-keyring \
				--recv-keys $(gcc_keys); \
		} && \
		gpg --verify --keyring ../gcc-keyring.gpg \
			"$(upstream_archive).sig" || \
		exit ${?}; \
	fi
	tar -xjf "$(upstream_archive)"
	for file in $(non_free_files); do \
		rm -f "$(upstream_name)/$${file}"; \
	done
	for file in $(needed_files); do \
		>"$(upstream_name)/$${file}"; \
	done
	tar -cjf '$(source_archive)' "$(upstream_name)"
	rm -Rf "$(upstream_name)"
	rm -f "$(upstream_archive)"

source: $(source_archive)