logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

kuroshiro-analyzer-mecab-1.0.0.ebuild (1020B)


  1. # Copyright 2023 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit nodejs
  5. DESCRIPTION="Mecab morphological analyzer for kuroshiro"
  6. HOMEPAGE="https://github.com/hexenq/kuroshiro-analyzer-mecab"
  7. SRC_URI="https://github.com/hexenq/kuroshiro-analyzer-mecab/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
  8. LICENSE="MIT"
  9. SLOT="0"
  10. KEYWORDS="~amd64"
  11. IUSE=""
  12. BDEPEND="dev-util/esbuild"
  13. RDEPEND="dev-nodejs/mecab-async"
  14. RESTRICT="test" # Uses jest
  15. src_prepare() {
  16. default
  17. #sed -i '/"module":/a"type": "module",' package.json || die
  18. # Can't import node:child_process, only require()
  19. sed -i \
  20. -e 's;^import Mecab from "mecab-async";const Mecab = require("mecab-async");' \
  21. -e 's;export default ;module.exports = ;' \
  22. src/index.js || die
  23. }
  24. src_compile() {
  25. # Uses babel by default, let's use esbuild for now instead to create a similar result
  26. esbuild --bundle src/index.js --outdir=lib --minify --sourcemap --platform=node || die
  27. }