From 80ea96312ffe50f2b62ed823baa19a2f904f8e91 Mon Sep 17 00:00:00 2001 From: Hadrien G Date: Thu, 23 Jan 2020 18:43:11 +0100 Subject: ftgl: Move to frankheckenbach fork + CMakePackage (#14221) * Try to switch to a newer fork of ftgl * Allow ROOT to be more flexible about ftgl versions * Turn ftgl into a CMakePackage * Update ROOT ftgl dep since 2.1.3 isn't a thing anymore * Please flake8 * Try to bring back the doc variant * Comment it out instead of removing it --- .../packages/ftgl/ftgl-2.1.3-rc5-ldflags.patch | 118 --------------------- var/spack/repos/builtin/packages/ftgl/package.py | 85 +++++---------- .../packages/ftgl/remove-extra-qualifier.diff | 11 -- .../ftgl/remove-ftlibrary-from-sources.diff | 10 ++ var/spack/repos/builtin/packages/root/package.py | 2 +- 5 files changed, 40 insertions(+), 186 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/ftgl/ftgl-2.1.3-rc5-ldflags.patch delete mode 100644 var/spack/repos/builtin/packages/ftgl/remove-extra-qualifier.diff create mode 100644 var/spack/repos/builtin/packages/ftgl/remove-ftlibrary-from-sources.diff diff --git a/var/spack/repos/builtin/packages/ftgl/ftgl-2.1.3-rc5-ldflags.patch b/var/spack/repos/builtin/packages/ftgl/ftgl-2.1.3-rc5-ldflags.patch deleted file mode 100644 index 871990a234..0000000000 --- a/var/spack/repos/builtin/packages/ftgl/ftgl-2.1.3-rc5-ldflags.patch +++ /dev/null @@ -1,118 +0,0 @@ -diff -up ftgl-2.1.3~rc5/demo/Makefile.am.ldflags ftgl-2.1.3~rc5/demo/Makefile.am ---- ftgl-2.1.3~rc5/demo/Makefile.am.ldflags 2008-06-02 03:10:10.000000000 +0200 -+++ ftgl-2.1.3~rc5/demo/Makefile.am 2010-02-14 15:02:19.670081290 +0100 -@@ -9,14 +9,14 @@ simple_SOURCES = \ - simple.cpp \ - $(NULL) - simple_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --simple_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+simple_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - simple_LDADD = ../src/libftgl.la - - c_demo_SOURCES = \ - c-demo.c \ - $(NULL) - c_demo_CFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --c_demo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+c_demo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) -lm - c_demo_LDADD = ../src/libftgl.la - - FTGLDemo_SOURCES = \ -@@ -27,7 +27,7 @@ FTGLDemo_SOURCES = \ - trackball.h \ - $(NULL) - FTGLDemo_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --FTGLDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+FTGLDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - FTGLDemo_LDADD = ../src/libftgl.la - - FTGLMFontDemo_SOURCES = \ -@@ -38,7 +38,7 @@ FTGLMFontDemo_SOURCES = \ - trackball.h \ - $(NULL) - FTGLMFontDemo_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --FTGLMFontDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+FTGLMFontDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - FTGLMFontDemo_LDADD = ../src/libftgl.la - - NULL = -diff -up ftgl-2.1.3~rc5/demo/Makefile.in.ldflags ftgl-2.1.3~rc5/demo/Makefile.in ---- ftgl-2.1.3~rc5/demo/Makefile.in.ldflags 2008-06-12 16:33:01.000000000 +0200 -+++ ftgl-2.1.3~rc5/demo/Makefile.in 2010-02-14 15:02:01.866831398 +0100 -@@ -242,14 +242,14 @@ simple_SOURCES = \ - $(NULL) - - simple_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --simple_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+simple_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - simple_LDADD = ../src/libftgl.la - c_demo_SOURCES = \ - c-demo.c \ - $(NULL) - - c_demo_CFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --c_demo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+c_demo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) -lm - c_demo_LDADD = ../src/libftgl.la - FTGLDemo_SOURCES = \ - FTGLDemo.cpp \ -@@ -260,7 +260,7 @@ FTGLDemo_SOURCES = \ - $(NULL) - - FTGLDemo_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --FTGLDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+FTGLDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - FTGLDemo_LDADD = ../src/libftgl.la - FTGLMFontDemo_SOURCES = \ - FTGLMFontDemo.cpp \ -@@ -271,7 +271,7 @@ FTGLMFontDemo_SOURCES = \ - $(NULL) - - FTGLMFontDemo_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --FTGLMFontDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+FTGLMFontDemo_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - FTGLMFontDemo_LDADD = ../src/libftgl.la - NULL = - all: all-am -diff -up ftgl-2.1.3~rc5/test/Makefile.am.ldflags ftgl-2.1.3~rc5/test/Makefile.am ---- ftgl-2.1.3~rc5/test/Makefile.am.ldflags 2010-02-14 14:43:14.819077822 +0100 -+++ ftgl-2.1.3~rc5/test/Makefile.am 2010-02-14 14:43:49.227081230 +0100 -@@ -51,7 +51,7 @@ AM_CPPFLAGS = \ - $(NULL) - - CXXTest_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --CXXTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -lcppunit -+CXXTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) -lcppunit - CXXTest_LDADD = ../src/libftgl.la - - CTest_SOURCES = \ -@@ -64,7 +64,7 @@ CTest_CPPFLAGS = \ - -I$(top_srcdir)/src/FTFont \ - -I$(top_srcdir)/src/FTLayout - CTest_CFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --CTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+CTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - CTest_LDADD = ../src/libftgl.la - - NULL = -diff -up ftgl-2.1.3~rc5/test/Makefile.in.ldflags ftgl-2.1.3~rc5/test/Makefile.in ---- ftgl-2.1.3~rc5/test/Makefile.in.ldflags 2010-02-14 14:43:20.365077958 +0100 -+++ ftgl-2.1.3~rc5/test/Makefile.in 2010-02-14 14:44:13.653078013 +0100 -@@ -294,7 +294,7 @@ AM_CPPFLAGS = \ - $(NULL) - - CXXTest_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --CXXTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -lcppunit -+CXXTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) -lcppunit - CXXTest_LDADD = ../src/libftgl.la - CTest_SOURCES = \ - CTest.c \ -@@ -308,7 +308,7 @@ CTest_CPPFLAGS = \ - -I$(top_srcdir)/src/FTLayout - - CTest_CFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS) --CTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -+CTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) $(GL_LIBS) - CTest_LDADD = ../src/libftgl.la - NULL = - all: all-am diff --git a/var/spack/repos/builtin/packages/ftgl/package.py b/var/spack/repos/builtin/packages/ftgl/package.py index c82a73cd77..bf77dd663a 100644 --- a/var/spack/repos/builtin/packages/ftgl/package.py +++ b/var/spack/repos/builtin/packages/ftgl/package.py @@ -3,74 +3,47 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import os -import sys from spack import * -class Ftgl(AutotoolsPackage): +class Ftgl(CMakePackage): """Library to use arbitrary fonts in OpenGL applications.""" - homepage = "http://ftgl.sourceforge.net/docs/html/" - url = "https://sourceforge.net/projects/ftgl/files/FTGL%20Source/2.1.2/ftgl-2.1.2.tar.gz/download" - list_url = "https://sourceforge.net/projects/ftgl/files/FTGL%20Source/" - list_depth = 1 + homepage = "https://github.com/frankheckenbach/ftgl" + git = "https://github.com/frankheckenbach/ftgl.git" - version('2.1.3-rc5', sha256='5458d62122454869572d39f8aa85745fc05d5518001bcefa63bd6cbb8d26565b') - version('2.1.2', sha256='2759cbd5fac0b631e8b012923cd0d2add320f6e541b399a7cda37163ad034075') + version('master', branch='master') + version('2.4.0', commit='483639219095ad080538e07ceb5996de901d4e74') + version('2.3.1', commit='3c0fdf367824b6381f29df3d8b4590240db62ab7') - variant('doc', default=False, description='Build docs') - conflicts('+doc', when='@2.1.3-rc5') - - # Ftgl does not come with a configure script - depends_on('autoconf', type='build') - depends_on('automake', type='build') - depends_on('libtool', type='build') - depends_on('m4', type='build') + # FIXME: Doc generation is broken in upstream build system + # variant('doc', default=False, description='Build the documentation') + variant('shared', default=True, description='Build as a shared library') + depends_on('cmake@2.8:', type='build') + # depends_on('doxygen', type='build', when='+doc') -- FIXME, see above depends_on('pkgconfig', type='build') depends_on('gl') depends_on('glu') depends_on('freetype@2.0.9:') - depends_on('doxygen', type='build', when='+doc') - - # Fix unnecessary qualifier in 2.1.2. - patch('remove-extra-qualifier.diff', when='@2.1.2') - # Add missing GL libraries to LDFLAGS. - patch('ftgl-2.1.3-rc5-ldflags.patch', when='@2.1.3-rc5') - - # Deactivate docs if we're not building them. - @when('@2.1.2~doc') - def patch(self): - filter_file('SUBDIRS = src demo docs', - 'SUBDIRS = src demo', os.path.join('unix', 'Makefile')) - @when('@2.1.3-rc5~doc') - def patch(self): - filter_file('SUBDIRS = src test demo docs', - 'SUBDIRS = src test demo', 'Makefile.am') - filter_file('SUBDIRS = src test demo docs', - 'SUBDIRS = src test demo', 'Makefile.in') + # Fix oversight in CMakeLists + patch('remove-ftlibrary-from-sources.diff', when='@:2.4.0') - @property - def configure_directory(self): - if self.spec.satisfies('@2.1.2'): - subdir = 'mac' if sys.platform == 'darwin' else 'unix' - return os.path.join(self.stage.source_path, subdir) - else: - return self.stage.source_path - - def configure_args(self): - args = ['--enable-shared', '--disable-static', - '--with-gl-inc={0}'.format( - self.spec['gl'].prefix.include), - '--with-gl-lib={0}'.format( - self.spec['gl'].prefix.lib), - '--with-freetype={0}'.format( - self.spec['freetype'].prefix), - '--with-glut-inc={0}'.format( - self.spec['glu'].prefix.include), - '--with-glut-lib={0}'.format( - self.spec['glu'].prefix.lib), - '--with-x'] + def cmake_args(self): + spec = self.spec + args = ['-DBUILD_SHARED_LIBS={0}'.format(spec.satisfies('+shared'))] return args + + # FIXME: See doc variant comment + # @run_after('build') + # def build_docs(self): + # if '+doc' in self.spec: + # cmake = self.spec['cmake'].command + # cmake('--build', '../spack-build', '--target', 'doc') + # + # @run_after('install') + # def install_docs(self): + # if '+doc' in self.spec: + # cmake = self.spec['cmake'].command + # cmake('--install', '../spack-build', '--target', 'doc') diff --git a/var/spack/repos/builtin/packages/ftgl/remove-extra-qualifier.diff b/var/spack/repos/builtin/packages/ftgl/remove-extra-qualifier.diff deleted file mode 100644 index cff9a3836e..0000000000 --- a/var/spack/repos/builtin/packages/ftgl/remove-extra-qualifier.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- FTGL/include/FTTextureGlyph.h 2018-07-26 08:30:55.144488976 +0000 -+++ FTGL/include/FTTextureGlyph.h 2018-07-26 08:29:42.072489186 +0000 -@@ -52,7 +52,7 @@ - * Reset the currently active texture to zero to get into a known state before - * drawing a string. This is to get round possible threading issues. - */ -- static void FTTextureGlyph::ResetActiveTexture(){ activeTextureID = 0;} -+ static void ResetActiveTexture(){ activeTextureID = 0;} - - private: - /** diff --git a/var/spack/repos/builtin/packages/ftgl/remove-ftlibrary-from-sources.diff b/var/spack/repos/builtin/packages/ftgl/remove-ftlibrary-from-sources.diff new file mode 100644 index 0000000000..0d1c6c3e2a --- /dev/null +++ b/var/spack/repos/builtin/packages/ftgl/remove-ftlibrary-from-sources.diff @@ -0,0 +1,10 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -26,7 +26,6 @@ SET(libftgl_la_SOURCES + FTGlyphContainer.h + FTInternals.h + FTLibrary.cpp +- FTLibrary.h + FTList.h + FTPoint.cpp + FTSize.cpp diff --git a/var/spack/repos/builtin/packages/root/package.py b/var/spack/repos/builtin/packages/root/package.py index 6d461fc843..a3c9202833 100644 --- a/var/spack/repos/builtin/packages/root/package.py +++ b/var/spack/repos/builtin/packages/root/package.py @@ -192,7 +192,7 @@ class Root(CMakePackage): depends_on('libsm', when="+x") # OpenGL - depends_on('ftgl@2.1.3-rc5', when="+x+opengl") + depends_on('ftgl@2.4.0:', when="+x+opengl") depends_on('glew', when="+x+opengl") depends_on('gl', when="+x+opengl") depends_on('glu', when="+x+opengl") -- cgit v1.2.3-60-g2f50