4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2018, Aurelien Larcher. All rights reserved.
27 BUILD_STYLE ?
= archive
29 ifneq ($(findstring X11
,$(FONT_TYPE
)),)
31 include $(WS_MAKE_RULES
)/x11.mk
34 include $(WS_MAKE_RULES
)/common.mk
36 MKFONTSCALE
= mkfontscale
39 ETCFONTSDIR
= $(ETCDIR
)/fonts
40 ETCFONTSCONFDIR
= $(ETCFONTSDIR
)/conf.avail
41 USRSHAREFONTSDIR
= $(USRSHAREDIR
)/fonts
51 PKGFONTDIR?
= $($(FONT_TYPE
)FONTDIR
)
54 USRSHARETTFFONTSDIR
= $(USRSHAREFONTSDIR
)/$(TTFFONTDIR
)
55 USRSHAREOTFFONTSDIR
= $(USRSHAREFONTSDIR
)/$(OTFFONTDIR
)
56 USRSHAREX11FONTSDIR
= $(USRSHAREFONTSDIR
)/$(X11FONTDIR
)
62 PKGFONTSRC?
= $($(FONT_TYPE
)FONTSRC
)
68 PKGFONTCLS?
= $($(FONT_TYPE
)FONTCLS
)
70 TTFFONTEXT
= *.ttc
*.tte
*.ttf
71 OTFFONTEXT
= *.otf
*.otc
*.ttf
*.ttc
73 X11MISCFONTEXT
= *.pcf
74 PKGFONTEXT?
= $($(FONT_TYPE
)FONTEXT
)
76 PKGFONTCONFSRC
= fontconfig
77 PKGFONTCONFEXT
= *.conf
80 # Proto area directories
83 PROTOFONTSDIR
= $(PROTO_DIR
)$(USRSHAREFONTSDIR
)
84 PROTOTTFFONTSDIR
= $(PROTOFONTSDIR
)/$(TTFFONTDIR
)
85 PROTOOTFFONTSDIR
= $(PROTOFONTSDIR
)/$(OTFFONTDIR
)
86 PROTOX11FONTSDIR
= $(PROTOFONTSDIR
)/$(X11FONTDIR
)
87 PROTOPKGFONTSDIR
= $(PROTO
$(FONT_TYPE
)FONTSDIR
)
89 PROTOFONTSCONFDIR
= $(PROTO_DIR
)$(ETCFONTSCONFDIR
)
95 COMPONENT_FONT_TYPE
= $(PKGFONTCLS
)
96 COMPONENT_FONT_NAME
= $(COMPONENT_NAME
)
97 COMPONENT_FONT_PKG
= $(COMPONENT_NAME
)
98 ifeq ($(strip $(COMPONENT_FONT_TYPE
)),)
100 system
/font
/$(strip $(COMPONENT_FONT_PKG
))
103 system
/font
/$(strip $(COMPONENT_FONT_TYPE
))/$(strip $(COMPONENT_FONT_PKG
))
105 COMPONENT_CLASSIFICATION
= System
/Fonts
106 COMPONENT_CATEGORY
= font
108 COMPONENT_FONT_DEST_DIR?
= $(USRSHAREFONTSDIR
)/$(PKGFONTDIR
)/$(COMPONENT_FONT_NAME
)
109 COMPONENT_FONT_SRC_DIR ?
= $(PKGFONTSRC
)
110 COMPONENT_FONT_FILES
=
112 COMPONENT_FONTCONF_DEST_DIR?
= $(ETCFONTSCONFDIR
)
113 COMPONENT_FONTCONF_SRC_DIR ?
= $(PKGFONTCONFSRC
)
114 COMPONENT_FONTCONF_FILES
= $(PKGFONTCONFEXT
)
117 # Build style specific rules
120 ifeq ($(strip $(BUILD_STYLE
)),archive
)
122 POST_INSTALL_MKFONT?
=no
124 COMPONENT_BUILD_ACTION?
= true
125 ifeq ($(strip $(POST_INSTALL_MKFONT
)),no
)
126 COMPONENT_BUILD_ACTION
= \
127 cd
$(@D
)/$(COMPONENT_FONT_SRC_DIR
); $(MKFONTSCALE
); $(MKFONTDIR
);
130 $(BUILD_DIR
)/%/.built
: $(SOURCE_DIR
)/.prep
131 ($(RM
) -rf
$(@D
) ; $(MKDIR
) $(@D
))
132 $(ENV
) $(CLONEY_ARGS
) $(CLONEY
) $(SOURCE_DIR
) $(@D
)
133 $(COMPONENT_PRE_BUILD_ACTION
)
134 ($(COMPONENT_BUILD_ACTION
))
135 $(COMPONENT_POST_BUILD_ACTION
)
138 build
: $(BUILD_
$(MK_BITS
))
140 COMPONENT_FONT_POST_INSTALL_ACTION
= \
141 ( $(MKFONTSCALE
) $(PROTO_DIR
)$(COMPONENT_FONT_DEST_DIR
); \
142 $(MKFONTDIR
) $(PROTO_DIR
)$(COMPONENT_FONT_DEST_DIR
) )
144 ifeq ($(strip $(POST_INSTALL_MKFONT
)),yes
)
145 COMPONENT_POST_INSTALL_ACTION
+=$(COMPONENT_FONT_POST_INSTALL_ACTION
)
147 COMPONENT_FONT_FILES
+= fonts.
dir
148 COMPONENT_FONT_FILES
+= fonts.scale
151 COMPONENT_INSTALL_ACTION
= \
152 cd
$(@D
)/$(COMPONENT_FONT_SRC_DIR
) && \
153 $(INSTALL
) -m
0444 $(COMPONENT_FONT_FILES
) \
154 $(PROTO_DIR
)$(COMPONENT_FONT_DEST_DIR
) ; \
155 if
[ -n
"$(strip $(COMPONENT_FONTCONF_FILES))" ]; \
157 cd
$(@D
)/$(COMPONENT_FONTCONF_SRC_DIR
) && \
158 $(INSTALL
) -m
0444 $(COMPONENT_FONTCONF_FILES
) \
159 $(PROTO_DIR
)$(COMPONENT_FONTCONF_DEST_DIR
) ; \
162 $(BUILD_DIR
)/%/.installed
: $(BUILD_DIR
)/%/.built
164 $(COMPONENT_PRE_INSTALL_ACTION
)
165 -$(RM
) -r
$(PROTO_DIR
)$(COMPONENT_FONT_DEST_DIR
)
166 $(MKDIR
) $(PROTO_DIR
)$(COMPONENT_FONT_DEST_DIR
)
167 $(MKDIR
) $(PROTO_DIR
)$(COMPONENT_FONTCONF_DEST_DIR
)
168 ($(COMPONENT_INSTALL_ACTION
))
169 $(COMPONENT_POST_INSTALL_ACTION
)
172 install: $(INSTALL_
$(MK_BITS
))
175 $(RM
) -r
$(BUILD_DIR
) $(PROTO_DIR
)
179 ifeq ($(strip $(BUILD_STYLE
)),configure
)
180 # We don't compress individual font files so that we get better compression
181 # at higher levels in ZFS & IPS, and so that we aren't constantly replacing
182 # font files in every build just because the timestamp in the compressed
184 CONFIGURE_OPTIONS
+= --without-compression
187 # Add font metadata to packages to make it easier to search for fonts
188 $(CANONICAL_MANIFESTS
:%.p5m
=$(MANIFEST_BASE
)-%.mogrified
): PUBLISH_TRANSFORMS
+= $(@
:.mogrified
=.font-transforms
)
190 $(CANONICAL_MANIFESTS
:%.p5m
=$(MANIFEST_BASE
)-%.mogrified
): font-transforms
191 font-transforms
: $(CANONICAL_MANIFESTS
:%.p5m
=$(MANIFEST_BASE
)-%.font-transforms
)
193 $(MANIFEST_BASE
)-%.font-transforms
: %.p5m
194 $(PERL
) $(WS_TOOLS
)/generate_font_metadata.pl \
195 -p
$(PROTO_DIR
) -m
$< > $@ ||
( rm $@
; exit
1 )
197 # Package containing fc-scan used in generate_font_metadata.pl
198 USERLAND_REQUIRED_PACKAGES
+= system
/library
/fontconfig
199 # Package containing $(MKFONTSCALE) & $(MKFONTDIR)
200 USERLAND_REQUIRED_PACKAGES
+= x11
/font-utilities