summaryrefslogtreecommitdiffstats
path: root/source.mk
blob: f8948c66c572f26433246f7b9755d0eec262fc4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
upstream_commit = $$(printf '%s\n' '$(OPK_SOURCE_VERSION_UPSTREAM)' | \
	sed 's/^.*~git........~\([0-9a-f]*\).*$$/\1/')
upstream_url_base = https://github.com/qca/open-ath9k-htc-firmware
upstream_url = $(upstream_url_base)/archive/$(upstream_commit).tar.gz
source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.gz

$(source_archive):
	wget -O '$@' "$(upstream_url)"

source: $(source_archive)
	set -e; \
	dir="$$(tar -tzf $(source_archive) | head -n 1 )"; \
	tar -xzOf $(source_archive) "$${dir%%/*}/Makefile" >Makefile; \
	printf '\ntoolchain-dl:\n' >>Makefile; \
	for pkg in GMP MPFR MPC BINUTILS GCC; do \
		printf '\twget -c -P ../toolchain/ $$(%s_URL)\n' "$${pkg}" \
			>>Makefile; \
	done; \
	make toolchain-dl; \
	rm Makefile