summaryrefslogtreecommitdiffstats
path: root/source.mk
blob: eff708f02487fda02027aef09c130af8e4d83eba (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
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.xz
upstream_url = http://ftp.gnu.org/gnu/gcc/$(upstream_name)/$(upstream_archive)
source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.bz2

gpg = GNUPGHOME=gnupghome/ gpg --no-default-keyring --keyring ../keyring.gpg
keys = \
	'B215 C163 3BCA 0477 615F  1B35 A5B3 A004 745C 015A' \
	'B3C4 2148 A44E 6983 B3E4  CC07 93FA 9B1A B75C 61B8' \
	'90AA 4704 69D3 965A 87A5  DCB4 94D0 3953 902C 9419' \
	'80F9 8B2E 0DAB 6C82 81BD  F541 A7C8 C3B2 F71E DF1C' \
	'7F74 F97C 1034 68EE 5D75  0B58 3AB0 0996 FC26 A641' \
	'33C2 35A3 4C46 AA3F FB29  3709 A328 C3A2 C3C4 5C06'

$(source_archive):
	wget -c "$(upstream_url)" "$(upstream_url).sig"
	install -m 0700 -d gnupghome/
	[ -e ../keyring.gpg ] || \
		$(gpg) --keyserver hkp://pool.sks-keyservers.net \
			--recv-keys $(keys); \
	rm -f ../keyring.gpg~; \
	if ! $(gpg) --verify "$(upstream_archive).sig" "$(upstream_archive)"; \
	then \
		rm -Rf gnupghome/; \
		exit 1; \
	fi
	rm -Rf gnupghome/
	tar -xJf "$(upstream_archive)"
	rm -f "$(upstream_archive)" "$(upstream_archive).sig"
	rm -Rf "$(upstream_name)/zlib/"; \
	for file in $(non_free_files); do \
		rm -f "$(upstream_name)/$${file}"; \
	done
	for file in $(needed_files); do \
		>"$(upstream_name)/$${file}"; \
	done
	cp -p "$(upstream_name)/COPYING.RUNTIME" ..
	tar -cjf '$(source_archive)' "$(upstream_name)"
	mv "$(upstream_name)" src/

source: $(source_archive)