meson: simplify handling of pkgconfigdatadir=no, pkgconfiglibdir=no
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Dec 2018 20:31:32 +0000 (21:31 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Dec 2018 12:43:20 +0000 (13:43 +0100)
The idea was that those vars could be configured to 'no' to not install the .pc
files, or they could be set to '', and then they would be built but not
installed. This was inherited from the autoconf build system. This couldn't
work because '' is replaced by the default value. Also, having this level of
control doesn't seem necessary, since creating those files is very
quick. Skipping with 'no' was implemented only for systemd.pc and not the other
.pc files. Let's simplify things and skip installation if the target dir
is configured as 'no' for all .pc files.

src/core/meson.build
src/libsystemd/meson.build
src/libudev/meson.build
src/udev/meson.build

index 450d6f7..85021bd 100644 (file)
@@ -173,26 +173,19 @@ systemd_shutdown_sources = files('''
 '''.split())
 
 in_files = [['macros.systemd',   rpmmacrosdir],
-            ['triggers.systemd', ''],
+            ['system.conf',      pkgsysconfdir],
             ['systemd.pc',       pkgconfigdatadir],
-            ['system.conf',      pkgsysconfdir]]
+            ['triggers.systemd', '']]
 
 foreach item : in_files
         file = item[0]
         dir = item[1]
 
-        # If 'no', disable generation completely.
-        # If '', generate, but do not install.
-        if dir != 'no'
-                gen = configure_file(
-                        input : file + '.in',
-                        output : file,
-                        configuration : substs)
-                if dir != ''
-                        install_data(gen,
-                                     install_dir : dir)
-                endif
-        endif
+        configure_file(
+                input : file + '.in',
+                output : file,
+                configuration : substs,
+                install_dir : dir == 'no' ? '' : dir)
 endforeach
 
 install_data('org.freedesktop.systemd1.conf',
index 05d4ea0..67add38 100644 (file)
@@ -109,9 +109,8 @@ libsystemd_static = static_library(
 
 libsystemd_sym = 'src/libsystemd/libsystemd.sym'
 
-libsystemd_pc = configure_file(
+configure_file(
         input : 'libsystemd.pc.in',
         output : 'libsystemd.pc',
-        configuration : substs)
-install_data(libsystemd_pc,
-             install_dir : pkgconfiglibdir)
+        configuration : substs,
+        install_dir : pkgconfiglibdir == 'no' ? '' : pkgconfiglibdir)
index 8d86c34..8818974 100644 (file)
@@ -22,9 +22,8 @@ libudev_sym_path = meson.current_source_dir() + '/libudev.sym'
 install_headers('libudev.h')
 libudev_h_path = '@0@/libudev.h'.format(meson.current_source_dir())
 
-libudev_pc = configure_file(
+configure_file(
         input : 'libudev.pc.in',
         output : 'libudev.pc',
-        configuration : substs)
-install_data(libudev_pc,
-             install_dir : pkgconfiglibdir)
+        configuration : substs,
+        install_dir : pkgconfiglibdir == 'no' ? '' : pkgconfiglibdir)
index e378d91..a9d6c63 100644 (file)
@@ -187,12 +187,11 @@ endforeach
 install_data('udev.conf',
              install_dir : join_paths(sysconfdir, 'udev'))
 
-udev_pc = configure_file(
+configure_file(
         input : 'udev.pc.in',
         output : 'udev.pc',
-        configuration : substs)
-install_data(udev_pc,
-             install_dir : pkgconfigdatadir)
+        configuration : substs,
+        install_dir : pkgconfigdatadir == 'no' ? '' : pkgconfigdatadir)
 
 meson.add_install_script('sh', '-c',
                          mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))