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://nerdfonts.com"
  7. LICENSE="MIT"
  8. SLOT="0"
  9. KEYWORDS="amd64 x86"
  10. # curl -s https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest \
  11. # | jq -r '.assets[].name | select(endswith(".tar.xz")) | split(".") | .[0] | select(test("(?i)symbolsonly") | not)'
  12. FONTS=(
  13. 0xProto
  14. 3270
  15. Agave
  16. AnonymousPro
  17. Arimo
  18. AurulentSansMono
  19. BigBlueTerminal
  20. BitstreamVeraSansMono
  21. CascadiaCode
  22. CascadiaMono
  23. CodeNewRoman
  24. ComicShannsMono
  25. CommitMono
  26. Cousine
  27. D2Coding
  28. DaddyTimeMono
  29. DejaVuSansMono
  30. DroidSansMono
  31. EnvyCodeR
  32. FantasqueSansMono
  33. FiraCode
  34. FiraMono
  35. GeistMono
  36. Go-Mono
  37. Gohu
  38. Hack
  39. Hasklig
  40. HeavyData
  41. Hermit
  42. iA-Writer
  43. IBMPlexMono
  44. Inconsolata
  45. InconsolataGo
  46. InconsolataLGC
  47. IntelOneMono
  48. Iosevka
  49. IosevkaTerm
  50. IosevkaTermSlab
  51. JetBrainsMono
  52. Lekton
  53. LiberationMono
  54. Lilex
  55. MartianMono
  56. Meslo
  57. Monaspace
  58. Monofur
  59. Monoid
  60. Mononoki
  61. MPlus
  62. Noto
  63. OpenDyslexic
  64. Overpass
  65. ProFont
  66. ProggyClean
  67. Recursive
  68. RobotoMono
  69. ShareTechMono
  70. SourceCodePro
  71. SpaceMono
  72. Terminus
  73. Tinos
  74. Ubuntu
  75. UbuntuMono
  76. UbuntuSans
  77. VictorMono
  78. ZedMono
  79. )
  80. IUSE_FLAGS=(${FONTS[*],,})
  81. # FIXME: `+hack` is workaround for: https://pkgcore.github.io/pkgcheck/man/pkgcheck.html#requiredusedefaults
  82. IUSE="symbols-only +hack ${IUSE_FLAGS[*]}"
  83. REQUIRED_USE="X? ( || ( ${IUSE_FLAGS[*]} ) )"
  84. iuse_src_uri() {
  85. local iuse="${1:?}"
  86. local name="${2:?}"
  87. local uri_prefix="https://github.com/ryanoasis/${PN}/releases/download/v${PV}"
  88. local ext=tar.xz
  89. echo "${iuse,,}? (
  90. ${uri_prefix}/${name}.${ext}
  91. -> ${PN}-${name}-${PV}.${ext}
  92. )"
  93. }
  94. nerd_src_uri() {
  95. for name; do
  96. iuse_src_uri "${name,,}" "${name}"
  97. done
  98. }
  99. SRC_URI="
  100. $(iuse_src_uri symbols-only NerdFontsSymbolsOnly)
  101. symbols-only? (
  102. https://github.com/ryanoasis/${PN}/raw/v${PV}/10-nerd-font-symbols.conf
  103. -> 10-nerd-font-symbols-${PV}.conf
  104. )
  105. $(nerd_src_uri "${FONTS[@]}")
  106. "
  107. RDEPEND="media-libs/fontconfig"
  108. S="${WORKDIR}"
  109. FONT_S="${S}"
  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. }