Package: meson
Version: 0.48.1-1
Severity: wishlist
File: /usr/share/meson/debcrossgen

Some Meson-built packages need to set custom properties. For example, GLib
(which is built with Meson in experimental) has a bundled copy of GNUlib
printf. During native compilation, its Meson build system automatically
detects whether the system (v)(sn)printf is POSIX- and ISO-compliant, and
uses the bundled GNUlib printf if not; but during cross compilation, it
cannot rely on being able to run test programs, so it defaults to using the
bundled GNUlib printf. We know that glibc printf is suitable for GLib, so
we want to set the cross properties that say "use the system printf".

For now, I have prototyped this for GLib by including this patched
debcrossgen in its debian/ directory:

----------------- 8< --------------------------------------------------
--- /usr/share/meson/debcrossgen        2018-10-17 16:57:16.000000000 +0100
+++ debian/debcrossgen  2018-11-01 10:49:46.324456237 +0000
@@ -32,6 +32,8 @@
                     help='A particular gcc version suffix if necessary.')
 parser.add_argument('-o', required=True, dest='outfile',
                     help='The output file.')
+parser.add_argument('--set', action='append', default=[],
+                    help='Set a cross property.')

 def locate_path(program):
     if os.path.isabs(program):
@@ -75,6 +77,10 @@
         except ValueError:
             pass # pkg-config is optional
         ofile.write('\n[properties]\n')
+        for prop in options.set:
+            assert '=' in prop
+            key, value = prop.split('=', 1)
+            ofile.write('%s = %s\n' % (key, value))
         ofile.write('\n[host_machine]\n')
         ofile.write("system = '%s'\n" % host_os)
         ofile.write("cpu_family = '%s'\n" % host_cpu_family)
----------------- 8< --------------------------------------------------

and invoking it in debian/rules:

----------------- 8< --------------------------------------------------
ifneq ($(filter hppa,$(DEB_HOST_ARCH_CPU)),)
stack_grows_up = true
else
stack_grows_up = false
endif

export DH_MESON_CROSS_FILE = debian/cross.txt

override_dh_auto_configure:
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
        debian/debcrossgen \
                --set have_c99_snprintf=true \
                --set have_c99_vsnprintf=true \
                --set have_strlcpy=false \
                --set have_unix98_printf=true \
                --set growing_stack=$(stack_grows_up) \
                -o debian/cross.txt
endif
        dh_auto_configure \
                ...
----------------- 8< --------------------------------------------------

but I would prefer it if there was a more official way to do this with
Meson and debhelper.

Perhaps dh_auto_configure could even take a repeatable
--set-cross-property argument?

Thanks,
    smcv

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'buildd-unstable'), (500, 
'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental-debug'), (1, 
'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, x32

Kernel: Linux 4.18.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages meson depends on:
ii  ninja-build            1.8.2-1
ii  python3                3.6.7-1
ii  python3-pkg-resources  40.4.3-1

meson recommends no packages.

meson suggests no packages.

-- no debconf information

Reply via email to