x-modular.eclass 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. #
  4. # DEPRECATED
  5. # This eclass has been superseded by xorg-2
  6. # Please modify your ebuilds to use that instead
  7. #
  8. # @ECLASS: x-modular.eclass
  9. # @MAINTAINER:
  10. # x11@gentoo.org
  11. # @BLURB: Reduces code duplication in the modularized X11 ebuilds.
  12. # @DESCRIPTION:
  13. # This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
  14. # and more. Many things that would normally be done in various functions
  15. # can be accessed by setting variables instead, such as patching,
  16. # running eautoreconf, passing options to configure and installing docs.
  17. #
  18. # All you need to do in a basic ebuild is inherit this eclass and set
  19. # DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
  20. # with the other X packages, you don't need to set SRC_URI. Pretty much
  21. # everything else should be automatic.
  22. if [[ ${PV} = 9999* ]]; then
  23. GIT_ECLASS="git"
  24. SNAPSHOT="yes"
  25. SRC_URI=""
  26. fi
  27. # If we're a font package, but not the font.alias one
  28. FONT_ECLASS=""
  29. if [[ "${PN/#font-}" != "${PN}" ]] \
  30. && [[ "${CATEGORY}" = "media-fonts" ]] \
  31. && [[ "${PN}" != "font-alias" ]] \
  32. && [[ "${PN}" != "font-util" ]]; then
  33. # Activate font code in the rest of the eclass
  34. FONT="yes"
  35. # Whether to inherit the font eclass
  36. FONT_ECLASS="font"
  37. fi
  38. inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
  39. ${FONT_ECLASS} ${GIT_ECLASS}
  40. EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm"
  41. case "${EAPI:-0}" in
  42. 0|1)
  43. ;;
  44. 2)
  45. EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure"
  46. ;;
  47. *)
  48. die "Unknown EAPI ${EAPI}"
  49. ;;
  50. esac
  51. # exports must be ALWAYS after inherit
  52. EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
  53. # @ECLASS-VARIABLE: XDIR
  54. # @DESCRIPTION:
  55. # Directory prefix to use for everything. If you want to install to a
  56. # non-default prefix (e.g., /opt/xorg), change XDIR. This has not been
  57. # recently tested. You may need to uncomment the setting of datadir and
  58. # mandir in x-modular_src_install() or add it back in if it's no longer
  59. # there. You may also want to change the SLOT.
  60. XDIR="/usr"
  61. IUSE=""
  62. HOMEPAGE="https://www.x.org/wiki/"
  63. # @ECLASS-VARIABLE: SNAPSHOT
  64. # @DESCRIPTION:
  65. # If set to 'yes' and configure.ac exists, eautoreconf will run. Set
  66. # before inheriting this eclass.
  67. : ${SNAPSHOT:=no}
  68. # Set up SRC_URI for individual modular releases
  69. BASE_INDIVIDUAL_URI="https://www.x.org/releases/individual"
  70. # @ECLASS-VARIABLE: MODULE
  71. # @DESCRIPTION:
  72. # The subdirectory to download source from. Possible settings are app,
  73. # doc, data, util, driver, font, lib, proto, xserver. Set above the
  74. # inherit to override the default autoconfigured module.
  75. if [[ -z ${MODULE} ]]; then
  76. case ${CATEGORY} in
  77. app-doc) MODULE="doc" ;;
  78. media-fonts) MODULE="font" ;;
  79. x11-apps|x11-wm) MODULE="app" ;;
  80. x11-misc|x11-themes) MODULE="util" ;;
  81. x11-drivers) MODULE="driver" ;;
  82. x11-base) MODULE="xserver" ;;
  83. x11-proto) MODULE="proto" ;;
  84. x11-libs) MODULE="lib" ;;
  85. esac
  86. fi
  87. if [[ -n ${GIT_ECLASS} ]]; then
  88. EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
  89. else
  90. SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
  91. fi
  92. SLOT="0"
  93. # Set the license for the package. This can be overridden by setting
  94. # LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
  95. # are under the MIT license. (This is what Red Hat does in their rpms)
  96. LICENSE="MIT"
  97. # Set up shared dependencies
  98. if [[ -n "${SNAPSHOT}" ]]; then
  99. # FIXME: What's the minimal libtool version supporting arbitrary versioning?
  100. DEPEND="${DEPEND}
  101. >=sys-devel/libtool-1.5
  102. >=sys-devel/m4-1.4"
  103. WANT_AUTOCONF="latest"
  104. WANT_AUTOMAKE="latest"
  105. fi
  106. if [[ -n "${FONT}" ]]; then
  107. RDEPEND="${RDEPEND}
  108. media-fonts/encodings
  109. x11-apps/mkfontscale
  110. x11-apps/mkfontdir"
  111. PDEPEND="${PDEPEND}
  112. media-fonts/font-alias"
  113. # Starting with 7.0RC3, we can specify the font directory
  114. # But oddly, we can't do the same for encodings or font-alias
  115. # @ECLASS-VARIABLE: FONT_DIR
  116. # @DESCRIPTION:
  117. # If you're creating a font package and the suffix of PN is not equal to
  118. # the subdirectory of /usr/share/fonts/ it should install into, set
  119. # FONT_DIR to that directory or directories. Set before inheriting this
  120. # eclass.
  121. : ${FONT_DIR:=${PN##*-}}
  122. # Fix case of font directories
  123. FONT_DIR=${FONT_DIR/ttf/TTF}
  124. FONT_DIR=${FONT_DIR/otf/OTF}
  125. FONT_DIR=${FONT_DIR/type1/Type1}
  126. FONT_DIR=${FONT_DIR/speedo/Speedo}
  127. # Set up configure options, wrapped so ebuilds can override if need be
  128. if [[ -z ${FONT_OPTIONS} ]]; then
  129. FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
  130. fi
  131. if [[ -n "${FONT}" ]]; then
  132. if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
  133. IUSE="${IUSE} nls"
  134. fi
  135. fi
  136. fi
  137. # If we're a driver package
  138. if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
  139. # Enable driver code in the rest of the eclass
  140. DRIVER="yes"
  141. fi
  142. # Debugging -- ignore packages that can't be built with debugging
  143. if [[ -z "${FONT}" ]] \
  144. && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \
  145. && [[ "${CATEGORY/x11-proto}" = "${CATEGORY}" ]] \
  146. && [[ "${PN/util-macros}" = "${PN}" ]] \
  147. && [[ "${PN/xbitmaps}" = "${PN}" ]] \
  148. && [[ "${PN/xkbdata}" = "${PN}" ]] \
  149. && [[ "${PN/xorg-cf-files}" = "${PN}" ]] \
  150. && [[ "${PN/xcursor}" = "${PN}" ]] \
  151. ; then
  152. DEBUGGABLE="yes"
  153. IUSE="${IUSE} debug"
  154. fi
  155. DEPEND="${DEPEND}
  156. virtual/pkgconfig"
  157. if [[ "${PN/util-macros}" = "${PN}" ]]; then
  158. DEPEND="${DEPEND}
  159. >=x11-misc/util-macros-1.3.0"
  160. fi
  161. RDEPEND="${RDEPEND}
  162. !<=x11-base/xorg-x11-6.9"
  163. # Provides virtual/x11 for temporary use until packages are ported
  164. # x11-base/x11-env"
  165. # @FUNCTION: x-modular_specs_check
  166. # @USAGE:
  167. # @DESCRIPTION:
  168. # Make any necessary changes related to gcc specs (generally hardened)
  169. x-modular_specs_check() {
  170. if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then
  171. append-ldflags -Wl,-z,lazy
  172. # (#116698) breaks loading
  173. filter-ldflags -Wl,-z,now
  174. fi
  175. }
  176. # @FUNCTION: x-modular_dri_check
  177. # @USAGE:
  178. # @DESCRIPTION:
  179. # Ensures the server supports DRI if building a driver with DRI support
  180. x-modular_dri_check() {
  181. # (#120057) Enabling DRI in drivers requires that the server was built with
  182. # support for it
  183. # Starting with xorg-server 1.5.3, DRI support is always enabled unless
  184. # USE=minimal is set (see bug #252084)
  185. if [[ -n "${DRIVER}" ]]; then
  186. if has dri ${IUSE} && use dri; then
  187. einfo "Checking for direct rendering capabilities ..."
  188. if has_version '>=x11-base/xorg-server-1.5.3'; then
  189. if built_with_use x11-base/xorg-server minimal; then
  190. die "You must build x11-base/xorg-server with USE=-minimal."
  191. fi
  192. else
  193. if ! built_with_use x11-base/xorg-server dri; then
  194. die "You must build x11-base/xorg-server with USE=dri."
  195. fi
  196. fi
  197. fi
  198. fi
  199. }
  200. # @FUNCTION: x-modular_server_supports_drivers_check
  201. # @USAGE:
  202. # @DESCRIPTION:
  203. # Ensures the server SDK is installed if a driver is being built
  204. x-modular_server_supports_drivers_check() {
  205. # (#135873) Only certain servers will actually use or be capable of
  206. # building external drivers, including binary drivers.
  207. if [[ -n "${DRIVER}" ]]; then
  208. if has_version '>=x11-base/xorg-server-1.1'; then
  209. if ! built_with_use x11-base/xorg-server xorg; then
  210. eerror "x11-base/xorg-server is not built with support for external drivers."
  211. die "You must build x11-base/xorg-server with USE=xorg."
  212. fi
  213. fi
  214. fi
  215. }
  216. # @FUNCTION: x-modular_unpack_source
  217. # @USAGE:
  218. # @DESCRIPTION:
  219. # Simply unpack source code. Nothing else.
  220. x-modular_unpack_source() {
  221. if [[ -n ${GIT_ECLASS} ]]; then
  222. git_src_unpack
  223. else
  224. unpack ${A}
  225. fi
  226. cd "${S}"
  227. if [[ -n ${FONT_OPTIONS} ]]; then
  228. einfo "Detected font directory: ${FONT_DIR}"
  229. fi
  230. }
  231. # @FUNCTION: x-modular_patch_source
  232. # @USAGE:
  233. # @DESCRIPTION:
  234. # Apply all patches
  235. x-modular_patch_source() {
  236. # Use standardized names and locations with bulk patching
  237. # Patch directory is ${WORKDIR}/patch
  238. # See epatch() in eutils.eclass for more documentation
  239. if [[ -z "${EPATCH_SUFFIX}" ]] ; then
  240. EPATCH_SUFFIX="patch"
  241. fi
  242. # @VARIABLE: PATCHES
  243. # @DESCRIPTION:
  244. # If you have any patches to apply, set PATCHES to their locations and epatch
  245. # will apply them. It also handles epatch-style bulk patches, if you know how to
  246. # use them and set the correct variables. If you don't, read eutils.eclass.
  247. if [[ ${#PATCHES[@]} -gt 1 ]]; then
  248. for x in "${PATCHES[@]}"; do
  249. epatch "${x}"
  250. done
  251. elif [[ -n "${PATCHES}" ]]; then
  252. for x in ${PATCHES}; do
  253. epatch "${x}"
  254. done
  255. # For non-default directory bulk patching
  256. elif [[ -n "${PATCH_LOC}" ]] ; then
  257. epatch ${PATCH_LOC}
  258. # For standard bulk patching
  259. elif [[ -d "${EPATCH_SOURCE}" ]] ; then
  260. epatch
  261. fi
  262. }
  263. # @FUNCTION: x-modular_reconf_source
  264. # @USAGE:
  265. # @DESCRIPTION:
  266. # Run eautoreconf if necessary, and run elibtoolize.
  267. x-modular_reconf_source() {
  268. if [[ "${SNAPSHOT}" = "yes" ]]
  269. then
  270. # If possible, generate configure if it doesn't exist
  271. if [ -f "./configure.ac" ]
  272. then
  273. eautoreconf
  274. fi
  275. fi
  276. # Joshua Baergen - October 23, 2005
  277. # Fix shared lib issues on MIPS, FBSD, etc etc
  278. elibtoolize
  279. }
  280. # @FUNCTION: x-modular_src_prepare
  281. # @USAGE:
  282. # @DESCRIPTION:
  283. # Prepare a package after unpacking, performing all X-related tasks.
  284. x-modular_src_prepare() {
  285. [[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \
  286. && git_src_prepare
  287. x-modular_patch_source
  288. x-modular_reconf_source
  289. }
  290. # @FUNCTION: x-modular_src_unpack
  291. # @USAGE:
  292. # @DESCRIPTION:
  293. # Unpack a package, performing all X-related tasks.
  294. x-modular_src_unpack() {
  295. x-modular_specs_check
  296. x-modular_server_supports_drivers_check
  297. x-modular_dri_check
  298. x-modular_unpack_source
  299. has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
  300. }
  301. # @FUNCTION: x-modular_font_configure
  302. # @USAGE:
  303. # @DESCRIPTION:
  304. # If a font package, perform any necessary configuration steps
  305. x-modular_font_configure() {
  306. if [[ -n "${FONT}" ]]; then
  307. # Might be worth adding an option to configure your desired font
  308. # and exclude all others. Also, should this USE be nls or minimal?
  309. if has nls ${IUSE//+} && ! use nls; then
  310. FONT_OPTIONS="${FONT_OPTIONS}
  311. --disable-iso8859-2
  312. --disable-iso8859-3
  313. --disable-iso8859-4
  314. --disable-iso8859-5
  315. --disable-iso8859-6
  316. --disable-iso8859-7
  317. --disable-iso8859-8
  318. --disable-iso8859-9
  319. --disable-iso8859-10
  320. --disable-iso8859-11
  321. --disable-iso8859-12
  322. --disable-iso8859-13
  323. --disable-iso8859-14
  324. --disable-iso8859-15
  325. --disable-iso8859-16
  326. --disable-jisx0201
  327. --disable-koi8-r"
  328. fi
  329. fi
  330. }
  331. # @FUNCTION: x-modular_debug_setup
  332. # @USAGE:
  333. # @DESCRIPTION:
  334. # Set up CFLAGS for a debug build
  335. x-modular_debug_setup() {
  336. if [[ -n "${DEBUGGABLE}" ]]; then
  337. if use debug; then
  338. strip-flags
  339. append-flags -g
  340. fi
  341. fi
  342. }
  343. # @FUNCTION: x-modular_src_configure
  344. # @USAGE:
  345. # @DESCRIPTION:
  346. # Perform any necessary pre-configuration steps, then run configure
  347. x-modular_src_configure() {
  348. x-modular_font_configure
  349. x-modular_debug_setup
  350. # @VARIABLE: CONFIGURE_OPTIONS
  351. # @DESCRIPTION:
  352. # Any extra options to pass to configure
  353. # If prefix isn't set here, .pc files cause problems
  354. if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
  355. econf --prefix=${XDIR} \
  356. --datadir=${XDIR}/share \
  357. ${FONT_OPTIONS} \
  358. ${DRIVER_OPTIONS} \
  359. ${CONFIGURE_OPTIONS}
  360. fi
  361. }
  362. # @FUNCTION: x-modular_src_make
  363. # @USAGE:
  364. # @DESCRIPTION:
  365. # Run make.
  366. x-modular_src_make() {
  367. emake || die "emake failed"
  368. }
  369. # @FUNCTION: x-modular_src_compile
  370. # @USAGE:
  371. # @DESCRIPTION:
  372. # Compile a package, performing all X-related tasks.
  373. x-modular_src_compile() {
  374. has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
  375. x-modular_src_make
  376. }
  377. # @FUNCTION: x-modular_src_install
  378. # @USAGE:
  379. # @DESCRIPTION:
  380. # Install a built package to ${D}, performing any necessary steps.
  381. # Creates a ChangeLog from git if using live ebuilds.
  382. x-modular_src_install() {
  383. # Install everything to ${XDIR}
  384. if [[ ${CATEGORY} = x11-proto ]]; then
  385. make \
  386. ${PN/proto/}docdir=/usr/share/doc/${PF} \
  387. DESTDIR="${D}" \
  388. install \
  389. || die
  390. else
  391. make \
  392. docdir=/usr/share/doc/${PF} \
  393. DESTDIR="${D}" \
  394. install \
  395. || die
  396. fi
  397. # Shouldn't be necessary in XDIR=/usr
  398. # einstall forces datadir, so we need to re-force it
  399. # datadir=${XDIR}/share \
  400. # mandir=${XDIR}/share/man \
  401. if [[ -n ${GIT_ECLASS} ]]; then
  402. pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}"
  403. git log ${GIT_TREE} > "${S}"/ChangeLog
  404. popd
  405. fi
  406. if [[ -e ${S}/ChangeLog ]]; then
  407. dodoc "${S}"/ChangeLog
  408. fi
  409. # @VARIABLE: DOCS
  410. # @DESCRIPTION:
  411. # Any documentation to install via dodoc
  412. [[ -n ${DOCS} ]] && dodoc ${DOCS}
  413. # Don't install libtool archives for server modules
  414. if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
  415. find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
  416. | xargs rm -f
  417. fi
  418. if [[ -n "${FONT}" ]]; then
  419. remove_font_metadata
  420. fi
  421. if [[ -n "${DRIVER}" ]]; then
  422. install_driver_hwdata
  423. fi
  424. }
  425. # @FUNCTION: x-modular_pkg_preinst
  426. # @USAGE:
  427. # @DESCRIPTION:
  428. # This function doesn't do anything right now, but it may in the future.
  429. x-modular_pkg_preinst() {
  430. # We no longer do anything here, but we can't remove it from the API
  431. :
  432. }
  433. # @FUNCTION: x-modular_pkg_postinst
  434. # @USAGE:
  435. # @DESCRIPTION:
  436. # Run X-specific post-installation tasks on the live filesystem. The
  437. # only task right now is some setup for font packages.
  438. x-modular_pkg_postinst() {
  439. if [[ -n "${FONT}" ]]; then
  440. setup_fonts
  441. fi
  442. }
  443. # @FUNCTION: x-modular_pkg_postrm
  444. # @USAGE:
  445. # @DESCRIPTION:
  446. # Run X-specific post-removal tasks on the live filesystem. The only
  447. # task right now is some cleanup for font packages.
  448. x-modular_pkg_postrm() {
  449. if [[ -n "${FONT}" ]]; then
  450. font_pkg_postrm
  451. fi
  452. }
  453. # @FUNCTION: setup_fonts
  454. # @USAGE:
  455. # @DESCRIPTION:
  456. # Generates needed files for fonts and fixes font permissions
  457. setup_fonts() {
  458. if [[ ! -n "${FONT_DIR}" ]]; then
  459. msg="FONT_DIR is empty. The ebuild should set it to at least one subdir of /usr/share/fonts."
  460. eerror "${msg}"
  461. die "${msg}"
  462. fi
  463. create_fonts_scale
  464. create_fonts_dir
  465. create_font_cache
  466. }
  467. # @FUNCTION: remove_font_metadata
  468. # @USAGE:
  469. # @DESCRIPTION:
  470. # Don't let the package install generated font files that may overlap
  471. # with other packages. Instead, they're generated in pkg_postinst().
  472. remove_font_metadata() {
  473. local DIR
  474. for DIR in ${FONT_DIR}; do
  475. if [[ "${DIR}" != "Speedo" ]] && \
  476. [[ "${DIR}" != "CID" ]] ; then
  477. # Delete font metadata files
  478. # fonts.scale, fonts.dir, fonts.cache-1
  479. rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1}
  480. fi
  481. done
  482. }
  483. # @FUNCTION: install_driver_hwdata
  484. # @USAGE:
  485. # @DESCRIPTION:
  486. # Installs device-to-driver mappings for system-config-display and
  487. # anything else that uses hwdata.
  488. install_driver_hwdata() {
  489. insinto /usr/share/hwdata/videoaliases
  490. for i in "${FILESDIR}"/*.xinf; do
  491. # We need this for the case when none exist,
  492. # so *.xinf doesn't expand
  493. if [[ -e $i ]]; then
  494. doins $i
  495. fi
  496. done
  497. }
  498. # @FUNCTION: discover_font_dirs
  499. # @USAGE:
  500. # @DESCRIPTION:
  501. # Deprecated. Sets up the now-unused FONT_DIRS variable.
  502. discover_font_dirs() {
  503. FONT_DIRS="${FONT_DIR}"
  504. }
  505. # @FUNCTION: create_fonts_scale
  506. # @USAGE:
  507. # @DESCRIPTION:
  508. # Create fonts.scale file, used by the old server-side fonts subsystem.
  509. create_fonts_scale() {
  510. ebegin "Creating fonts.scale files"
  511. local x
  512. for DIR in ${FONT_DIR}; do
  513. x=${ROOT}/usr/share/fonts/${DIR}
  514. [[ -z "$(ls ${x}/)" ]] && continue
  515. [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
  516. # Only generate .scale files if truetype, opentype or type1
  517. # fonts are present ...
  518. # NOTE: There is no way to regenerate Speedo/CID fonts.scale
  519. # <dberkholz@gentoo.org> 2 August 2004
  520. if [[ "${x/encodings}" = "${x}" ]] \
  521. && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
  522. mkfontscale \
  523. -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \
  524. -- ${x}
  525. fi
  526. done
  527. eend 0
  528. }
  529. # @FUNCTION: create_fonts_dir
  530. # @USAGE:
  531. # @DESCRIPTION:
  532. # Create fonts.dir file, used by the old server-side fonts subsystem.
  533. create_fonts_dir() {
  534. ebegin "Generating fonts.dir files"
  535. for DIR in ${FONT_DIR}; do
  536. x=${ROOT}/usr/share/fonts/${DIR}
  537. [[ -z "$(ls ${x}/)" ]] && continue
  538. [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
  539. if [[ "${x/encodings}" = "${x}" ]]; then
  540. mkfontdir \
  541. -e "${ROOT}"/usr/share/fonts/encodings \
  542. -e "${ROOT}"/usr/share/fonts/encodings/large \
  543. -- ${x}
  544. fi
  545. done
  546. eend 0
  547. }
  548. # @FUNCTION: create_font_cache
  549. # @USAGE:
  550. # @DESCRIPTION:
  551. # Create fonts.cache-1 files, used by the new client-side fonts
  552. # subsystem.
  553. create_font_cache() {
  554. font_pkg_postinst
  555. }