Newer
Older
tools-builder / makefile
# Produce standard tools tarballs using linuxbrew

# Customize the variables as desired

# Software depot to archive releases
DEPOT = depot@slice.tundraware.com:/opt/depot/

# Where to store build tarballs
EXPORTDIR = /shared

# Where tools directory lives
INSTALLDIR = /opt/TundraWare

# Name of the tools directory
TOOLS = tools

# Things that have to be built during the bootstrap phase with system tools
BOOTSTRAP = gcc glibc make

# Languages to install after bootstrap but before other packages
LANGS = go perl python

# Stuff we want pip to install
PIPMODULES = pip ansible pew pythonz-bd

# Set of packages we want to include in the distribution tarball
MYTOOLS = bash-completion emacs file-formula git htop nload nmap screen socat source-highlight the_silver_searcher tmux tree vim


# ----------- Nothing below here should need changing ----------- #

TOOLSDIR = ${INSTALLDIR}/${TOOLS}
BREW = ${TOOLSDIR}/bin/brew -v
DATESTAMP = $(shell date +%Y%m%d)

# Get latest linuxbrew

getbrew:
	@echo "Make sure you have write permission on the target directory!"
	git clone https://github.com/Homebrew/brew ${TOOLSDIR}


# Bootstrapping

bootstrap-build:
	@echo "Make sure you have the OS development tools installed!"
	sudo yum -y install texinfo
	${BREW} install ${BOOTSTRAP}

bootstrap-release: tidyup
	cd ${INSTALLDIR} && mv -v ${TOOLS} ${TOOLS}-bootstrap-${DATESTAMP}
	cd ${INSTALLDIR} && tar -czvf ${EXPORTDIR}/${TOOLS}-bootstrap-${DATESTAMP}.tar.gz ${TOOLS}-bootstrap-${DATESTAMP}
	cd ${INSTALLDIR} && mv -v ${TOOLS}-bootstrap-${DATESTAMP} ${TOOLS}


# Full tools set

full-build:
	@echo "Make sure the bootstrap is installed at ${TOOLSDIR}"
	sudo yum -y install autoconf automake patch perl texinfo
	${BREW} install ${LANGS}
	ln -nfs ${INSTALLDIR}/${TOOLS}/bin/python3 ${INSTALLDIR}/${TOOLS}/bin/python
	ln -nfs ${INSTALLDIR}/${TOOLS}/bin/pip3 ${INSTALLDIR}/${TOOLS}/bin/pip
	pip install ${PIPMODULES} -U --ignore-installed
	${BREW} install ${MYTOOLS}
	ln -nfs ${INSTALLDIR}/${TOOLS}/bin/vim ${INSTALLDIR}/${TOOLS}/bin/vi

full-release: tidyup
	cd ${INSTALLDIR} && mv -v ${TOOLS} ${TOOLS}-${DATESTAMP}
	cd ${INSTALLDIR} && tar -czvf ${EXPORTDIR}/${TOOLS}-${DATESTAMP}.tar.gz ${TOOLS}-${DATESTAMP}
	cd ${INSTALLDIR} && mv -v ${TOOLS}-${DATESTAMP} ${TOOLS}

upgrade:
	brew update
	brew upgrade
	pip install ${PIPMODULES} -U --ignore-installed


# Housekeeping

push-release:
	scp ${EXPORTDIR}/${TOOLS}-${DATESTAMP}.tar.gz ${DEPOT}

tidyup:
	${BREW} config
	${BREW} cleanup
	-${BREW} doctor

clean:
	cd ${INSTALLDIR} && rm -vrf ${TOOLS} ${TOOLS}-bootstrap-${DATESTAMP} ${TOOLS}-${DATESTAMP}