[freetype] Fix building Freetype 2.11 on MSVC. (#20674)

* Fix building Freetype 2.11 on MSVC.

* [freetype] Change tab to spaces.

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [freetype] Remove comments from patch.

* [freetype] Quote file paths.

* [freetype] Update versions after force push.

* [freetype] Update ports/freetype/portfile.cmake

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [freetype] x-add-version

Co-authored-by: Bartosz Taudul <bartosz.taudul@huuugegames.com>
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Bartosz Taudul 2021-10-22 09:42:41 +02:00 committed by GitHub
parent a3aef4e5bf
commit ce52984f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 174 additions and 15 deletions

View File

@ -0,0 +1,152 @@
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index aedb74ddd..5d53dfb71 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -19,6 +19,7 @@
#include "afglobal.h"
#include "afranges.h"
#include "afshaper.h"
+#include "afws_dec.h"
#include <freetype/internal/ftdebug.h>
@@ -32,11 +33,6 @@
#define FT_COMPONENT afglobal
- /* get writing system specific header files */
-#undef WRITING_SYSTEM
-#define WRITING_SYSTEM( ws, WS ) /* empty */
-#include "afwrtsys.h"
-
#include "aferrors.h"
@@ -74,7 +70,7 @@
af_writing_system_classes[] =
{
-#include "afwrtsys.h"
+#include "afws_itr.h"
NULL /* do not remove */
};
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index e76b103ed..a036a0f56 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -198,7 +198,6 @@ extern void* _af_debug_hints;
* outline according to the results of the glyph analyzer.
*/
-#define AFWRTSYS_H_ /* don't load header files */
#undef WRITING_SYSTEM
#define WRITING_SYSTEM( ws, WS ) \
AF_WRITING_SYSTEM_ ## WS,
@@ -207,14 +206,12 @@ extern void* _af_debug_hints;
typedef enum AF_WritingSystem_
{
-#include "afwrtsys.h"
+#include "afws_itr.h"
AF_WRITING_SYSTEM_MAX /* do not remove */
} AF_WritingSystem;
-#undef AFWRTSYS_H_
-
typedef struct AF_WritingSystemClassRec_
{
diff --git a/src/autofit/afws_dec.h b/src/autofit/afws_dec.h
new file mode 100644
index 000000000..39e707c5a
--- /dev/null
+++ b/src/autofit/afws_dec.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ *
+ * afws_dec.h
+ *
+ * Auto-fitter writing systems (specification only).
+ *
+ * Copyright (C) 2013-2021 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.
+ *
+ */
+
+
+#ifndef AFWS_DEC_H_
+#define AFWS_DEC_H_
+
+ /* Since preprocessor directives can't create other preprocessor */
+ /* directives, we have to include the header files manually. */
+
+#include "afdummy.h"
+#include "aflatin.h"
+#include "afcjk.h"
+#include "afindic.h"
+
+#endif /* AFWS_DEC_H_ */
diff --git a/src/autofit/afwrtsys.h b/src/autofit/afws_itr.h
similarity index 66%
rename from src/autofit/afwrtsys.h
rename to src/autofit/afws_itr.h
index 39aa12112..2da77d459 100644
--- a/src/autofit/afwrtsys.h
+++ b/src/autofit/afws_itr.h
@@ -1,6 +1,6 @@
/****************************************************************************
*
- * afwrtsys.h
+ * afws_itr.h
*
* Auto-fitter writing systems (specification only).
*
@@ -15,23 +15,8 @@
*
*/
-
-#ifndef AFWRTSYS_H_
-#define AFWRTSYS_H_
-
- /* Since preprocessor directives can't create other preprocessor */
- /* directives, we have to include the header files manually. */
-
-#include "afdummy.h"
-#include "aflatin.h"
-#include "afcjk.h"
-#include "afindic.h"
-
-#endif /* AFWRTSYS_H_ */
-
-
- /* The following part can be included multiple times. */
- /* Define `WRITING_SYSTEM' as needed. */
+ /* This header may be included multiple times. */
+ /* Define `WRITING_SYSTEM' as needed. */
/* Add new writing systems here. The arguments are the writing system */
diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk
index 19b3bcadb..a5438ecba 100644
--- a/src/autofit/rules.mk
+++ b/src/autofit/rules.mk
@@ -48,7 +48,8 @@ AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \
$(AUTOF_DIR)/afscript.h \
$(AUTOF_DIR)/afstyles.h \
$(AUTOF_DIR)/aftypes.h \
- $(AUTOF_DIR)/afwrtsys.h
+ $(AUTOF_DIR)/afws_dec.h \
+ $(AUTOF_DIR)/afws_itr.h
# AUTOF driver object(s)

View File

@ -11,6 +11,7 @@ vcpkg_from_sourceforge(
fix-bzip2-pc.patch # we have a bzip2 file that we can use - https://gitlab.freedesktop.org/freetype/freetype/-/commit/b2aeca5fda870751f3c9d645e0dca4c80fa1ae5a
brotli-static.patch
fix-exports.patch
fix-2.11-msvc-build.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -38,13 +39,13 @@ vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/freetype)
# Rename for easy usage (VS integration; CMake and autotools will not care)
file(RENAME ${CURRENT_PACKAGES_DIR}/include/freetype2/freetype ${CURRENT_PACKAGES_DIR}/include/freetype)
file(RENAME ${CURRENT_PACKAGES_DIR}/include/freetype2/ft2build.h ${CURRENT_PACKAGES_DIR}/include/ft2build.h)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/freetype2)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(RENAME "${CURRENT_PACKAGES_DIR}/include/freetype2/freetype" "${CURRENT_PACKAGES_DIR}/include/freetype")
file(RENAME "${CURRENT_PACKAGES_DIR}/include/freetype2/ft2build.h" "${CURRENT_PACKAGES_DIR}/include/ft2build.h")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/freetype2")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
# Fix the include dir [freetype2 -> freetype]
file(READ ${CURRENT_PACKAGES_DIR}/share/freetype/freetype-targets.cmake CONFIG_MODULE)
file(READ "${CURRENT_PACKAGES_DIR}/share/freetype/freetype-targets.cmake" CONFIG_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}/include/freetype2" "\${_IMPORT_PREFIX}/include" CONFIG_MODULE "${CONFIG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/lib/brotlicommon-static.lib" [[\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/brotlicommon-static.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/brotlicommon-static.lib>]] CONFIG_MODULE "${CONFIG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/lib/brotlidec-static.lib" [[\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/brotlidec-static.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/brotlidec-static.lib>]] CONFIG_MODULE "${CONFIG_MODULE}")
@ -67,10 +68,10 @@ if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/freetype2.pc")
file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/freetype2.pc" "${_contents}")
endif()
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m)
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
if("zlib" IN_LIST FEATURES)
@ -89,13 +90,13 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(USE_BROTLI ON)
endif()
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
endif()
file(COPY
${SOURCE_PATH}/docs/FTL.TXT
${SOURCE_PATH}/docs/GPLv2.TXT
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
"${SOURCE_PATH}/docs/FTL.TXT"
"${SOURCE_PATH}/docs/GPLv2.TXT"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright")

View File

@ -1,6 +1,7 @@
{
"name": "freetype",
"version-semver": "2.11.0",
"port-version": 1,
"description": "A library to render fonts.",
"homepage": "https://www.freetype.org/",
"dependencies": [

View File

@ -2250,7 +2250,7 @@
},
"freetype": {
"baseline": "2.11.0",
"port-version": 0
"port-version": 1
},
"freetype-gl": {
"baseline": "2020-09-14",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a314ebd21048f1cf17a6b4330d9970c661f8fea7",
"version-semver": "2.11.0",
"port-version": 1
},
{
"git-tree": "6814e10440bcdc58c4bd29a0373d2f902783ba54",
"version-semver": "2.11.0",