fluidd-9999.ebuild 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright 2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. HOMEPAGE="https://docs.fluidd.xyz"
  5. DESCRIPTION="A free and open-source Klipper web interface for managing your 3d printer."
  6. inherit git-r3
  7. EGIT_REPO_URI="https://github.com/fluidd-core/${PN}"
  8. EGIT_BRANCH="develop"
  9. KEYWORDS=""
  10. LICENSE="GPL-3"
  11. SLOT="0"
  12. IUSE=""
  13. BDEPEND="
  14. net-libs/nodejs[npm]
  15. "
  16. RDEPEND="
  17. app-misc/moonraker
  18. www-servers/nginx
  19. "
  20. RESTRICT="mirror"
  21. S=${WORKDIR}/${P}
  22. NPM_FLAGS=(
  23. --audit false
  24. --color false
  25. --foreground-scripts
  26. --progress false
  27. --save false
  28. --verbose
  29. --cache "${T}/npm-cache"
  30. --target_arch="${ARCH}"
  31. --target_libc="${ELIBC}"
  32. --target_platform="${KERNEL}"
  33. --no-update-notifier
  34. )
  35. src_prepare() {
  36. default
  37. npm "${NPM_FLAGS[@]}" install vite || die "npm install failed"
  38. }
  39. src_compile() {
  40. PATH="${PATH}:$S/node_modules/.bin" NODE_ENV=production vite build || die "vite build failed"
  41. }
  42. src_install() {
  43. dodir /usr/share/${PN}
  44. cp -R dist/* "${ED}"/usr/share/"${PN}" || die "Copy files failed"
  45. insinto /etc/klipper
  46. doins "${FILESDIR}/config.json"
  47. dosym ../../../etc/klipper/config.json /var/www/${PN}/config.json
  48. insinto /etc/nginx/conf.d
  49. doins "${FILESDIR}"/fluidd.conf "${FILESDIR}"/upstreams.conf "${FILESDIR}"/common_vars.conf
  50. }
  51. pkg_postinst() {
  52. echo
  53. elog "Adapt /etc/klipper/config.json to your needs"
  54. }