summaryrefslogtreecommitdiffstats
path: root/source.mk
blob: f946eeab158d532d4f8a876689e513b84b52f9c9 (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
non_free_files = \
	gdb/doc/gdb.texinfo \
	gdb/doc/gdb.info*

upstream_version = $$(printf '%s\n' '$(OPK_SOURCE_VERSION_UPSTREAM)' | \
	sed 's/^\([0-9a-z.~-][0-9a-z.~-]*\)+sip[1-9][0-9]*.*$$/\1/')
upstream_name = $(OPK_SOURCE)-$(upstream_version)
upstream_archive = $(upstream_name).tar.bz2
upstream_url = http://ftp.gnu.org/gnu/$(OPK_SOURCE)/$(upstream_archive)
source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.bz2
keys = FF325CF3

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

source: $(source_archive)