Andreas Wacknitz
2024-04-05 3ed869342c8a02e8b359df8b8c6bf6e08d0c5d4f
commit | author | age
a49d4f 1 #
AL 2 # CDDL HEADER START
3 #
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.
7 #
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.
12 #
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]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2018, Aurelien Larcher. All rights reserved.
25 #
26 BUILD_BITS  ?= NO_ARCH
27 BUILD_STYLE ?= archive
28
43756a 29 ifneq ($(findstring X11,$(FONT_TYPE)),)
AL 30 X11_CATEGORY = FONT
31 include $(WS_MAKE_RULES)/x11.mk
32 endif
33
a49d4f 34 include $(WS_MAKE_RULES)/common.mk
AL 35
36 MKFONTSCALE = mkfontscale
37 MKFONTDIR = mkfontdir
38
39 ETCFONTSDIR = $(ETCDIR)/fonts
40 ETCFONTSCONFDIR = $(ETCFONTSDIR)/conf.avail
41 USRSHAREFONTSDIR = $(USRSHAREDIR)/fonts
42
43 #
44 # Font type macros 
45 #
46
43756a 47 TTFFONTDIR     = TrueType
AL 48 OTFFONTDIR     = OpenType
49 X11FONTDIR     = X11
50 X11MISCFONTDIR = X11
a49d4f 51 PKGFONTDIR?= $($(FONT_TYPE)FONTDIR)
AL 52
53 # For compatibility
c356c9 54 USRSHARETTFFONTSDIR = $(USRSHAREFONTSDIR)/$(TTFFONTDIR)
AL 55 USRSHAREOTFFONTSDIR = $(USRSHAREFONTSDIR)/$(OTFFONTDIR)
56 USRSHAREX11FONTSDIR = $(USRSHAREFONTSDIR)/$(X11FONTDIR)
a49d4f 57
43756a 58 TTFFONTSRC     = ttf
AL 59 OTFFONTSRC     = otf
60 X11FONTSRC     =
61 X11MISCFONTSRC =
a49d4f 62 PKGFONTSRC?= $($(FONT_TYPE)FONTSRC)
AL 63
43756a 64 TTFFONTCLS     = truetype
AL 65 OTFFONTCLS     = opentype
66 X11FONTCLS     = xorg
67 X11MISCFONTCLS =
a49d4f 68 PKGFONTCLS?= $($(FONT_TYPE)FONTCLS)
AL 69
43756a 70 TTFFONTEXT     = *.ttc *.tte *.ttf
AL 71 OTFFONTEXT     = *.otf *.otc *.ttf *.ttc
72 X11FONTEXT     = *.pcf
73 X11MISCFONTEXT = *.pcf
a49d4f 74 PKGFONTEXT?= $($(FONT_TYPE)FONTEXT)
AL 75
76 PKGFONTCONFSRC = fontconfig
77 PKGFONTCONFEXT = *.conf
78
79 #
80 # Proto area directories
81 #
82
83 PROTOFONTSDIR = $(PROTO_DIR)$(USRSHAREFONTSDIR)
20b13a 84 PROTOTTFFONTSDIR = $(PROTOFONTSDIR)/$(TTFFONTDIR)
AL 85 PROTOOTFFONTSDIR = $(PROTOFONTSDIR)/$(OTFFONTDIR)
86 PROTOX11FONTSDIR = $(PROTOFONTSDIR)/$(X11FONTDIR)
a49d4f 87 PROTOPKGFONTSDIR = $(PROTO$(FONT_TYPE)FONTSDIR)
AL 88
89 PROTOFONTSCONFDIR = $(PROTO_DIR)$(ETCFONTSCONFDIR)
90
91 #
43756a 92 # Default macros 
a49d4f 93 #
AL 94
2073b9 95 COMPONENT_FONT_TYPE = $(PKGFONTCLS)
43756a 96 COMPONENT_FONT_NAME = $(COMPONENT_NAME)
AL 97 COMPONENT_FONT_PKG  = $(COMPONENT_NAME)
98 ifeq ($(strip $(COMPONENT_FONT_TYPE)),)
746f23 99 COMPONENT_FMRI ?= \
43756a 100   system/font/$(strip $(COMPONENT_FONT_PKG))
AL 101 else
746f23 102 COMPONENT_FMRI ?= \
43756a 103   system/font/$(strip $(COMPONENT_FONT_TYPE))/$(strip $(COMPONENT_FONT_PKG))
AL 104 endif
a49d4f 105 COMPONENT_CLASSIFICATION = System/Fonts
43756a 106 COMPONENT_CATEGORY = font 
a49d4f 107
AL 108 COMPONENT_FONT_DEST_DIR?= $(USRSHAREFONTSDIR)/$(PKGFONTDIR)/$(COMPONENT_FONT_NAME)
109 COMPONENT_FONT_SRC_DIR ?= $(PKGFONTSRC)
110 COMPONENT_FONT_FILES    =
111
112 COMPONENT_FONTCONF_DEST_DIR?= $(ETCFONTSCONFDIR)
113 COMPONENT_FONTCONF_SRC_DIR ?= $(PKGFONTCONFSRC)
114 COMPONENT_FONTCONF_FILES    = $(PKGFONTCONFEXT)
115
43756a 116 #
AL 117 # Build style specific rules
118 #
119
a49d4f 120 ifeq ($(strip $(BUILD_STYLE)),archive)
AL 121
122 POST_INSTALL_MKFONT?=no 
123
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);
128 endif
129
130 $(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep
131     ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
c529ec 132     $(ENV) $(CLONEY_ARGS) $(CLONEY) $(SOURCE_DIR) $(@D)
a49d4f 133     $(COMPONENT_PRE_BUILD_ACTION)
AL 134     ($(COMPONENT_BUILD_ACTION))
135     $(COMPONENT_POST_BUILD_ACTION)
136     $(TOUCH) $@
137
138 build: $(BUILD_$(MK_BITS))
139
140 COMPONENT_FONT_POST_INSTALL_ACTION = \
141   ( $(MKFONTSCALE) $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR); \
142     $(MKFONTDIR) $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR) )
143
144 ifeq ($(strip $(POST_INSTALL_MKFONT)),yes)
145 COMPONENT_POST_INSTALL_ACTION+=$(COMPONENT_FONT_POST_INSTALL_ACTION)
146 else
147 COMPONENT_FONT_FILES += fonts.dir
148 COMPONENT_FONT_FILES += fonts.scale
149 endif
150
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))" ]; \
156   then \
157     cd $(@D)/$(COMPONENT_FONTCONF_SRC_DIR) && \
158       $(INSTALL) -m 0444 $(COMPONENT_FONTCONF_FILES) \
159         $(PROTO_DIR)$(COMPONENT_FONTCONF_DEST_DIR) ; \
160   fi;
161
162 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
163     $(MKDIR) $(@D)
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)
170     $(TOUCH) $@
171
172 install: $(INSTALL_$(MK_BITS))
173
174 clean::
175     $(RM) -r $(BUILD_DIR) $(PROTO_DIR)
176
177 endif
178
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
183 # version changed.
184 CONFIGURE_OPTIONS += --without-compression
185 endif
186
187 # Add font metadata to packages to make it easier to search for fonts
11c2e2 188 $(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.mogrified): PUBLISH_TRANSFORMS += $(@:.mogrified=.font-transforms)
a49d4f 189
11c2e2 190 $(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.mogrified): font-transforms
AL 191 font-transforms: $(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.font-transforms)
a49d4f 192
AL 193 $(MANIFEST_BASE)-%.font-transforms: %.p5m
194     $(PERL) $(WS_TOOLS)/generate_font_metadata.pl \
195     -p $(PROTO_DIR) -m $< > $@ || ( rm $@ ; exit 1 )
196
197 # Package containing fc-scan used in generate_font_metadata.pl
8203c7 198 USERLAND_REQUIRED_PACKAGES += system/library/fontconfig
a49d4f 199 # Package containing $(MKFONTSCALE) & $(MKFONTDIR)
8203c7 200 USERLAND_REQUIRED_PACKAGES += x11/font-utilities
a49d4f 201