aboutsummaryrefslogtreecommitdiff
path: root/cnf
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2023-07-15 12:20:27 +0100
committerSam James <sam@gentoo.org>2023-08-02 07:31:19 +0100
commitad3994394af0bc975ec7c28bd60de496b580c25e (patch)
tree6d7d1321e8c1a9ef585764a67cc0694762a9b217 /cnf
parentLinting fixes (diff)
downloadportage-ad3994394af0bc975ec7c28bd60de496b580c25e.tar.gz
portage-ad3994394af0bc975ec7c28bd60de496b580c25e.tar.bz2
portage-ad3994394af0bc975ec7c28bd60de496b580c25e.zip
Migrate from setuptools to Meson and meson-python
This makes Portage PEP 517 compliant. When building via meson-python, the man pages and logrotate config are no longer included as there seems little point. Bug: https://bugs.gentoo.org/910035 Signed-off-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'cnf')
-rw-r--r--cnf/meson.build144
1 files changed, 144 insertions, 0 deletions
diff --git a/cnf/meson.build b/cnf/meson.build
new file mode 100644
index 000000000..00af62085
--- /dev/null
+++ b/cnf/meson.build
@@ -0,0 +1,144 @@
+install_data(
+ [
+ 'etc-update.conf',
+ 'dispatch-conf.conf'
+ ],
+ install_dir : sysconfdir
+)
+
+extra_features = []
+make_globals = 'make.globals'
+repos_conf = 'repos.conf'
+
+if get_option('gentoo-dev')
+ extra_features += [
+ 'ipc-sandbox',
+ 'network-sandbox',
+ 'strict-keepdir',
+ 'warn-on-large-env'
+ ]
+endif
+
+if get_option('xattr') and host_machine.system() == 'linux'
+ extra_features += [
+ 'xattr'
+ ]
+endif
+
+if extra_features.length() > 0
+ make_globals = configure_file(
+ input : make_globals,
+ output : 'make.globals#features',
+ command : [sed, '$aFEATURES="${FEATURES} ' + ' '.join(extra_features) + '"', '@INPUT@'],
+ capture : true
+ )
+endif
+
+if not get_option('rsync-verify')
+ repos_conf = configure_file(
+ input : repos_conf,
+ output : 'repos.conf#rsync-verify',
+ command : [sed, '-r', 's:\\b(sync-rsync-verify-metamanifest|sync-webrsync-verify-signature)(\\s*=\\s*).*:\\1\\2no:', '@INPUT@'],
+ capture : true
+ )
+endif
+
+if eprefix != ''
+ make_globals = configure_file(
+ input : make_globals,
+ output : 'make.globals#eprefix',
+ command : hprefixify,
+ capture : true
+ )
+
+ repos_conf = configure_file(
+ input : repos_conf,
+ output : 'repos.conf#eprefix',
+ command : hprefixify,
+ capture : true
+ )
+endif
+
+arch = host_machine.cpu()
+
+arch = {
+ 'aarch64' : 'arm64',
+ 'loongarch64' : 'loong',
+ 'mips64' : 'mips',
+ 'parisc' : 'hppa',
+ 'riscv32' : 'risc',
+ 'riscv64' : 'risc',
+ 's390x' : 's390',
+ 'sh4' : 'sh',
+ 'sparc64' : 'sparc',
+ 'x86_64' : 'amd64'
+}.get(arch, arch)
+
+if host_machine.system() == 'freebsd'
+ arch += '-fbsd'
+endif
+
+make_conf_example = 'make.conf.example'
+diff = make_conf_example + '.' + arch + '.diff'
+fs = import('fs')
+
+if fs.exists(diff)
+ patch = find_program('patch', required : true)
+ make_conf_example = configure_file(
+ input : [make_conf_example, diff],
+ output : 'make.conf.example',
+ command : [patch, '-o', '@OUTPUT@', '@INPUT0@', '@INPUT1@']
+ )
+else
+ warning('Portage does not have an arch-specific configuration for this arch. Please notify the arch maintainer about this issue. Using the generic configuration.')
+endif
+
+# TODO: Use fs.copyfile() when requiring Meson >=0.64.0.
+
+make_globals = configure_file(
+ input : make_globals,
+ output : 'make.globals',
+ copy : true
+)
+
+repos_conf = configure_file(
+ input : repos_conf,
+ output : 'repos.conf',
+ copy : true
+)
+
+# TODO: Use preserve_path option when requiring Meson >=0.64.0.
+
+install_data(
+ [
+ make_conf_example,
+ make_globals,
+ repos_conf,
+ ],
+ install_dir : portage_datadir / 'config'
+)
+
+install_data(
+ [
+ 'repo.postsync.d/example'
+ ],
+ install_dir : portage_datadir / 'config' / 'repo.postsync.d'
+)
+
+install_data(
+ [
+ 'sets/portage.conf'
+ ],
+ install_dir : portage_datadir / 'config' / 'sets'
+)
+
+if not system_wide
+ subdir_done()
+endif
+
+install_data(
+ [
+ 'logrotate.d/elog-save-summary'
+ ],
+ install_dir : sysconfdir / 'logrotate.d'
+)