media-libs/freetype: avoid redefining TT_CONFIG_OPTION_SUBPIXEL_HINTING
authorMike Gilbert <floppym@gentoo.org>
Fri, 30 Sep 2016 15:48:24 +0000 (11:48 -0400)
committerMike Gilbert <floppym@gentoo.org>
Fri, 30 Sep 2016 20:16:13 +0000 (16:16 -0400)
Adjust the enable_option function to remvoe comments instead of appending an
additional line. This should resolve a build failure in sys-boot/grub.

Also allow both cleartype and infinality to be enabled simultaneously, as
documented in ftoption.h.

Bug: https://bugs.gentoo.org/595558
Package-Manager: portage-2.3.1_p4_p550764

media-libs/freetype/freetype-2.7-r2.ebuild [moved from media-libs/freetype/freetype-2.7-r1.ebuild with 93% similarity]

similarity index 93%
rename from media-libs/freetype/freetype-2.7-r1.ebuild
rename to media-libs/freetype/freetype-2.7-r2.ebuild
index c7c0aaf9d9976359658a37cbbc69af3e66f86117..8650a681ed853fa5997052b6299856bea63e0226 100644 (file)
@@ -41,8 +41,6 @@ RDEPEND="${CDEPEND}
        abi_x86_32? ( utils? ( !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)] ) )"
 PDEPEND="infinality? ( media-libs/fontconfig-infinality )"
 
-REQUIRED_USE="?? ( cleartype_hinting infinality )"
-
 PATCHES=(
        # This is the same as the 01 patch from infinality
        "${FILESDIR}"/${PN}-2.7-enable-valid.patch
@@ -52,27 +50,28 @@ PATCHES=(
 
 src_prepare() {
        enable_option() {
-               sed -i -e "/#define $1/a #define $1" \
+               sed -i -e "/#define $1/ { s:/\* ::; s: \*/:: }" \
                        include/${PN}/config/ftoption.h \
                        || die "unable to enable option $1"
        }
 
        disable_option() {
-               sed -i -e "/#define $1/ { s:^:/*:; s:$:*/: }" \
+               sed -i -e "/#define $1/ { s:^:/* :; s:$: */: }" \
                        include/${PN}/config/ftoption.h \
                        || die "unable to disable option $1"
        }
 
        default
 
-       if use infinality; then
-               # FT_CONFIG_OPTION_SUBPIXEL_RENDERING is already enabled in freetype-2.4.11
+       # Will be the new default for >=freetype-2.7.0
+       disable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING  2"
+
+       if use infinality && use cleartype_hinting; then
+               enable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING  ( 1 | 2 )"
+       elif use infinality; then
                enable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING  1"
        elif use cleartype_hinting; then
-               # Will be the new default for >=freetype-2.7.0
                enable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING  2"
-       else
-               disable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING  2"
        fi
 
        if ! use bindist; then