ipfs.mk 3.45 KB
Newer Older
1 2 3 4 5 6 7 8
# This file contains quick phony targets to build IPFS packages

ARCH ?= amd64
OS ?= linux

IPFS_VERSION=$(shell curl https://dist.ipfs.io/go-ipfs/versions | tail -n 1)
NUMBER_IPFS_VERSION=$(shell echo ${IPFS_VERSION} | sed 's/v//')

9 10 11
EMAIL ?= "hello@siderus.io"
DEBFULLNAME ?= "Siderus OU"

12 13 14 15 16 17 18 19 20 21 22 23
download_ipfs:
	mkdir -p build/orig/
	curl -L --output build/orig/ipfs-${IPFS_VERSION}-${ARCH}.tar.gz \
		https://dist.ipfs.io/go-ipfs/${IPFS_VERSION}/go-ipfs_${IPFS_VERSION}_${OS}-${ARCH}.tar.gz
.PHONY: download_ipfs

unpack_ipfs: download_ipfs
	rm -rf build/source/
	mkdir -p build/source/
	tar -xvzf build/orig/ipfs-${IPFS_VERSION}-${ARCH}.tar.gz -C build/source/
.PHONY: unpack_ipfs

24
prepare_ipfs_deb: unpack_ipfs
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
	mkdir -p build/ipfs-${NUMBER_IPFS_VERSION}
	cp -aR source/ipfs.deb/* build/ipfs-${NUMBER_IPFS_VERSION}/
	@echo "Source: ipfs" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Section: misc" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Priority: optional" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Maintainer: ${DEBFULLNAME} <${EMAIL}>" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Build-Depends: debhelper (>= 9)" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Standards-Version: ${NUMBER_IPFS_VERSION}" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Package: ipfs" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	# @echo "Depends: " >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Version: ${NUMBER_IPFS_VERSION}" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Maintainer: ${DEBFULLNAME} <${EMAIL}>" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Architecture: ${ARCH}" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "Description: IPFS is a global, versioned, peer-to-peer filesystem." >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "  It combines good ideas from Git, BitTorrent, Kademlia," >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "  SFS, and the Web. It is like a single bittorrent swarm," >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "  exchanging git objects. IPFS provides an interface as" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "  simple as the HTTP web, but with permanence built in." >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "  You can also mount the world at /ipfs." >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
	@echo "  This package is maintained and distributed by Siderus." >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/control
46
	# Building the changelog
47 48 49 50 51 52
	@echo "ipfs (${NUMBER_IPFS_VERSION}) internal; urgency=low" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/changelog
	@echo "  " >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/changelog
	@echo "  This package has been built by Siderus using an automation pipeline. Please" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/changelog
	@echo "  refer to the official go-ipfs changelog for more information" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/changelog
	@echo "  " >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/changelog
	@echo " -- ${DEBFULLNAME} <${EMAIL}>  $(shell date -R)" >> build/ipfs-${NUMBER_IPFS_VERSION}/debian/changelog
53
	# Move the source here
54
	cp -aR build/source/go-ipfs build/ipfs-${NUMBER_IPFS_VERSION}/
55 56
.PHONY: prepare_ipfs_deb

57
build_ipfs_deb: prepare_ipfs_deb
58
	cd build/ipfs-${NUMBER_IPFS_VERSION} ;\
59
	dpkg-buildpackage -us -uc -d
60
.PHONY: build_ipfs_deb