Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pkg-config to find FreeType 2 #3870

Closed
sebastic opened this issue Mar 9, 2018 · 3 comments
Closed

Use pkg-config to find FreeType 2 #3870

sebastic opened this issue Mar 9, 2018 · 3 comments
Assignees
Milestone

Comments

@sebastic
Copy link
Contributor

sebastic commented Mar 9, 2018

As reported in Debian Bug #892451:

The next release of libfreetype6-dev will not ship freetype-config, as the script has now been deprecated in favour of pkg-config.

This is an upstream change:

Use of the freetype-config script to get compilation and linking options is deprecated since it doesn't support cross-compiling, among other deficiencies. Instead, you should use the pkg-config interface. [1]

Please use pkg-config to detect the FreeType 2 headers and libraries in mapnik.

If this bug is not resolved prior to the release of FreeType 2.9.1, your package may FTBFS.

@artemp
Copy link
Member

artemp commented Mar 9, 2018

@sebastic - thanks for the heads-up!

@artemp artemp self-assigned this Mar 9, 2018
@artemp artemp added this to the v3.1.0 milestone Mar 9, 2018
@sebastic
Copy link
Contributor Author

sebastic commented Mar 9, 2018

The following patch may suffice:

--- a/SConstruct
+++ b/SConstruct
@@ -1393,6 +1393,8 @@ if not preconfigured:
         ['harfbuzz', 'harfbuzz/hb.h',True,'C++']
     ]
 
+    CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
+
     if env.get('FREETYPE_LIBS') or env.get('FREETYPE_INCLUDES'):
         REQUIRED_LIBSHEADERS.insert(0,['freetype','ft2build.h',True,'C'])
         if env.get('FREETYPE_INCLUDES'):
@@ -1413,6 +1415,15 @@ if not preconfigured:
                     env['EXTRA_FREETYPE_LIBS'].append('bz2')
             except OSError as e:
                 pass
+    elif env['RUNTIME_LINK'] == 'static':
+        temp_env = env.Clone()
+        temp_env['LIBS'] = []
+        try:
+            temp_env.ParseConfig('pkg-config freetype2 --libs')
+            if 'bz2' in temp_env['LIBS']:
+                env['EXTRA_FREETYPE_LIBS'].append('bz2')
+        except OSError as e:
+            pass
 
     # libxml2 should be optional but is currently not
     # https://github.com/mapnik/mapnik/issues/913
@@ -1635,8 +1646,6 @@ if not preconfigured:
             env['MISSING_DEPS'].append('ICU_DATA')
 
 
-    CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
-
     if len(env['REQUESTED_PLUGINS']):
         if env['HOST']:
             for plugin in env['REQUESTED_PLUGINS']:

I haven't had the time to test it yet.

@artemp
Copy link
Member

artemp commented Mar 9, 2018

@sebastic great, cheers!

raspbian-autopush pushed a commit to raspbian-packages/mapnik that referenced this issue Mar 1, 2020
Origin: mapnik/mapnik@23755a5
Bug: mapnik/mapnik#3870
Bug-Debian: https://bugs.debian.org/892451


Gbp-Pq: Name 0001-Use-pkg-config-to-find-FreeType2-if-available.patch
raspbian-autopush pushed a commit to raspbian-packages/mapnik that referenced this issue Nov 17, 2020
Origin: mapnik/mapnik@23755a5
Bug: mapnik/mapnik#3870
Bug-Debian: https://bugs.debian.org/892451


Gbp-Pq: Name 0001-Use-pkg-config-to-find-FreeType2-if-available.patch
raspbian-autopush pushed a commit to raspbian-packages/mapnik that referenced this issue Dec 18, 2020
Origin: mapnik/mapnik@23755a5
Bug: mapnik/mapnik#3870
Bug-Debian: https://bugs.debian.org/892451


Gbp-Pq: Name 0001-Use-pkg-config-to-find-FreeType2-if-available.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants