Build and deploy user-facing frontend (gitea)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

122 lines
3.8 KiB

  1. HOSTNAME_FQDN := codeberg-test.org
  2. export PATCHDIR := ${PWD}/local_patches
  3. export BUILDDIR := ${PWD}/build
  4. export GOROOT := ${BUILDDIR}/go
  5. export GOPATH := ${BUILDDIR}/gitea
  6. export PATH := ${GOROOT}/bin:${GOPATH}/bin:${PATH}
  7. GOTAR = go1.15.2.$(shell uname | tr [:upper:] [:lower:])-amd64.tar.gz
  8. ORIGIN = https://codeberg.org/Codeberg/gitea
  9. GITEA_BRANCH := codeberg-test
  10. IMAGE_PREFIX = etc/gitea/public/img
  11. IMAGES = \
  12. ${IMAGE_PREFIX}/logo.svg \
  13. ${IMAGE_PREFIX}/logo-small.svg \
  14. ${IMAGE_PREFIX}/logo-medium.svg \
  15. ${IMAGE_PREFIX}/favicon.ico \
  16. ${IMAGE_PREFIX}/favicon.png \
  17. ${IMAGE_PREFIX}/codeberg.png \
  18. ${IMAGE_PREFIX}/gitea-sm.png \
  19. ${IMAGE_PREFIX}/gitea-lg.png \
  20. ${IMAGE_PREFIX}/gitea-safari.svg
  21. MATHJAX = etc/gitea/public/mathjax
  22. THREEJS = etc/gitea/public/three.js
  23. TARGETS = \
  24. ${IMAGES} \
  25. ${MATHJAX} \
  26. ${THREEJS} \
  27. ${GOPATH}/bin/gitea
  28. all : ${TARGETS}
  29. images : ${IMAGES}
  30. ${GOPATH}/bin/gitea : ${GOPATH}/src/code.gitea.io/gitea
  31. TAGS=bindata make -j1 -C $< build install
  32. ${GOPATH}/src/code.gitea.io/gitea : ${GOROOT}/bin/go
  33. ${GOROOT}/bin/go get -d -u -v code.gitea.io/gitea
  34. ( cd $@ && git remote rename origin github-gitea )
  35. ( cd $@ && git remote add origin ${ORIGIN} )
  36. ( cd $@ && git fetch origin)
  37. ( cd $@ && git checkout origin/${GITEA_BRANCH} )
  38. ( cd $@ && cat $(wildcard ${PATCHDIR}/*.diff) | patch -p1 )
  39. ( cd $@ && cp -v contrib/options/label/Advanced options/label/Advanced )
  40. ( cd $@ && find . -type f -print0 | xargs -0 sed -i 's/\/sign_up/\/sing_up/g' )
  41. ${GOROOT}/bin/go :
  42. mkdir -p ${GOROOT}/Downloads
  43. wget -c --no-verbose --directory-prefix=${GOROOT}/Downloads https://dl.google.com/go/${GOTAR}
  44. tar xfz ${GOROOT}/Downloads/${GOTAR} -C ${BUILDDIR}
  45. deployment : deploy-gitea
  46. deploy-gitea : ${GOPATH}/bin/gitea ${TARGETS}
  47. ssh root@${HOSTNAME_FQDN} mkdir -p /data/git/bin
  48. scp $< root@${HOSTNAME_FQDN}:/data/git/bin/gitea.new
  49. ./deployConfigFiles.sh ${HOSTNAME_FQDN}
  50. rsync -av -e ssh --delete --chown=www-data:www-data var/www/pages root@${HOSTNAME_FQDN}:/var/www/
  51. -ssh root@${HOSTNAME_FQDN} "/data/git/bin/gitea manager flush-queues"
  52. ssh root@${HOSTNAME_FQDN} "systemctl daemon-reload && systemctl stop gitea && mv /data/git/bin/gitea.new /data/git/bin/gitea && systemctl start gitea && systemctl enable gitea && systemctl status gitea"
  53. ${IMAGE_PREFIX}/logo.svg : codeberg.svg
  54. mkdir -p $(dir $@)
  55. cp -v $< $@
  56. ! which svgo || svgo -i $@ -o $@ --multipass
  57. ${IMAGE_PREFIX}/logo-medium.svg : codeberg-favicon.svg
  58. mkdir -p $(dir $@)
  59. cp -v $< $@
  60. ! which svgo || svgo -i $@ -o $@ --multipass
  61. ${IMAGE_PREFIX}/logo-small.svg : codeberg-white.svg
  62. mkdir -p $(dir $@)
  63. cp -v $< $@
  64. ! which svgo || svgo -i $@ -o $@ --multipass
  65. ${IMAGE_PREFIX}/favicon.png : ${IMAGE_PREFIX}/logo-medium.svg
  66. rsvg-convert -h 64 -o $@ $<
  67. ${IMAGE_PREFIX}/favicon.ico : ${IMAGE_PREFIX}/favicon.png
  68. convert -background none $< -define icon:auto-resize=64,48,32,24,16 $@
  69. ${IMAGE_PREFIX}/codeberg.png : ${IMAGE_PREFIX}/logo-medium.svg
  70. rsvg-convert -h 290 -o $@ $<
  71. ${IMAGE_PREFIX}/gitea-sm.png : ${IMAGE_PREFIX}/logo-medium.svg
  72. rsvg-convert -h 120 -o $@ $<
  73. ${IMAGE_PREFIX}/gitea-lg.png : ${IMAGE_PREFIX}/logo.svg
  74. rsvg-convert -w 1200 -o $@ $<
  75. ${IMAGE_PREFIX}/gitea-safari.svg : ${IMAGE_PREFIX}/logo-medium.svg
  76. cp -v $< $@
  77. ${MATHJAX} :
  78. mkdir -p ${BUILDDIR}
  79. git clone --depth=1 https://github.com/mathjax/MathJax.git ${BUILDDIR}/MathJax.git
  80. mv -v ${BUILDDIR}/MathJax.git/es5 $@
  81. rm -rf ${BUILDDIR}/MathJax.git
  82. ${THREEJS} :
  83. mkdir -p ${BUILDDIR}
  84. mkdir -p $@/examples/jsm
  85. git clone --depth=1 https://github.com/mrdoob/three.js.git ${BUILDDIR}/three.js.git
  86. mv -v ${BUILDDIR}/three.js.git/build $@/
  87. mv -v ${BUILDDIR}/three.js.git/examples/jsm/controls $@/examples/jsm/
  88. mv -v ${BUILDDIR}/three.js.git/examples/jsm/loaders $@/examples/jsm/
  89. rm -rf ${BUILDDIR}/three.js.git
  90. clean :
  91. ${MAKE} -C ${GOPATH}/src/code.gitea.io/gitea clean
  92. rm -rf ${TARGETS}
  93. realclean :
  94. rm -rf ${TARGETS}
  95. rm -rf ${BUILDDIR}