nerd-fonts-3.2.1.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # Copyright 2023-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit font
  5. DESCRIPTION="Collection of fonts that are patched to include a high number of glyphs (icons)."
  6. HOMEPAGE="https://www.nerdfonts.com/"
  7. # curl -s https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest \
  8. # | jq -r '.assets[].name | select(endswith(".tar.xz")) | split(".") | .[0] | select(test("(?i)symbolsonly") | not)'
  9. FONTS=(
  10. 0xProto
  11. 3270
  12. Agave
  13. AnonymousPro
  14. Arimo
  15. AurulentSansMono
  16. BigBlueTerminal
  17. BitstreamVeraSansMono
  18. CascadiaCode
  19. CascadiaMono
  20. CodeNewRoman
  21. ComicShannsMono
  22. CommitMono
  23. Cousine
  24. D2Coding
  25. DaddyTimeMono
  26. DejaVuSansMono
  27. DroidSansMono
  28. EnvyCodeR
  29. FantasqueSansMono
  30. FiraCode
  31. FiraMono
  32. GeistMono
  33. Go-Mono
  34. Gohu
  35. Hack
  36. Hasklig
  37. HeavyData
  38. Hermit
  39. iA-Writer
  40. IBMPlexMono
  41. Inconsolata
  42. InconsolataGo
  43. InconsolataLGC
  44. IntelOneMono
  45. Iosevka
  46. IosevkaTerm
  47. IosevkaTermSlab
  48. JetBrainsMono
  49. Lekton
  50. LiberationMono
  51. Lilex
  52. MartianMono
  53. Meslo
  54. Monaspace
  55. Monofur
  56. Monoid
  57. Mononoki
  58. MPlus
  59. Noto
  60. OpenDyslexic
  61. Overpass
  62. ProFont
  63. ProggyClean
  64. Recursive
  65. RobotoMono
  66. ShareTechMono
  67. SourceCodePro
  68. SpaceMono
  69. Terminus
  70. Tinos
  71. Ubuntu
  72. UbuntuMono
  73. UbuntuSans
  74. VictorMono
  75. ZedMono
  76. )
  77. iuse_src_uri() {
  78. local iuse="${1:?}"
  79. local name="${2:?}"
  80. local uri_prefix="https://github.com/ryanoasis/${PN}/releases/download/v${PV}"
  81. local ext=tar.xz
  82. echo "${iuse,,}? (
  83. ${uri_prefix}/${name}.${ext}
  84. -> ${PN}-${name}-${PV}.${ext}
  85. )"
  86. }
  87. nerd_src_uri() {
  88. for name; do
  89. iuse_src_uri "${name,,}" "${name}"
  90. done
  91. }
  92. SRC_URI="
  93. $(iuse_src_uri symbols-only NerdFontsSymbolsOnly)
  94. symbols-only? (
  95. https://github.com/ryanoasis/${PN}/raw/v${PV}/10-nerd-font-symbols.conf
  96. -> 10-nerd-font-symbols-${PV}.conf
  97. )
  98. $(nerd_src_uri "${FONTS[@]}")
  99. "
  100. S="${WORKDIR}"
  101. FONT_S="${S}"
  102. LICENSE="MIT"
  103. SLOT="0"
  104. KEYWORDS="amd64 x86"
  105. IUSE_FLAGS=(${FONTS[*],,})
  106. # FIXME: `+hack` is workaround for: https://pkgcore.github.io/pkgcheck/man/pkgcheck.html#requiredusedefaults
  107. IUSE="symbols-only +hack ${IUSE_FLAGS[*]}"
  108. REQUIRED_USE="X? ( || ( ${IUSE_FLAGS[*]} ) )"
  109. RDEPEND="media-libs/fontconfig"
  110. src_unpack() {
  111. default
  112. use symbols-only && {
  113. cp -v "${DISTDIR}/10-nerd-font-symbols-${PV}.conf" \
  114. "${S}/10-nerd-font-symbols.conf"
  115. FONT_CONF=(
  116. "${S}/10-nerd-font-symbols.conf"
  117. )
  118. }
  119. }
  120. check_suffix() {
  121. local dir="${1:?}" suffix="${2:?}" f=''
  122. for f in "${dir}"/*."${suffix}"; do
  123. [ -e "${f}" ] && return 0
  124. done
  125. return 1
  126. }
  127. src_install() {
  128. FONT_SUFFIX=''
  129. local suffixes=(ttf otf) suf=''
  130. for suf in "${suffixes[@]}"; do
  131. check_suffix "${S}" "${suf}" && FONT_SUFFIX+=" ${suf} "
  132. done
  133. font_src_install
  134. }