Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic build of Bubblewrap with Meson. #133

Closed
wants to merge 1 commit into from

Conversation

jpakkane
Copy link

Builds and installs Bubblewrap, the man page and the Bash completion file.

I could not properly comprehend how the setuid binary thing should work so I left that alone. FWICT it should just be a case of a custom install script or a custom target.

Selinux mode not tested because I don't have an selinux machine but It Should Work (TM).

The werror flags are not added. Maybe a better combination would be warning_level=2 + werror? Anyway it is just a question of adding those to add_project_arguments.

@rh-atomic-bot
Copy link

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

@cgwalters
Copy link
Collaborator

bot, add author to whitelist

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build logic looks nice, but I really don't like config.h.meson as is.

@@ -0,0 +1,98 @@
/* config.h.in. Generated from configure.ac by autoheader. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Why do we need to carry this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the simplest way of getting a build going is to do this. Meson does not actually need a config.h.in, if you don't have one it will just serialise out values set in the configuration object. Which one to use depends on how the project maintainers want to set things up.

#mesondefine HAVE_MEMORY_H

/* Define if SELinux is available */
#mesondefine HAVE_SELINUX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically having things like this seems pretty broken. It should be detected at build time, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what it's for. If you do cdata.set('HAVE_SELINUX', 1) then that will get replaced by

#define HAVE_SELINUX 1

If it is not set, then it will be replaced with

/* undef HAVE_SELINUX */

As mentioned above I don't have an SELinux machine to test this with so I left it out.

@cgwalters
Copy link
Collaborator

Is this a PoC or are you planning to use it? I'm OK merging this if it'll be used.

@jpakkane
Copy link
Author

This is a PoC.

smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 17, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 17, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
@smcv smcv mentioned this pull request Jun 17, 2021
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 17, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 17, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 23, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 23, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 28, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Jun 28, 2021
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Feb 5, 2022
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

One feature that is deliberately missing is an equivalent of
--with-priv-mode=setuid. On distributions like Debian <= 10 that still
require a setuid bwrap, the sysadmin or distribution packaging will need
to set the correct permissions on the bwrap executable; Debian already
did this in the packaging rather than the upstream build system.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Feb 18, 2022
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Differences between the Autotools and Meson builds:

The Meson build requires a version of libcap that has pkg-config
metadata (introduced in libcap 2.23, in 2013).

The Meson build has no equivalent of --with-priv-mode=setuid. On
distributions like Debian <= 10 and RHEL <= 7 that require a setuid bwrap
executable, the sysadmin or distribution packaging will need to set the
correct permissions on the bwrap executable; Debian already did this via
packaging rather than the upstream build system.

The Meson build supports being used as a subproject, and there is CI
for this. It automatically disables shell completions and man pages,
moves the bubblewrap executable to ${libexecdir}, and renames the
bubblewrap executable according to a program_prefix option that the
caller must specify (for example, Flatpak would use
-Dprogram_prefix=flatpak- to get /usr/libexec/flatpak-bwrap). See the
tests/use-as-subproject/ directory for an example.

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Feb 18, 2022
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and require
a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap.

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Differences between the Autotools and Meson builds:

The Meson build requires a version of libcap that has pkg-config
metadata (introduced in libcap 2.23, in 2013).

The Meson build has no equivalent of --with-priv-mode=setuid. On
distributions like Debian <= 10 and RHEL <= 7 that require a setuid bwrap
executable, the sysadmin or distribution packaging will need to set the
correct permissions on the bwrap executable; Debian already did this via
packaging rather than the upstream build system.

The Meson build supports being used as a subproject, and there is CI
for this. It automatically disables shell completions and man pages,
moves the bubblewrap executable to ${libexecdir}, and renames the
bubblewrap executable according to a program_prefix option that the
caller must specify (for example, Flatpak would use
-Dprogram_prefix=flatpak- to get /usr/libexec/flatpak-bwrap). See the
tests/use-as-subproject/ directory for an example.

Signed-off-by: Simon McVittie <smcv@collabora.com>
smcv added a commit to smcv/bubblewrap that referenced this pull request Feb 18, 2022
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and
require a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap. Verified to
be backwards-compatible as far as Meson 0.49.0 (Debian 9 backports).

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Differences between the Autotools and Meson builds:

The Meson build requires a version of libcap that has pkg-config
metadata (introduced in libcap 2.23, in 2013).

The Meson build has no equivalent of --with-priv-mode=setuid. On
distributions like Debian <= 10 and RHEL <= 7 that require a setuid bwrap
executable, the sysadmin or distribution packaging will need to set the
correct permissions on the bwrap executable; Debian already did this via
packaging rather than the upstream build system.

The Meson build supports being used as a subproject, and there is CI
for this. It automatically disables shell completions and man pages,
moves the bubblewrap executable to ${libexecdir}, and renames the
bubblewrap executable according to a program_prefix option that the
caller must specify (for example, Flatpak would use
-Dprogram_prefix=flatpak- to get /usr/libexec/flatpak-bwrap). See the
tests/use-as-subproject/ directory for an example.

Signed-off-by: Simon McVittie <smcv@collabora.com>
@rusty-snake
Copy link
Contributor

I guess this PR can be closed given that #432 is merged.

@smcv
Copy link
Collaborator

smcv commented Mar 19, 2022

I guess this PR can be closed given that #432 is merged.

Yes, thanks for the reminder.

@smcv smcv closed this Mar 19, 2022
brandsimon pushed a commit to brandsimon/bubblewrap that referenced this pull request Mar 19, 2023
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and
require a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap. Verified to
be backwards-compatible as far as Meson 0.49.0 (Debian 9 backports).

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Differences between the Autotools and Meson builds:

The Meson build requires a version of libcap that has pkg-config
metadata (introduced in libcap 2.23, in 2013).

The Meson build has no equivalent of --with-priv-mode=setuid. On
distributions like Debian <= 10 and RHEL <= 7 that require a setuid bwrap
executable, the sysadmin or distribution packaging will need to set the
correct permissions on the bwrap executable; Debian already did this via
packaging rather than the upstream build system.

The Meson build supports being used as a subproject, and there is CI
for this. It automatically disables shell completions and man pages,
moves the bubblewrap executable to ${libexecdir}, and renames the
bubblewrap executable according to a program_prefix option that the
caller must specify (for example, Flatpak would use
-Dprogram_prefix=flatpak- to get /usr/libexec/flatpak-bwrap). See the
tests/use-as-subproject/ directory for an example.

Signed-off-by: Simon McVittie <smcv@collabora.com>
CrackerCat pushed a commit to CrackerCat/bubblewrap that referenced this pull request Jul 31, 2024
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and
require a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap. Verified to
be backwards-compatible as far as Meson 0.49.0 (Debian 9 backports).

Loosely based on previous work by Jussi Pakkanen (see containers#133).

Differences between the Autotools and Meson builds:

The Meson build requires a version of libcap that has pkg-config
metadata (introduced in libcap 2.23, in 2013).

The Meson build has no equivalent of --with-priv-mode=setuid. On
distributions like Debian <= 10 and RHEL <= 7 that require a setuid bwrap
executable, the sysadmin or distribution packaging will need to set the
correct permissions on the bwrap executable; Debian already did this via
packaging rather than the upstream build system.

The Meson build supports being used as a subproject, and there is CI
for this. It automatically disables shell completions and man pages,
moves the bubblewrap executable to ${libexecdir}, and renames the
bubblewrap executable according to a program_prefix option that the
caller must specify (for example, Flatpak would use
-Dprogram_prefix=flatpak- to get /usr/libexec/flatpak-bwrap). See the
tests/use-as-subproject/ directory for an example.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants