shithub: freetype+ttf2subf

Download patch

ref: 34b1c897c109d853fcae123f11a4bc756a5eca2f
parent: 8da4b437b4f784e9822e260cab5ecf1a0273469c
author: Priyesh Kumar <priyeshkkumar@gmail.com>
date: Wed Aug 26 08:27:52 EDT 2020

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- 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>
--- a/autogen.sh
+++ b/autogen.sh
@@ -162,4 +162,25 @@
 
 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
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -101,6 +101,7 @@
 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 @@
 INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \
                                       $(DEVEL_DIR) \
                                       $(BUILD_DIR) \
+                                      $(DLG_DIR) \
                                       $(TOP_DIR)/include)
 
 INCLUDE_FLAGS := $(INCLUDES:%=$I%)
@@ -150,9 +152,10 @@
 #
 # `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 @@
 #
 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 @@
 
 # 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
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -103,6 +103,23 @@
   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.
 #
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -433,6 +433,21 @@
 
   /**************************************************************************
    *
+   * 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
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -433,6 +433,21 @@
 
   /**************************************************************************
    *
+   * 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
--- /dev/null
+++ b/src/dlg/dlgwrap.c
@@ -1,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 */
--- /dev/null
+++ b/src/dlg/rules.mk
@@ -1,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