Newer
Older
tools-builder / makefile
  1. # Produce standard tools tarballs using linuxbrew
  2.  
  3. # Customize the variables as desired
  4.  
  5. # Software depot to archive releases
  6. DEPOT = depot@slice.tundraware.com:/opt/depot/
  7.  
  8. # Where to store build tarballs
  9. EXPORTDIR = /shared
  10.  
  11. # Where tools directory lives
  12. INSTALLDIR = /opt/TundraWare
  13.  
  14. # Name of the tools directory
  15. TOOLS = tools
  16.  
  17. # Things that have to be built during the bootstrap phase with system tools
  18. BOOTSTRAP = gcc glibc make
  19.  
  20. # Languages to install after bootstrap but before other packages
  21. LANGS = go perl python
  22.  
  23. # Stuff we want pip to install
  24. PIPMODULES = pip ansible pew pythonz-bd
  25.  
  26. # Set of packages we want to include in the distribution tarball
  27. MYTOOLS = bash-completion emacs file-formula git htop nload nmap screen socat source-highlight the_silver_searcher tmux tree vim
  28.  
  29.  
  30. # ----------- Nothing below here should need changing ----------- #
  31.  
  32. TOOLSDIR = ${INSTALLDIR}/${TOOLS}
  33. BREW = ${TOOLSDIR}/bin/brew -v
  34. DATESTAMP = $(shell date +%Y%m%d)
  35. FULLDATE = $(shell date)
  36. GITREVISION = $(shell git log -1 | head -n3)
  37.  
  38. # Get latest linuxbrew
  39.  
  40. getbrew:
  41. @echo "Make sure you have write permission on the target directory!"
  42. git clone https://github.com/Homebrew/brew ${TOOLSDIR}
  43.  
  44.  
  45. # Bootstrapping
  46.  
  47. bootstrap-build:
  48. @echo "Make sure you have the OS development tools installed!"
  49. sudo yum -y install texinfo
  50. ${BREW} install --verbose ${BOOTSTRAP}
  51.  
  52. bootstrap-release: tidyup
  53. echo "${FULLDATE}" > ${TOOLSDIR}/tools-builder.bootstrap.datetime
  54. echo "${GITREVISION}" > ${TOOLSDIR}/tools-builder.bootstrap.gitrevision
  55. cd ${INSTALLDIR} && mv -v ${TOOLS} ${TOOLS}-bootstrap-${DATESTAMP}
  56. cd ${INSTALLDIR} && tar -czvf ${EXPORTDIR}/${TOOLS}-bootstrap-${DATESTAMP}.tar.gz ${TOOLS}-bootstrap-${DATESTAMP}
  57. cd ${INSTALLDIR} && mv -v ${TOOLS}-bootstrap-${DATESTAMP} ${TOOLS}
  58.  
  59.  
  60. # Full tools set
  61.  
  62. full-build:
  63. @echo "Make sure the bootstrap is installed at ${TOOLSDIR}"
  64. sudo yum -y install autoconf automake patch perl texinfo
  65. ${BREW} install --verbose ${LANGS}
  66. ln -nfs ${TOOLSDIR}/bin/python3 ${TOOLSDIR}/bin/python
  67. ln -nfs ${TOOLSDIR}/bin/pip3 ${TOOLSDIR}/bin/pip
  68. pip install ${PIPMODULES} -U --ignore-installed
  69. ${BREW} install --verbose ${MYTOOLS}
  70. ln -nfs ${TOOLSDIR}/bin/vim ${TOOLSDIR}/bin/vi
  71.  
  72. full-release: tidyup
  73. echo "${FULLDATE}" > ${TOOLSDIR}/tools-builder.full.datetime
  74. echo "${GITREVISION}" > ${TOOLSDIR}/tools-builder.full.gitrevision
  75. cd ${INSTALLDIR} && mv -v ${TOOLS} ${TOOLS}-${DATESTAMP}
  76. cd ${INSTALLDIR} && tar -czvf ${EXPORTDIR}/${TOOLS}-${DATESTAMP}.tar.gz ${TOOLS}-${DATESTAMP}
  77. cd ${INSTALLDIR} && mv -v ${TOOLS}-${DATESTAMP} ${TOOLS}
  78.  
  79. upgrade:
  80. echo "${FULLDATE}" > ${TOOLSDIR}/tools-builder.upgrade.datetime
  81. echo "${GITREVISION}" > ${TOOLSDIR}/tools-builder.upgrade.gitrevision
  82. brew update
  83. brew upgrade
  84. pip install ${PIPMODULES} -U --ignore-installed
  85.  
  86.  
  87. # Housekeeping
  88.  
  89. push-release:
  90. scp ${EXPORTDIR}/${TOOLS}-${DATESTAMP}.tar.gz ${DEPOT}
  91.  
  92. tidyup:
  93. ${BREW} config
  94. ${BREW} cleanup
  95. -${BREW} doctor
  96.  
  97. clean:
  98. cd ${INSTALLDIR} && rm -vrf ${TOOLS} ${TOOLS}-bootstrap-${DATESTAMP} ${TOOLS}-${DATESTAMP}