-
Notifications
You must be signed in to change notification settings - Fork 4
Build Arch Linux package #52
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /landlockconfig-*.pkg.tar.zst | ||
| /pkg | ||
| /src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # See docker-build.sh | ||
|
|
||
| FROM archlinux | ||
|
|
||
| ARG UID=1000 | ||
| ARG GID=1000 | ||
|
|
||
| RUN pacman -Syu --noconfirm \ | ||
| binutils \ | ||
| cargo-c \ | ||
| fakeroot \ | ||
| gcc \ | ||
| git \ | ||
| make \ | ||
| pkg-config \ | ||
| rust \ | ||
| sudo \ | ||
| && \ | ||
| pacman -Scc --noconfirm && \ | ||
| groupadd -g "${GID}" builder && \ | ||
| useradd -m -u "${UID}" -g "${GID}" builder && \ | ||
| echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
|
||
| USER builder | ||
| WORKDIR /landlockconfig | ||
| CMD ["make", "-C", "pkg/arch", "install"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
|
||
| .PHONY: build clean docker | ||
|
|
||
| # Build package directly (requires Arch Linux). | ||
| build: | ||
| makepkg --force | ||
| sed -i -e 's/^pkgver=.*/pkgver=0/' PKGBUILD | ||
|
|
||
| install: build | ||
| sudo pacman -U --noconfirm -- "$$(ls -t landlockconfig-git-*.pkg.tar.zst | head -n 1)" | ||
|
|
||
| # Build package using Docker container | ||
| # Prerequisites: Install rustup and cargo-c (see .github/workflows/ci.yml) | ||
| docker: | ||
| docker buildx build --file Dockerfile \ | ||
| --build-arg "UID=$(shell id -u)" \ | ||
| --build-arg "GID=$(shell id -g)" \ | ||
| --tag landlockconfig-archlinux \ | ||
| . | ||
| docker run --rm \ | ||
| --volume "$(HOME)/.cargo/registry:/home/builder/.cargo/registry:ro" \ | ||
| --volume "$(CURDIR)/../..:/landlockconfig" \ | ||
| landlockconfig-archlinux | ||
|
|
||
| clean: | ||
| rm landlockconfig-git-*.pkg.tar.zst || : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Maintainer: Mickaël Salaün | ||
| # | ||
| # For now, this package is only meant to be used for testing with the Landlock | ||
| # Config repository. | ||
| # TODO: Make it more generic while still efficient for development and CI (see | ||
| # https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/commit/16294a0b4415b15f48e07f9e939c49fdf069c506). | ||
|
|
||
| pkgname=landlockconfig-git | ||
| pkgver=0 | ||
| pkgrel=1 | ||
| pkgdesc="Sandboxer library leveraging Landlock with JSON or TOML configuration (git version)" | ||
| arch=('x86_64' 'aarch64') | ||
| url="https://landlock.io" | ||
| license=('MIT' 'Apache-2.0') | ||
| depends=('glibc' 'gcc-libs') | ||
| makedepends=('cargo' 'cargo-c' 'git' 'rust') | ||
| provides=('landlockconfig' 'liblandlockconfig.so') | ||
| conflicts=('landlockconfig') | ||
|
|
||
| # Disable debug package creation to avoid debug symlink issues. | ||
| options=('!debug') | ||
|
|
||
| # Build directly from the current repository. | ||
| # Change this to remote URL for distribution: git+https://github.com/landlock-lsm/landlockconfig.git | ||
| source=() | ||
| sha256sums=() | ||
|
|
||
| pkgver() { | ||
| cd "$startdir/../.." | ||
|
|
||
| local crate_version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml) | ||
| local rev_count=$(git rev-list --count HEAD) | ||
| local short_hash=$(git rev-parse --short HEAD) | ||
| printf "%s.r%s.%s" "$crate_version" "$rev_count" "$short_hash" | ||
| } | ||
|
|
||
| build() { | ||
| # Work directly with the current repository and reuse cached target directory. | ||
| cd "$startdir/../.." | ||
|
|
||
| cargo cbuild --package=landlockconfig_ffi --release | ||
| } | ||
|
|
||
| check() { | ||
| cd "$startdir/../.." | ||
|
|
||
| cargo test | ||
| } | ||
|
|
||
| package() { | ||
| cd "$startdir/../.." | ||
|
|
||
| cargo cinstall --package=landlockconfig_ffi --release \ | ||
| --prefix=/usr --destdir="$pkgdir" | ||
|
|
||
| install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md" | ||
| install -Dm644 COPYRIGHT "$pkgdir/usr/share/doc/$pkgname/COPYRIGHT" | ||
|
|
||
| install -Dm644 LICENSE-MIT "$pkgdir/usr/share/licenses/$pkgname/LICENSE-MIT" | ||
| install -Dm644 LICENSE-APACHE "$pkgdir/usr/share/licenses/$pkgname/LICENSE-APACHE" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Arch Linux package | ||
|
|
||
| This directory contains files for building an Arch Linux package of Landlock Config. | ||
|
|
||
| Built packages are only [meant for development and testing](https://github.com/landlock-lsm/landlockconfig/pull/52). | ||
|
|
||
| ## Building the package | ||
|
|
||
| ### Option 1: using Docker | ||
|
|
||
| On any Linux system with Docker installed: | ||
|
|
||
| ```bash | ||
| make docker | ||
| ``` | ||
|
|
||
| ### Option 2: native build | ||
|
|
||
| On Arch Linux systems with development tools installed: | ||
|
|
||
| ```bash | ||
| make build | ||
| ``` | ||
|
|
||
| ## Output | ||
|
|
||
| The build creates a package file: `landlockconfig-git-*.pkg.tar.zst` | ||
|
|
||
| Install with: `sudo pacman -U landlockconfig-git-*.pkg.tar.zst` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.