fontconfig: Branch 'main' - 2 commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 doc/meson.build |    9 ++-------
 meson.build     |    7 +++----
 src/cutout.py   |   33 +++++++--------------------------
 src/meson.build |   19 ++++---------------
 4 files changed, 16 insertions(+), 52 deletions(-)

New commits:
commit 60171c963fb410c5f20c6b17a7df1f22ce74430d
Merge: c38b15b e3563fa
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Thu Apr 11 00:45:22 2024 +0000

    Merge branch 'preprocess' into 'main'
    
    Meson: Fix build with clang-cl by using cc.preprocess()
    
    See merge request fontconfig/fontconfig!276

commit e3563fa20d3b04f6033eddf062c2d624036777f5
Author: Xavier Claessens <xavier.claessens@xxxxxxxxxxxxx>
Date:   Wed May 31 09:36:11 2023 -0400

    Meson: Fix build with clang-cl by using cc.preprocess()
    
    Fontconfig currently hardcode a few supported compilers to preprocess
    gperf file. That hack is no needed since Meson 0.64.0 which added
    support to preprocess files.
    
    Also use fs.copyfile() to avoid deprecation warnings.

diff --git a/doc/meson.build b/doc/meson.build
index b46d350..e7b6b07 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -52,13 +52,8 @@ endforeach
 edit_sgml = find_program('edit-sgml.py')
 
 # copy into build directory, it includes generated files from build directory
-fontconfig_devel_sgml = configure_file(output: 'fontconfig-devel.sgml',
-  input: 'fontconfig-devel.sgml',
-  copy: true)
-
-fontconfig_user_sgml = configure_file(output: 'fontconfig-user.sgml',
-  input: 'fontconfig-user.sgml',
-  copy: true)
+fontconfig_devel_sgml = fs.copyfile('fontconfig-devel.sgml')
+fontconfig_user_sgml = fs.copyfile('fontconfig-user.sgml')
 
 version_conf = configuration_data()
 version_conf.set('VERSION', meson.project_version())
diff --git a/meson.build b/meson.build
index f358227..a466328 100644
--- a/meson.build
+++ b/meson.build
@@ -4,6 +4,8 @@ project('fontconfig', 'c',
   default_options: [ 'buildtype=debugoptimized'],
 )
 
+fs = import('fs')
+
 fc_version = meson.project_version()
 version_arr = fc_version.split('.')
 fc_version_major = version_arr[0].to_int()
@@ -438,10 +440,7 @@ foreach t : ['uint64_t', 'int32_t', 'uintptr_t', 'intptr_t']
   endif
 endforeach
 
-fcstdint_h = configure_file(
-  input: 'src/fcstdint.h.in',
-  output: 'fcstdint.h',
-  copy: true)
+fcstdint_h = fs.copyfile('src/fcstdint.h.in', 'fcstdint.h')
 
 makealias = files('src/makealias.py')[0]
 
diff --git a/src/cutout.py b/src/cutout.py
old mode 100644
new mode 100755
index 39bdc54..f172a97
--- a/src/cutout.py
+++ b/src/cutout.py
@@ -1,38 +1,19 @@
+#!/usr/bin/env python3
+
+from pathlib import Path
 import argparse
-import subprocess
-import json
-import os
 import re
 
 if __name__== '__main__':
     parser = argparse.ArgumentParser()
     parser.add_argument('input')
     parser.add_argument('output')
-    parser.add_argument('buildroot')
-
-    args = parser.parse_known_args()
-
-    # c_args might contain things that are essential for crosscompilation, but
-    # are not included in cc.cmd_array(), so we have to look them up ourselves
-    host_cargs = []
-    buildroot = args[0].buildroot
-    with open(os.path.join(buildroot, 'meson-info', 'intro-buildoptions.json')) as json_file:
-        bopts = json.load(json_file)
-        for opt in bopts:
-            if opt['name'] == 'c_args' and opt['section'] == 'compiler' and opt['machine'] == 'host':
-                host_cargs = opt['value']
-                break
-
-    cpp = args[1]
-    cpp_args = [i for i in host_cargs + [args[0].input] if not i.startswith('-g')]
-    ret = subprocess.run(cpp + cpp_args, stdout=subprocess.PIPE, check=True)
-
-    stdout = ret.stdout.decode('utf8')
+    args = parser.parse_args()
 
-    with open(args[0].output, 'w') as out:
+    input_lines = Path(args.input).read_text(encoding='utf-8').splitlines()
+    with Path(args.output).open('w', encoding='utf-8') as out:
         write = True
-        for l in stdout.split('\n'):
-            l = l.strip('\r')
+        for l in input_lines:
             if l.startswith('CUT_OUT_BEGIN'):
                 write = False
 
diff --git a/src/meson.build b/src/meson.build
index c994f92..6538ce4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -29,22 +29,11 @@ fc_sources = [
   'ftglue.c',
 ]
 
-# FIXME: obviously fragile, cc.preprocess would be sweet
-cpp = cc.cmd_array()
-if cc.get_argument_syntax() == 'gcc'
-  cpp += ['-E', '-P']
-elif cc.get_argument_syntax() == 'msvc'
-  cpp += ['/EP']
-else
-  error('FIXME: implement cc.preprocess')
-endif
-
-cpp += ['-I', join_paths(meson.current_source_dir(), '..')]
-
-fcobjshash_gperf = custom_target('fcobjshash.gperf',
-  input: 'fcobjshash.gperf.h',
+fcobjshash_h = cc.preprocess('fcobjshash.gperf.h', include_directories: incbase)
+fcobjshash_gperf = custom_target(
+  input: fcobjshash_h,
   output: 'fcobjshash.gperf',
-  command: [python3, files('cutout.py')[0], '@INPUT@', '@OUTPUT@', '@BUILD_ROOT@', cpp],
+  command: ['cutout.py', '@INPUT@', '@OUTPUT@'],
   build_by_default: true,
 )
 



[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux