Commit graph

61 commits

Author SHA1 Message Date
Jan Alexander Steffens (heftig)
f07d547cf1
libmakepkg: Use only /etc/makepkg.d/gitconfig
Globally set `GIT_CONFIG_GLOBAL` and `GIT_CONFIG_SYSTEM` so that we're
only loading `/etc/makepkg.d/gitconfig` (if it exists) and no other Git
config files.

Allow injecting another value via `MAKEPKG_GIT_CONFIG`.

Fixes: https://gitlab.archlinux.org/pacman/pacman/-/issues/193
2025-03-19 21:15:55 +01:00
Remi Gacogne
cf473bcfbd Ensure that the download process cannot get new privileges
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-08-02 00:39:45 +00:00
Remi Gacogne
f142df92c7 Restrict syscalls for the download process whenever possible
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-08-02 00:39:45 +00:00
Allan McRae
138cbae584 Update meson versions for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Remi Gacogne
eacadbcc41
Restrict filesystem access to the download process whenever possible
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-06-14 09:30:20 +02:00
Christoph Reiter
15a2338656 meson: use the custom meson provided intl dependency
Let meson deal with the system differences instead of handling
it manually.

The custom dependency was added in meson 0.59, then gained
static support with 0.60, and static support for cygwin with 0.61,
which is why the meson requirement is bumped to 0.61.

Debian bullseye ships meson 0.56, so switch to bookworm which
has 1.0.1
2024-05-04 21:05:48 +10:00
Allan McRae
4b25bb63c1 Update meson.build for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
loqs
dba383f092 makepkg: Add support for Fortran build flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-25 09:33:29 +10:00
Allan McRae
4856fb53ac Add -Wunused_result to debug build compiler flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:53:44 +10:00
Andrew Gregory
2d190d5a33 meson.build: add _FILE_OFFSET_BITS to pkgconfig
Meson automatically sets _FILE_OFFSET_BITS but that value was not
getting carried through to the libalpm pkgconfig file, breaking
downstream projects that relied on it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-11-25 13:05:00 -08:00
morganamilo
85ab0307d7
Fix compile on some platforms
Controlling the type of getmntinfo's param was decided by
whether or not we had the statvfs type avaliable. But getmntinfo uses
statfs regardless of this except on netbsd where it uses statvfs.

Add a check to detect which type our version of the function uses.
2023-09-04 22:00:48 +02:00
Allan McRae
6c913af95d Add the -pedantic' compiler flag back to our debug builds
This was lost in the transition from autotools to meson. No additional
warnings are given with current gcc and clang.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-02-13 22:07:32 +10:00
Allan McRae
71764b6d4c makepkg.conf: allow configuration additions via a subdirectory
Move rust related buildflags to their own configuration file to
provide an example of how other languages could be supported.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-01-17 10:26:07 +10:00
Ziemowit Laski
f4f66fcca7 Bump required GPGME version to 1.12.0
GPGME_KEYLIST_MODE_LOCATE was introduced in 1.12.0

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 11:46:18 +10:00
Daan De Meyer
79bd512181 Add --keyringdir meson option to configure the keyring directory
On Debian, keyrings are stored in /usr/share/keyrings. To support
this, let's add a new --keyringdir option that allows configuring
the directory under datarootdir where the keyrings should be
imported from. We default to 'pacman/keyrings' for backwards
compatibility.
2022-07-29 10:17:52 +10:00
Joe Baldino
daa2db6a23 meson: replace deprecated get_pkgconfig_variable()
Apparently that function was deprecated in 0.56, so use the generic
getter introduced in 0.51 instead. This squashes a warning.

Signed-off-by: Joe Baldino <pedanticdm@gmx.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-29 09:41:47 +10:00
Jonas Witschel
f5f9e0f4ea makepkg: use bsdtar --no-read-sparse for archive creation if available
bsdtar uses the "pax" TAR archive format by default, which has support for
storing sparse file information in the archive. Unfortunately this is a source
of unreproducibility because the sparse encoding is taken from the file system
and different file systems handle sparse files differently: some file systems
have no support for sparsely encoded files at all, and even file systems with
sparse file support can report different file information for identical files
due to differing implementations.

As a real world example where this happens, consider the Arch Linux package
"brotli-testdata 1.0.9-7", which contains a sparsely encoded all-zeros file
"usr/share/brotli/testdata/zeros". Building this package on a btrfs file system
yields a different package than building it on tmpfs or ext4 solely due to
different sparse file information that gets recorded in the package tarball.

To improve the reproducibility of archives containing sparsely encoded files,
libarchive version 3.6.0 introduces a new --no-read-sparse option. This skips
reading sparse file information from disk entirely and therefore stores files
"expanded" in the archive, which is the only way to make them reliably
reproducible across file systems.

makepkg will use this option if libarchive is recent enough to support it,
which is detected at build time.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-11 09:43:59 +10:00
Allan McRae
c89f42f17b meson: do not use meson.source_root() and meson.build_root()
Using meson.source_root() and meson.build_root() are deprectated in
meson-0.56.  Using current_source_dir() or current_build_dir() (which
have been available in all Meson versions) would require manually
adding "../" in some places.  Instead, use project_source_root() and
project_build_root() and require meson-0.56.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 16:26:34 +10:00
Allan McRae
3a39eff15e meson.build: change ExternalProgram.path to full_path
Removes "Future-deprecated features used", but reuires meson-0.55

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:55:17 +10:00
Allan McRae
5bbda937f1 Silence meson warning about extract_all_objects
Upstream is changing the default from false to true.  This makes
no difference to us, so just set as the future default.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:07:57 +10:00
Allan McRae
0a792843f9 Silence meson run_command warning
Upsteam is warning about future change in the run_command check
argument. Ref: https://github.com/mesonbuild/meson/issues/9300

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 14:53:42 +10:00
Allan McRae
0a6fecd072 Release pacman-6.0.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:36:22 +10:00
Allan McRae
75eb3f4cd3 Release 6.0.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-20 13:35:27 +10:00
morganamilo
15be417c17 remove unused variable in meson.build
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09 22:05:33 +10:00
Eli Schwartz
0699321b3c meson: make -uninstalled.pc correct
This pkg-config file is automatically created in the meson-uninstalled/
directory of the build tree, and points to the built artifacts there. If
this directory is added to PKG_CONFIG_PATH, it will be preferred over an
installed copy.

Making this work properly means it becomes trivially possible to build a
private copy of libalpm, and then compile other projects using it rather
than the system copy.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 17:51:44 +10:00
Mark Weiman
207f0439ee meson.build: Fix detection of symbols
This patch changes the behavior of meson to define configuration options
*only* when the symbol checked is present. Currently, it defines all of
them in config.h whether the symbol exists or not and the code that
looks for it doesn't check the macro's value, but whether it's defined.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 17:08:40 +10:00
Jelle van der Waa
c294b7cb4c Update urls to not use www. for archlinux.org
www.archlinux.org now redirects to archlinux.org.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-08 10:14:33 +10:00
Eli Schwartz
9bf3d6a760 remove sed command lookup and hardcoding in edit-script.sh
We should not need to hardcode the path to sed as we simply don't care.
We don't check what kind of sed we found, and we're using the same one
we initially found on the PATH, which is surely still on the PATH.

At one point we did care to find the system copy of sed and hardcode it
in makepkg, because we also passed non-portable -i options to it and
makepkg needed to continue working on macOS even if some incompatible
GNU sed got installed afterward, elsewhere on the PATH. But this was
never relevant to the in-tree buildsystem script running sed.

In commit 3a814ee6bc we removed even that,
so we don't need to look it up at all.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-25 11:38:58 +10:00
Emil Velikov
67a42b9549 meson: use hidden symbol visiblity by default
All the required public API is annotated with SYMEXPORT, so we can just
add the meson notation, to hide all the symbols by default.

Thus we no longer spill all the internal API into the global namespace.

This is effectively a regression from the autotools build, which used
hidden and internal for DARWIN and others respectively.

The use of hidden is considered sufficient, considering:
 - internal was introduced with commit 920b0d20 ("Update usage of gcc
   __attribute__ flags"), referencing the GCC manual and potential
   optimisations, although
 - the details about the optimisations or respective benefits are close
   to non-existent,
 - the code/data size of the binaries is identical across hidden and
   internal. While the latter produces slightly larger overall binaries.
 - Internal is not widely supported - missing on Darwin, the CMake build
   system lacks a wrapper (unlike for hidden)
 - Internal is not widely used in projects.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:42 +10:00
Emil Velikov
d53ba019f5 meson: pacman-conf add missing libcommon link
Currently, we are erroneously exporting all the symbols via the
libalpm.so. As such, the libcommon dependency is resolved.

The libalpm.so exports are about to be resolved shortly, yet that
exposed that pacman-conf is missing a link against libcommon.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:33 +10:00
morganamilo
f5b373788f libalpm: don't use curl's deprecated functions
This bumps the minimun curl version from 7.32.0 to 7.55.0.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:12:19 +10:00
Eli Schwartz
3bd88821bb build: add libintl dependency to meson and the .pc file
In order to use gettext on systems where it is not part of libc, the
correct linker flags are needed in libalpm.pc (for static compilation).
This has never been the case.

The new meson build system currently only checks for ngettext in libc,
but does not fall back to searching for the existence of -lintl; add it
to the libalpm dependencies.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:47:14 +10:00
Eli Schwartz
3a6c9220ff meson: use better check for debug builds
meson 0.48 added the 'debug' and 'optimization' builtin options, which
bidirectionally map to the buildtype, but in some cases where debug is
enabled, the builtype may be custom. Checking the 'debug' option lets us
detect every case currently detected, plus a few more, and does so in a
shorter and more concise manner.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-06 13:48:07 +10:00
Eli Schwartz
49a8e90bc7 meson: make non-symlink scripts install for real, and use a better wrapper
We now generate the scripts using their real name, install them using
meson's builtin facility instead of an install_script, and generate the
wrapper scripts in the root of the build directory, instead of a
subdirectory.

This gets us closer to resolving FS#64394.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-26 10:49:57 +10:00
Eli Schwartz
7b73c4a75f build: remove use of handcrafted m4 in configuring scripts
Now that library/ is fully gone, we don't need this anymore.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 16:11:53 +10:00
Ethan Sommer
3a814ee6bc makepkg: replaces sed in-place with built in substitution
Reads PKGBUILD into an array and replaces the pkgver and pkgrel with
bash parameter substitution, then uses shell redirection to write to to
the file. Because shell redirection follows symlinks, this accomplishes
the same thing as the previous default of using the GNU-specific
--follow-symlinks sed flag.

Removes SEDPATH and SEDINPLACEFLAGS from the build systems as they are
not used elsewhere.

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 12:03:38 +10:00
Allan McRae
f6564377a2 Release 5.2.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 10:57:09 +10:00
Eli Schwartz
99639dc27c meson: fix inodecmd for darwin/bsd
The BSD stat command uses %N, not %n, and was incorrectly ported to
meson.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 09:34:51 +10:00
Allan McRae
8ce20d3754 Release v5.2.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-21 17:56:25 +10:00
Eli Schwartz
0e3a4bd1fb 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-07 14:09:34 +10:00
Eli Schwartz
facd9533b0 meson: fix incorrect libalpm version
LIB_VERSION is supposed to be something like 11.0.1, not simply
reiterate the project version. As a result, we ended up with this:

$ pacman -V
[...]
Pacman v5.1.0 - libalpm v5.1.0
[...]

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:09:21 +10:00
Eli Schwartz
c0da1ba13a meson: fix libcommon being publicly exposed as a static link dependency
libcommon isn't even installed, so that means libalpm.a (if installed)
is fatally broken as it misses objects. The problem is that meson
doesn't handle this case correctly:

https://github.com/mesonbuild/meson/issues/3934
https://github.com/mesonbuild/meson/issues/3937
https://github.com/mesonbuild/meson/pull/3939

Work around this by manually extracting libcommon's .o files into the
list of objects used to create libalpm.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:08:57 +10:00
Eli Schwartz
de6249ce22 Support file with seccomp enabled
Not all compression types can be detected in the seccomp sandbox, so we
need to disable it. This requires either configuring makepkg to know the
sandbox is available, or checking for file >= 5.38 in which the sandbox
option is a no-op even when seccomp is disabled.

- Requires autoconf-archive for autotools version compare macro.
- meson version comparison could be made a lot simpler using meson-git.

Fixes FS#58626

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 13:43:37 +10:00
Dave Reisner
72dae345e4 meson: port over checks for types used from sys/types.h
These are defined by a POSIX standard, and we should assert that we have
them, or define sane fallbacks (as per sys_types.h(0P)).

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:21:17 +10:00
Dave Reisner
b3dd02236c meson: drop checks for things we don't use
This was ported over from the AC_CHECK_{FUNCS,HEADERS} lists in
configure.ac, but I never actually checked if the resulting CPP defines
are used. Turns out, lots of symbols, not a lot of define usage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:21:12 +10:00
Eli Schwartz
796c02af4c meson: use dependency('gpgme') exclusively
This works everywhere that gpgme >= 1.13.0 because it is a pkg-config
dependency, and meson 0.51 adds a fallback config-tool dependency
provider that detects older versions of gpgme seamlessly via
gpgme-config.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 10:20:58 +10:00
Eli Schwartz
e7a2b2764a meson: use not_found_message when dependencies are not found
The default state of `dependency()` is `required: true`, which means if
a dependency is not found, meson immediately aborts and does not log our
`error()` messages. meson 0.50 has builtin support for dependencies with
custom error messages.

The alternative would be to specify `required: false` everywhere, and
only then to key off of `dep.found()`.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 10:20:53 +10:00
Eli Schwartz
83f428d974 meson: bump the minimum supported version of meson to 0.51
We haven't reached our first public release of the meson build backend
yet, so we have lots of flexibility for this... and build dependencies
are easier to upgrade than runtime dependencies anyway.

Updating meson allows us to make use of a bunch of new features that
rewquire the latest version of meson.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 10:20:49 +10:00
Eli Schwartz
583f3122ce meson: fix build of executables with nonstandard libarchive path
The libarchive header is used in alpm.h, and several binaries include
this header. This is noticeably a problem when using e.g. the musl-gcc
compiler which does not include /usr/include by default, and thus the
build system reports:

...../lib/libalpm/alpm.h:35:10: fatal error: archive.h: No such file or directory

More commonly, this will result in compiling against potentially the
wrong headers, if the libarchive installation picked up by pkg-config is
different from the one with headers in /usr/include, and /usr/include is
in the -isystem path.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 10:15:52 +10:00
Eli Schwartz
0a72874734 build: check for gpgme with pkg-config before gpgme-config
gpgme in git master now supports pkg-config and with the next release we
can and should prefer its use. However, retain the legacy code that
enables building with older versions of gpgme, as a fallback.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 14:05:53 +10:00