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 make curl git
  19.  
  20. # Support and 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 mutagen docutils
  25.  
  26. # Set of packages we want to include in the distribution tarball
  27. MYTOOLS = file-formula gawk gnu-tar htop nload nmap screen socat source-highlight ripgrep 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. all: clean getbrew bootstrap-build bootstrap-release full-build full-release
  39.  
  40.  
  41. # Get latest linuxbrew
  42.  
  43. getbrew:
  44. @echo "Make sure you have write permission on the target directory!"
  45. git clone https://github.com/Homebrew/brew ${TOOLSDIR}
  46.  
  47.  
  48. # Bootstrapping
  49.  
  50. bootstrap-build:
  51. ulimit -n 65535
  52. @echo "Make sure you have the OS development tools installed!"
  53. # sudo yum -y install texinfo
  54. ${BREW} install --verbose ${BOOTSTRAP}
  55. # ${BREW} reinstall -s --verbose curl
  56.  
  57.  
  58. bootstrap-release: tidyup
  59. echo "${FULLDATE}" >> ${TOOLSDIR}/tools-builder.bootstrap.datetime
  60. echo "${GITREVISION}" >> ${TOOLSDIR}/tools-builder.bootstrap.gitrevision
  61. cd ${INSTALLDIR} && mv -v ${TOOLS} ${TOOLS}-bootstrap-${DATESTAMP}
  62. cd ${INSTALLDIR} && tar -czvf ${EXPORTDIR}/${TOOLS}-bootstrap-${DATESTAMP}.tar.gz ${TOOLS}-bootstrap-${DATESTAMP}
  63. cd ${INSTALLDIR} && mv -v ${TOOLS}-bootstrap-${DATESTAMP} ${TOOLS}
  64.  
  65.  
  66. # Full tools set
  67.  
  68. full-build:
  69. # Do some housekeeping
  70. ulimit -n 65535
  71.  
  72. @echo "Make sure the bootstrap is installed at ${TOOLSDIR}"
  73. # sudo yum -y install autoconf automake patch perl texinfo
  74. brew unlink util-linux
  75.  
  76. brew unlink tcl-tk
  77. brew unlink util-linux
  78. ${BREW} install -s --verbose ${LANGS}
  79. ${BREW} link --verbose python
  80. ln -nfs ${TOOLSDIR}/bin/python3 ${TOOLSDIR}/bin/python
  81. ln -nfs ${TOOLSDIR}/bin/pip3 ${TOOLSDIR}/bin/pip
  82. pip install ${PIPMODULES} -U --ignore-installed
  83. brew link tcl-tk
  84. brew link util-linux
  85. ${BREW} install -s --verbose ${MYTOOLS}
  86. ln -nfs ${TOOLSDIR}/bin/vim ${TOOLSDIR}/bin/vi
  87.  
  88. ${BREW} install -s --verbose the_silver_searcher
  89.  
  90. full-release: tidyup
  91. echo "${FULLDATE}" >> ${TOOLSDIR}/tools-builder.full.datetime
  92. echo "${GITREVISION}" >> ${TOOLSDIR}/tools-builder.full.gitrevision
  93. cd ${INSTALLDIR} && mv -v ${TOOLS} ${TOOLS}-${DATESTAMP}
  94. cd ${INSTALLDIR} && tar -czvf ${EXPORTDIR}/${TOOLS}-${DATESTAMP}.tar.gz ${TOOLS}-${DATESTAMP}
  95. cd ${INSTALLDIR} && mv -v ${TOOLS}-${DATESTAMP} ${TOOLS}
  96.  
  97. upgrade:
  98. echo "${FULLDATE}" >> ${TOOLSDIR}/tools-builder.upgrade.datetime
  99. echo "${GITREVISION}" >> ${TOOLSDIR}/tools-builder.upgrade.gitrevision
  100. brew update
  101. brew upgrade
  102. brew unlink python
  103. brew link --overwrite python
  104. pip install ${PIPMODULES} -U --ignore-installed
  105.  
  106. insecure:
  107. echo insecure >> ~/.curlrc
  108. git config --global http.sslVerify false
  109.  
  110.  
  111. # Housekeeping
  112.  
  113. push-release:
  114. scp ${EXPORTDIR}/${TOOLS}-${DATESTAMP}.tar.gz ${DEPOT}
  115.  
  116. tidyup:
  117. ${BREW} config
  118. ${BREW} cleanup
  119. -${BREW} doctor
  120.  
  121. clean:
  122. cd ${INSTALLDIR} && rm -vrf ${TOOLS} ${TOOLS}-bootstrap-${DATESTAMP} ${TOOLS}-${DATESTAMP}