public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] xorg-3.eclass update
@ 2020-08-02 13:54 Henrik Pihl
  2020-08-02 17:15 ` [gentoo-dev] " Henrik Pihl
  0 siblings, 1 reply; 4+ messages in thread
From: Henrik Pihl @ 2020-08-02 13:54 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,
According to the bug[1] it should be all right to restore the font parts in
the xorg-3 eclass. Matt didn't object either. Currently upgrading the
font-* packages to EAPI 7 and seemed to work the same way as with 5.

[1] https://bugs.gentoo.org/712064

Henrik Pihl
-----BEGIN PGP SIGNATURE-----
Version: FlowCrypt Email Encryption 7.8.8
Comment: Seamlessly send and receive encrypted email

wsFzBAEBCgAGBQJfJsWdACEJELLeoy9dd+JHFiEEZ+1cZjaUPp4qaEdxst6j
L1134kcOWBAArEPmt1Oqn91xuEiwmG5yIKGkUHfs+Ja1YZ9BdY5pFMr8nzIa
74GU2lqDjKoD6dvAdqnR6Ov/hzrLLIUXfotebnaaoIxaGNbf565NSzA80O/k
mAF+MPg14ydji3CtrSNz/xzbcktgoy0l/QHX8yYMrS/mZHODQQcxrfZaUGz3
uWLDOl9+8GvCztSrTORoku2IGk0MXu5ICNvrzrqRTb84KQOA/HoUyvLp4Tj/
zJwscgYKf9RYVcbXovEKw2qcGZh5ahKifkBnO7jNyJO20WWxPKeD9xY9hWKK
1YjB5ZGsdUd20AZEJuaW4V/gxxTDlzzyQSHOsf3zeGVKb1P709kM3Uig0+xY
oxveFa1UARZ8WcKUSD1+1Al9mkzW2Vwir2Rowlp55N1Pignt9QWEjowSPZdt
XLUzTBtjMBqduhhDMQCsyM0hUKrbFKCA9D90+JNpfqcOFQdgrbFjslGV0kMO
sNEblUj/GYwkiNAG/Tm4nwOzkuwk6dlRd3m5OQQZw2JTRn8TnUweQW2qyirY
aWD+6eSbQSkGdW5aProBAyM3G9TkjmMRe4GAVu5d/yOS7a1QmOQ3YMeAgUvq
m1qZiwD81LJm8ofLPOQH/WMbTDZgRwQg76zoXFe/bgqHneMgdrCzume6+CPw
9qbUHyoRDXsuUV67ptQD174cbnIAVHkzmT4=
=R4ig
-----END PGP SIGNATURE-----

[-- Attachment #2: xorg-3.patch --]
[-- Type: text/x-patch, Size: 6933 bytes --]

diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
index 168e58b42c8..b20a09a843d 100644
--- a/eclass/xorg-3.eclass
+++ b/eclass/xorg-3.eclass
@@ -27,6 +27,20 @@ if [[ ${PV} == *9999* ]]; then
 	XORG_EAUTORECONF="yes"
 fi
 
+# If we're a font package, but not the font.alias one
+FONT_ECLASS=""
+if [[ ${CATEGORY} = media-fonts ]]; then
+	case ${PN} in
+	font-alias|font-util)
+		;;
+	font*)
+		# Activate font code in the rest of the eclass
+		FONT="yes"
+		FONT_ECLASS="font"
+		;;
+	esac
+fi
+
 # @ECLASS-VARIABLE: XORG_MULTILIB
 # @DESCRIPTION:
 # If set to 'yes', the multilib support for package will be enabled. Set
@@ -66,7 +80,7 @@ IUSE=""
 # @ECLASS-VARIABLE: XORG_MODULE
 # @DESCRIPTION:
 # The subdirectory to download source from. Possible settings are app,
-# doc, data, util, driver, lib, proto, xserver. Set above the
+# doc, data, util, driver, font, lib, proto, xserver. Set above the
 # inherit to override the default autoconfigured module.
 : ${XORG_MODULE:="auto"}
 if [[ ${XORG_MODULE} == auto ]]; then
@@ -129,6 +143,36 @@ BDEPEND+=" ${EAUTORECONF_DEPENDS}"
 unset EAUTORECONF_DEPENDS
 unset EAUTORECONF_DEPEND
 
+if [[ ${FONT} == yes ]]; then
+	RDEPEND+=" media-fonts/encodings
+		>=x11-apps/mkfontscale-1.2.0"
+	PDEPEND+=" media-fonts/font-alias"
+	DEPEND+=" >=media-fonts/font-util-1.2.0
+		>=x11-apps/mkfontscale-1.2.0"
+
+	# @ECLASS-VARIABLE: FONT_DIR
+	# @DESCRIPTION:
+	# If you're creating a font package and the suffix of PN is not equal to
+	# the subdirectory of /usr/share/fonts/ it should install into, set
+	# FONT_DIR to that directory or directories. Set before inheriting this
+	# eclass.
+	[[ -z ${FONT_DIR} ]] && FONT_DIR=${PN##*-}
+
+	# Fix case of font directories
+	FONT_DIR=${FONT_DIR/ttf/TTF}
+	FONT_DIR=${FONT_DIR/otf/OTF}
+	FONT_DIR=${FONT_DIR/type1/Type1}
+	FONT_DIR=${FONT_DIR/speedo/Speedo}
+
+	# Set up configure options, wrapped so ebuilds can override if need be
+	[[ -z ${FONT_OPTIONS} ]] && FONT_OPTIONS="--with-fontdir=\"${EPREFIX}/usr/share/fonts/${FONT_DIR}\""
+
+	[[ ${PN} = font-misc-misc || ${PN} = font-schumacher-misc || ${PN##*-} = 75dpi || ${PN##*-} = 100dpi || ${PN##*-} = cyrillic ]] && IUSE+=" nls"
+fi
+
+# If we're a driver package, then enable DRIVER case
+[[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes"
+
 # @ECLASS-VARIABLE: XORG_STATIC
 # @DESCRIPTION:
 # Enables static-libs useflag. Set to no, if your package gets:
@@ -224,6 +268,15 @@ debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}"
 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: BDEPEND=${BDEPEND}"
 
+# @FUNCTION: xorg-3_pkg_setup
+# @DESCRIPTION:
+# Setup prefix compat
+xorg-3_pkg_setup() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	[[ ${FONT} == yes ]] && font_pkg_setup "$@"
+}
+
 # @FUNCTION: xorg-3_src_unpack
 # @DESCRIPTION:
 # Simply unpack source code.
@@ -235,6 +288,8 @@ xorg-3_src_unpack() {
 	else
 		unpack ${A}
 	fi
+
+	[[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
 }
 
 # @FUNCTION: xorg-3_reconf_source
@@ -270,6 +325,40 @@ xorg-3_src_prepare() {
 	xorg-3_reconf_source
 }
 
+# @FUNCTION: xorg-3_font_configure
+# @DESCRIPTION:
+# If a font package, perform any necessary configuration steps
+xorg-3_font_configure() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if has nls ${IUSE//+} && ! use nls; then
+		if grep -q -s "disable-all-encodings" ${ECONF_SOURCE:-.}/configure; then
+			FONT_OPTIONS+="
+				--disable-all-encodings
+				--enable-iso8859-1"
+		else
+			FONT_OPTIONS+="
+				--disable-iso8859-2
+				--disable-iso8859-3
+				--disable-iso8859-4
+				--disable-iso8859-5
+				--disable-iso8859-6
+				--disable-iso8859-7
+				--disable-iso8859-8
+				--disable-iso8859-9
+				--disable-iso8859-10
+				--disable-iso8859-11
+				--disable-iso8859-12
+				--disable-iso8859-13
+				--disable-iso8859-14
+				--disable-iso8859-15
+				--disable-iso8859-16
+				--disable-jisx0201
+				--disable-koi8-r"
+		fi
+	fi
+}
+
 # @FUNCTION: xorg-3_flags_setup
 # @DESCRIPTION:
 # Set up CFLAGS for a debug build
@@ -308,6 +397,8 @@ xorg-3_src_configure() {
 	# @DEFAULT_UNSET
 	local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
 
+	[[ -n "${FONT}" ]] && xorg-3_font_configure
+
 	# Check if package supports disabling of dep tracking
 	# Fixes warnings like:
 	#    WARNING: unrecognized options: --disable-dependency-tracking
@@ -323,6 +414,7 @@ xorg-3_src_configure() {
 	local econfargs=(
 		${dep_track}
 		${selective_werror}
+		${FONT_OPTIONS}
 		"${xorgconfadd[@]}"
 	)
 
@@ -388,4 +480,81 @@ xorg-3_src_install() {
 
 	# Don't install libtool archives (even for modules)
 	find "${D}" -type f -name '*.la' -delete || die
+
+	[[ -n ${FONT} ]] && remove_font_metadata
+}
+
+# @FUNCTION: xorg-3_pkg_postinst
+# @DESCRIPTION:
+# Run X-specific post-installation tasks on the live filesystem. The
+# only task right now is some setup for font packages.
+xorg-3_pkg_postinst() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ -n ${FONT} ]]; then
+		create_fonts_scale
+		create_fonts_dir
+		font_pkg_postinst "$@"
+
+		ewarn "Installed fonts changed. Run 'xset fp rehash' if you are using non-fontconfig applications."
+	fi
+}
+
+# @FUNCTION: xorg-3_pkg_postrm
+# @DESCRIPTION:
+# Run X-specific post-removal tasks on the live filesystem. The only
+# task right now is some cleanup for font packages.
+xorg-3_pkg_postrm() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ -n ${FONT} ]]; then
+		# if we're doing an upgrade, postinst will do
+		if [[ -z ${REPLACED_BY_VERSION} ]]; then
+			create_fonts_scale
+			create_fonts_dir
+			font_pkg_postrm "$@"
+		fi
+	fi
+}
+
+# @FUNCTION: remove_font_metadata
+# @DESCRIPTION:
+# Don't let the package install generated font files that may overlap
+# with other packages. Instead, they're generated in pkg_postinst().
+remove_font_metadata() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
+		einfo "Removing font metadata"
+		rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
+	fi
+}
+
+# @FUNCTION: create_fonts_scale
+# @DESCRIPTION:
+# Create fonts.scale file, used by the old server-side fonts subsystem.
+create_fonts_scale() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
+		ebegin "Generating fonts.scale"
+			mkfontscale \
+				-a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
+				-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
+		eend $?
+	fi
+}
+
+# @FUNCTION: create_fonts_dir
+# @DESCRIPTION:
+# Create fonts.dir file, used by the old server-side fonts subsystem.
+create_fonts_dir() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	ebegin "Generating fonts.dir"
+			mkfontdir \
+				-e "${EROOT}"/usr/share/fonts/encodings \
+				-e "${EROOT}"/usr/share/fonts/encodings/large \
+				-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
+	eend $?
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] Re: xorg-3.eclass update
  2020-08-02 13:54 [gentoo-dev] xorg-3.eclass update Henrik Pihl
@ 2020-08-02 17:15 ` Henrik Pihl
  2020-08-02 17:49   ` Henrik Pihl
  0 siblings, 1 reply; 4+ messages in thread
From: Henrik Pihl @ 2020-08-02 17:15 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I'm sorry for my lack of testing but I didn't notice that it was doing
everything except updating the fontconfig cache when dealing with the fonts
packages. So, here should be hopefully the complete version, as originally
intented.

Henrik

On 2020-08-02 at 13:54, ahvenas@gmail.com wrote:
> Hi,
> According to the bug[1] it should be all right to restore the font parts
in
> the xorg-3 eclass. Matt didn't object either. Currently upgrading the
> font-* packages to EAPI 7 and seemed to work the same way as with 5.
>
> [1] https://bugs.gentoo.org/712064
>
> Henrik Pihl
-----BEGIN PGP SIGNATURE-----
Version: FlowCrypt Email Encryption 7.8.8
Comment: Seamlessly send and receive encrypted email

wsFzBAEBCgAGBQJfJvSwACEJELLeoy9dd+JHFiEEZ+1cZjaUPp4qaEdxst6j
L1134keE5BAAm+t01PP5ecvEn+3UTA0H4RulnlPbHX7T11EpCQdfHGxfU5Ly
YutTP3sVU7Ji6TfF/KrdDj5MUtfhaNUFVbwEx6f3MeiaRLB4mGQML5Un28Jp
I+DmY2PyZYJVcqtAJE4B13RiUpAlNT13zpWn/5pGXt2ykLW9i79WpRjr6iQ+
c6EtYWSyGUG7elnkg8Cdn9z2xa3zZXPlyZEEmFcXrKYpfSA8D8JMfUlQSRHk
X5V8v2ZrYp5ouXXn/YECFLo6+Cg1OcyIVi9zbX/1/n+r7EMy8Ae2TVtt5kud
agR3zvwMwz7tu+EVCmvWXRA4aR214X3UGUW+oKeY1wolICP3ecpn+HTWAh6+
2ccT66dy6LqrAckbJAhDUHJo/1tIBAGhQK8Z3ckL5XWTqP7MEaIg8vDOv+PL
c/s/cr8vUkEcUrBtthuAkAP7zHmsLWs17DNgCTKlyDh/aOklCd6NNG37YRHJ
l5G8rhHLEqIVTDs5OkP6phuXSjtucyNS/XgdDkxia2XyQ3vmZuv1AqoIlc5h
4nv4/DC9IDQwsR51EvyM6CssgM8jP7jimAQu/WD1B8oRL4pFHowyO3hb5HMu
8Lw+dbAQGisA/HJ6dAyb+62L7kFtSBmT6ju9CrIVqlPow655B2n1Zp1/XZ9i
keJmegoTpCAH0xkNMPB0pXKdQ3fwzb6Nkmw=
=yX6R
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-dev] Re: xorg-3.eclass update
  2020-08-02 17:15 ` [gentoo-dev] " Henrik Pihl
@ 2020-08-02 17:49   ` Henrik Pihl
  2020-08-02 19:54     ` Aaron Bauman
  0 siblings, 1 reply; 4+ messages in thread
From: Henrik Pihl @ 2020-08-02 17:49 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hello once again,
and of course I get to apologize some more due to forgetting to attach the
new patch.

Henrik

On 2020-08-02 at 17:15, ahvenas@gmail.com wrote:
> I'm sorry for my lack of testing but I didn't notice that it was doing
> everything except updating the fontconfig cache when dealing with the
fonts
> packages. So, here should be hopefully the complete version, as
originally
> intented.
>
> Henrik
>
> On 2020-08-02 at 13:54, ahvenas@gmail.com wrote:
> > Hi,
> > According to the bug[1] it should be all right to restore the font
parts
> in
> > the xorg-3 eclass. Matt didn't object either. Currently upgrading the
> > font-* packages to EAPI 7 and seemed to work the same way as with 5.
> >
> > [1] https://bugs.gentoo.org/712064
> >
> > Henrik Pihl
-----BEGIN PGP SIGNATURE-----
Version: FlowCrypt Email Encryption 7.8.8
Comment: Seamlessly send and receive encrypted email

wsFzBAEBCgAGBQJfJvyxACEJELLeoy9dd+JHFiEEZ+1cZjaUPp4qaEdxst6j
L1134kfMZBAAuOppKJ+HT73gj/Fug7ZDlGY9+uH/RyokDU5jDD+A3eSqLtK0
462767d/Of9kjmkJxJv55OGB/XVkZGZTbWpsdwS6GnsG5cj9KsblbBQU5a0g
lRcxbzJuHoNRdhVwz48Z9vC0g41mm3Plj03TmkaM2ys1CVyDlZDylAQOTSPP
a3YSkIj4VfzoSClnwH8sXNAZyqobIU9Av+wIQt0dYkve7Z6LH1OcRJgk8jFQ
siOp6mnqJMb5rvioZyuBUZwOdNL5GD3qbFXJn10Ek+fYZzcE/1pqySbfoLtl
IhtqGp9v4lYz7Yv9MLwEl+XjabJOZbZBRceHIXRJbjLCZEUpDmwFO9NObc8e
KhsFlI3DjM8nz/EyEFIw3/51zENcJPpwlSbDPus6N5nIOjKzGCEOJNpigG5P
uD5Es1s5QCgHf77lB8eRDQoa+u+UwiTbLWUlDIVM3IyYc6crpIM4eAM9mKVA
Jge6EKiRG62IuIAMcPYWNzVxa+TfJWJgpy5Jdu5frxV1Vh8LplTQYIWh5U7G
Jtq1WiGC1u2Jwyk/M8LOqtaymekeG6BSTvYf4Me1FK4+vRL7G4YeYg6LZj36
RmJz0IeVXfRC+BAit7ctBD4AOfAlNQ9UJIpHnEKNXTGLqtDVuHeF+VEOuJWL
GHsyorcfdpJjtbIKmCvuraysWo/I34u3Qgg=
=XKvL
-----END PGP SIGNATURE-----

[-- Attachment #2: xorg-3-r1.patch --]
[-- Type: text/x-patch, Size: 8252 bytes --]

diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
index 168e58b42c8..a52c0146baa 100644
--- a/eclass/xorg-3.eclass
+++ b/eclass/xorg-3.eclass
@@ -27,6 +27,20 @@ if [[ ${PV} == *9999* ]]; then
 	XORG_EAUTORECONF="yes"
 fi
 
+# If we're a font package, but not the font.alias one
+FONT_ECLASS=""
+if [[ ${CATEGORY} = media-fonts ]]; then
+	case ${PN} in
+	font-alias|font-util)
+		;;
+	font*)
+		# Activate font code in the rest of the eclass
+		FONT="yes"
+		FONT_ECLASS="font"
+		;;
+	esac
+fi
+
 # @ECLASS-VARIABLE: XORG_MULTILIB
 # @DESCRIPTION:
 # If set to 'yes', the multilib support for package will be enabled. Set
@@ -34,13 +48,14 @@ fi
 : ${XORG_MULTILIB:="no"}
 
 # we need to inherit autotools first to get the deps
-inherit autotools libtool multilib toolchain-funcs flag-o-matic ${GIT_ECLASS}
+inherit autotools libtool multilib toolchain-funcs flag-o-matic ${GIT_ECLASS} \
+	flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS}
 
 if [[ ${XORG_MULTILIB} == yes ]]; then
 	inherit multilib-minimal
 fi
 
-EXPORTED_FUNCTIONS="src_prepare src_configure src_unpack src_compile src_install"
+EXPORTED_FUNCTIONS="src_prepare src_configure src_unpack src_compile src_install pkg_postinst pkg_postrm"
 case "${EAPI:-0}" in
 	7) ;;
 	*) die "EAPI=${EAPI} is not supported" ;;
@@ -66,7 +81,7 @@ IUSE=""
 # @ECLASS-VARIABLE: XORG_MODULE
 # @DESCRIPTION:
 # The subdirectory to download source from. Possible settings are app,
-# doc, data, util, driver, lib, proto, xserver. Set above the
+# doc, data, util, driver, font, lib, proto, xserver. Set above the
 # inherit to override the default autoconfigured module.
 : ${XORG_MODULE:="auto"}
 if [[ ${XORG_MODULE} == auto ]]; then
@@ -116,7 +131,9 @@ EAUTORECONF_DEPEND+="
 	>=sys-devel/libtool-2.2.6a
 	sys-devel/m4"
 if [[ ${PN} != util-macros ]] ; then
-	EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.18 >=media-fonts/font-util-1.2.0"
+	EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.18"
+	# Required even by xorg-server
+	[[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0"
 fi
 WANT_AUTOCONF="latest"
 WANT_AUTOMAKE="latest"
@@ -129,6 +146,36 @@ BDEPEND+=" ${EAUTORECONF_DEPENDS}"
 unset EAUTORECONF_DEPENDS
 unset EAUTORECONF_DEPEND
 
+if [[ ${FONT} == yes ]]; then
+	RDEPEND+=" media-fonts/encodings
+		>=x11-apps/mkfontscale-1.2.0"
+	PDEPEND+=" media-fonts/font-alias"
+	DEPEND+=" >=media-fonts/font-util-1.2.0
+		>=x11-apps/mkfontscale-1.2.0"
+
+	# @ECLASS-VARIABLE: FONT_DIR
+	# @DESCRIPTION:
+	# If you're creating a font package and the suffix of PN is not equal to
+	# the subdirectory of /usr/share/fonts/ it should install into, set
+	# FONT_DIR to that directory or directories. Set before inheriting this
+	# eclass.
+	[[ -z ${FONT_DIR} ]] && FONT_DIR=${PN##*-}
+
+	# Fix case of font directories
+	FONT_DIR=${FONT_DIR/ttf/TTF}
+	FONT_DIR=${FONT_DIR/otf/OTF}
+	FONT_DIR=${FONT_DIR/type1/Type1}
+	FONT_DIR=${FONT_DIR/speedo/Speedo}
+
+	# Set up configure options, wrapped so ebuilds can override if need be
+	[[ -z ${FONT_OPTIONS} ]] && FONT_OPTIONS="--with-fontdir=\"${EPREFIX}/usr/share/fonts/${FONT_DIR}\""
+
+	[[ ${PN} = font-misc-misc || ${PN} = font-schumacher-misc || ${PN##*-} = 75dpi || ${PN##*-} = 100dpi || ${PN##*-} = cyrillic ]] && IUSE+=" nls"
+fi
+
+# If we're a driver package, then enable DRIVER case
+[[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes"
+
 # @ECLASS-VARIABLE: XORG_STATIC
 # @DESCRIPTION:
 # Enables static-libs useflag. Set to no, if your package gets:
@@ -138,6 +185,7 @@ unset EAUTORECONF_DEPEND
 
 # Add static-libs useflag where useful.
 if [[ ${XORG_STATIC} == yes \
+		&& ${FONT} != yes \
 		&& ${CATEGORY} != app-doc \
 		&& ${CATEGORY} != x11-apps \
 		&& ${CATEGORY} != x11-drivers \
@@ -224,6 +272,15 @@ debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}"
 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: BDEPEND=${BDEPEND}"
 
+# @FUNCTION: xorg-3_pkg_setup
+# @DESCRIPTION:
+# Setup prefix compat
+xorg-3_pkg_setup() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	[[ ${FONT} == yes ]] && font_pkg_setup "$@"
+}
+
 # @FUNCTION: xorg-3_src_unpack
 # @DESCRIPTION:
 # Simply unpack source code.
@@ -235,6 +292,8 @@ xorg-3_src_unpack() {
 	else
 		unpack ${A}
 	fi
+
+	[[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
 }
 
 # @FUNCTION: xorg-3_reconf_source
@@ -270,6 +329,40 @@ xorg-3_src_prepare() {
 	xorg-3_reconf_source
 }
 
+# @FUNCTION: xorg-3_font_configure
+# @DESCRIPTION:
+# If a font package, perform any necessary configuration steps
+xorg-3_font_configure() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if has nls ${IUSE//+} && ! use nls; then
+		if grep -q -s "disable-all-encodings" ${ECONF_SOURCE:-.}/configure; then
+			FONT_OPTIONS+="
+				--disable-all-encodings
+				--enable-iso8859-1"
+		else
+			FONT_OPTIONS+="
+				--disable-iso8859-2
+				--disable-iso8859-3
+				--disable-iso8859-4
+				--disable-iso8859-5
+				--disable-iso8859-6
+				--disable-iso8859-7
+				--disable-iso8859-8
+				--disable-iso8859-9
+				--disable-iso8859-10
+				--disable-iso8859-11
+				--disable-iso8859-12
+				--disable-iso8859-13
+				--disable-iso8859-14
+				--disable-iso8859-15
+				--disable-iso8859-16
+				--disable-jisx0201
+				--disable-koi8-r"
+		fi
+	fi
+}
+
 # @FUNCTION: xorg-3_flags_setup
 # @DESCRIPTION:
 # Set up CFLAGS for a debug build
@@ -308,6 +401,8 @@ xorg-3_src_configure() {
 	# @DEFAULT_UNSET
 	local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
 
+	[[ -n "${FONT}" ]] && xorg-3_font_configure
+
 	# Check if package supports disabling of dep tracking
 	# Fixes warnings like:
 	#    WARNING: unrecognized options: --disable-dependency-tracking
@@ -323,6 +418,7 @@ xorg-3_src_configure() {
 	local econfargs=(
 		${dep_track}
 		${selective_werror}
+		${FONT_OPTIONS}
 		"${xorgconfadd[@]}"
 	)
 
@@ -388,4 +484,81 @@ xorg-3_src_install() {
 
 	# Don't install libtool archives (even for modules)
 	find "${D}" -type f -name '*.la' -delete || die
+
+	[[ -n ${FONT} ]] && remove_font_metadata
+}
+
+# @FUNCTION: xorg-3_pkg_postinst
+# @DESCRIPTION:
+# Run X-specific post-installation tasks on the live filesystem. The
+# only task right now is some setup for font packages.
+xorg-3_pkg_postinst() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ -n ${FONT} ]]; then
+		create_fonts_scale
+		create_fonts_dir
+		font_pkg_postinst "$@"
+
+		ewarn "Installed fonts changed. Run 'xset fp rehash' if you are using non-fontconfig applications."
+	fi
+}
+
+# @FUNCTION: xorg-3_pkg_postrm
+# @DESCRIPTION:
+# Run X-specific post-removal tasks on the live filesystem. The only
+# task right now is some cleanup for font packages.
+xorg-3_pkg_postrm() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ -n ${FONT} ]]; then
+		# if we're doing an upgrade, postinst will do
+		if [[ -z ${REPLACED_BY_VERSION} ]]; then
+			create_fonts_scale
+			create_fonts_dir
+			font_pkg_postrm "$@"
+		fi
+	fi
+}
+
+# @FUNCTION: remove_font_metadata
+# @DESCRIPTION:
+# Don't let the package install generated font files that may overlap
+# with other packages. Instead, they're generated in pkg_postinst().
+remove_font_metadata() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
+		einfo "Removing font metadata"
+		rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
+	fi
+}
+
+# @FUNCTION: create_fonts_scale
+# @DESCRIPTION:
+# Create fonts.scale file, used by the old server-side fonts subsystem.
+create_fonts_scale() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
+		ebegin "Generating fonts.scale"
+			mkfontscale \
+				-a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
+				-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
+		eend $?
+	fi
+}
+
+# @FUNCTION: create_fonts_dir
+# @DESCRIPTION:
+# Create fonts.dir file, used by the old server-side fonts subsystem.
+create_fonts_dir() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	ebegin "Generating fonts.dir"
+			mkfontdir \
+				-e "${EROOT}"/usr/share/fonts/encodings \
+				-e "${EROOT}"/usr/share/fonts/encodings/large \
+				-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
+	eend $?
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] Re: xorg-3.eclass update
  2020-08-02 17:49   ` Henrik Pihl
@ 2020-08-02 19:54     ` Aaron Bauman
  0 siblings, 0 replies; 4+ messages in thread
From: Aaron Bauman @ 2020-08-02 19:54 UTC (permalink / raw
  To: gentoo-dev



On August 2, 2020 1:49:37 PM EDT, Henrik Pihl <ahvenas@gmail.com> wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA512
>
>Hello once again,
>and of course I get to apologize some more due to forgetting to attach
>the
>new patch.
>
>Henrik
>
>On 2020-08-02 at 17:15, ahvenas@gmail.com wrote:
>> I'm sorry for my lack of testing but I didn't notice that it was
>doing
>> everything except updating the fontconfig cache when dealing with the
>fonts
>> packages. So, here should be hopefully the complete version, as
>originally
>> intented.
>>
>> Henrik
>>
>> On 2020-08-02 at 13:54, ahvenas@gmail.com wrote:
>> > Hi,
>> > According to the bug[1] it should be all right to restore the font
>parts
>> in
>> > the xorg-3 eclass. Matt didn't object either. Currently upgrading
>the
>> > font-* packages to EAPI 7 and seemed to work the same way as with
>5.
>> >
>> > [1] https://bugs.gentoo.org/712064
>> >
>> > Henrik Pihl
>-----BEGIN PGP SIGNATURE-----
>Version: FlowCrypt Email Encryption 7.8.8
>Comment: Seamlessly send and receive encrypted email
>
>wsFzBAEBCgAGBQJfJvyxACEJELLeoy9dd+JHFiEEZ+1cZjaUPp4qaEdxst6j
>L1134kfMZBAAuOppKJ+HT73gj/Fug7ZDlGY9+uH/RyokDU5jDD+A3eSqLtK0
>462767d/Of9kjmkJxJv55OGB/XVkZGZTbWpsdwS6GnsG5cj9KsblbBQU5a0g
>lRcxbzJuHoNRdhVwz48Z9vC0g41mm3Plj03TmkaM2ys1CVyDlZDylAQOTSPP
>a3YSkIj4VfzoSClnwH8sXNAZyqobIU9Av+wIQt0dYkve7Z6LH1OcRJgk8jFQ
>siOp6mnqJMb5rvioZyuBUZwOdNL5GD3qbFXJn10Ek+fYZzcE/1pqySbfoLtl
>IhtqGp9v4lYz7Yv9MLwEl+XjabJOZbZBRceHIXRJbjLCZEUpDmwFO9NObc8e
>KhsFlI3DjM8nz/EyEFIw3/51zENcJPpwlSbDPus6N5nIOjKzGCEOJNpigG5P
>uD5Es1s5QCgHf77lB8eRDQoa+u+UwiTbLWUlDIVM3IyYc6crpIM4eAM9mKVA
>Jge6EKiRG62IuIAMcPYWNzVxa+TfJWJgpy5Jdu5frxV1Vh8LplTQYIWh5U7G
>Jtq1WiGC1u2Jwyk/M8LOqtaymekeG6BSTvYf4Me1FK4+vRL7G4YeYg6LZj36
>RmJz0IeVXfRC+BAit7ctBD4AOfAlNQ9UJIpHnEKNXTGLqtDVuHeF+VEOuJWL
>GHsyorcfdpJjtbIKmCvuraysWo/I34u3Qgg=
>=XKvL
>-----END PGP SIGNATURE-----

Henrik, please send the patch inline so folks can review it. Likely, 'git send-email'. 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-02 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-02 13:54 [gentoo-dev] xorg-3.eclass update Henrik Pihl
2020-08-02 17:15 ` [gentoo-dev] " Henrik Pihl
2020-08-02 17:49   ` Henrik Pihl
2020-08-02 19:54     ` Aaron Bauman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox