Skip to content

Commit

Permalink
ftgl: Fix builds with freetype 2.13.3
Browse files Browse the repository at this point in the history
Based on research into this issue, freetype 2.13.3 changed some return
types that caused current (modern?) builds to fail as seen in the linked
ticket.

A patch was applied with frankheckenbach/ftgl#20 that appears to fix
this, but the repo owner has not indicated a plan to cut a new release
with this and other fixes since v2.4.0.

In addition to the patch files that were previously present, I have
applied all other patches from v2.4.0 to current HEAD. This involved
removing the existing patch files, but those changes have been fully
incorporated.

Builds with +doc and +universal variants worked fine and I have tested
a downstream port (gource) with this on an affected system.

macOS 15.2 24C101 arm64
Xcode 16.2 16C5032a

Closes: https://trac.macports.org/ticket/71434
  • Loading branch information
halostatue committed Jan 4, 2025
1 parent 6b12302 commit 8279680
Show file tree
Hide file tree
Showing 12 changed files with 469 additions and 61 deletions.
16 changes: 12 additions & 4 deletions graphics/ftgl/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PortSystem 1.0
PortGroup github 1.0

github.setup frankheckenbach ftgl 2.4.0 v
revision 1
revision 2
platforms darwin
categories graphics
license MIT
Expand All @@ -24,7 +24,7 @@ autoreconf.cmd ./autogen.sh
autoreconf.args

depends_lib-append \
port:freetype
port:freetype

depends_build-append \
port:autoconf \
Expand All @@ -33,8 +33,16 @@ depends_build-append \
port:libtool \
port:pkgconfig

patchfiles AC_ARG_WITH.patch \
dylib_file.patch
patch.pre_args-replace -p0 -p1
patchfiles autoconf.patch \
CMakeLists-pkgconfig.patch \
debian.patch \
docs-meta.patch \
float-functions.patch \
fontdemo.patch \
freetype2-13-3-type-error.patch \
FTFont-GL_TEXTURE_BIT.patch \
src_CMakeLists-remove-FTLibrary.patch

# Don't use MacPorts X11 since there doesn't seem to be a need to do so.
# Don't use MacPorts OpenGL (mesa) since that would bring in X11 deps.
Expand Down
35 changes: 0 additions & 35 deletions graphics/ftgl/files/AC_ARG_WITH.patch

This file was deleted.

32 changes: 32 additions & 0 deletions graphics/ftgl/files/CMakeLists-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git c/CMakeLists.txt i/CMakeLists.txt
index 303fcaede209..cdcf2c96012d 100644
--- c/CMakeLists.txt
+++ i/CMakeLists.txt
@@ -72,5 +72,14 @@ endif ()

install(EXPORT FTGL-targets DESTINATION "${cmakedir}")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FTGLConfig.cmake"
DESTINATION "${cmakedir}")
+
+SET(PKGCONFIG_INSTALL_PREFIX "lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ftgl.pc.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/ftgl.pc
+ @ONLY)
+INSTALL(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/ftgl.pc
+ DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
diff --git c/ftgl.pc.cmake i/ftgl.pc.cmake
new file mode 100644
index 000000000000..1f1a0af7b3f4
--- /dev/null
+++ i/ftgl.pc.cmake
@@ -0,0 +1,6 @@
+Name: ftgl
+Description: OpenGL frontend to Freetype 2
+Requires.private: freetype2
+Version: @VERSION_SERIES@.@VERSION_MAJOR@.@VERSION_MINOR@
+Libs: -L@CMAKE_INSTALL_PREFIX@/lib -lftgl
+Cflags: -I@CMAKE_INSTALL_PREFIX@/include
\ No newline at end of file
34 changes: 34 additions & 0 deletions graphics/ftgl/files/FTFont-GL_TEXTURE_BIT.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git c/src/FTFont/FTBufferFont.cpp i/src/FTFont/FTBufferFont.cpp
index ce04cf56ae0f..b330a3b119f7 100644
--- c/src/FTFont/FTBufferFont.cpp
+++ i/src/FTFont/FTBufferFont.cpp
@@ -230,11 +230,11 @@ inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
int width, height, texWidth, texHeight;
int cacheIndex = -1;
bool inCache = false;

// Protect blending functions, GL_TEXTURE_2D and optionally GL_BLEND
- glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_TEXTURE_ENV_MODE);
+ glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT);

// Protect glPixelStorei() calls
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);

if(FTLibrary::Instance().GetLegacyOpenGLStateSet())
diff --git c/src/FTFont/FTTextureFont.cpp i/src/FTFont/FTTextureFont.cpp
index 97e876876e12..a5145cf05f53 100644
--- c/src/FTFont/FTTextureFont.cpp
+++ i/src/FTFont/FTTextureFont.cpp
@@ -239,11 +239,11 @@ template <typename T>
inline FTPoint FTTextureFontImpl::RenderI(const T* string, const int len,
FTPoint position, FTPoint spacing,
int renderMode)
{
// Protect GL_TEXTURE_2D and optionally GL_BLEND
- glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TEXTURE_ENV_MODE);
+ glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);

if(FTLibrary::Instance().GetLegacyOpenGLStateSet())
{
glEnable(GL_BLEND);
/*
56 changes: 56 additions & 0 deletions graphics/ftgl/files/autoconf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git c/m4/gl.m4 i/m4/gl.m4
index 4a1bc4886c35..a4c789f873b6 100644
--- c/m4/gl.m4
+++ i/m4/gl.m4
@@ -5,15 +5,15 @@ AC_DEFUN([FTGL_CHECK_GL],
[dnl
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PATH_X])
AC_REQUIRE([AC_PATH_XTRA])

-AC_ARG_WITH([--with-gl-inc],
+AC_ARG_WITH([gl-inc],
AC_HELP_STRING([--with-gl-inc=DIR],[Directory where GL/gl.h is installed]))
-AC_ARG_WITH([--with-gl-lib],
+AC_ARG_WITH([gl-lib],
AC_HELP_STRING([--with-gl-lib=DIR],[Directory where OpenGL libraries are installed]))
-AC_ARG_WITH([--with-glu-lib],
+AC_ARG_WITH([glu-lib],
AC_HELP_STRING([--with-glu-lib=DIR],[Directory where OpenGL GLU library is installed]))

AC_LANG_SAVE
AC_LANG_C

@@ -48,11 +48,11 @@ FRAMEWORK_OPENGL=""
PRELIBS="$LIBS"
LIBS="$LIBS -Xlinker -framework -Xlinker OpenGL"
# -Xlinker is used because libtool is busted prior to 1.6 wrt frameworks
AC_TRY_LINK([#include <OpenGL/gl.h>], [glBegin(GL_POINTS)],
[GL_DYLIB="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
- FRAMEWORK_OPENGL="-Xlinker -framework -Xlinker OpenGL -dylib_file $GL_DYLIB: $GL_DYLIB"
+ FRAMEWORK_OPENGL="-Xlinker -framework -Xlinker OpenGL -dylib_file $GL_DYLIB:$GL_DYLIB"
ac_cv_search_glBegin="$FRAMEWORK_OPENGL"
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
if test x"$FRAMEWORK_OPENGL" != "x"; then
with_gl_lib="$FRAMEWORK_OPENGL"
diff --git c/m4/glut.m4 i/m4/glut.m4
index 4a2b0b87b020..450824962ce8 100644
--- c/m4/glut.m4
+++ i/m4/glut.m4
@@ -6,13 +6,13 @@ AC_DEFUN([FTGL_CHECK_GLUT],
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PATH_X])dnl
AC_REQUIRE([AC_PATH_XTRA])dnl
AC_REQUIRE([FTGL_CHECK_GL])dnl

-AC_ARG_WITH([--with-glut-inc],
+AC_ARG_WITH([glut-inc],
AC_HELP_STRING([--with-glut-inc=DIR],[Directory where GL/glut.h is installed (optional)]))
-AC_ARG_WITH([--with-glut-lib],
+AC_ARG_WITH([glut-lib],
AC_HELP_STRING([--with-glut-lib=DIR],[Directory where GLUT libraries are installed (optional)]))

AC_LANG_SAVE
AC_LANG_C

49 changes: 49 additions & 0 deletions graphics/ftgl/files/debian.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git c/debian/changelog i/debian/changelog
index 6741f8e22ab2..bd533a7eecd1 100644
--- c/debian/changelog
+++ i/debian/changelog
@@ -1,5 +1,36 @@
+ftgl (2.4.0-2) unstable; urgency=medium
+
+ * Install ftgl.pdf file again, the external problem generating PDF file
+ was fixed (#921779)
+ * d/patches:
+ - drop disable-pdf.patch
+ * Bump SHLIBVER to 2.4.0, there are new methods/functions in the
+ interface compared to older releases
+
+ -- Manuel A. Fernandez Montecelo <[email protected]> Tue, 26 Feb 2019 16:52:23 +0100
+
+ftgl (2.4.0-1) unstable; urgency=medium
+
+ * New upstream release.
+ - Fixes problem with some applications's rendering of fonts by
+ reverting to old behaviour by default, but it will be revisited in
+ next upstream major releases (Closes: #914153)
+ * d/watch: Update pattern, some versions don't start with 'v' in the
+ tags of this repo
+ * d/patches:
+ - drop substitute-freetype-config.patch, applied upstream
+ - drop enable-docs.patch, applied upstream
+ - drop fix-pdf-generation, applied upstream
+ - drop patch-relibtoolize-prep.diff, applied upstream
+ - add disable-pdf.patch, problem generating PDF file
+ - add fix-doc-projects-eman2.patch, fix duplicated entry in doc
+ * Do not install ftgl.pdf file, it cannot be generated at the moment and
+ probably it's not very useful (HTML doc is still shipped)
+
+ -- Manuel A. Fernandez Montecelo <[email protected]> Fri, 08 Feb 2019 02:25:02 +0100
+
ftgl (2.3.0-3) unstable; urgency=medium

[ IOhannes m zmölnig ]
* Copyright improvements:
- d/copyright: convert to standard format 1.0
diff --git c/debian/watch i/debian/watch
index 34c3c9bd58f5..8fefb4596347 100644
--- c/debian/watch
+++ i/debian/watch
@@ -1,2 +1,2 @@
version=4
-https://github.com/frankheckenbach/ftgl/tags .*/v(\d[\d\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))|zip)
+https://github.com/frankheckenbach/ftgl/tags .*/v?(\d[\d\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))|zip)
141 changes: 141 additions & 0 deletions graphics/ftgl/files/docs-meta.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
diff --git c/ChangeLog i/ChangeLog
index 42fef90bc716..0bb44b8d53cd 100644
--- c/ChangeLog
+++ i/ChangeLog
@@ -1,5 +1,20 @@
+2019-05-24 23:57 Frank Heckenbach <[email protected]>
+
+ * src/FTFont/FTBufferFont.cpp, src/FTFont/FTTextureFont.cpp:
+ GL_TEXTURE_ENV_MODE is not valid mask for glPushAttrib.
+ Use GL_TEXTURE_BIT instead to avoid leaking texture env mode.
+ (reported by Eddie-cz, https://github.com/frankheckenbach/ftgl/issues/3)
+
+2019-02-23 16:41 Frank Heckenbach <[email protected]>
+
+ * ftgl-release: new script
+
+2019-02-08 00:44 Manuel A. Fernandez Montecelo
+
+ * docs/projects_using_ftgl.txt: fix duplicated entry in doc
+
2019-02-07 22:35 Frank Heckenbach <[email protected]>

* NEWS, configure.ac, ppa_upload.sh, msvc/config.h, CMakeLists.txt:
* Mark package as being version 2.4.0.

diff --git c/docs/projects_using_ftgl.txt i/docs/projects_using_ftgl.txt
index 0b756a898316..2066350de323 100644
--- c/docs/projects_using_ftgl.txt
+++ i/docs/projects_using_ftgl.txt
@@ -152,11 +152,11 @@ Projects are listed in alphabetical order.
\subsection duel Duel

Duel (http://www.personal.rdg.ac.uk/~sir03me/play/code.html) is a small
overhead perspective spaceship game.

-\subsection emptyclip EMAN2
+\subsection eman2 EMAN2

EMAN2 (http://blake.bcm.tmc.edu/eman/eman2/) is a suite of
scientific image processing tools aimed primarily at the
transmission electron microscopy community.

diff --git c/ftgl-release i/ftgl-release
new file mode 100644
index 000000000000..0ca4d09abd44
--- /dev/null
+++ i/ftgl-release
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+# Set release number
+#
+# Copyright 2019 Frank Heckenbach <[email protected]>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+die ()
+{
+ echo "$*" >&2
+ exit 1
+}
+
+[ "$#" = 2 ] || die "Usage: $(basename "$0") version description"
+egrep -q "^[0-9]+.[0-9]+.[0-9]+$" <<< "$1" || die "invalid version format (x.y.z)"
+
+[ "$CHANGELOG_NAME" ] || die "Please set CHANGELOG_NAME"
+
+[ -e src/FTLibrary.cpp ] || die "This script must be invoked in the main FTGL source directory."
+
+description="$2"
+new="$1"
+major="${new%%.*}"
+minor="${new#*.}"
+micro="${minor#*.}"
+minor="${minor%%.*}"
+
+prev="$(sed -En '/.* Release ([0-9]+.[0-9]+.[0-9]+)[ -]*$/{s//\1/p;q;}' NEWS)"
+pmajor="${prev%%.*}"
+pminor="${prev#*.}"
+pmicro="${pminor#*.}"
+pminor="${pminor%%.*}"
+
+[[ "$((major != pmajor ? major > pmajor :
+ minor != pminor ? minor > pminor :
+ micro > pmicro))" -eq 1 ]] || die "new version must be greater than old version ($prev)"
+
+! fgrep "version $new." ChangeLog || die "new version already mentioned in ChangeLog"
+
+[ -z "$(git status --porcelain)" ] || die "Please commit previous changes first."
+
+sed -Ei "s/(AC_INIT\(FTGL, )[0-9]+.[0-9]+.[0-9]+(, )/\1$new\2/;
+ s/(LT_MAJOR=\")[0-9]+(\")/\1$major\2/;
+ s/(LT_MINOR=\")[0-9]+(\")/\1$minor\2/;
+ s/(LT_MICRO=\")[0-9]+(\")/\1$micro\2/" configure.ac
+
+sed -Ei "s/(SET\(VERSION_SERIES )[0-9]+(\))/\1$major\2/;
+ s/(SET\(VERSION_MAJOR )[0-9]+(\))/\1$minor\2/;
+ s/(SET\(VERSION_MINOR )[0-9]+(\))/\1$micro\2/" CMakeLists.txt
+
+sed -Ei "s/(VERSIONNBR=)[0-9]+.[0-9]+.[0-9]+/\1$new/" ppa_upload.sh
+
+sed -Ei "s/(#define PACKAGE_VERSION \")[0-9]+.[0-9]+.[0-9]+(\")/\1$new\2/" msvc/config.h
+
+sed -Ei "s/(SHLIBVER := ).*$/\1$new/" debian/rules
+
+sed -i "1i\\
+$(date +"%F %H:%M") $CHANGELOG_NAME\\
+\\
+ * NEWS, configure.ac, CMakeLists.txt, ppa_upload.sh, msvc/config.h, debian/rules:\\
+ * Mark package as being version $new.\\
+
+" ChangeLog
+
+sed -i "0,/--- .* Release /{/--- .* Release /i\\
+--- $(date +"%F") Release $new ---\\
+----------------------------------------------------------------------\\
+\\
+ * ${description//\n/\n * }\\
+\\
+----------------------------------------------------------------------
+;}" NEWS
+
+PAGER= git diff
+git add -A
+git commit -m "$description"
+
+echo
+echo "*** New release number set; now push and create release tag."
Loading

0 comments on commit 8279680

Please sign in to comment.