2018-07-07 10:29:48 -04:00
|
|
|
project('pacman',
|
|
|
|
'c',
|
2024-07-07 20:14:35 +10:00
|
|
|
version : '7.0.0',
|
2018-07-07 10:29:48 -04:00
|
|
|
license : 'GPLv2+',
|
|
|
|
default_options : [
|
|
|
|
'c_std=gnu99',
|
|
|
|
'prefix=/usr',
|
|
|
|
'sysconfdir=/etc',
|
|
|
|
'localstatedir=/var',
|
|
|
|
],
|
2024-04-28 14:29:44 +02:00
|
|
|
meson_version : '>= 0.61')
|
2018-07-07 10:29:48 -04:00
|
|
|
|
2024-07-07 20:14:35 +10:00
|
|
|
libalpm_version = '15.0.0'
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
|
|
|
# commandline options
|
|
|
|
PREFIX = get_option('prefix')
|
|
|
|
DATAROOTDIR = join_paths(PREFIX, get_option('datarootdir'))
|
|
|
|
SYSCONFDIR = join_paths(PREFIX, get_option('sysconfdir'))
|
|
|
|
LOCALSTATEDIR = join_paths(PREFIX, get_option('localstatedir'))
|
|
|
|
LOCALEDIR = join_paths(PREFIX, get_option('localedir'))
|
|
|
|
ROOTDIR = get_option('root-dir')
|
|
|
|
BINDIR = join_paths(PREFIX, get_option('bindir'))
|
|
|
|
MANDIR = join_paths(PREFIX, get_option('mandir'))
|
|
|
|
BUILDSCRIPT = get_option('buildscript')
|
|
|
|
LIBMAKEPKGDIR = join_paths(PREFIX, DATAROOTDIR, 'makepkg')
|
|
|
|
PKGDATADIR = join_paths(PREFIX, DATAROOTDIR, meson.project_name())
|
2022-07-27 17:10:33 +02:00
|
|
|
KEYRINGDIR = join_paths(PREFIX, DATAROOTDIR, get_option('keyringdir'))
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
PYTHON = import('python').find_installation('python3')
|
|
|
|
LDCONFIG = get_option('ldconfig')
|
2022-03-06 16:06:39 +10:00
|
|
|
MESON_MAKE_SYMLINK = join_paths(meson.project_source_root(), 'build-aux/meson-make-symlink.sh')
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
BASH = find_program('bash4', 'bash')
|
|
|
|
if BASH.found()
|
2022-03-06 14:51:00 +10:00
|
|
|
bash_version = run_command(BASH, '-c', 'IFS=.; echo "${BASH_VERSINFO[*]:0:3}"', check: true).stdout()
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
have_bash = bash_version.version_compare('>= 4.4.0')
|
|
|
|
endif
|
|
|
|
if not have_bash
|
|
|
|
error('bash >= 4.4.0 is required for pacman scripts.')
|
|
|
|
endif
|
|
|
|
|
|
|
|
bashcompletion = dependency('bash-completion', required : false)
|
|
|
|
if bashcompletion.found()
|
2022-07-28 05:36:11 +00:00
|
|
|
BASHCOMPDIR = bashcompletion.get_variable(pkgconfig: 'completionsdir')
|
2018-07-07 10:29:48 -04:00
|
|
|
else
|
|
|
|
BASHCOMPDIR = join_paths(DATAROOTDIR, 'bash-completion/completions')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('use-git-version')
|
|
|
|
PACKAGE_VERSION = run_command(
|
|
|
|
find_program('git'),
|
|
|
|
'describe',
|
|
|
|
'--abbrev=4',
|
2022-03-06 14:51:00 +10:00
|
|
|
'--dirty',
|
|
|
|
check: true).stdout().strip().strip('v')
|
2018-07-07 10:29:48 -04:00
|
|
|
else
|
|
|
|
PACKAGE_VERSION = meson.project_version()
|
|
|
|
endif
|
|
|
|
|
|
|
|
conf = configuration_data()
|
|
|
|
conf.set('_GNU_SOURCE', true)
|
|
|
|
conf.set_quoted('PACKAGE', meson.project_name())
|
|
|
|
conf.set_quoted('PACKAGE_VERSION', PACKAGE_VERSION)
|
|
|
|
conf.set_quoted('LOCALEDIR', LOCALEDIR)
|
|
|
|
conf.set_quoted('SCRIPTLET_SHELL', get_option('scriptlet-shell'))
|
|
|
|
conf.set_quoted('LDCONFIG', LDCONFIG)
|
2019-09-18 23:46:58 -04:00
|
|
|
conf.set_quoted('LIB_VERSION', libalpm_version)
|
2018-07-07 10:29:48 -04:00
|
|
|
conf.set_quoted('SYSHOOKDIR', join_paths(DATAROOTDIR, 'libalpm/hooks/'))
|
|
|
|
conf.set_quoted('CONFFILE', join_paths(SYSCONFDIR, 'pacman.conf'))
|
2018-12-10 23:47:58 -05:00
|
|
|
conf.set_quoted('DBPATH', join_paths(LOCALSTATEDIR, 'lib/pacman/'))
|
|
|
|
conf.set_quoted('GPGDIR', join_paths(SYSCONFDIR, 'pacman.d/gnupg/'))
|
2018-07-07 10:29:48 -04:00
|
|
|
conf.set_quoted('LOGFILE', join_paths(LOCALSTATEDIR, 'log/pacman.log'))
|
2018-12-10 23:47:58 -05:00
|
|
|
conf.set_quoted('CACHEDIR', join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'))
|
2018-07-07 10:29:48 -04:00
|
|
|
conf.set_quoted('HOOKDIR', join_paths(SYSCONFDIR, 'pacman.d/hooks/'))
|
|
|
|
conf.set_quoted('ROOTDIR', ROOTDIR)
|
|
|
|
|
2020-05-18 15:18:12 -04:00
|
|
|
libintl = dependency('', required: false)
|
2018-07-07 10:29:48 -04:00
|
|
|
if get_option('i18n')
|
2024-04-28 14:29:44 +02:00
|
|
|
libintl = dependency('intl', static: get_option('buildstatic'))
|
2018-07-07 10:29:48 -04:00
|
|
|
conf.set('ENABLE_NLS', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
libarchive = dependency('libarchive',
|
|
|
|
version : '>=3.0.0',
|
|
|
|
static : get_option('buildstatic'))
|
2022-03-10 16:38:42 +01:00
|
|
|
if libarchive.version().version_compare('>=3.6.0')
|
|
|
|
bsdtar_no_read_sparse = '--no-read-sparse'
|
|
|
|
else
|
|
|
|
bsdtar_no_read_sparse = ''
|
|
|
|
endif
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
libcurl = dependency('libcurl',
|
2021-01-02 00:00:02 +00:00
|
|
|
version : '>=7.55.0',
|
2018-07-07 10:29:48 -04:00
|
|
|
required : get_option('curl'),
|
|
|
|
static : get_option('buildstatic'))
|
|
|
|
conf.set('HAVE_LIBCURL', libcurl.found())
|
|
|
|
|
2022-12-13 11:46:18 +10:00
|
|
|
needed_gpgme_version = '>=1.12.0'
|
2019-03-07 23:10:38 -05:00
|
|
|
gpgme = dependency('gpgme',
|
2019-06-25 16:28:17 -04:00
|
|
|
version : needed_gpgme_version,
|
|
|
|
required : get_option('gpgme'),
|
|
|
|
static : get_option('buildstatic'),
|
|
|
|
not_found_message : 'gpgme @0@ is needed for GPG signature support'.format(needed_gpgme_version))
|
2019-03-07 23:10:38 -05:00
|
|
|
conf.set('HAVE_LIBGPGME', gpgme.found())
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
want_crypto = get_option('crypto')
|
|
|
|
if want_crypto == 'openssl'
|
2019-06-25 16:28:16 -04:00
|
|
|
libcrypto = dependency('libcrypto', static : get_option('buildstatic'),
|
|
|
|
not_found_message : 'openssl support requested but not found')
|
2018-07-07 10:29:48 -04:00
|
|
|
crypto_provider = libcrypto
|
|
|
|
conf.set10('HAVE_LIBSSL', true)
|
|
|
|
elif want_crypto == 'nettle'
|
2019-06-25 16:28:16 -04:00
|
|
|
libnettle = dependency('nettle', static : get_option('buildstatic'),
|
|
|
|
not_found_message : 'nettle support requested but not found')
|
2018-07-07 10:29:48 -04:00
|
|
|
crypto_provider = libnettle
|
|
|
|
conf.set10('HAVE_LIBNETTLE', true)
|
|
|
|
else
|
|
|
|
error('unhandled crypto value @0@'.format(want_crypto))
|
|
|
|
endif
|
|
|
|
|
2024-04-03 17:05:18 +02:00
|
|
|
libseccomp = dependency('libseccomp',
|
|
|
|
static : get_option('buildstatic'),
|
|
|
|
required : false)
|
|
|
|
conf.set('HAVE_LIBSECCOMP', libseccomp.found())
|
2018-07-07 10:29:48 -04:00
|
|
|
foreach header : [
|
2024-04-03 16:18:17 +02:00
|
|
|
'linux/landlock.h',
|
2018-07-07 10:29:48 -04:00
|
|
|
'mntent.h',
|
|
|
|
'sys/mnttab.h',
|
|
|
|
'sys/mount.h',
|
|
|
|
'sys/param.h',
|
2024-04-03 17:11:25 +02:00
|
|
|
'sys/prctl.h',
|
2018-07-07 10:29:48 -04:00
|
|
|
'sys/statvfs.h',
|
|
|
|
'sys/types.h',
|
|
|
|
'sys/ucred.h',
|
|
|
|
'termios.h',
|
|
|
|
]
|
|
|
|
if cc.has_header(header)
|
|
|
|
conf.set('HAVE_' + header.underscorify().to_upper(), true)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach sym : [
|
|
|
|
'getmntent',
|
|
|
|
'getmntinfo',
|
|
|
|
'strndup',
|
|
|
|
'strnlen',
|
|
|
|
'strsep',
|
|
|
|
'swprintf',
|
|
|
|
'tcflush',
|
|
|
|
]
|
|
|
|
have = cc.has_function(sym, args : '-D_GNU_SOURCE')
|
2021-04-16 23:45:21 -04:00
|
|
|
if have
|
|
|
|
conf.set10('HAVE_' + sym.to_upper(), have)
|
|
|
|
endif
|
2018-07-07 10:29:48 -04:00
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach member : [
|
|
|
|
['struct stat', 'st_blksize', '''#include <sys/stat.h>'''],
|
|
|
|
['struct statvfs', 'f_flag', '''#include <sys/statvfs.h>'''],
|
|
|
|
['struct statfs', 'f_flags', '''#include <sys/param.h>
|
|
|
|
#include <sys/mount.h>'''],
|
|
|
|
]
|
|
|
|
have = cc.has_member(member[0], member[1], prefix : member[2])
|
|
|
|
conf.set('HAVE_' + '_'.join([member[0], member[1]]).underscorify().to_upper(), have)
|
|
|
|
endforeach
|
|
|
|
|
2019-06-29 12:58:26 -04:00
|
|
|
foreach type : [
|
|
|
|
# type # program prefix # fallback
|
|
|
|
['mode_t', '''#include <sys/types.h>''', 'unsigned int'],
|
|
|
|
['uid_t', '''#include <sys/types.h>''', 'unsigned int'],
|
|
|
|
['off_t', '''#include <sys/types.h>''', 'signed int'],
|
|
|
|
['pid_t', '''#include <sys/types.h>''', 'signed int'],
|
|
|
|
['size_t', '''#include <sys/types.h>''', 'unsigned int'],
|
|
|
|
['ssize_t', '''#include <sys/types.h>''', 'signed int'],
|
|
|
|
['int64_t', '''#include <stdint.h>''', 'signed long int'],
|
|
|
|
]
|
|
|
|
if not cc.has_type(type[0], prefix: type[1])
|
|
|
|
conf.set(type[0], type[2])
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2023-08-25 07:01:46 +02:00
|
|
|
|
|
|
|
if conf.has('HAVE_GETMNTINFO')
|
|
|
|
if cc.compiles('''
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/statvfs.h>
|
|
|
|
|
|
|
|
void func() {
|
|
|
|
struct statvfs *buf;
|
|
|
|
getmntinfo(&buf, 0);
|
|
|
|
}
|
|
|
|
''')
|
|
|
|
conf.set('FSSTATSTYPE', 'struct statvfs')
|
|
|
|
else
|
|
|
|
conf.set('FSSTATSTYPE', 'struct statfs')
|
|
|
|
endif
|
|
|
|
elif conf.has('HAVE_STRUCT_STATVFS_F_FLAG')
|
2018-07-07 10:29:48 -04:00
|
|
|
conf.set('FSSTATSTYPE', 'struct statvfs')
|
|
|
|
elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS')
|
|
|
|
conf.set('FSSTATSTYPE', 'struct statfs')
|
|
|
|
endif
|
|
|
|
|
2020-05-05 00:41:09 -04:00
|
|
|
if get_option('debug')
|
2018-07-07 10:29:48 -04:00
|
|
|
extra_cflags = [
|
2023-02-09 11:48:20 +10:00
|
|
|
'-pedantic',
|
2018-07-07 10:29:48 -04:00
|
|
|
'-Wcast-align',
|
|
|
|
'-Wclobbered',
|
|
|
|
'-Wempty-body',
|
|
|
|
'-Wfloat-equal',
|
|
|
|
'-Wformat-nonliteral',
|
|
|
|
'-Wformat-security',
|
|
|
|
'-Wignored-qualifiers',
|
2019-02-12 11:17:30 +10:00
|
|
|
'-Wimplicit-fallthrough',
|
2018-07-07 10:29:48 -04:00
|
|
|
'-Winit-self',
|
|
|
|
'-Wlogical-op',
|
|
|
|
'-Wmissing-declarations',
|
|
|
|
'-Wmissing-field-initializers',
|
|
|
|
'-Wmissing-parameter-type',
|
|
|
|
'-Wmissing-prototypes',
|
|
|
|
'-Wold-style-declaration',
|
|
|
|
'-Woverride-init',
|
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wredundant-decls',
|
|
|
|
'-Wshadow',
|
|
|
|
'-Wsign-compare',
|
|
|
|
'-Wstrict-aliasing',
|
|
|
|
'-Wstrict-overflow=5',
|
|
|
|
'-Wstrict-prototypes',
|
|
|
|
'-Wtype-limits',
|
|
|
|
'-Wuninitialized',
|
|
|
|
'-Wunused-but-set-parameter',
|
|
|
|
'-Wunused-parameter',
|
2024-01-25 23:58:11 +10:00
|
|
|
'-Wunused-result',
|
2018-07-07 10:29:48 -04:00
|
|
|
'-Wwrite-strings',
|
|
|
|
]
|
|
|
|
add_project_arguments(cc.get_supported_arguments(extra_cflags), language : 'c')
|
|
|
|
|
|
|
|
conf.set('PACMAN_DEBUG', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
config_h = configure_file(
|
|
|
|
output : 'config.h',
|
|
|
|
configuration : conf)
|
|
|
|
add_project_arguments('-include', 'config.h', language : 'c')
|
|
|
|
|
2019-08-11 23:46:25 -04:00
|
|
|
filecmd = 'file'
|
2018-07-07 10:29:48 -04:00
|
|
|
inodecmd = 'stat -c \'%i %n\''
|
|
|
|
strip_binaries = '--strip-all'
|
|
|
|
strip_shared = '--strip-unneeded'
|
|
|
|
strip_static = '--strip-debug'
|
|
|
|
|
2019-08-11 23:46:25 -04:00
|
|
|
file_seccomp = get_option('file-seccomp')
|
|
|
|
# meson-git has find_program('file', required: false, version: '>=5.38')
|
2022-03-06 14:51:00 +10:00
|
|
|
filever = run_command('sh', '-c', 'file --version | sed -n "s/^file-\(.*\)/\\1/p"', check: true).stdout()
|
2019-08-11 23:46:25 -04:00
|
|
|
if file_seccomp.enabled() or ( file_seccomp.auto() and filever.version_compare('>= 5.38') )
|
|
|
|
filecmd = 'file -S'
|
|
|
|
endif
|
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
os = host_machine.system()
|
|
|
|
if os.startswith('darwin')
|
2019-10-27 02:11:28 -04:00
|
|
|
inodecmd = '/usr/bin/stat -f \'%i %N\''
|
2018-07-07 10:29:48 -04:00
|
|
|
strip_binaries = ''
|
|
|
|
strip_shared = '-s'
|
|
|
|
strip_static = '-s'
|
|
|
|
elif os.contains('bsd') or os == 'dragonfly'
|
2019-10-27 02:11:28 -04:00
|
|
|
inodecmd = 'stat -f \'%i %N\''
|
2018-07-07 10:29:48 -04:00
|
|
|
endif
|
|
|
|
|
2022-03-06 14:51:00 +10:00
|
|
|
chost = run_command(cc, '-dumpmachine', check: true).stdout().strip()
|
2018-07-07 10:29:48 -04:00
|
|
|
carch = chost.split('-')[0]
|
|
|
|
|
|
|
|
# annoyingly, we have to maintain two sets of configuration_data which is
|
|
|
|
# largely identical, but which distinguishes between quoting needs.
|
|
|
|
substs = configuration_data()
|
|
|
|
substs.set('CARCH', carch)
|
|
|
|
substs.set('CHOST', chost)
|
|
|
|
substs.set('PKGEXT', get_option('pkg-ext'))
|
|
|
|
substs.set('SRCEXT', get_option('src-ext'))
|
|
|
|
substs.set('ROOTDIR', ROOTDIR)
|
|
|
|
substs.set('LOCALEDIR', LOCALEDIR)
|
|
|
|
substs.set('sysconfdir', SYSCONFDIR)
|
|
|
|
substs.set('localstatedir', LOCALSTATEDIR)
|
|
|
|
substs.set('PKGDATADIR', PKGDATADIR)
|
2022-07-27 17:10:33 +02:00
|
|
|
substs.set('KEYRINGDIR', KEYRINGDIR)
|
2018-07-07 10:29:48 -04:00
|
|
|
substs.set('PREFIX', PREFIX)
|
2022-03-06 15:51:32 +10:00
|
|
|
substs.set('BASH', BASH.full_path())
|
2018-07-07 10:29:48 -04:00
|
|
|
substs.set('PACKAGE_VERSION', PACKAGE_VERSION)
|
|
|
|
substs.set('PACKAGE_NAME', meson.project_name())
|
|
|
|
substs.set('BUILDSCRIPT', BUILDSCRIPT)
|
|
|
|
substs.set('TEMPLATE_DIR', get_option('makepkg-template-dir'))
|
|
|
|
substs.set('DEBUGSUFFIX', get_option('debug-suffix'))
|
|
|
|
substs.set('INODECMD', inodecmd)
|
2019-08-11 23:46:25 -04:00
|
|
|
substs.set('FILECMD', filecmd)
|
2018-07-07 10:29:48 -04:00
|
|
|
substs.set('LIBMAKEPKGDIR', LIBMAKEPKGDIR)
|
|
|
|
substs.set('STRIP_BINARIES', strip_binaries)
|
|
|
|
substs.set('STRIP_SHARED', strip_shared)
|
|
|
|
substs.set('STRIP_STATIC', strip_static)
|
2022-03-10 16:38:42 +01:00
|
|
|
substs.set('BSDTAR_NO_READ_SPARSE', bsdtar_no_read_sparse)
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
subdir('lib/libalpm')
|
|
|
|
subdir('src/common')
|
|
|
|
subdir('src/pacman')
|
|
|
|
subdir('src/util')
|
|
|
|
subdir('scripts')
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
if get_option('i18n')
|
|
|
|
i18n = import('i18n')
|
|
|
|
subdir('lib/libalpm/po')
|
|
|
|
subdir('src/pacman/po')
|
|
|
|
subdir('scripts/po')
|
|
|
|
endif
|
|
|
|
|
|
|
|
want_doc = get_option('doc')
|
|
|
|
ASCIIDOC = find_program('asciidoc', required : want_doc)
|
|
|
|
A2X = find_program('a2x', required : want_doc)
|
|
|
|
build_doc = A2X.found() and not want_doc.disabled()
|
|
|
|
if build_doc
|
|
|
|
subdir('doc')
|
|
|
|
endif
|
|
|
|
|
|
|
|
includes = include_directories('src/common', 'lib/libalpm')
|
|
|
|
|
|
|
|
libcommon = static_library(
|
|
|
|
'common',
|
|
|
|
libcommon_sources,
|
|
|
|
include_directories : includes,
|
2021-01-05 00:48:12 +00:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
2018-07-07 10:29:48 -04:00
|
|
|
install : false)
|
|
|
|
|
2024-04-03 17:05:18 +02:00
|
|
|
alpm_deps = [crypto_provider, libarchive, libcurl, libintl, libseccomp, gpgme]
|
meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.
Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.
We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.
One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:
meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-02 03:20:13 -04:00
|
|
|
|
2019-02-11 11:19:26 -05:00
|
|
|
libalpm_a = static_library(
|
meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.
Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.
We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.
One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:
meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-02 03:20:13 -04:00
|
|
|
'alpm_objlib',
|
2018-07-07 10:29:48 -04:00
|
|
|
libalpm_sources,
|
2019-09-18 23:44:57 -04:00
|
|
|
# https://github.com/mesonbuild/meson/issues/3937
|
2022-03-06 15:07:57 +10:00
|
|
|
objects : libcommon.extract_all_objects(recursive: true),
|
2018-07-07 10:29:48 -04:00
|
|
|
include_directories : includes,
|
2021-01-05 00:48:12 +00:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.
Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.
We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.
One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:
meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-02 03:20:13 -04:00
|
|
|
dependencies : alpm_deps)
|
2018-07-07 10:29:48 -04:00
|
|
|
|
meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.
Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.
We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.
One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:
meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-02 03:20:13 -04:00
|
|
|
libalpm = library(
|
|
|
|
'alpm',
|
|
|
|
version : libalpm_version,
|
|
|
|
objects: libalpm_a.extract_all_objects(recursive: true),
|
2021-04-18 23:25:13 -04:00
|
|
|
include_directories : includes,
|
meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.
Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.
We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.
One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:
meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-02 03:20:13 -04:00
|
|
|
dependencies : alpm_deps,
|
|
|
|
install : true)
|
2019-02-11 11:19:26 -05:00
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
install_headers(
|
|
|
|
'lib/libalpm/alpm.h',
|
|
|
|
'lib/libalpm/alpm_list.h')
|
|
|
|
|
|
|
|
pkgconfig = import('pkgconfig')
|
|
|
|
pkgconfig.generate(
|
|
|
|
libalpm,
|
|
|
|
name : 'libalpm',
|
|
|
|
description : 'Arch Linux package management library',
|
|
|
|
version : libalpm_version,
|
2023-11-25 12:35:54 -08:00
|
|
|
url : 'http://archlinux.org/pacman/',
|
|
|
|
extra_cflags: [ '-D_FILE_OFFSET_BITS=64' ],
|
|
|
|
)
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
pacman_bin = executable(
|
|
|
|
'pacman',
|
|
|
|
pacman_sources,
|
|
|
|
include_directories : includes,
|
|
|
|
link_with : [libalpm, libcommon],
|
|
|
|
dependencies : [libarchive],
|
|
|
|
install : true,
|
|
|
|
)
|
|
|
|
|
|
|
|
executable(
|
|
|
|
'pacman-conf',
|
|
|
|
pacman_conf_sources,
|
|
|
|
include_directories : includes,
|
2021-01-05 00:48:11 +00:00
|
|
|
link_with : [libalpm, libcommon],
|
2019-04-14 20:56:17 -04:00
|
|
|
dependencies : [libarchive],
|
2018-07-07 10:29:48 -04:00
|
|
|
install : true,
|
|
|
|
)
|
|
|
|
|
|
|
|
executable(
|
|
|
|
'testpkg',
|
|
|
|
testpkg_sources,
|
|
|
|
include_directories : includes,
|
|
|
|
link_with : [libalpm],
|
2019-04-14 20:56:17 -04:00
|
|
|
dependencies : [libarchive],
|
2018-07-07 10:29:48 -04:00
|
|
|
install : true,
|
|
|
|
)
|
|
|
|
|
|
|
|
executable(
|
|
|
|
'vercmp',
|
|
|
|
vercmp_sources,
|
|
|
|
include_directories : includes,
|
2019-02-11 11:19:26 -05:00
|
|
|
link_with : [libalpm_a],
|
2018-07-07 10:29:48 -04:00
|
|
|
install : true,
|
|
|
|
)
|
|
|
|
|
2019-11-12 01:34:30 -05:00
|
|
|
foreach wrapper : script_wrappers
|
|
|
|
cdata = configuration_data()
|
2022-03-06 15:51:32 +10:00
|
|
|
cdata.set_quoted('BASH', BASH.full_path())
|
2019-11-12 01:34:30 -05:00
|
|
|
cdata.set_quoted('BUILDDIR', wrapper[2])
|
|
|
|
cdata.set_quoted('REAL_PROGPATH', wrapper[1].full_path())
|
|
|
|
|
|
|
|
# Create a wrapper script that bootstraps the real script within the build
|
|
|
|
# directory. Use configure_file instead of a custom_target to ensure that
|
|
|
|
# permissions on the input script wrapper are preserved.
|
|
|
|
configure_file(
|
2022-03-06 16:06:39 +10:00
|
|
|
input : join_paths(meson.project_source_root(), 'build-aux', 'script-wrapper.sh.in'),
|
2019-11-12 01:34:30 -05:00
|
|
|
output : wrapper[0],
|
|
|
|
configuration : cdata)
|
|
|
|
endforeach
|
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
configure_file(
|
|
|
|
input : 'etc/makepkg.conf.in',
|
|
|
|
output : 'makepkg.conf',
|
|
|
|
configuration : substs,
|
|
|
|
install_dir : SYSCONFDIR)
|
|
|
|
|
2024-02-24 20:10:23 +10:00
|
|
|
configure_file(
|
|
|
|
input : 'etc/makepkg.conf.d/fortran.conf.in',
|
|
|
|
output : 'fortran.conf',
|
|
|
|
configuration : substs,
|
|
|
|
install_dir : join_paths(SYSCONFDIR, 'makepkg.conf.d/'))
|
|
|
|
|
2023-01-13 11:32:52 +10:00
|
|
|
configure_file(
|
|
|
|
input : 'etc/makepkg.conf.d/rust.conf.in',
|
|
|
|
output : 'rust.conf',
|
|
|
|
configuration : substs,
|
|
|
|
install_dir : join_paths(SYSCONFDIR, 'makepkg.conf.d/'))
|
|
|
|
|
2025-03-19 21:14:51 +01:00
|
|
|
install_emptydir(join_paths(SYSCONFDIR, 'makepkg.d/'))
|
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
configure_file(
|
|
|
|
input : 'etc/pacman.conf.in',
|
|
|
|
output : 'pacman.conf',
|
|
|
|
configuration : substs,
|
|
|
|
install_dir : SYSCONFDIR)
|
|
|
|
|
|
|
|
install_data(
|
|
|
|
'proto/PKGBUILD-split.proto',
|
|
|
|
'proto/PKGBUILD-vcs.proto',
|
|
|
|
'proto/PKGBUILD.proto',
|
|
|
|
'proto/proto.install',
|
|
|
|
install_dir : join_paths(DATAROOTDIR, 'pacman'))
|
|
|
|
|
2018-12-10 01:15:19 -05:00
|
|
|
foreach path : [
|
|
|
|
join_paths(LOCALSTATEDIR, 'lib/pacman/'),
|
|
|
|
join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'),
|
|
|
|
join_paths(DATAROOTDIR, 'makepkg-template/'),
|
|
|
|
join_paths(DATAROOTDIR, 'libalpm/hooks/'),
|
|
|
|
]
|
|
|
|
meson.add_install_script('sh', '-c', 'mkdir -p "$DESTDIR/@0@"'.format(path))
|
|
|
|
endforeach
|
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
TEST_ENV = environment()
|
2022-03-06 16:06:39 +10:00
|
|
|
TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.project_source_root(), 'scripts/library/'))
|
|
|
|
TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.project_build_root(), 'scripts/libmakepkg/'))
|
|
|
|
TEST_ENV.set('PMTEST_UTIL_DIR', meson.project_build_root() + '/')
|
|
|
|
TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.project_build_root(), 'scripts/'))
|
2018-07-07 10:29:48 -04:00
|
|
|
|
|
|
|
subdir('test/pacman')
|
|
|
|
subdir('test/scripts')
|
|
|
|
subdir('test/util')
|
|
|
|
|
|
|
|
message('\n '.join([
|
|
|
|
'@0@ @1@'.format(meson.project_name(), meson.project_version()),
|
|
|
|
'Build information:',
|
|
|
|
' prefix : @0@'.format(PREFIX),
|
|
|
|
' sysconfdir : @0@'.format(SYSCONFDIR),
|
|
|
|
' conf file : @0@'.format(join_paths(SYSCONFDIR, 'pacman.conf')),
|
|
|
|
' localstatedir : @0@'.format(LOCALSTATEDIR),
|
|
|
|
' database dir : @0@'.format(join_paths(LOCALSTATEDIR, 'lib/pacman/')),
|
|
|
|
' cache dir : @0@'.format(join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/')),
|
2022-07-27 17:10:33 +02:00
|
|
|
' keyringdir : @0@'.format(KEYRINGDIR),
|
2018-07-07 10:29:48 -04:00
|
|
|
' compiler : @0@ @1@'.format(cc.get_id(), cc.version()),
|
|
|
|
'',
|
|
|
|
' Architecture : @0@'.format(carch),
|
|
|
|
' Host Type : @0@'.format(chost),
|
|
|
|
' File inode command : @0@'.format(inodecmd),
|
2019-08-11 23:46:25 -04:00
|
|
|
' File seccomp command : @0@'.format(filecmd),
|
2018-07-07 10:29:48 -04:00
|
|
|
' libalpm version : @0@'.format(libalpm_version),
|
|
|
|
' pacman version : @0@'.format(PACKAGE_VERSION),
|
|
|
|
'',
|
|
|
|
'Directory and file information:',
|
|
|
|
' root working directory : @0@'.format(ROOTDIR),
|
|
|
|
' package extension : @0@'.format(get_option('pkg-ext')),
|
|
|
|
' source pkg extension : @0@'.format(get_option('src-ext')),
|
|
|
|
' build script name : @0@'.format(BUILDSCRIPT),
|
|
|
|
' template directory : @0@'.format(get_option('makepkg-template-dir')),
|
|
|
|
'',
|
|
|
|
'Compilation options:',
|
|
|
|
' i18n support : @0@'.format(get_option('i18n')),
|
|
|
|
' Build docs : @0@'.format(build_doc),
|
|
|
|
' debug build : @0@'.format(get_option('buildtype') == 'debug'),
|
|
|
|
' Use libcurl : @0@'.format(conf.get('HAVE_LIBCURL')),
|
|
|
|
' Use GPGME : @0@'.format(conf.get('HAVE_LIBGPGME')),
|
|
|
|
' Use OpenSSL : @0@'.format(conf.has('HAVE_LIBSSL') and
|
|
|
|
conf.get('HAVE_LIBSSL') == 1),
|
|
|
|
' Use nettle : @0@'.format(conf.has('HAVE_LIBNETTLE') and
|
|
|
|
conf.get('HAVE_LIBNETTLE') == 1),
|
|
|
|
'',
|
|
|
|
]))
|