nerd-fonts-3.3.0.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. DepartureMono
  28. DroidSansMono
  29. EnvyCodeR
  30. FantasqueSansMono
  31. FiraCode
  32. FiraMono
  33. GeistMono
  34. Go-Mono
  35. Gohu
  36. Hack
  37. Hasklig
  38. HeavyData
  39. Hermit
  40. iA-Writer
  41. IBMPlexMono
  42. Inconsolata
  43. InconsolataGo
  44. InconsolataLGC
  45. IntelOneMono
  46. Iosevka
  47. IosevkaTerm
  48. IosevkaTermSlab
  49. JetBrainsMono
  50. Lekton
  51. LiberationMono
  52. Lilex
  53. MartianMono
  54. Meslo
  55. Monaspace
  56. Monofur
  57. Monoid
  58. Mononoki
  59. MPlus
  60. Noto
  61. OpenDyslexic
  62. Overpass
  63. ProFont
  64. ProggyClean
  65. Recursive
  66. RobotoMono
  67. ShareTechMono
  68. SourceCodePro
  69. SpaceMono
  70. Terminus
  71. Tinos
  72. Ubuntu
  73. UbuntuMono
  74. UbuntuSans
  75. VictorMono
  76. ZedMono
  77. )
  78. iuse_src_uri() {
  79. local iuse="${1:?}"
  80. local name="${2:?}"
  81. local uri_prefix="https://github.com/ryanoasis/${PN}/releases/download/v${PV}"
  82. local ext=tar.xz
  83. echo "${iuse,,}? (
  84. ${uri_prefix}/${name}.${ext}
  85. -> ${PN}-${name}-${PV}.${ext}
  86. )"
  87. }
  88. nerd_src_uri() {
  89. for name; do
  90. iuse_src_uri "${name,,}" "${name}"
  91. done
  92. }
  93. SRC_URI="
  94. $(iuse_src_uri symbols-only NerdFontsSymbolsOnly)
  95. symbols-only? (
  96. https://github.com/ryanoasis/${PN}/raw/v${PV}/10-nerd-font-symbols.conf
  97. -> 10-nerd-font-symbols-${PV}.conf
  98. )
  99. $(nerd_src_uri "${FONTS[@]}")
  100. "
  101. S="${WORKDIR}"
  102. FONT_S="${S}"
  103. LICENSE="MIT"
  104. SLOT="0"
  105. KEYWORDS="amd64 x86"
  106. IUSE_FLAGS=(${FONTS[*],,})
  107. # FIXME: `+hack` is workaround for: https://pkgcore.github.io/pkgcheck/man/pkgcheck.html#requiredusedefaults
  108. IUSE="symbols-only +hack ${IUSE_FLAGS[*]}"
  109. REQUIRED_USE="X? ( || ( ${IUSE_FLAGS[*]} ) )"
  110. RDEPEND="media-libs/fontconfig"
  111. src_unpack() {
  112. default
  113. use symbols-only && {
  114. cp -v "${DISTDIR}/10-nerd-font-symbols-${PV}.conf" \
  115. "${S}/10-nerd-font-symbols.conf"
  116. FONT_CONF=(
  117. "${S}/10-nerd-font-symbols.conf"
  118. )
  119. }
  120. }
  121. check_suffix() {
  122. local dir="${1:?}" suffix="${2:?}" f=''
  123. for f in "${dir}"/*."${suffix}"; do
  124. [ -e "${f}" ] && return 0
  125. done
  126. return 1
  127. }
  128. src_install() {
  129. FONT_SUFFIX=''
  130. local suffixes=(ttf otf) suf=''
  131. for suf in "${suffixes[@]}"; do
  132. check_suffix "${S}" "${suf}" && FONT_SUFFIX+=" ${suf} "
  133. done
  134. font_src_install
  135. }