[builds] Necessary changes to make 'dlg' compile. * autogen.sh (copy_submodule_files): New script to copy all the necessary source and include files from `submodules/dlg` to `src/dlg`. * src/dlg/dlgwrap.c: New wrapper file for `src/dlg.c`. It enables the build of 'dlg' if the `FT_LOGGING` macro is defined. * src/dlg/rules.mk: New sub-Makefile. * builds/freetype.mk (DLG_DIR): New variable to include the header files of the 'dlg' library. (INCLUDES): Add `DLG_DIR`. (FT_CFLAGS): Add `-std=c99' flag. Include `src/dlg/rules.mk` file to build 'dlg' library. (OBJ_S, OBJ_M): Add `DLG_OBJS_M` and `DLG_OBJS_S`. * builds/toplevel.mk: For builds directly from the git repository we need to copy files from `submodule/dlg` to `src/dlg`. * include/freetype/config/ftoption.h, devel/ftoption.h (FT_LOGGING): New macro to enable or disable the logging facility in FreeType.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
diff --git a/ChangeLog b/ChangeLog
index d2243fa..89f6116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
2020-11-27 Priyesh Kumar <priyeshkkumar@gmail.com>
+ [builds] Necessary changes to make 'dlg' compile.
+
+ * autogen.sh (copy_submodule_files): New script to copy all the
+ necessary source and include files from `submodules/dlg` to
+ `src/dlg`.
+
+ * src/dlg/dlgwrap.c: New wrapper file for `src/dlg.c`. It enables
+ the build of 'dlg' if the `FT_LOGGING` macro is defined.
+
+ * src/dlg/rules.mk: New sub-Makefile.
+
+ * builds/freetype.mk (DLG_DIR): New variable to include the
+ header files of the 'dlg' library.
+ (INCLUDES): Add `DLG_DIR`.
+ (FT_CFLAGS): Add `-std=c99' flag.
+ Include `src/dlg/rules.mk` file to build 'dlg' library.
+ (OBJ_S, OBJ_M): Add `DLG_OBJS_M` and `DLG_OBJS_S`.
+
+ * builds/toplevel.mk: For builds directly from the git repository
+ we need to copy files from `submodule/dlg` to `src/dlg`.
+
+ * include/freetype/config/ftoption.h, devel/ftoption.h (FT_LOGGING):
+ New macro to enable or disable the logging facility in FreeType.
+
+2020-11-27 Priyesh Kumar <priyeshkkumar@gmail.com>
+
* .gitmodules: Add 'dlg' library's git repository as submodule.
2020-12-01 Werner Lemberg <wl@gnu.org>
diff --git a/autogen.sh b/autogen.sh
index 79c4e4e..5608040 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -162,4 +162,25 @@ cd ../..
chmod +x ./configure
+# Copy all necessary 'dlg' files.
+copy_submodule_files ()
+{
+ echo "Copying files from \`submodules/dlg' to \`src/dlg'"
+ mkdir src/dlg/dlg
+ cp $DLG_INC_DIR/dlg.h src/dlg/dlg
+ cp $DLG_INC_DIR/output.h src/dlg/dlg
+ cp $DLG_SRC_DIR/* src/dlg
+}
+
+DLG_INC_DIR=submodules/dlg/include/dlg
+DLG_SRC_DIR=submodules/dlg/src/dlg
+
+if ! test -d "$DLG_INC_DIR"; then
+ echo "Checking out submodule in \`submodules/dlg':"
+ git submodule init
+ git submodule update
+fi
+
+copy_submodule_files
+
# EOF
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 1d7eeb6..9b52510 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -101,6 +101,7 @@ PUBLIC_DIR := $(TOP_DIR)/include/freetype
INTERNAL_DIR := $(PUBLIC_DIR)/internal
SERVICES_DIR := $(INTERNAL_DIR)/services
CONFIG_DIR := $(PUBLIC_DIR)/config
+DLG_DIR := $(TOP_DIR)/src/dlg
# The documentation directory.
#
@@ -122,6 +123,7 @@ PROJECT_LIBRARY := $(LIB_DIR)/$(LIBRARY).$A
INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \
$(DEVEL_DIR) \
$(BUILD_DIR) \
+ $(DLG_DIR) \
$(TOP_DIR)/include)
INCLUDE_FLAGS := $(INCLUDES:%=$I%)
@@ -150,9 +152,10 @@ endif
#
# `CPPFLAGS' might be specified by the user in the environment.
#
-FT_CFLAGS = $(CPPFLAGS) \
- $(CFLAGS) \
- $DFT2_BUILD_LIBRARY
+FT_CFLAGS = $(CPPFLAGS) \
+ $(CFLAGS) \
+ $DFT2_BUILD_LIBRARY \
+ -std=c99
FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)
@@ -220,6 +223,7 @@ $(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
#
include $(SRC_DIR)/base/rules.mk
include $(patsubst %,$(SRC_DIR)/%/rules.mk,$(MODULES))
+include $(SRC_DIR)/dlg/rules.mk
# ftinit component
@@ -260,8 +264,8 @@ endif
# All FreeType library objects.
#
-OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
-OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
+OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) $(DLG_OBJS_M)
+OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S) $(DLG_OBJS_S)
# The target `multi' on the Make command line indicates that we want to
diff --git a/builds/toplevel.mk b/builds/toplevel.mk
index 5de61c1..c08c9f4 100644
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -103,6 +103,23 @@ ifneq ($(findstring setup,$(MAKECMDGOALS)),)
check_platform := 1
endif
+# For builds directly from the git repository we need to copy files
+# from `submodule/dlg' to `src/dlg'.
+#
+ifeq ($(wildcard src/dlg/dlg.*),)
+ ifeq ($(wildcard submodules/dlg/dlg.*),)
+ $(info Checking out submodule in `submodules/dlg')
+ $(shell git submodule init)
+ $(shell git submodule update)
+ endif
+
+ $(info Copying files from `submodules/dlg' to `src/dlg')
+ $(shell mkdir src/dlg/dlg)
+ $(shell cp submodules/dlg/include/dlg/dlg.h src/dlg/dlg)
+ $(shell cp submodules/dlg/include/dlg/output.h src/dlg/dlg)
+ $(shell cp submodules/dlg/src/dlg/dlg.c src/dlg/)
+endif
+
# Include the automatic host platform detection rules when we need to
# check the platform.
#
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 307d1a3..7162b70 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -433,6 +433,21 @@ FT_BEGIN_HEADER
/**************************************************************************
*
+ * Logging
+ *
+ * Compiling FreeType in debug or trace mode makes FreeType write error
+ * and trace log messages to `stderr`. Enabling this macro
+ * automatically forces the `FT_DEBUG_LEVEL_ERROR` and
+ * `FT_DEBUG_LEVEL_TRACE` macros and allows FreeType to write error and
+ * trace log messages to a file instead of `stderr`. For writing logs
+ * to a file, FreeType uses an the external `dlg` library (the source
+ * code is in `src/dlg`).
+ */
+#define FT_LOGGING
+
+
+ /**************************************************************************
+ *
* Autofitter debugging
*
* If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 097f19b..7dcf197 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -433,6 +433,21 @@ FT_BEGIN_HEADER
/**************************************************************************
*
+ * Logging
+ *
+ * Compiling FreeType in debug or trace mode makes FreeType write error
+ * and trace log messages to `stderr`. Enabling this macro
+ * automatically forces the `FT_DEBUG_LEVEL_ERROR` and
+ * `FT_DEBUG_LEVEL_TRACE` macros and allows FreeType to write error and
+ * trace log messages to a file instead of `stderr`. For writing logs
+ * to a file, FreeType uses an the external `dlg` library (the source
+ * code is in `src/dlg`).
+ */
+/* #define FT_LOGGING */
+
+
+ /**************************************************************************
+ *
* Autofitter debugging
*
* If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to
diff --git a/src/dlg/dlgwrap.c b/src/dlg/dlgwrap.c
new file mode 100644
index 0000000..0333eb9
--- /dev/null
+++ b/src/dlg/dlgwrap.c
@@ -0,0 +1,30 @@
+/****************************************************************************
+ *
+ * dlgwrap.c
+ *
+ * Wrapper file for the 'dlg' library (body only)
+ *
+ * Copyright (C) 2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+
+#include <freetype/freetype.h>
+
+
+#ifdef FT_LOGGING
+#include "dlg.c"
+#else
+ /* ANSI C doesn't like empty source files */
+ typedef int _dlg_dummy;
+#endif
+
+
+/* END */
diff --git a/src/dlg/rules.mk b/src/dlg/rules.mk
new file mode 100644
index 0000000..6df60ad
--- /dev/null
+++ b/src/dlg/rules.mk
@@ -0,0 +1,70 @@
+#
+# FreeType 2 dlg logging library configuration rules
+#
+
+
+# Copyright (C) 2020 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT. By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
+
+
+# dlg logging library directory
+#
+DLG_DIR := $(SRC_DIR)/dlg
+
+
+# compilation flags for the library
+#
+DLG_COMPILE := $(CC) $(ANSIFLAGS) \
+ $I$(subst /,$(COMPILER_SEP),$(DLG_DIR)) \
+ $(INCLUDE_FLAGS) \
+ $(FT_CFLAGS)
+
+
+# dlg logging library sources (i.e., C files)
+#
+DLG_SRC := $(DLG_DIR)/dlgwrap.c
+
+# dlg logging library headers
+#
+DLG_H := $(DLG_DIR)/dlg/dlg.h \
+ $(DLG_DIR)/dlg/output.h
+
+
+# dlg logging library object(s)
+#
+# DLG_OBJ_M is used during `multi' builds
+# DLG_OBJ_S is used during `single' builds
+#
+DLG_OBJ_M := $(DLG_SRC:$(DLG_DIR)/%.c=$(OBJ_DIR)/%.$O)
+DLG_OBJ_S := $(OBJ_DIR)/dlg.$O
+
+# dlg logging library source file for single build
+#
+DLG_SRC_S := $(DLG_DIR)/dlgwrap.c
+
+
+# dlg logging library - single object
+#
+$(DLG_OBJ_S): $(DLG_SRC_S) $(DLG_SRC) $(FREETYPE_H) $(DLG_H)
+ $(DLG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(DLG_SRC_S))
+
+
+# dlg logging library - multiple objects
+#
+$(OBJ_DIR)/%.$O: $(DLG_DIR)/%.c $(FREETYPE_H) $(DLG_H)
+ $(DLG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
+
+
+# update main object lists
+#
+DLG_OBJS_S += $(DLG_OBJ_S)
+DLG_OBJS_M += $(DLG_OBJ_M)
+
+
+# EOF