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

ARCH ?= amd64
OS ?= linux

6 7 8 9 10 11 12
ifeq ($(ARCH),amd64)
	DEB_ARCH := amd64
endif
ifeq ($(ARCH),arm)
	DEB_ARCH := armhf
endif

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

16 17 18
EMAIL ?= "hello@siderus.io"
DEBFULLNAME ?= "Siderus OU"

19
_download_ipfs:
20 21 22
	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
23
.PHONY: _download_ipfs
24

25
_unpack_ipfs: _download_ipfs
26 27 28
	rm -rf build/source/go-ipfs/${ARCH}
	mkdir -p build/source/go-ipfs/${ARCH}
	tar -xvzf build/orig/ipfs-${IPFS_VERSION}-${ARCH}.tar.gz -C build/source/go-ipfs/${ARCH}
29
.PHONY: _unpack_ipfs
30

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

63
_build_ipfs_deb_package: _prepare_ipfs_deb
64 65
	cd build/deb/${DEB_ARCH}/ipfs-${NUMBER_IPFS_VERSION} ;\
	dpkg-buildpackage -us -uc -d --host-arch ${DEB_ARCH}
66 67 68 69
.PHONY: ipfs_deb_package

deb_ipfs_%:
	$(MAKE) clean_build _build_ipfs_deb_package collect_deb_packages -e ARCH=$$(echo "$@" | sed "s/deb_ipfs_//g")