nerd-fonts-3.3.0.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit font check-reqs
  5. DESCRIPTION="Nerd Fonts is a project that patches developer targeted fonts with glyphs"
  6. HOMEPAGE="https://github.com/ryanoasis/nerd-fonts"
  7. COMMON_URI="https://github.com/ryanoasis/${PN}/releases/download/v${PV/_rc/-RC}"
  8. FONTS=(
  9. 0xProto
  10. 3270
  11. Agave
  12. AnonymousPro
  13. Arimo
  14. AurulentSansMono
  15. BigBlueTerminal
  16. BitstreamVeraSansMono
  17. CascadiaCode
  18. CascadiaMono
  19. CodeNewRoman
  20. ComicShannsMono
  21. CommitMono
  22. Cousine
  23. D2Coding
  24. DaddyTimeMono
  25. DejaVuSansMono
  26. DepartureMono
  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. Monofur
  55. Monoid
  56. Mononoki
  57. Monaspace
  58. MPlus
  59. NerdFontsSymbolsOnly
  60. Noto
  61. OpenDyslexic
  62. Overpass
  63. ProFont
  64. ProggyClean
  65. RobotoMono
  66. Recursive
  67. ShareTechMono
  68. SourceCodePro
  69. SpaceMono
  70. Terminus
  71. Tinos
  72. Ubuntu
  73. UbuntuMono
  74. UbuntuSans
  75. VictorMono
  76. ZedMono
  77. )
  78. gen_src_uri() {
  79. for f in ${FONTS[*]}; do
  80. echo "${f,,}? ( ${COMMON_URI}/${f}.zip -> ${f}-nf-${PV}.zip )"
  81. done
  82. }
  83. SRC_URI="
  84. $(gen_src_uri)
  85. https://github.com/ryanoasis/nerd-fonts/raw/v${PV}/10-nerd-font-symbols.conf -> ${P}-10-nerd-font-symbols.conf
  86. "
  87. RESTRICT="mirror"
  88. LICENSE="MIT
  89. OFL-1.1
  90. Apache-2.0
  91. CC-BY-SA-4.0
  92. BitstreamVera
  93. BSD
  94. WTFPL-2
  95. Vic-Fieger-License
  96. UbuntuFontLicense-1.0"
  97. SLOT="0"
  98. KEYWORDS="*"
  99. DEPEND="app-arch/unzip"
  100. RDEPEND="media-libs/fontconfig"
  101. CHECKREQS_DISK_BUILD="3G"
  102. CHECKREQS_DISK_USR="4G"
  103. IUSE_FLAGS=(${FONTS[*],,})
  104. IUSE="${IUSE_FLAGS[*]}"
  105. REQUIRED_USE="X || ( ${IUSE_FLAGS[*]} )"
  106. S="${WORKDIR}"
  107. FONT_CONF=(
  108. "${S}/10-nerd-font-symbols.conf"
  109. )
  110. FONT_S=${S}
  111. pkg_pretend() {
  112. check-reqs_pkg_setup
  113. }
  114. src_prepare() {
  115. default
  116. cp "${DISTDIR}/${P}-10-nerd-font-symbols.conf" "10-nerd-font-symbols.conf"
  117. }
  118. src_install() {
  119. declare -A font_filetypes
  120. local otf_file_number ttf_file_number
  121. otf_file_number=$(ls "${S}" | grep -i otf | wc -l)
  122. ttf_file_number=$(ls "${S}" | grep -i ttf | wc -l)
  123. if [[ ${otf_file_number} != 0 ]]; then
  124. font_filetypes[otf]=
  125. fi
  126. if [[ ${ttf_file_number} != 0 ]]; then
  127. font_filetypes[ttf]=
  128. fi
  129. FONT_SUFFIX="${!font_filetypes[@]}"
  130. font_src_install
  131. }
  132. pkg_postinst() {
  133. einfo "Installing font-patcher via an ebuild is hard, because paths are hardcoded differently"
  134. einfo "in .sh files. You can still get it and use it by git cloning the nerd-font project and"
  135. einfo "running it from the cloned directory."
  136. einfo "https://github.com/ryanoasis/nerd-fonts"
  137. elog "You might have to enable 50-user.conf and 10-nerd-font-symbols.conf by using"
  138. elog "eselect fontconfig"
  139. }