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 f637058
Show file tree
Hide file tree
Showing 12 changed files with 481 additions and 61 deletions.
28 changes: 24 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 @@ -18,13 +18,25 @@ checksums rmd160 c904e2aa2e5dc5329867ce120f4b1ebe1910ff65 \
sha256 933a371dbb2f44c9fa3121484d46081b5f1ed08c18908ba49bff92811629aede \
size 630956

# There is a bug *somehwere* which is causing `$all_dist_files` to have an extra blank
# value (`[{ } ftgl-2.4.0.tar.gz]`). This fixes this to remove the blank value, allowing
# the checksum to proceed with the correct `$all_dist_files` ([ftgl-2.4.0.tar.gz]).
#
# This is a complete hack.
pre-checksum {
if {[lsearch -exact $all_dist_files { }] != -1} {
set blank_index [lsearch -exact $all_dist_files { }]
set all_dist_files [lreplace $all_dist_files $blank_index $blank_index]
}
}

use_autoreconf yes
autoreconf.env LIBTOOLIZE=${prefix}/bin/glibtoolize
autoreconf.cmd ./autogen.sh
autoreconf.args

depends_lib-append \
port:freetype
port:freetype

depends_build-append \
port:autoconf \
Expand All @@ -33,8 +45,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)
Loading

0 comments on commit f637058

Please sign in to comment.