1
0
Fork 0
mirror of https://github.com/xHyroM/void-packages.git synced 2024-11-23 06:51:04 +01:00

add vesktop

This commit is contained in:
Jozef Steinhübl 2024-03-29 08:12:19 +01:00
commit ef47fd365f
345 changed files with 27241 additions and 0 deletions

22
.editorconfig Normal file
View file

@ -0,0 +1,22 @@
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
indent_size = 4
indent_style = space
[*.{yml,yaml}]
indent_size = 2
indent_style = space
[*.{patch,diff}]
indent_style = unset
end_of_line = unset
charset = unset
trim_trailing_whitespace = unset

4
.gitattributes vendored Normal file
View file

@ -0,0 +1,4 @@
template linguist-language=bash
common/shlibs merge=union
*.patch whitespace=-space-before-tab,-trailing-space
*.diff whitespace=-space-before-tab,-trailing-space

73
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View file

@ -0,0 +1,73 @@
name: Bug Report
description: File a bug report
labels: ["bug", "needs-testing"]
body:
- type: markdown
attributes:
value: >
#### Don't request an update of a package,
[We have a script for that](https://repo-default.voidlinux.org/void-updates/void-updates.txt).
However, a quality pull request may help.
- id: verified
type: dropdown
attributes:
label: Is this a new report?
description: I verified that there isn't already an open issue for this bug
options:
- "Yes"
- "No"
validations:
required: true
- id: xuname
type: input
attributes:
label: System Info
description: Output of `xuname` (part of [`xtools`](https://man.voidlinux.org/xtools.1))
placeholder: Void 5.x.y_z x86_64-musl ...
validations:
required: true
- id: packages
type: input
attributes:
label: Package(s) Affected
description: Affected package(s) including version (this can be found with `xbps-query -p pkgver foo`)
placeholder: foo-1.0.2_5, bar-5.6.7_1, baz-0.0.3_5, ...
validations:
required: true
- id: upstream
type: textarea
attributes:
label: Does a report exist for this bug with the project's home (upstream) and/or another distro?
description: If so, link it here (It's fine if there's none)
placeholder: |
For example:
https://bugs.kde.org/show_bug.cgi?id=432975
https://bugs.gentoo.org/767478
- id: expected
type: textarea
attributes:
label: Expected behaviour
description: A clear and concise description of what you expected to happen
placeholder: The package is supposed to do this thing.
validations:
required: true
- id: description
type: textarea
attributes:
label: Actual behaviour
description: A clear and concise description of what the bug is
placeholder: There was a crash when...
validations:
required: true
- id: steps
type: textarea
attributes:
label: Steps to reproduce
description: Clear steps to reproduce the bug
placeholder: |
1. Do the thing
2. Do the other thing
3. ???
4. Crash :(
validations:
required: true

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Other kind of issue
url: https://github.com/void-linux/void-packages/issues/new
about: For RFCs, tracking issues, etc (freeform text)

59
.github/ISSUE_TEMPLATE/pkg-request.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: Package Request
title: "Package request: "
description: Request the addition of a package
labels: ["request"]
body:
- type: markdown
attributes:
value: >
#### Don't request an update of a package,
[We have a script for that](https://repo-default.voidlinux.org/void-updates/void-updates.txt).
However, a quality pull request may help.
- id: name
type: input
attributes:
label: Package name
placeholder: foobar9k
validations:
required: true
- id: homepage
type: input
attributes:
label: Package homepage
placeholder: https://example.com/foobar9k
validations:
required: true
- id: description
type: textarea
attributes:
label: Description
description: What does the package do?
placeholder: >
Foobar9k is a music player that turns your music up to 11.
It provides features X, Y, and Z, which other music players in Void don't.
validations:
required: true
- id: quality
type: dropdown
attributes:
label: Does the requested package meet the package requirements?
description: |
See [CONTRIBUTING.md](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements) for details
multiple: true
options:
- System
- Compiled
- Required
validations:
required: true
- id: released
type: dropdown
attributes:
label: Is the requested package released?
description: |
See [CONTRIBUTING.md](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements) for details
options:
- "Yes"
- "No"
validations:
required: true

8
.github/issue_template.md vendored Normal file
View file

@ -0,0 +1,8 @@
<!--
if you are creating a bug report or package request, please fill out one of the forms here:
https://github.com/void-linux/void-packages/issues/new/choose
Don't request an update of a package, We have a script for that:
https://repo-default.voidlinux.org/void-updates/void-updates.txt
However, a quality pull request may help.
-->

23
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,23 @@
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->

144
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,144 @@
name: Check build
on:
pull_request:
paths:
- 'srcpkgs/**'
push:
branches:
- 'ci-**'
paths:
- 'srcpkgs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Lint changed templates.
xlint:
name: Lint templates
runs-on: ubuntu-latest
container:
image: 'ghcr.io/void-linux/void-buildroot-musl:20231230R1'
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
LICENSE_LIST: common/travis/license.lst
steps:
- name: Prepare container
run: |
# switch to repo-ci mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# install tools needed for lints
xbps-install -y grep curl git
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1
- name: Create hostrepo and prepare masterdir
run: |
ln -s "$(pwd)" /hostrepo &&
common/travis/set_mirror.sh &&
common/travis/prepare.sh &&
common/travis/fetch-xtools.sh
- run: common/travis/changed_templates.sh
- name: Run lints
run: |
rv=0
common/travis/xlint.sh || rv=1
common/travis/verify-update-check.sh || rv=1
exit $rv
# Build changed packages.
build:
name: Build packages
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')"
container:
image: ghcr.io/void-linux/void-buildroot-${{ matrix.config.libc }}:20231230R1
options: --platform ${{ matrix.config.platform }}
env:
PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.host }}'
TEST: '${{ matrix.config.test }}'
HOSTREPO: /hostrepo
strategy:
fail-fast: false
matrix:
config:
- { arch: x86_64, host: x86_64, libc: glibc, platform: linux/amd64, test: 1 }
- { arch: i686, host: i686, libc: glibc, platform: linux/386, test: 1 }
- { arch: aarch64, host: x86_64, libc: glibc, platform: linux/amd64, test: 0 }
- { arch: armv7l, host: x86_64, libc: glibc, platform: linux/amd64, test: 0 }
- { arch: x86_64-musl, host: x86_64-musl, libc: musl, platform: linux/amd64, test: 1 }
- { arch: armv6l-musl, host: x86_64-musl, libc: musl, platform: linux/amd64, test: 0 }
- { arch: aarch64-musl, host: x86_64-musl, libc: musl, platform: linux/amd64, test: 0 }
steps:
- name: Prepare container
run: |
# switch to repo-ci mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1
- name: Create hostrepo and prepare masterdir
run: |
ln -s "$(pwd)" /hostrepo &&
common/travis/set_mirror.sh &&
common/travis/prepare.sh &&
common/travis/fetch-xtools.sh
- run: common/travis/changed_templates.sh
- name: Build and check packages
run: |
(
here="$(pwd)"
cd /
"$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" "$TEST"
)
- name: Show files
run: |
(
here="$(pwd)"
cd /
"$here/common/travis/show_files.sh" "$BOOTSTRAP" "$ARCH"
)
- name: Compare to previous
run: |
(
here="$(pwd)"
cd /
"$here/common/travis/xpkgdiff.sh" "$BOOTSTRAP" "$ARCH"
)
- name: Check file conflicts
if: matrix.config.arch == 'x86_64' # the arch indexed in xlocate
run: |
if [ -s /tmp/templates ]; then
xlocate -S &&
common/scripts/lint-conflicts $HOME/hostdir/binpkgs
fi
- name: Verify repository state
run: |
(
here="$(pwd)"
cd /
"$here/common/travis/check-install.sh" "$BOOTSTRAP" "$ARCH"
)

98
.github/workflows/container.yaml vendored Normal file
View file

@ -0,0 +1,98 @@
---
name: 'Build buildroot containers'
on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- common/container/**
push:
branches:
- master
paths:
- common/container/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
libc:
- glibc
- musl
steps:
- name: Checkout
uses: classabbyamp/treeless-checkout-action@v1
- name: Get image release
id: release
run: |
# gets the list of all date-shaped tags for the image, finds the most recent one
tag="$(skopeo list-tags "docker://ghcr.io/${{ github.repository_owner }}/void-buildroot-${{ matrix.libc }}" | \
jq -r '.Tags | sort | reverse | map(select(test("^[0-9]{8}(R[0-9]+)?$")))[0]')"
# tags from a different day or pre-YYYYMMDDRN
if [ "${tag%R*}" != "$(date -u +%Y%m%d)" ] || [ "${tag%R*}" = "${tag}" ]; then
rel=1
else
rel=$(( ${tag##*R} + 1 ))
fi
echo "rel=${rel}" >> "${GITHUB_OUTPUT}"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/void-buildroot-${{ matrix.libc }}
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{date 'YYYYMMDD'}}R${{ steps.release.outputs.rel }},enable={{is_default_branch}},priority=1000
flavor: latest=false
labels: |
org.opencontainers.image.authors=Void Linux team and contributors
org.opencontainers.image.url=https://voidlinux.org
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=Void Linux
org.opencontainers.image.title=Void Linux build root
org.opencontainers.image.description=Image for building packages with xbps-src on Void Linux
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GCHR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images
id: build_and_push
uses: docker/bake-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
targets: void-buildroot-${{ matrix.libc }}
files: |
common/container/docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
set: |
_common.cache-to=type=gha
_common.cache-from=type=gha

48
.github/workflows/cycles.yml vendored Normal file
View file

@ -0,0 +1,48 @@
name: 'Cycle Check'
on:
schedule:
- cron: '0 18 * * *'
jobs:
cycles:
runs-on: ubuntu-latest
permissions:
issues: write
container:
image: 'ghcr.io/void-linux/void-buildroot-musl:20231230R1'
env:
PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
# switch to repo-ci mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1
- name: Create hostrepo and prepare masterdir
run: |
ln -s "$(pwd)" /hostrepo &&
common/travis/set_mirror.sh &&
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
printf "Issue on '%s' already exists.\n" "$line"
else
gh issue create -R "$GITHUB_REPOSITORY" -b '' -t "$line"
fi
done
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}

25
.github/workflows/stale.yml vendored Normal file
View file

@ -0,0 +1,25 @@
---
name: Stale Cleanup
on:
workflow_dispatch:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v6
with:
stale-issue-message: 'Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.'
stale-pr-message: 'Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.'
days-before-stale: 90
days-before-close: 14
exempt-all-assignees: true
ascending: true
operations-per-run: 250
exempt-issue-labels: 'request,bug,tracking'

25
.gitignore vendored Normal file
View file

@ -0,0 +1,25 @@
*.swo
*.swp
*~
\#*#
# exclude everything in root except files and directories from void-packages
/*
!/.editorconfig
!/.gitattributes
!/.github
!/.gitignore
!/.mailmap
!/CONTRIBUTING.md
!/COPYING
!/Manual.md
!/README.md
!/common
!/etc
!/srcpkgs
!/xbps-src
etc/conf
etc/conf.*
etc/virtual
etc/xbps.d/custom
etc/repo-keys

230
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,230 @@
# Contributing to void-packages
void-packages is the backbone of the Void Linux distribution. It contains all the definitions to build packages from source.
This document describes how you, as a contributor, can help with adding packages, correcting bugs and adding features to void-packages.
## Package Requirements
To be included in the Void repository, software must meet at least one of the following requirements.
Exceptions to the list are possible, and might be accepted, but are extremely unlikely.
If you believe you have an exception, start a PR and make an argument for why that particular piece of software,
while not meeting any of the following requirements, is a good candidate for the Void packages system.
1. **System**: The software should be installed system-wide, not per-user.
1. **Compiled**: The software needs to be compiled before being used, even if it is software that is not needed by the whole system.
1. **Required**: Another package either within the repository or pending inclusion requires the package.
In particular, new themes are highly unlikely to be accepted.
Simple shell scripts are unlikely to be accepted unless they provide considerable value to a broad user base.
New fonts may be accepted if they provide value beyond aesthetics (e.g. they contain glyphs for a script missing in already packaged fonts).
Packages related to cryptocurrencies (wallets, miners, nodes, etc) are not accepted.
Browser forks, including those based on Chromium and Firefox, are generally not accepted.
Such forks require heavy patching, maintenance and hours of build time.
Software need to be used in version announced by authors as ready to use by the general public - usually called releases.
Betas, arbitrary VCS revisions, templates using tip of development branch taken at build time and releases created by the package maintainer won't be accepted.
## Creating, updating, and modifying packages in Void by yourself
If you really want to get a new package or package update into Void Linux, we recommend you contribute it yourself.
We provide a [comprehensive Manual](./Manual.md) on how to create new packages.
There's also a [manual for xbps-src](./README.md), which is used to build package files from templates.
For this guide, we assume you have basic knowledge about [git](http://git-scm.org), as well as a [GitHub Account](http://github.com) with [SSH set up](https://docs.github.com/en/authentication/connecting-to-github-with-ssh).
You should also [set the email](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address) on your GitHub account and in git so your commits are associated with your GitHub account properly.
To get started, [fork](https://help.github.com/articles/fork-a-repo) the void-linux `void-packages` git repository on GitHub and clone it:
$ git clone git@github.com:<user>/void-packages.git
To keep your forked repository up to date, setup the `upstream` remote to pull in new changes:
$ git remote add upstream https://github.com/void-linux/void-packages.git
$ git pull --rebase upstream master
This can also be done with the `github-cli` tool:
$ gh repo fork void-linux/void-packages
$ gh repo clone <user>/void-packages
This automatically sets up the `upstream` remote, so `git pull --rebase upstream master` can still be used to keep your fork up-to-date.
Using the GitHub web editor for making changes is strongly discouraged, because you will need to clone the repo anyways to edit and test your changes.
Using the `master` branch of your fork for contributing is also strongly discouraged.
It can cause many issues with updating your pull request (also called a PR), and having multiple PRs open at once.
To create a new branch:
$ git checkout master -b <a-descriptive-name>
### Creating a new template
You can use the helper tool `xnew`, from the [xtools](https://github.com/leahneukirchen/xtools) package, to create new templates:
$ xnew pkgname subpkg1 subpkg2 ...
Templates must have the name `void-packages/srcpkgs/<pkgname>/template`, where `pkgname` is the same as the `pkgname` variable in the template.
For deeper insights on the contents of template files, please read the [manual](./Manual.md), and be sure to browse the existing template files in the `srcpkgs` directory of this repository for concrete examples.
### Updating a template
At minimum, a template update will consist of changing `version` and `checksum`, if there was an upstream version change, and/or `revision`, if a template-specific change (e.g. patch, correction, etc.) is needed.
Other changes to the template may be needed depending on what changes the upstream has made.
The checksum can be updated automatically with the `xgensum` helper from the [xtools](https://github.com/leahneukirchen/xtools) package:
$ xgensum -i <pkgname>
### Adopting a template
If a template is orphaned (maintained by `orphan@voidlinux.org`) or the current `maintainer` has not contributed to
Void in over a year, template maintainership can be adopted by someone else. To ensure a template gets the care it needs,
template adopters should be familiar with the package and have an established history of contributions to Void.
Those who have contributed several updates, especially for the template in question, are good candidates for template
maintainership.
It is best to adopt a template when making another change to it. When adopting the template, add your name or username
and email to the `maintainer` field in the template, and mention the adoption in your commit message, for example:
libfoo: update to 1.2.3, adopt.
### Orphaning a template
If you no longer wish to maintain a template, you can remove yourself as maintainer by setting the `maintainer` field in
the template to `Orphaned <orphan@voidlinux.org>`. The commit message should mention this, for example:
libfoo: orphan.
It is not necessary to make other changes to the template when orphaning, and incrementing the revision (triggering a
rebuild) is not necessary either.
### Committing your changes
After making your changes, please check that the package builds successfully. From the top level directory of your local copy of the `void-packages` repository, run:
$ ./xbps-src pkg <pkgname>
Your package must build successfully for at least x86, but we recommend also trying a cross-build for armv6l* as well, e.g.:
$ ./xbps-src -a armv6l pkg <pkgname>
When building for `x86_64*` or `i686`, building with the `-Q` flag or with `XBPS_CHECK_PKGS=yes` set in `etc/conf` (to run the check phase) is strongly encouraged.
Also, new packages and updates will not be accepted unless they have been runtime tested by installing and running the package.
When you've finished working on the template file, please check it with `xlint` helper from the [xtools](https://github.com/leahneukirchen/xtools) package:
$ xlint template
If `xlint` reports any issues, resolve them before committing.
Once you have made and verified your changes to the package template and/or other files, make one commit per package (including all changes to its sub-packages). Each commit message should have one of the following formats:
* for new packages, use `New package: <pkgname>-<version>` ([example](https://github.com/void-linux/void-packages/commit/8ed8d41c40bf6a82cf006c7e207e05942c15bff8)).
* for package updates, use `<pkgname>: update to <version>.` ([example](https://github.com/void-linux/void-packages/commit/c92203f1d6f33026ae89f3e4c1012fb6450bbac1)).
* for template modifications without a version change, use `<pkgname>: <reason>` ([example](https://github.com/void-linux/void-packages/commit/ff39c912d412717d17232de9564f659b037e95b5)).
* for package removals, use `<pkgname>: remove package` and include the removal reason in the commit body ([example](https://github.com/void-linux/void-packages/commit/4322f923bdf5d4e0eb36738d4f4717d72d0a0ca4)).
* for changes to any other file, use `<filename>: <reason>` ([example](https://github.com/void-linux/void-packages/commit/e00bea014c36a70d60acfa1758514b0c7cb0627d),
[example](https://github.com/void-linux/void-packages/commit/93bf159ce10d8e474da5296e5bc98350d00c6c82), [example](https://github.com/void-linux/void-packages/commit/dc62938c67b66a7ff295eab541dc37b92fb9fb78), [example](https://github.com/void-linux/void-packages/commit/e52317e939d41090562cf8f8131a68772245bdde))
If you want to describe your changes in more detail, explain in the commit body (separated from the first line with a blank line) ([example](https://github.com/void-linux/void-packages/commit/f1c45a502086ba1952f23ace9084a870ce437bc6)).
`xbump`, available in the [xtools](https://github.com/leahneukirchen/xtools) package, can be used to commit a new or updated package:
$ xbump <pkgname> <git commit options>
`xrevbump`, also available in the [xtools](https://github.com/leahneukirchen/xtools) package, can be used to commit a template modification for a package:
$ xrevbump '<message>' <pkgnames...>
`xbump` and `xrevbump` will use `git commit` to commit the changes with the appropriate commit message. For more fine-grained control over the commit, specific options can be passed to `git commit` by adding them after the package name.
### Starting a pull request
Once you have successfully built the package, you can [create a pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request). Pull requests are also known as PRs.
Most pull requests should only contain a single package and dependencies which are not part of void-packages yet.
If you make updates to packages containing a soname bump, you also need to update `common/shlibs` and revbump all packages that are dependant.
There should be a commit for each package revbump, and those commits should be part of the same pull request.
When you make changes to your pull request, please *do not close and reopen your pull request*. Instead, just [forcibly git push](#review), overwriting any old commits. Closing and opening your pull requests repeatedly spams the Void maintainers.
#### Continuous Integration
Pull requests are automatically submitted for Continuous Integration (CI) testing to ensure packages build and pass their tests (on native builds) on various combinations of C library and architecture.
Packages that take longer than 120 minutes or need more than 14G of storage to complete their build (for example, Firefox or the Linux kernel) will fail CI and should include `[ci skip]` in the PR title or body (the comment field when the PR is being opened) to avoid wasting CI builder time.
Use your best judgment on build times based on your local building experience. If you skip CI when submitting a PR, please build and cross-build for a variety of architectures locally, with both glibc and musl, and note your local results in PR comments.
Make sure to cover 64-bit and 32-bit architectures.
If you notice a failure in CI that didn't happen locally, that is likely because you didn't run tests locally.
Use `./xbps-src -Q pkg <package>` to do so.
Some tests won't work in the CI environment or at all, and their templates should encode this information using the `make_check` variable.
Continuous Integration will also check if the templates you have changed
comply with the our guidelines. At the moment not all packages comply with the rules, so if you update a package, it may report errors about places you haven't touched. Please feel free to fix those errors too.
#### Review
It's possible (and common) that a pull request will contain mistakes or reviewers will ask for additional tweaks.
Reviewers will comment on your pull request and point out which changes are needed before the pull request can be merged.
Most PRs will have a single commit, as seen [above](#committing-your-changes), so if you need to make changes to the commit and already have a pull request open, you can use the following commands:
$ git add <file>
$ git commit --amend
$ git push -f
A more powerful way of modifying commits than using `git commit --amend` is with [git-rebase](https://git-scm.com/docs/git-rebase#_interactive_mode), which allows you to join, reorder, change description of past commits and more.
Alternatively, if there are issues with your git history, you can make another branch and push it to the existing PR:
$ git checkout master -b <attempt2>
$ # do changes anew
$ git push -f <fork> <attempt2>:<branch-of-pr>
#### Closing the pull request
Once you have applied all requested changes, the reviewers will merge your request.
If the pull request becomes inactive for some days, the reviewers may or may not warn you when they are about to close it.
If it stays inactive further, it will be closed.
Please abstain from temporarily closing a pull request while revising the templates. Instead, leave a comment on the PR describing what still needs work, [mark it as a draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft), or add "[WIP]" to the PR title. Only close your pull request if you're sure you don't want your changes to be included.
#### Publishing the package
Once the reviewers have merged the pull request, our [build server](http://build.voidlinux.org) is automatically triggered and builds
all packages in the pull request for all supported platforms. Upon completion, the packages are available to all Void Linux users.
## Testing Pull Requests
While it is the responsibility of the PR creator to test changes before sending it, one person can't test all configuration options, usecases, hardware, etc.
Testing new package submissions and updates is always helpful, and is a great way to get started with contributing.
First, [clone the repository](https://github.com/void-linux/void-packages#quick-start) if you haven't done so already.
Then check out the pull request, either with `github-cli`:
$ gh pr checkout <number>
Or with `git`:
If your local void-packages repository is cloned from your fork, you may need to add the main repository as a remote first:
$ git remote add upstream https://github.com/void-linux/void-packages.git
Then fetch and check out the PR (replacing `<remote>` with either `origin` or `upstream`):
$ git fetch <remote> pull/<number>/head:<branch-name>
$ git checkout <branch-name>
Then [build and install](https://github.com/void-linux/void-packages#building-packages) the package and test its functionality.

23
COPYING Normal file
View file

@ -0,0 +1,23 @@
Copyright (c) 2008-2020 Juan Romero Pardines and contributors
Copyright (c) 2017-2024 The Void Linux team and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2205
Manual.md Normal file

File diff suppressed because it is too large Load diff

511
README.md Normal file
View file

@ -0,0 +1,511 @@
## The XBPS source packages collection
This repository contains the XBPS source packages collection to build binary packages
for the Void Linux distribution.
The included `xbps-src` script will fetch and compile the sources, and install its
files into a `fake destdir` to generate XBPS binary packages that can be installed
or queried through the `xbps-install(1)` and `xbps-query(1)` utilities, respectively.
See [Contributing](./CONTRIBUTING.md) for a general overview of how to contribute and the
[Manual](./Manual.md) for details of how to create source packages.
### Table of Contents
- [Requirements](#requirements)
- [Quick start](#quick-start)
- [chroot methods](#chroot-methods)
- [Install the bootstrap packages](#install-bootstrap)
- [Configuration](#configuration)
- [Directory hierarchy](#directory-hierarchy)
- [Building packages](#building-packages)
- [Package build options](#build-options)
- [Sharing and signing your local repositories](#sharing-and-signing)
- [Rebuilding and overwriting existing local packages](#rebuilding)
- [Enabling distcc for distributed compilation](#distcc)
- [Distfiles mirrors](#distfiles-mirrors)
- [Cross compiling packages for a target architecture](#cross-compiling)
- [Using xbps-src in a foreign Linux distribution](#foreign)
- [Remaking the masterdir](#remaking-masterdir)
- [Keeping your masterdir uptodate](#updating-masterdir)
- [Building 32bit packages on x86_64](#building-32bit)
- [Building packages natively for the musl C library](#building-for-musl)
- [Building void base-system from scratch](#building-base-system)
### Requirements
- GNU bash
- xbps >= 0.56
- git(1) - unless configured to not, see etc/defaults.conf
- common POSIX utilities included by default in almost all UNIX systems
- curl(1) - required by `xbps-src update-check`
For bootstrapping additionally:
- flock(1) - util-linux
- bsdtar or GNU tar (in that order of preference)
- install(1) - GNU coreutils
- objcopy(1), objdump(1), strip(1): binutils
`xbps-src` requires [a utility to chroot](#chroot-methods) and bind mount existing directories
into a `masterdir` that is used as its main `chroot` directory. `xbps-src` supports
multiple utilities to accomplish this task.
> NOTE: `xbps-src` does not allow building as root anymore. Use one of the chroot
methods.
<a name="quick-start"></a>
### Quick start
Clone the `void-packages` git repository and install the bootstrap packages:
```
$ git clone https://github.com/void-linux/void-packages.git
$ cd void-packages
$ ./xbps-src binary-bootstrap
```
Build a package by specifying the `pkg` target and the package name:
```
$ ./xbps-src pkg <package_name>
```
Use `./xbps-src -h` to list all available targets and options.
To build packages marked as 'restricted', modify `etc/conf`:
```
$ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
```
Once built, the package will be available in `hostdir/binpkgs` or an appropriate subdirectory (e.g. `hostdir/binpkgs/nonfree`). To install the package:
```
# xbps-install --repository hostdir/binpkgs <package_name>
```
Alternatively, packages can be installed with the `xi` utility, from the `xtools` package. `xi` takes the repository of the current working directory into account.
```
$ xi <package_name>
```
<a name="chroot-methods"></a>
### chroot methods
#### xbps-uunshare(1) (default)
XBPS utility that uses `user_namespaces(7)` (part of xbps, default without `-t` flag).
This utility requires these Linux kernel options:
- CONFIG\_NAMESPACES
- CONFIG\_IPC\_NS
- CONFIG\_UTS\_NS
- CONFIG\_USER\_NS
This is the default method, and if your system does not support any of the required kernel
options it will fail with `EINVAL (Invalid argument)`.
#### xbps-uchroot(1)
XBPS utility that uses `namespaces` and must be `setgid` (part of xbps).
> NOTE: This is the only method that implements functionality of `xbps-src -t`, therefore the
flag ignores the choice made in configuration files and enables `xbps-uchroot`.
This utility requires these Linux kernel options:
- CONFIG\_NAMESPACES
- CONFIG\_IPC\_NS
- CONFIG\_PID\_NS
- CONFIG\_UTS\_NS
Your user must be added to a special group to be able to use `xbps-uchroot(1)` and the
executable must be `setgid`:
# chown root:<group> xbps-uchroot
# chmod 4750 xbps-uchroot
# usermod -a -G <group> <user>
> NOTE: by default in void you shouldn't do this manually, your user must be a member of
the `xbuilder` group.
To enable it:
$ cd void-packages
$ echo XBPS_CHROOT_CMD=uchroot >> etc/conf
If for some reason it's erroring out as `ERROR clone (Operation not permitted)`, check that
your user is a member of the required `group` and that `xbps-uchroot(1)` utility has the
proper permissions and owner/group as explained above.
#### bwrap(1)
bubblewrap, sandboxing tool for unprivileged users that uses
user namespaces or setuid.
See <https://github.com/containers/bubblewrap>.
#### ethereal
Destroys host system it runs on. Only useful for one-shot containers, i.e docker (used with CI).
<a name="install-bootstrap"></a>
### Install the bootstrap packages
There is a set of packages that makes up the initial build container, called the `bootstrap`.
These packages are installed into the `masterdir` in order to create the container.
The primary and recommended way to set up this container is using the `binary-bootstrap`
command. This will use pre-existing binary packages, either from remote `xbps` repositories
or from your local repository.
There is also the `bootstrap` command, which will build all necessary `bootstrap` packages from
scratch. This is usually not recommended, since those packages are built using your host system's
toolchain and are neither fully featured nor reproducible (your host system may influence the
build) and thus should only be used as a stage 0 for bootstrapping new Void systems.
If you still choose to use `bootstrap`, use the resulting stage 0 container to rebuild all
`bootstrap` packages again, then use `binary-bootstrap` (stage 1) and rebuild the `bootstrap`
packages once more (to gain stage 2, and then use `binary-bootstrap` again). Once you've done
that, you will have a `bootstrap` set equivalent to using `binary-bootstrap` in the first place.
Also keep in mind that a full source `bootstrap` is time consuming and will require having an
assortment of utilities installed in your host system, such as `binutils`, `gcc`, `perl`,
`texinfo` and others.
### Configuration
The `etc/defaults.conf` file contains the possible settings that can be overridden
through the `etc/conf` configuration file for the `xbps-src` utility; if that file
does not exist, will try to read configuration settings from `$XDG_CONFIG_HOME/xbps-src.conf`, `~/.config/xbps-src.conf`, `~/.xbps-src.conf`.
If you want to customize default `CFLAGS`, `CXXFLAGS` and `LDFLAGS`, don't override
those defined in `etc/defaults.conf`, set them on `etc/conf` instead i.e:
$ echo 'XBPS_CFLAGS="your flags here"' >> etc/conf
$ echo 'XBPS_LDFLAGS="your flags here"' >> etc/conf
Native and cross compiler/linker flags are set per architecture in `common/build-profiles`
and `common/cross-profiles` respectively. Ideally those settings are good enough by default,
and there's no need to set your own unless you know what you are doing.
#### Virtual packages
The `etc/defaults.virtual` file contains the default replacements for virtual packages,
used as dependencies in the source packages tree.
If you want to customize those replacements, copy `etc/defaults.virtual` to `etc/virtual`
and edit it accordingly to your needs.
<a name="directory-hierarchy"></a>
### Directory hierarchy
The following directory hierarchy is used with a default configuration file:
/void-packages
|- common
|- etc
|- srcpkgs
| |- xbps
| |- template
|
|- hostdir
| |- binpkgs ...
| |- ccache ...
| |- distcc-<arch> ...
| |- repocache ...
| |- sources ...
|
|- masterdir-<arch>
| |- builddir -> ...
| |- destdir -> ...
| |- host -> bind mounted from <hostdir>
| |- void-packages -> bind mounted from <void-packages>
The description of these directories is as follows:
- `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
- `builddir`: to unpack package source tarballs and where packages are built.
- `destdir`: to install packages, aka **fake destdir**.
- `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
- `hostdir/distcc-<arch>`: to store distcc data if the `XBPS_DISTCC` option is enabled.
- `hostdir/repocache`: to store binary packages from remote repositories.
- `hostdir/sources`: to store package sources.
- `hostdir/binpkgs`: local repository to store generated binary packages.
<a name="building-packages"></a>
### Building packages
The simplest form of building package is accomplished by running the `pkg` target in `xbps-src`:
```
$ cd void-packages
$ ./xbps-src pkg <pkgname>
```
When the package and its required dependencies are built, the binary packages will be created
and registered in the default local repository at `hostdir/binpkgs`; the path to this local repository can be added to
any xbps configuration file (see xbps.d(5)) or by explicitly appending them via cmdline, i.e:
$ xbps-install --repository=hostdir/binpkgs ...
$ xbps-query --repository=hostdir/binpkgs ...
By default **xbps-src** will try to resolve package dependencies in this order:
- If a dependency exists in the local repository, use it (`hostdir/binpkgs`).
- If a dependency exists in a remote repository, use it.
- If a dependency exists in a source package, use it.
It is possible to avoid using remote repositories completely by using the `-N` flag.
> The default local repository may contain multiple *sub-repositories*: `debug`, `multilib`, etc.
<a name="build-options"></a>
### Package build options
The supported build options for a source package can be shown with `xbps-src show-options`:
$ ./xbps-src show-options foo
Build options can be enabled with the `-o` flag of `xbps-src`:
$ ./xbps-src -o option,option1 pkg foo
Build options can be disabled by prefixing them with `~`:
$ ./xbps-src -o ~option,~option1 pkg foo
Both ways can be used together to enable and/or disable multiple options
at the same time with `xbps-src`:
$ ./xbps-src -o option,~option1,~option2 pkg foo
The build options can also be shown for binary packages via `xbps-query(1)`:
$ xbps-query -R --property=build-options foo
> NOTE: if you build a package with a custom option, and that package is available
in an official void repository, an update will ignore those options. Put that package
on `hold` mode via `xbps-pkgdb(1)`, i.e `xbps-pkgdb -m hold foo` to ignore updates
with `xbps-install -u`. Once the package is on `hold`, the only way to update it
is by declaring it explicitly: `xbps-install -u foo`.
Permanent global package build options can be set via `XBPS_PKG_OPTIONS` variable in the
`etc/conf` configuration file. Per package build options can be set via
`XBPS_PKG_OPTIONS_<pkgname>`.
> NOTE: if `pkgname` contains `dashes`, those should be replaced by `underscores`
i.e `XBPS_PKG_OPTIONS_xorg_server=opt`.
The list of supported package build options and its description is defined in the
`common/options.description` file or in the `template` file.
<a name="sharing-and-signing"></a>
### Sharing and signing your local repositories
To share a local repository remotely it's mandatory to sign it and the binary packages
stored on it. This is accomplished with the `xbps-rindex(1)` utility.
First a RSA key must be created with `openssl(1)` or `ssh-keygen(1)`:
$ openssl genrsa -des3 -out privkey.pem 4096
or
$ ssh-keygen -t rsa -b 4096 -m PEM -f privkey.pem
> Only RSA keys in PEM format are currently accepted by xbps.
Once the RSA private key is ready you can use it to initialize the repository metadata:
$ xbps-rindex --sign --signedby "I'm Groot" --privkey privkey.pem $PWD/hostdir/binpkgs
And then make a signature per package:
$ xbps-rindex --sign-pkg --privkey privkey.pem $PWD/hostdir/binpkgs/*.xbps
> If --privkey is unset, it defaults to `~/.ssh/id_rsa`.
If the RSA key was protected with a passphrase you'll have to type it, or alternatively set
it via the `XBPS_PASSPHRASE` environment variable.
Once the binary packages have been signed, check if the repository contains the appropriate `hex fingerprint`:
$ xbps-query --repository=hostdir/binpkgs -vL
...
Each time a binary package is created, a package signature must be created with `--sign-pkg`.
> It is not possible to sign a repository with multiple RSA keys.
If packages in `hostdir/binpkgs` are signed, the key in `.plist` format (as imported by xbps) can be placed
in `etc/repo-keys/` to prevent xbps-src from prompting to import that key.
<a name="rebuilding"></a>
### Rebuilding and overwriting existing local packages
Packages are overwritten on every build to make getting package with changed build options easy.
To make xbps-src skip build and preserve first package build with given version and revision,
same as in official void repository, set `XBPS_PRESERVE_PKGS=yes` in `etc/conf` file.
Reinstalling a package in your target `rootdir` can be easily done too:
$ xbps-install --repository=/path/to/local/repo -yf xbps-0.25_1
Using `-f` flag twice will overwrite configuration files.
> Please note that the `package expression` must be properly defined to explicitly pick up
the package from the desired repository.
<a name="distcc"></a>
### Enabling distcc for distributed compilation
Setup the workers (machines that will compile the code):
# xbps-install -Sy distcc
Modify the configuration to allow your local network machines to use distcc (e.g. `192.168.2.0/24`):
# echo "192.168.2.0/24" >> /etc/distcc/clients.allow
Enable and start the `distccd` service:
# ln -s /etc/sv/distccd /var/service
Install distcc on the host (machine that executes xbps-src) as well.
Unless you want to use the host as worker from other machines, there is no need
to modify the configuration.
On the host you can now enable distcc in the `void-packages/etc/conf` file:
XBPS_DISTCC=yes
XBPS_DISTCC_HOSTS="localhost/2 --localslots_cpp=24 192.168.2.101/9 192.168.2.102/2"
XBPS_MAKEJOBS=16
The example values assume a localhost CPU with 4 cores of which at most 2 are used for compiler jobs.
The number of slots for preprocessor jobs is set to 24 in order to have enough preprocessed data for other CPUs to compile.
The worker 192.168.2.101 has a CPU with 8 cores and the /9 for the number of jobs is a saturating choice.
The worker 192.168.2.102 is set to run at most 2 compile jobs to keep its load low, even if its CPU has 4 cores.
The XBPS_MAKEJOBS setting is increased to 16 to account for the possible parallelism (2 + 9 + 2 + some slack).
<a name="distfiles-mirrors"></a>
### Distfiles mirror(s)
In etc/conf you may optionally define a mirror or a list of mirrors to search for distfiles.
$ echo 'XBPS_DISTFILES_MIRROR="ftp://192.168.100.5/gentoo/distfiles"' >> etc/conf
If more than one mirror is to be searched, you can either specify multiple URLs separated
with blanks, or add to the variable like this
$ echo 'XBPS_DISTFILES_MIRROR+=" https://sources.voidlinux.org/"' >> etc/conf
Make sure to put the blank after the first double quote in this case.
The mirrors are searched in order for the distfiles to build a package until the
checksum of the downloaded file matches the one specified in the template.
Ultimately, if no mirror carries the distfile, or in case all downloads failed the
checksum verification, the original download location is used.
If you use `uchroot` for your XBPS_CHROOT_CMD, you may also specify a local path
using the `file://` prefix or simply an absolute path on your build host (e.g. /mnt/distfiles).
Mirror locations specified this way are bind mounted inside the chroot environment
under $XBPS_MASTERDIR and searched for distfiles just the same as remote locations.
<a name="cross-compiling"></a>
### Cross compiling packages for a target architecture
Currently `xbps-src` can cross build packages for some target architectures with a cross compiler.
The supported target is shown with `./xbps-src -h`.
If a source package has been adapted to be **cross buildable** `xbps-src` will automatically build the binary package(s) with a simple command:
$ ./xbps-src -a <target> pkg <pkgname>
If the build for whatever reason fails, might be a new build issue or simply because it hasn't been adapted to be **cross compiled**.
<a name="foreign"></a>
### Using xbps-src in a foreign Linux distribution
xbps-src can be used in any recent Linux distribution matching the CPU architecture.
To use xbps-src in your Linux distribution use the following instructions. Let's start downloading the xbps static binaries:
$ wget http://repo-default.voidlinux.org/static/xbps-static-latest.<arch>-musl.tar.xz
$ mkdir ~/XBPS
$ tar xvf xbps-static-latest.<arch>-musl.tar.xz -C ~/XBPS
$ export PATH=~/XBPS/usr/bin:$PATH
If `xbps-uunshare` does not work because of lack of `user_namespaces(7)` support,
try other [chroot methods](#chroot-methods).
Clone the `void-packages` git repository:
$ git clone https://github.com/void-linux/void-packages.git
and `xbps-src` should be fully functional; just start the `bootstrap` process, i.e:
$ ./xbps-src binary-bootstrap
The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
<a name="remaking-masterdir"></a>
### Remaking the masterdir
If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a masterdir with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact):
$ ./xbps-src zap
$ ./xbps-src binary-bootstrap
<a name="updating-masterdir"></a>
### Keeping your masterdir uptodate
Sometimes the bootstrap packages must be updated to the latest available version in repositories, this is accomplished with the `bootstrap-update` target:
$ ./xbps-src bootstrap-update
<a name="building-32bit"></a>
### Building 32bit packages on x86_64
Two ways are available to build 32bit packages on x86\_64:
- native mode with a 32bit masterdir (recommended, used in official repository)
- cross compilation mode to i686 [target](#cross-compiling)
The canonical mode (native) needs a new x86 `masterdir`:
$ ./xbps-src -A i686 binary-bootstrap
$ ./xbps-src -A i686 ...
<a name="building-for-musl"></a>
### Building packages natively for the musl C library
The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
$ ./xbps-src -A x86_64-musl binary-bootstrap
This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
Your new masterdir is now ready to build packages natively for the musl C library:
$ ./xbps-src -A x86_64-musl pkg ...
<a name="building-base-system"></a>
### Building void base-system from scratch
To rebuild all packages in `base-system` for your native architecture:
$ ./xbps-src -N pkg base-system
It's also possible to cross compile everything from scratch:
$ ./xbps-src -a <target> -N pkg base-system
Once the build has finished, you can specify the path to the local repository to `void-mklive`, i.e:
# cd void-mklive
# make
# ./mklive.sh ... -r /path/to/hostdir/binpkgs

View file

@ -0,0 +1,6 @@
if [ "$CROSS_BUILD" ]; then
export WX_CONFIG=${XBPS_WRAPPERDIR}/wx-config-gtk3
else
export WX_CONFIG=/usr/bin/wx-config-gtk3
fi
configure_args+=" -DwxWidgets_CONFIG_EXECUTABLE=${WX_CONFIG} "

View file

@ -0,0 +1,42 @@
#
# gir - build-helper for gobject-introspection
#
# This build-helper is used for packages that make use of
# the GObject introspection middleware layer.
#
# Check if the 'gir' build_option is set or if there is no
# 'gir' build_option.
if [ "$build_option_gir" ] || [[ $build_options != *"gir"* ]]; then
if [[ $hostmakedepends != *"gobject-introspection"* ]]; then
# Provide the host tooling, g-ir-scanner, g-ir-compiler
# and its wrappers.
hostmakedepends+=" gobject-introspection"
fi
if [ "$CROSS_BUILD" ]; then
# Required for running binaries produced from g-ir-compiler
# via g-ir-scanner-qemuwrapper
hostmakedepends+=" qemu-user-static"
# Required for running the g-ir-scanner-lddwrapper
hostmakedepends+=" prelink-cross"
if [[ $makedepends != *"gobject-introspection"* ]]; then
# Provide basic .gir types like GLib, GObject, DBus, Gio, cairo
# and tooling like g-ir-compiler
makedepends+=" gobject-introspection"
fi
export VAPIGEN_VAPIDIRS=${XBPS_CROSS_BASE}/usr/share/vala/vapi
export VAPIGEN_GIRDIRS=${XBPS_CROSS_BASE}/usr/share/gir-1.0
# Provide some packages in hostmakedepends if they are in makedepends
for f in gtk+3-devel python3-gobject-devel; do
if [[ $makedepends == *"${f}"* ]]; then
hostmakedepends+=" ${f}"
fi
done
unset f
fi
fi

View file

@ -0,0 +1,86 @@
# This build helper writes a Meson cross-file, allowing other build styles
# to properly drive cross-builds in Meson when appropriate
# Action is only taken for cross builds
[ -z "$CROSS_BUILD" ] && return 0
# The cross file should only be written once, unless forced
[ -e "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" ] && [ -z "$XBPS_BUILD_FORCEMODE" ] && return 0
mkdir -p "${XBPS_WRAPPERDIR}/meson"
_MESON_TARGET_ENDIAN=little
# drop the -musl suffix to the target cpu, meson doesn't recognize it
_MESON_TARGET_CPU=${XBPS_TARGET_MACHINE/-musl/}
case "$XBPS_TARGET_MACHINE" in
mips|mips-musl|mipshf-musl)
_MESON_TARGET_ENDIAN=big
_MESON_CPU_FAMILY=mips
;;
armv*)
_MESON_CPU_FAMILY=arm
;;
i686*)
_MESON_CPU_FAMILY=x86
;;
ppc64le*)
_MESON_CPU_FAMILY=ppc64
;;
ppc64*)
_MESON_TARGET_ENDIAN=big
_MESON_CPU_FAMILY=ppc64
;;
ppcle*)
_MESON_CPU_FAMILY=ppc
;;
ppc*)
_MESON_TARGET_ENDIAN=big
_MESON_CPU_FAMILY=ppc
;;
*)
# if we reached here that means that the cpu and cpu_family
# are the same like 'x86_64' and 'aarch64'
_MESON_CPU_FAMILY=${_MESON_TARGET_CPU}
;;
esac
# Tell meson to run binaries with qemu if desired
_MESON_EXE_WRAPPER=""
if [[ "${build_helper}" = *qemu* ]]; then
_MESON_EXE_WRAPPER="exe_wrapper = '/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static'"
fi
# Record cross-compiling information in cross file.
#
# CFLAGS, CXXFLAGS and LDFLAGS are not yet available and
# will be taken from the environment at configure time.
cat > "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" <<-EOF
[binaries]
${_MESON_EXE_WRAPPER:-# exe_wrapper is not set}
c = '${CC}'
cpp = '${CXX}'
ar = '${XBPS_CROSS_TRIPLET}-gcc-ar'
nm = '${NM}'
strip = '${STRIP}'
readelf = '${READELF}'
objcopy = '${OBJCOPY}'
pkgconfig = '${PKG_CONFIG}'
rust = ['rustc', '--target', '${RUST_TARGET}' ,'--sysroot', '${XBPS_CROSS_BASE}/usr']
g-ir-scanner = '${XBPS_CROSS_BASE}/usr/bin/g-ir-scanner'
g-ir-compiler = '${XBPS_CROSS_BASE}/usr/bin/g-ir-compiler'
g-ir-generate = '${XBPS_CROSS_BASE}/usr/bin/g-ir-generate'
llvm-config = '/usr/bin/llvm-config'
cups-config = '${XBPS_CROSS_BASE}/usr/bin/cups-config'
[properties]
needs_exe_wrapper = true
bindgen_clang_arguments = ['-target', '${XBPS_CROSS_TRIPLET}']
[host_machine]
system = 'linux'
cpu_family = '${_MESON_CPU_FAMILY}'
cpu = '${_MESON_TARGET_CPU}'
endian = '${_MESON_TARGET_ENDIAN}'
EOF
unset _MESON_CPU_FAMILY _MESON_TARGET_CPU _MESON_TARGET_ENDIAN _MESON_EXE_WRAPPER

View file

@ -0,0 +1,53 @@
#
# numpy - build-helper for packages that compile against python3-numpy
#
# This build-helper makes sure packages can find python3-numpy libraries and
# headers on the target architecture rather than the host, as well as making
# sure the gfortran cross compiler is properly identified.
# Even for cross compilation, numpy should be available on the host to ensure
# that the host interpreter doesn't complain about missing deps
if [[ $hostmakedepends != *"python3-numpy"* ]]; then
hostmakedepends+=" python3-numpy"
fi
[ -z "$CROSS_BUILD" ] && return 0
if [[ $makedepends != *"python3-numpy"* ]]; then
makedepends+=" python3-numpy"
fi
# python3-setuptools finds numpy libs and headers on the host first;
# adding search paths up front allows the target to take priority
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/lib"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/random/lib"
# distutils from python3-numpy looks to environment variables F77 and
# F90 rather than the XBPS-set FC
export F77="${FC}"
export F90="${FC}"
# When compiling and linking FORTRAN, distutils from python3-numpy
# refuses respect any linker name except "gfortran"; symlink to the
# cross-compiler to that the right linker and compiler will be used
if _gfortran=$(command -v "${FC}"); then
ln -sf "${_gfortran}" "${XBPS_WRAPPERDIR}/gfortran"
fi
unset _gfortran
# Write a secondary meson cross file for numpy configuration
if [[ "${build_helper}" = *meson* ]]; then
_npy_meson_cross="${XBPS_WRAPPERDIR}/meson/xbps_numpy.cross"
_cross_py_site="${XBPS_CROSS_BASE}/${py3_sitelib}"
if [ ! -e "${_npy_meson_cross}" ] || [ -n "$XBPS_BUILD_FORCEMODE" ]; then
mkdir -p "${XBPS_WRAPPERDIR}/meson"
cat > "${_npy_meson_cross}" <<-EOF
[properties]
numpy-include-dir = '${_cross_py_site}/numpy/core/include'
pythran-include-dir = '${_cross_py_site}/pythran'
EOF
fi
unset _npy_meson_cross _cross_py_site
fi

View file

@ -0,0 +1,16 @@
# fix building non-pure-python modules on cross
if [ -n "$CROSS_BUILD" ]; then
export PYPREFIX="$XBPS_CROSS_BASE"
export CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc} -I${XBPS_CROSS_BASE}/usr/include"
export LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
export CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
export LDSHARED="${CC} -shared $LDFLAGS"
export PYTHON_CONFIG="${XBPS_CROSS_BASE}/usr/bin/python3-config"
export PYTHONPATH="${XBPS_CROSS_BASE}/${py3_lib}"
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
[ -f "$f" ] || continue
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
[ -n "$_PYTHON_SYSCONFIGDATA_NAME" ] && export _PYTHON_SYSCONFIGDATA_NAME
fi

View file

@ -0,0 +1,14 @@
if [ "$CROSS_BUILD" ]; then
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
if [[ $hostmakedepends != *"qemu-user-static"* ]]; then
hostmakedepends+=" qemu-user-static"
fi
fi
vtargetrun() {
if [ "$CROSS_BUILD" ]; then
"/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static" "$@"
else
"$@"
fi
}

View file

@ -0,0 +1,95 @@
# This build-helper sets up qmakes cross environment
# in cases the build-style is mixed,
# e.g. when in a gnu-configure style the configure
# script calls qmake or a makefile in a gnu-makefile style,
# respectively.
if [ "$CROSS_BUILD" ]; then
mkdir -p "${XBPS_WRAPPERDIR}/target-spec/linux-g++"
cat > "${XBPS_WRAPPERDIR}/target-spec/linux-g++/qmake.conf" <<_EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental no_qt_rpath
QMAKE_INCREMENTAL_STYLE = sublib
include(/usr/lib/qt5/mkspecs/common/linux.conf)
include(/usr/lib/qt5/mkspecs/common/gcc-base-unix.conf)
include(/usr/lib/qt5/mkspecs/common/g++-unix.conf)
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/qconfig.pri
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/qmodule.pri
QMAKEMODULES = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/modules
QMAKE_CC = ${CC}
QMAKE_CXX = ${CXX}
QMAKE_LINK = ${CXX}
QMAKE_LINK_C = ${CC}
QMAKE_LINK_SHLIB = ${CXX}
QMAKE_AR = ${XBPS_CROSS_TRIPLET}-gcc-ar cqs
QMAKE_OBJCOPY = ${OBJCOPY}
QMAKE_NM = ${NM} -P
QMAKE_STRIP = ${STRIP}
QMAKE_CFLAGS = ${CFLAGS}
QMAKE_CXXFLAGS = ${CXXFLAGS}
QMAKE_LFLAGS = ${LDFLAGS}
load(qt_config)
_EOF
echo "#include \"${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h\"" > "${XBPS_WRAPPERDIR}/target-spec/linux-g++/qplatformdefs.h"
cat > "${XBPS_WRAPPERDIR}/qt.conf" <<_EOF
[Paths]
Sysroot=${XBPS_CROSS_BASE}
Prefix=${XBPS_CROSS_BASE}/usr
ArchData=${XBPS_CROSS_BASE}/usr/lib/qt5
Data=${XBPS_CROSS_BASE}/usr/share/qt5
Documentation=${XBPS_CROSS_BASE}/usr/share/doc/qt5
Headers=${XBPS_CROSS_BASE}/usr/include/qt5
Libraries=${XBPS_CROSS_BASE}/usr/lib
LibraryExecutables=/usr/lib/qt5/libexec
Binaries=/usr/lib/qt5/bin
Tests=${XBPS_CROSS_BASE}/usr/tests
Plugins=/usr/lib/qt5/plugins
Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/imports
Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/qml
Translations=${XBPS_CROSS_BASE}/usr/share/qt5/translations
Settings=${XBPS_CROSS_BASE}/etc/xdg
Examples=${XBPS_CROSS_BASE}/usr/share/qt5/examples
HostPrefix=/usr
HostData=/usr/lib/qt5
HostBinaries=/usr/lib/qt5/bin
HostLibraries=/usr/lib
Spec=linux-g++
TargetSpec=$XBPS_WRAPPERDIR/target-spec/linux-g++
_EOF
# create the qmake-wrapper here because it only
# makes sense together with the qmake build-helper
# and not to interfere with e.g. the qmake build-style
#
# + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS
# + hardening flags will be picked up from environment variables
cat > "${XBPS_WRAPPERDIR}/qmake" <<_EOF
#!/bin/sh
exec /usr/lib/qt5/bin/qmake "\$@" -qtconf "${XBPS_WRAPPERDIR}/qt.conf" \\
QMAKE_CFLAGS+="\${CFLAGS}" \\
QMAKE_CXXFLAGS+="\${CXXFLAGS}" \\
QMAKE_LFLAGS+="\${LDFLAGS}"
_EOF
else
cat > "${XBPS_WRAPPERDIR}/qmake" <<_EOF
#!/bin/sh
exec /usr/lib/qt5/bin/qmake \
"\$@" \
PREFIX=/usr \
QT_INSTALL_PREFIX=/usr \
LIB=/usr/lib \
QMAKE_CC="$CC" QMAKE_CXX="$CXX" \
QMAKE_LINK="$CXX" QMAKE_LINK_C="$CC" \
QMAKE_CFLAGS+="\${CFLAGS}" \
QMAKE_CXXFLAGS+="\${CXXFLAGS}" \
QMAKE_LFLAGS+="\${LDFLAGS}" \
CONFIG+=no_qt_rpath
_EOF
fi
chmod 755 ${XBPS_WRAPPERDIR}/qmake
cp -p ${XBPS_WRAPPERDIR}/qmake{,-qt5}

View file

@ -0,0 +1,75 @@
# Define equivalent of TOML config in environment
# [build]
# jobs = $XBPS_MAKEJOBS
export CARGO_BUILD_JOBS="$XBPS_MAKEJOBS"
export CARGO_HOME="/host/cargo"
if [ "$CROSS_BUILD" ]; then
# Define equivalent of TOML config in environment
# [target.${RUST_TARGET}]
# linker = ${CC}
_XBPS_CROSS_RUST_TARGET_ENV="${XBPS_CROSS_RUST_TARGET^^}"
_XBPS_CROSS_RUST_TARGET_ENV="${_XBPS_CROSS_RUST_TARGET_ENV//-/_}"
export CARGO_TARGET_${_XBPS_CROSS_RUST_TARGET_ENV}_LINKER="$CC"
unset _XBPS_CROSS_RUST_TARGET_ENV
# Define equivalent of TOML config in environment
# [build]
# target = ${RUST_TARGET}
export CARGO_BUILD_TARGET="$RUST_TARGET"
# If cc-rs needs to build host binaries, it guesses the compiler and
# uses default (wrong) flags unless they are specified explicitly;
# innocuous flags are used here just to disable its defaults
export HOST_CC="gcc"
export HOST_CFLAGS="-O2"
# Crates that use bindgen via build.rs are not cross-aware unless these are set
export BINDGEN_EXTRA_CLANG_ARGS+=" --sysroot=${XBPS_CROSS_BASE} -I${XBPS_CROSS_BASE}/usr/include"
else
unset CARGO_BUILD_TARGET
fi
# prevent cargo stripping debug symbols
export CARGO_PROFILE_RELEASE_STRIP=false
# For cross-compiling rust -sys crates
export PKG_CONFIG_ALLOW_CROSS=1
# For cross-compiling pyo3 bindings
export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
# gettext-rs
export GETTEXT_BIN_DIR=/usr/bin
export GETTEXT_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib/gettext"
export GETTEXT_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
# libssh2-sys
export LIBSSH2_SYS_USE_PKG_CONFIG=1
# sodium-sys
export SODIUM_LIB_DIR="${XBPS_CROSS_BASE}/usr/include"
export SODIUM_INC_DIR="${XBPS_CROSS_BASE}/usr/lib"
export SODIUM_SHARED=1
# openssl-sys
export OPENSSL_NO_VENDOR=1
# pcre2-sys, only necessary for musl targets
export PCRE2_SYS_STATIC=0
# zstd-sys
export ZSTD_SYS_USE_PKG_CONFIG=1
# onig-sys
export RUSTONIG_SYSTEM_LIBONIG=1
# libsqlite3-sys
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
# jemalloc-sys
export JEMALLOC_SYS_WITH_LG_PAGE=16
# libgit2-sys
export LIBGIT2_NO_VENDOR=1

View file

@ -0,0 +1,17 @@
BUILD PROFILES
==============
This directory contains build profiles to set properties on native builds
for a specific architecture:
- XBPS_TRIPLET (the compiler triplet)
- XBPS_CFLAGS (C compiler flags for host compiler)
- XBPS_CXXFLAGS (C++ compiler flags for the host compiler)
- XBPS_FFLAGS (Fortran compiler flags for the host compiler)
- XBPS_RUST_TARGET (the compiler triplet for usage by cargo)
- XBPS_ZIG_TARGET (the arch-os-abi target triplet for zig)
- XBPS_ZIG_CPU (the cpu/feature set for zig)
These properties are also set in a cross environment, but the compiler
flags are not added into the global flags. XBPS_RUST_TARGET is also
exposed as RUST_BUILD instead of RUST_TARGET.

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=armv8-a"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="aarch64-unknown-linux-musl"
XBPS_RUST_TARGET="$XBPS_TRIPLET"
XBPS_ZIG_TARGET="aarch64-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=armv8-a"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="aarch64-unknown-linux-gnu"
XBPS_RUST_TARGET="$XBPS_TRIPLET"
XBPS_ZIG_TARGET="aarch64-linux-gnu"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="armv6l-linux-musleabihf"
XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
XBPS_ZIG_TARGET="arm-linux-musleabihf"
XBPS_ZIG_CPU="generic+v6"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
XBPS_ZIG_TARGET="arm-linux-gnueabihf"
XBPS_ZIG_CPU="generic+v6"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="armv7l-linux-musleabihf"
XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
XBPS_ZIG_TARGET="arm-linux-musleabihf"
XBPS_ZIG_CPU="generic+v7a+vfp3"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"

View file

@ -0,0 +1,3 @@
XBPS_CFLAGS="-O2 -pipe"
XBPS_CXXFLAGS="$XBPS_CFLAGS"
XBPS_FFLAGS="-fPIC -pipe"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=i686"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="i686-linux-musl"
XBPS_RUST_TARGET="i686-unknown-linux-musl"
XBPS_ZIG_TARGET="i686-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=i686"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="i686-pc-linux-gnu"
XBPS_RUST_TARGET="i686-unknown-linux-gnu"
XBPS_ZIG_TARGET="i386-linux-gnu"
XBPS_ZIG_CPU="_i686+sse2"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=G4"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpc-linux-musl"
XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
XBPS_ZIG_TARGET="powerpc-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=G4"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpc-linux-gnu"
XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
XBPS_ZIG_TARGET="powerpc-linux-gnu"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mcpu=970 -mtune=power9"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpc64-unknown-linux-musl"
XBPS_RUST_TARGET="$XBPS_TRIPLET"
XBPS_ZIG_TARGET="powerpc64-linux-musl"
XBPS_ZIG_CPU="970"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mcpu=970 -mtune=power9"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
XBPS_RUST_TARGET="$XBPS_TRIPLET"
XBPS_ZIG_TARGET="powerpc64-linux-gnu"
XBPS_ZIG_CPU="970"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=power9"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
XBPS_RUST_TARGET="$XBPS_TRIPLET"
XBPS_ZIG_TARGET="powerpc64le-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=power9"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
XBPS_RUST_TARGET="$XBPS_TRIPLET"
XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mcpu=power8 -mtune=power9"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpcle-linux-musl"
XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
XBPS_ZIG_TARGET="powerpcle-linux-musl"
XBPS_ZIG_CPU="pwr8"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mcpu=power8 -mtune=power9"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="powerpcle-linux-gnu"
XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
XBPS_ZIG_TARGET="powerpcle-linux-gnu"
XBPS_ZIG_CPU="pwr8"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=rv64imafdc"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="riscv64-unknown-linux-musl"
XBPS_RUST_TARGET="riscv64gc-unknown-linux-musl"
XBPS_ZIG_TARGET="riscv64-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=rv64imafdc"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="riscv64-unknown-linux-gnu"
XBPS_RUST_TARGET="riscv64gc-unknown-linux-gnu"
XBPS_ZIG_TARGET="riscv64-linux-gnu"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=generic"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="x86_64-unknown-linux-musl"
XBPS_RUST_TARGET="${XBPS_TRIPLET}"
XBPS_ZIG_TARGET="x86_64-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-mtune=generic"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="x86_64-unknown-linux-gnu"
XBPS_RUST_TARGET="${XBPS_TRIPLET}"
XBPS_ZIG_TARGET="x86_64-linux-gnu"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
#
# This helper is for templates using R-cran.
#
do_install() {
mkdir -p ${DESTDIR}/usr/lib/R/library
( cd .. && R CMD INSTALL -l ${DESTDIR}/usr/lib/R/library ${pkgname#R-cran-} )
}

12
common/build-style/README Normal file
View file

@ -0,0 +1,12 @@
BUILD STYLES
============
These shell snippets provide support for multiple build systems, i.e GNU configure,
CMake, etc. A build style file must provide at least the following functions:
- do_configure
- do_build
- do_install
If a source package defines its own do_xxx() function, the function defined in
the build style file is simply ignored.

View file

@ -0,0 +1,27 @@
#
# This helper is for building rust projects which use cargo for building
#
do_build() {
: ${make_cmd:=cargo auditable}
${make_cmd} build --release --locked --target ${RUST_TARGET} ${configure_args}
}
do_check() {
: ${make_cmd:=cargo auditable}
${make_check_pre} ${make_cmd} test --release --locked --target ${RUST_TARGET} \
${configure_args} ${make_check_args}
}
do_install() {
: ${make_cmd:=cargo auditable}
: ${make_install_args:=--path .}
${make_cmd} install --target ${RUST_TARGET} --root="${DESTDIR}/usr" \
--offline --locked ${configure_args} ${make_install_args}
rm -f "${DESTDIR}"/usr/.crates.toml
rm -f "${DESTDIR}"/usr/.crates2.json
}

138
common/build-style/cmake.sh Normal file
View file

@ -0,0 +1,138 @@
#
# This helper is for templates using cmake.
#
do_configure() {
local cmake_args=
[ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir}
cd ${cmake_builddir}
if [ -z "$CHROOT_READY" ]; then
cat >bootstrap.cmake <<_EOF
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER ${CC})
SET(CMAKE_CXX_COMPILER ${CXX})
SET(CMAKE_FIND_ROOT_PATH "${XBPS_MASTERDIR}/usr;${XBPS_MASTERDIR}")
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
_EOF
configure_args+=" -DCMAKE_TOOLCHAIN_FILE=bootstrap.cmake"
elif [ "$CROSS_BUILD" ]; then
case "$XBPS_TARGET_MACHINE" in
x86_64*) _CMAKE_SYSTEM_PROCESSOR=x86_64 ;;
i686*) _CMAKE_SYSTEM_PROCESSOR=x86 ;;
aarch64*) _CMAKE_SYSTEM_PROCESSOR=aarch64 ;;
arm*) _CMAKE_SYSTEM_PROCESSOR=arm ;;
mips*) _CMAKE_SYSTEM_PROCESSOR=mips ;;
ppc64le*) _CMAKE_SYSTEM_PROCESSOR=ppc64le ;;
ppc64*) _CMAKE_SYSTEM_PROCESSOR=ppc64 ;;
ppcle*) _CMAKE_SYSTEM_PROCESSOR=ppcle ;;
ppc*) _CMAKE_SYSTEM_PROCESSOR=ppc ;;
riscv64*) _CMAKE_SYSTEM_PROCESSOR=riscv64 ;;
*) _CMAKE_SYSTEM_PROCESSOR=generic ;;
esac
cat > cross_${XBPS_CROSS_TRIPLET}.cmake <<_EOF
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER ${CC})
SET(CMAKE_CXX_COMPILER ${CXX})
SET(Rust_CARGO_TARGET ${XBPS_CROSS_RUST_TARGET})
SET(CMAKE_CROSSCOMPILING TRUE)
SET(CMAKE_SYSTEM_PROCESSOR ${_CMAKE_SYSTEM_PROCESSOR})
SET(CMAKE_FIND_ROOT_PATH "${XBPS_CROSS_BASE}/usr;${XBPS_CROSS_BASE}")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
_EOF
cmake_args+=" -DCMAKE_TOOLCHAIN_FILE=${wrksrc}/${build_wrksrc}/${cmake_builddir}/cross_${XBPS_CROSS_TRIPLET}.cmake"
fi
cmake_args+=" -DCMAKE_INSTALL_PREFIX:PATH=/usr"
cmake_args+=" -DCMAKE_BUILD_TYPE=None"
cmake_args+=" -DCMAKE_INSTALL_LIBDIR:PATH=lib${XBPS_TARGET_WORDSIZE}"
cmake_args+=" -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc"
if [ "$CROSS_BUILD" ]; then
cmake_args+=" -DQT_HOST_PATH=/usr"
# QT_HOST_PATH isn't enough in my system,
# which have binfmts support on and off
cmake_args+=" -DQT_HOST_PATH_CMAKE_DIR=/usr/lib/cmake"
fi
if [[ $build_helper = *"qemu"* ]]; then
echo "SET(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static)" \
>> cross_${XBPS_CROSS_TRIPLET}.cmake
fi
cmake_args+=" -DCMAKE_INSTALL_SBINDIR:PATH=bin"
export CMAKE_GENERATOR="${CMAKE_GENERATOR:-Ninja}"
# Remove -pipe: https://gitlab.kitware.com/cmake/cmake/issues/19590
CFLAGS="-DNDEBUG ${CFLAGS/ -pipe / }" CXXFLAGS="-DNDEBUG ${CXXFLAGS/ -pipe / }" \
cmake ${cmake_args} ${configure_args} \
${LIBS:+-DCMAKE_C_STANDARD_LIBRARIES="$LIBS"} \
${LIBS:+-DCMAKE_CXX_STANDARD_LIBRARIES="$LIBS"} \
${wrksrc}/${build_wrksrc}
# Replace -isystem with -I
if [ "$CMAKE_GENERATOR" = "Unix Makefiles" ]; then
find . -name flags.make -exec sed -i -e 's/-isystem/-I/g' "{}" +
elif [ "$CMAKE_GENERATOR" = Ninja ]; then
sed -i -e 's/-isystem/-I/g' build.ninja
fi
}
do_build() {
: ${make_cmd:=ninja}
cd ${cmake_builddir:=build}
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
}
do_check() {
: ${make_cmd:=ninja}
cd ${cmake_builddir:=build}
if [ -z "$make_check_target" ]; then
case $make_cmd in
make)
if make -q test 2>/dev/null; then
:
else
if [ $? -eq 2 ]; then
msg_warn 'No target to "make test".\n'
return 0
fi
fi
;;
ninja)
if ! ninja -t query test >/dev/null 2>&1; then
msg_warn 'No target to "ninja test".\n'
return 0
fi
;;
*)
msg_warn "Can't run tests with '$make_cmd', define do_check.\n"
;;
esac
fi
: ${make_check_target:=test}
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_cmd:=ninja}
: ${make_install_target:=install}
cd ${cmake_builddir:=build}
DESTDIR=${DESTDIR} ${make_cmd} ${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,40 @@
#
# This helper is for templates using configure scripts (not generated
# by the GNU autotools).
#
do_configure() {
: ${configure_script:=./configure}
${configure_script} ${configure_args}
}
do_build() {
: ${make_cmd:=make}
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
}
do_check() {
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
if make -q check 2>/dev/null; then
:
else
if [ $? -eq 2 ]; then
msg_warn 'No target to "make check".\n'
return 0
fi
fi
fi
: ${make_cmd:=make}
: ${make_check_target:=check}
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_cmd:=make}
: ${make_install_target:=install}
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,12 @@
# fetch build_style: fetches and copies files to ${wrksrc}.
do_extract() {
local f curfile
mkdir -p "${wrksrc}"
for f in ${distfiles}; do
curfile="${f#*>}"
curfile="${curfile##*/}"
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} "${wrksrc}/${curfile}"
done
}

68
common/build-style/gem.sh Normal file
View file

@ -0,0 +1,68 @@
#
# This helper is for templates using gem files from RubyGems.
#
do_install() {
: ${gem_cmd:=gem}
local _GEMDIR _INSTDIR
_GEMDIR=$($gem_cmd env gemdir)
_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${pkgname#ruby-}-${version}
$gem_cmd install \
--local \
--install-dir ${DESTDIR}/${_GEMDIR} \
--bindir ${DESTDIR}/usr/bin \
--ignore-dependencies \
--no-document \
--verbose \
${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname#ruby-}-${version}.gem
# Remove cache
rm -rf ${DESTDIR}/${_GEMDIR}/cache
# Remove ext directory. they are only source code and configuration
# The actual extensions are guarded in an arch path
rm -rf ${_INSTDIR}/ext
# Remove installed tests and benchmarks
rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}
# Remove files shipped on the root of the gem, most of the time they are useless
find ${_INSTDIR} -maxdepth 1 -type f -delete
# Remove unnecessary files
find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete
# Place manpages in usr/share/man/man[0-9]
if [ -d ${_INSTDIR}/man ]; then
find ${_INSTDIR}/man -type f -name '*.[0-8n]' | while read -r m; do
vman ${m}
done
fi
rm -rf "${_INSTDIR}/man"
# Place executables in /usr/bin
if [ -d "${_INSTDIR}/bin" ]; then
for f in "${_INSTDIR}"/bin/*; do
vbin "${f}"
done
fi
rm -rf ${_INSTDIR}/bin
# Place conf files in their places
if [ -d ${_INSTDIR}/etc ]; then
find ${_INSTDIR}/etc -type f | while read -r c; do
vmkdir ${c%/*}/
mv ${c} "${DESTDIR}/${c##*${_INSTDIR}/etc/}/"
done
fi
rm -rf ${_INSTDIR}/etc
# Ignore the ~> operator, replace it with >=
sed 's|~>|>=|g' \
-i ${DESTDIR}/${_GEMDIR}/specifications/${pkgname#ruby-}-${version}.gemspec
}

View file

@ -0,0 +1,190 @@
#
# This helper is for templates using gemspec files from upstream or Rubygems.
#
do_build() {
: ${gem_cmd:=gem}
: ${gemspec:=${pkgname#ruby-}.gemspec}
# Fix packages that keep Gem.gemspec as the name instead of the proper
# $pkgname.gemspec
if [ -f Gem.gemspec ]; then
gemspec=Gem.gemspec
fi
if [ -f .gemspec ]; then
gemspec=.gemspec
fi
# Hardcode name and version just in case they try something funny like
# requiring RELEASE to be on the environment to not append -rc0 to version
# Some even forget to update the version in the gemspec after releasing
sed -ri "s|(\.name .*)=.*|\1 = \"${pkgname#ruby-}\"|g" $gemspec
sed -ri "s|(\.version .*)=.*|\1 = \"${version}\"|g" $gemspec
# Replace use of `git ls-files` with find, use printf so we can print without starting
# dot-slash path
sed -i 's|`git ls-files`|`find . -type f -printf "%P\\n"`|g' $gemspec
# Sadly ruby isn't capable of handling nullbytes in a command so we have to use
# -print0, then try using sed to remove the suffix
# The end result is:
# `find . -type f -print0 | sed -e "s@\\./@@g"`
sed -i 's|`git ls-files -z`|`find . -type f -print0 \| sed -e "s@\\\\./@@g"`|g' $gemspec
if [ "$CROSS_BUILD" ]; then
local _TARGET_PLATFORM
_TARGET_PLATFORM="$(ruby -r \
$(find ${XBPS_CROSS_BASE}/usr/lib/ruby -iname rbconfig.rb) \
-e 'puts RbConfig::CONFIG["arch"]' 2>/dev/null)"
# Patch all instances of extconf that use create_makefile
for f in $(find . -type f -name 'extconf.rb'); do
if [ ! -f ${f}.orig ]; then
# Create a .extconf file that forces the Makefile to use our environment
# this allows us to cross-compile like it is done with meson cross-files
cat<<EOF>append
\$CPPFLAGS = ENV['CPPFLAGS'] if ENV['CPPFLAGS']
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX']
RbConfig::MAKEFILE_CONFIG['LD'] = ENV['LD'] if ENV['LD']
RbConfig::MAKEFILE_CONFIG['CFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
RbConfig::MAKEFILE_CONFIG['CPPFLAGS'] = ENV['CPPFLAGS'] if ENV['CPPFLAGS']
RbConfig::MAKEFILE_CONFIG['CXXFLAGS'] = ENV['CXXFLAGS'] if ENV['CXXFLAGS']
EOF
cat $f > append2
# Use sed and enable verbose mode
cat<<EOF>>append2
system("sed -i 's|^V =.*|V = 1|' Makefile")
system("sed -i 's|^CFLAGS.*|CFLAGS = \$(CCDLFLAGS) ${VOID_TARGET_CFLAGS} \$(ARCH_FLAG)|' Makefile")
system("sed -i 's|^topdir.*|topdir = ${XBPS_CROSS_BASE}/usr/include/ruby-\$(ruby_version)|' Makefile")
system("sed -i 's|^hdrdir.*|hdrdir = ${XBPS_CROSS_BASE}/usr/include/ruby-\$(ruby_version)|' Makefile")
system("sed -i 's|^arch_hdrdir.*|arch_hdrdir = ${XBPS_CROSS_BASE}/usr/include/ruby-\$(ruby_version)/\$(arch)|' Makefile")
system("sed -i 's|^arch =.*|arch = ${_TARGET_PLATFORM}|' Makefile")
system("sed -i 's|^dldflags =.*|dldflags = ${LDFLAGS}|' Makefile")
EOF
# Create a backup which we will restore later
cp $f ${f}.orig
# Patch extconf.rb for cross compile
cat append append2 > $f
fi
done
fi
# If we are downloading a gem file then create a spec out of it
for f in $distfiles; do
if [ "${f##*.}" = "gem" ]; then
$gem_cmd spec \
"${XBPS_SRCDISTDIR}/${pkgname}-${version}/${f##*/}" \
--ruby > $gemspec
fi
done
sed 's|~>|>=|g' -i $gemspec
$gem_cmd build --verbose ${gemspec}
if [ "$CROSS_BUILD" ]; then
# Restore previous extconf.rb which we ship.
find . -type f -name 'extconf.rb.orig' | while read -r f; do
mv $f ${f%.*}
done
fi
}
do_install() {
: ${gem_cmd:=gem}
local _GEMDIR _INSTDIR
_GEMDIR=$($gem_cmd env gemdir)
_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${pkgname#ruby-}-${version}
# Ruby is very eager to add CFLAGS everywhere there is a compilation
# but we do both cross compilation of the modules and host compilation
# for checks, so unset CFLAGS and keep it in a separate value.
# We will manually pass CFLAGS as VOID_TAGET_CFLAGS to cross-compilation
# And ruby will use rbconfig.rb to get the proper CFLAGS for host compilation
VOID_TARGET_CFLAGS="$CFLAGS"
export VOID_TARGET_CFLAGS
unset CFLAGS
$gem_cmd install \
--local \
--install-dir ${DESTDIR}/${_GEMDIR} \
--bindir ${DESTDIR}/usr/bin \
--ignore-dependencies \
--no-document \
--verbose \
"${pkgname#ruby-}-${version}.gem" \
-- $configure_args
# Remove cache
rm -rf ${DESTDIR}/${_GEMDIR}/cache
# Remove ext directory, they are only source code and configuration
# The actual extensions are in a arch path guarded
rm -rf ${_INSTDIR}/ext
# Remove duplicated library that is available in a arch guarded
# extension
rm -rf ${_INSTDIR}/lib/*.so
# Remove installed tests and benchmarks
rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}
# Remove files shipped on the root of the gem, most of the time they are useless
find ${_INSTDIR} -maxdepth 1 -type f -delete
# Remove unnecessary files
find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete
# Place manpages in usr/share/man/man[0-9]
if [ -d ${_INSTDIR}/man ]; then
find ${_INSTDIR}/man -type f -name '*.[0-8n]' | while read -r m; do
vman ${m}
done
fi
rm -rf "${_INSTDIR}/man"
# Place executables in /usr/bin
if [ -d "${_INSTDIR}/bin" ]; then
for f in "${_INSTDIR}"/bin/*; do
vbin "${f}"
done
fi
rm -rf ${_INSTDIR}/bin
# Place conf files in their places
if [ -d ${_INSTDIR}/etc ]; then
find ${_INSTDIR}/etc -type f | while read -r c; do
vmkdir ${c%/*}/
mv ${c} "${DESTDIR}/${c##*${_INSTDIR}/etc/}/"
done
fi
rm -rf ${_INSTDIR}/etc
if [ "$CROSS_BUILD" ]; then
local _TARGET_PLATFORM _TARGET_EXT_DIR
# Get arch of the target and host platform by reading the rbconfig.rb
# of the cross ruby
_TARGET_PLATFORM="$(ruby -r \
$(find ${XBPS_CROSS_BASE}/usr/lib/ruby -iname rbconfig.rb) \
-e 'puts RbConfig::CONFIG["arch"]' 2>/dev/null)"
# Path to the extensions on a package, ruby installs against the platform
# of the host, so we have to move them to the correct place
_TARGET_EXT_DIR="${DESTDIR}/${_GEMDIR}/extensions/${_TARGET_PLATFORM}"
find ${DESTDIR}/${_GEMDIR}/extensions -maxdepth 1 -type d \
-exec mv '{}' ${_TARGET_EXT_DIR} \;
fi
}

View file

@ -0,0 +1,41 @@
#
# This helper is for templates using GNU configure scripts.
#
do_configure() {
: ${configure_script:=./configure}
export lt_cv_sys_lib_dlsearch_path_spec="/usr/lib64 /usr/lib32 /usr/lib /lib /usr/local/lib"
${configure_script} ${configure_args}
}
do_build() {
: ${make_cmd:=make}
export lt_cv_sys_lib_dlsearch_path_spec="/usr/lib64 /usr/lib32 /usr/lib /lib /usr/local/lib"
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
}
do_check() {
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
if make -q check 2>/dev/null; then
:
else
if [ $? -eq 2 ]; then
msg_warn 'No target to "make check".\n'
return 0
fi
fi
fi
: ${make_cmd:=make}
: ${make_check_target:=check}
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_cmd:=make}
: ${make_install_target:=install}
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,43 @@
#
# This helper is for templates using GNU Makefiles.
#
do_build() {
: ${make_cmd:=make}
if [ -z "$make_use_env" ]; then
${make_cmd} \
CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" \
CPP="$CPP" AS="$AS" OBJCOPY="$OBJCOPY" OBJDUMP="$OBJDUMP" \
CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \
PREFIX=/usr prefix=/usr \
${makejobs} ${make_build_args} ${make_build_target}
else
export PREFIX=/usr prefix=/usr
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
fi
}
do_check() {
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
if make -q check 2>/dev/null; then
:
else
if [ $? -eq 2 ]; then
msg_warn 'No target to "make check".\n'
return 0
fi
fi
fi
: ${make_cmd:=make}
: ${make_check_target:=check}
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_cmd:=make}
: ${make_install_target:=install}
${make_cmd} STRIP=true PREFIX=/usr prefix=/usr DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
}

69
common/build-style/go.sh Normal file
View file

@ -0,0 +1,69 @@
#
# This helper is for templates for Go packages.
#
do_configure() {
# $go_import_path must be set, or we can't link $PWD into $GOSRCPATH
# nor build from modules
if [ -z "$go_import_path" ]; then
msg_error "\"\$go_import_path\" not set on $pkgname template.\n"
fi
# This isn't really configuration, but its needed by packages
# that do unusual things with the build where the expect to be
# able to cd into the $GOSRCPATH
if [ "${go_mod_mode}" != "off" ] && [ -f go.mod ]; then
# Skip GOPATH symlink for Go modules
msg_normal "Building $pkgname using Go modules.\n"
else
mkdir -p ${GOSRCPATH%/*}/
ln -fs "$PWD" "${GOSRCPATH}"
fi
}
do_build() {
# remove -s and -w from go_ldflags, we should let xbps-src strip binaries itself
for wd in $go_ldflags; do
if [ "$wd" == "-s" ] || [ "$wd" == "-w" ]; then
msg_error "$pkgname: remove -s and -w from go_ldflags\n"
fi
done
go_package=${go_package:-$go_import_path}
# Build using Go modules if there's a go.mod file
if [ "${go_mod_mode}" != "off" ] && [ -f go.mod ]; then
if [[ -n "${_go_mod_path}" ]]; then
pushd $(dirname ${_go_mod_path})
fi
# Check if go_import_path matches module
if [ "module $go_import_path" != "$(grep '^module' go.mod | head -n1)" ]; then
msg_error "\"\$go_import_path\" doesn't match the one defined in go.mod!\n"
fi
if [ -z "${go_mod_mode}" ] && [ -d vendor ]; then
msg_normal "Using vendor dir for $pkgname Go dependencies.\n"
go_mod_mode=vendor
elif [ "${go_mod_mode}" = "default" ]; then
# Allow templates to explicitly opt into the go tool's
# default behavior.
go_mod_mode=
fi
go install -p "$XBPS_MAKEJOBS" -mod="${go_mod_mode}" -modcacherw -v -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
if [[ -n "${_go_mod_path}" ]]; then
popd
fi
else
# Otherwise, build using GOPATH
go get -p "$XBPS_MAKEJOBS" -v -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
fi
}
do_install() {
for f in ${GOPATH}/bin/* ${GOPATH}/bin/**/*; do
if [ -f "$f" ] && [ -x "$f" ]; then
vbin "$f"
fi
done
}

View file

@ -0,0 +1,37 @@
#
# This helper is for templates built using Haskell stack.
#
# make_build_args="stack-build-flags"
# stackage="lts-X.Y" # or include a stack.yaml in $FILESDIR
#
do_build() {
# use --skip-ghc-check to really force stack to use the ghc in the system
# --system-ghc still downloads if stackage ghc version does not match ours
# this fails on all platforms other than x86_64 glibc when we bump ghc
local _stack_args="--system-ghc --skip-ghc-check"
if [ -f "${FILESDIR}/stack.yaml" ]; then
msg_normal "Using stack config in stack.yaml.\n"
cp "${FILESDIR}/stack.yaml" .
elif [ -z "$stackage" -a -f "stack.yaml" ]; then
msg_normal "Using stack.yaml from downloaded source.\n"
else
if [ -z "$stackage" ]; then
msg_error "Stackage version not set in \$stackage.\n"
fi
msg_normal "Using stackage resolver ${stackage}.\n"
STACK_ROOT="$wrksrc/.stack" \
stack init ${_stack_args} --force --resolver ${stackage}
fi
STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} ${makejobs} build \
${make_build_args}
}
do_install() {
local _stack_args="--system-ghc --skip-ghc-check"
vmkdir usr/bin
STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} install \
${make_build_args} --local-bin-path=${DESTDIR}/usr/bin
}

View file

@ -0,0 +1,67 @@
#
# This helper is for templates using meson.
#
do_configure() {
: ${meson_cmd:=meson}
: ${meson_builddir:=build}
: ${meson_crossfile:="${XBPS_WRAPPERDIR}/meson/xbps_meson.cross"}
if [ "$CROSS_BUILD" ]; then
configure_args+=" --cross-file=${meson_crossfile}"
fi
# binutils ar needs a plugin when LTO is used on static libraries, so we
# have to use the gcc-ar wrapper that calls the correct plugin.
# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
# issues with static libraries + LTO by defaulting to gcc-ar themselves.
# We also force gcc-ar usage in the crossfile above.
export AR="gcc-ar"
# unbuffered output for continuous logging
PYTHONUNBUFFERED=1 ${meson_cmd} setup \
--prefix=/usr \
--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \
--libexecdir=/usr/libexec \
--bindir=/usr/bin \
--sbindir=/usr/bin \
--includedir=/usr/include \
--datadir=/usr/share \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localedir=/usr/share/locale \
--sysconfdir=/etc \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--buildtype=plain \
--auto-features=auto \
--wrap-mode=nodownload \
-Db_lto=true -Db_ndebug=true \
-Db_staticpic=true \
${configure_args} . ${meson_builddir}
}
do_build() {
: ${make_cmd:=ninja}
: ${make_build_target:=all}
: ${meson_builddir:=build}
${make_cmd} -C ${meson_builddir} ${makejobs} ${make_build_args} ${make_build_target}
}
do_check() {
: ${make_cmd:=ninja}
: ${make_check_target:=test}
: ${meson_builddir:=build}
${make_check_pre} ${make_cmd} -C ${meson_builddir} ${makejobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_cmd:=ninja}
: ${make_install_target:=install}
: ${meson_builddir:=build}
DESTDIR=${DESTDIR} ${make_cmd} -C ${meson_builddir} ${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,9 @@
# meta pkg build style; do nothing.
do_fetch() {
:
}
do_install() {
:
}

View file

@ -0,0 +1,52 @@
#
# This helper does the required steps to be able to build and install
# perl modules with the Module::Build method into the correct location.
#
# Required vars to be set by a template:
#
# build_style=perl-ModuleBuild
#
do_configure() {
if [ -f Build.PL ]; then
# When cross compiling Module::Build reads in the build flags from the host perl, not the target:
# extract the target specific flags (the ones also set in perls template) from
# the target perl configuration and use them to override Module::Builds default
_conf="${XBPS_CROSS_BASE}/usr/lib/perl5/core_perl/Config_heavy.pl"
_optimize=$(sed -n "s;^optimize='\(.*\)';\1;p" $_conf)
_ccflags=$(sed -n "s;^ccflags='\(.*\)';\1;p" $_conf)
_lddlflags=$(sed -n "s;^lddlflags='\(.*\)';\1;p" $_conf)
_ldflags=$(sed -n "s;^ldflags='\(.*\)';\1;p" $_conf)
_archlibexp=$(sed -n "s;^archlibexp='\(.*\)';\1;p" $_conf)
PERL_MM_USE_DEFAULT=1 PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$DESTDIR'" \
PERL_MB_OPT="--installdirs vendor --destdir '$DESTDIR'" \
LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
perl Build.PL --config optimize="$_optimize" --config ccflags="$_ccflags" \
--config lddlflags="$_lddlflags" --config ldflags="$_ldflags" \
--config archlibexp="${XBPS_CROSS_BASE}${_archlibexp}" \
${configure_args} INSTALLDIRS=vendor
else
msg_error "$pkgver: cannot find Build.PL for perl module!\n"
fi
}
do_build() {
if [ ! -x ./Build ]; then
msg_error "$pkgver: cannot find ./Build script!\n"
fi
LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./Build ${make_build_args}
}
do_check() {
if [ ! -x ./Build ]; then
msg_error "$pkgver: cannot find ./Build script!\n"
fi
${make_check_pre} ./Build test
}
do_install() {
if [ ! -x ./Build ]; then
msg_error "$pkgver: cannot find ./Build script!\n"
fi
./Build ${make_install_args} install
}

View file

@ -0,0 +1,90 @@
#
# This helper does the required steps to be able to build and install
# perl modules that use MakeMaker into the correct location.
#
# Required vars to be set by a template:
#
# build_style=perl-module
#
# Optionally if the module needs more directories to be configured other
# than $XBPS_BUILDDIR/$wrksrc/$build_wrksrc, one can use (relative to
# $wrksrc/$build_wrksrc):
#
# perl_configure_dirs="blob/bob foo/blah"
#
do_configure() {
local perlmkf
local perlprefix=${XBPS_STATEDIR}/perlprefix-${XBPS_TARGET_MACHINE}
mkdir -p $perlprefix
if [ -d "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl" ]; then
cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
sed -i -e "s;archlibexp => '\(.*\)';archlibexp => '${XBPS_CROSS_BASE}\1';" \
${perlprefix}/Config.pm
sed -i -e "s;^archlibexp='\(.*\)';archlibexp='${XBPS_CROSS_BASE}\1';" \
${perlprefix}/Config_heavy.pl
else
cp "/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
cp "/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
fi
export PERL5LIB=$perlprefix
if [ -f "${wrksrc}/${build_wrksrc:+$build_wrksrc/}Makefile.PL" ]; then
sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" \
"${wrksrc}/${build_wrksrc:+$build_wrksrc/}Makefile.PL"
fi
if [ -z "$perl_configure_dirs" ]; then
perlmkf="$wrksrc/${build_wrksrc:+$build_wrksrc/}Makefile.PL"
if [ ! -f "$perlmkf" ]; then
msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
fi
cd "$wrksrc/${build_wrksrc:+$build_wrksrc}"
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
OPTIMIZE="$CFLAGS" \
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
perl -I. Makefile.PL ${configure_args} INSTALLDIRS=vendor
fi
for i in ${perl_configure_dirs}; do
perlmkf="$wrksrc/${build_wrksrc:+$build_wrksrc/}$i/Makefile.PL"
if [ -f "$perlmkf" ]; then
cd "$wrksrc/${build_wrksrc:+$build_wrksrc/}$i"
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
OPTIMIZE="$CFLAGS" \
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
perl -I. Makefile.PL ${make_build_args} INSTALLDIRS=vendor
else
msg_error "*** ERROR: couldn't find $perlmkf, aborting **\n"
fi
done
}
do_build() {
: ${make_cmd:=make}
${make_cmd} CC="$CC" LD="$CC" CFLAGS="$CFLAGS" OPTIMIZE="$CFLAGS" \
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
${makejobs} ${make_build_args} ${make_build_target}
}
do_check() {
: ${make_cmd:=make}
: ${make_check_target:=test}
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_cmd:=make}
: ${make_install_target:=install}
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,34 @@
#
# This helper is for templates installing python2-only modules.
#
do_build() {
if [ -n "$CROSS_BUILD" ]; then
PYPREFIX="$XBPS_CROSS_BASE"
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py2_inc} -I${XBPS_CROSS_BASE}/usr/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py2_lib} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python2 setup.py build ${make_build_args}
else
python2 setup.py build ${make_build_args}
fi
}
do_install() {
if [ -n "$CROSS_BUILD" ]; then
PYPREFIX="$XBPS_CROSS_BASE"
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py2_inc} -I${XBPS_CROSS_BASE}/usr/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py2_lib} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python2 setup.py \
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
else
python2 setup.py install --prefix=/usr --root=${DESTDIR} ${make_install_args}
fi
}

View file

@ -0,0 +1,34 @@
#
# This helper is for templates installing python3-only modules.
#
do_build() {
python3 setup.py build ${make_build_args}
}
do_check() {
local testjobs
if python3 -c 'import pytest' >/dev/null 2>&1; then
if python3 -c 'import xdist' >/dev/null 2>&1; then
testjobs="-n $XBPS_MAKEJOBS"
fi
PYTHONPATH="$(cd build/lib* && pwd)" PY_IGNORE_IMPORTMISMATCH=1 \
${make_check_pre} \
python3 -m pytest ${testjobs} ${make_check_args} ${make_check_target}
else
# Fall back to deprecated setup.py test orchestration without pytest
if [ -z "$make_check_target" ]; then
if ! python3 setup.py --help test >/dev/null 2>&1; then
msg_warn "No command 'test' defined by setup.py.\n"
return 0
fi
fi
: ${make_check_target:=test}
${make_check_pre} python3 setup.py ${make_check_target} ${make_check_args}
fi
}
do_install() {
python3 setup.py install --prefix=/usr --root=${DESTDIR} ${make_install_args}
}

View file

@ -0,0 +1,46 @@
#
# This style is for templates installing python3 modules adhering to PEP517
#
do_build() {
: ${make_build_target:=.}
if [ "${CROSS_BUILD}" ] && [[ "${build_helper}" = *meson* ]]; then
local mcross="-Csetup-args=--cross-file=${XBPS_WRAPPERDIR}/meson"
make_build_args+=" ${mcross}/xbps_meson.cross"
if [[ "${build_helper}" = *numpy* ]]; then
make_build_args+=" ${mcross}/xbps_numpy.cross"
fi
fi
python3 -m build --no-isolation --wheel \
${make_build_args} ${make_build_target}
}
do_check() {
if ! python3 -c 'import pytest' >/dev/null 2>&1; then
msg_warn "Testing of python3-pep517 templates requires pytest\n"
return 0
fi
local testjobs
if python3 -c 'import xdist' >/dev/null 2>&1; then
testjobs="-n $XBPS_MAKEJOBS"
fi
local testdir="${wrksrc}/.xbps-testdir/$(date +%s)"
python3 -m installer --destdir "${testdir}" \
${make_install_args} ${make_install_target:-dist/*.whl}
PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" PY_IGNORE_IMPORTMISMATCH=1 \
${make_check_pre} pytest3 ${testjobs} ${make_check_args} ${make_check_target}
}
do_install() {
: ${make_install_args:=--no-compile-bytecode}
: ${make_install_target:="dist/*.whl"}
python3 -m installer --destdir ${DESTDIR} \
${make_install_args} ${make_install_target}
}

149
common/build-style/qmake.sh Normal file
View file

@ -0,0 +1,149 @@
#
# This helper is for templates using Qt5/Qt6 qmake.
#
do_configure() {
local qmake
local qmake_args
local qt
if [ -x "/usr/lib/qt5/bin/qmake" ]; then
qmake="/usr/lib/qt5/bin/qmake"
qt="qt5"
elif [ -x "/usr/lib/qt6/bin/qmake" ]; then
qmake="/usr/lib/qt6/bin/qmake"
qt="qt6"
fi
if [ -z "${qmake}" ]; then
msg_error "${pkgver}: Could not find qmake - missing in hostmakedepends?\n"
fi
if [ "$CROSS_BUILD" ]; then
case $XBPS_TARGET_MACHINE in
i686*) _qt_arch=i386;;
x86_64*) _qt_arch=x86_64;;
aarch64*) _qt_arch=arm64;;
arm*) _qt_arch=arm;;
mips*) _qt_arch=mips;;
ppc64*) _qt_arch=power64;;
ppc*) _qt_arch=power;;
esac
mkdir -p "${wrksrc}/.target-spec/linux-g++"
cat > "${wrksrc}/.target-spec/linux-g++/qmake.conf" <<_EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental no_qt_rpath
QMAKE_INCREMENTAL_STYLE = sublib
include(/usr/lib/${qt}/mkspecs/common/linux.conf)
include(/usr/lib/${qt}/mkspecs/common/gcc-base-unix.conf)
include(/usr/lib/${qt}/mkspecs/common/g++-unix.conf)
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qconfig.pri
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qmodule.pri
QMAKEMODULES = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/modules
QMAKE_CC = ${CC}
QMAKE_CXX = ${CXX}
QMAKE_LINK = ${CXX}
QMAKE_LINK_C = ${CC}
QMAKE_LINK_SHLIB = ${CXX}
QMAKE_AR = ${XBPS_CROSS_TRIPLET}-gcc-ar cqs
QMAKE_OBJCOPY = ${OBJCOPY}
QMAKE_NM = ${NM} -P
QMAKE_STRIP = ${STRIP}
QMAKE_CFLAGS = ${CFLAGS}
QMAKE_CXXFLAGS = ${CXXFLAGS}
QMAKE_LFLAGS = ${LDFLAGS}
load(qt_config)
_EOF
echo "#include \"${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/linux-g++/qplatformdefs.h\"" > "${wrksrc}/.target-spec/linux-g++/qplatformdefs.h"
mkdir -p "${wrksrc}/.host-spec/linux-g++"
cat > "${wrksrc}/.host-spec/linux-g++/qmake.conf" <<_EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental no_qt_rpath
QMAKE_INCREMENTAL_STYLE = sublib
include(/usr/lib/${qt}/mkspecs/common/linux.conf)
include(/usr/lib/${qt}/mkspecs/common/gcc-base-unix.conf)
include(/usr/lib/${qt}/mkspecs/common/g++-unix.conf)
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qconfig.pri
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qmodule.pri
QMAKE_CC = ${CC_host}
QMAKE_CXX = ${CXX_host}
QMAKE_LINK = ${CXX_host}
QMAKE_LINK_C = ${CC_host}
QMAKE_LINK_SHLIB = ${CXX_host}
QMAKE_AR = gcc-ar cqs
QMAKE_OBJCOPY = ${OBJCOPY_host}
QMAKE_NM = ${NM_host} -P
QMAKE_STRIP = ${STRIP_host}
QMAKE_CFLAGS = ${CFLAGS_host}
QMAKE_CXXFLAGS = ${CXXFLAGS_host}
QMAKE_LFLAGS = ${LDFLAGS_host}
load(qt_config)
_EOF
echo '#include "/usr/lib/${qt}/mkspecs/linux-g++/qplatformdefs.h"' > "${wrksrc}/.host-spec/linux-g++/qplatformdefs.h"
cat > "${wrksrc}/qt.conf" <<_EOF
[Paths]
Sysroot=${XBPS_CROSS_BASE}
Prefix=/usr
ArchData=${XBPS_CROSS_BASE}/usr/lib/${qt}
Data=${XBPS_CROSS_BASE}/usr/share/${qt}
Documentation=${XBPS_CROSS_BASE}/usr/share/doc/${qt}
Headers=${XBPS_CROSS_BASE}/usr/include/${qt}
Libraries=${XBPS_CROSS_BASE}/usr/lib
LibraryExecutables=/usr/lib/${qt}/libexec
Binaries=/usr/lib/${qt}/bin
Tests=${XBPS_CROSS_BASE}/usr/tests
Plugins=/usr/lib/${qt}/plugins
Imports=${XBPS_CROSS_BASE}/usr/lib/${qt}/imports
Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/${qt}/qml
Translations=${XBPS_CROSS_BASE}/usr/share/${qt}/translations
Settings=${XBPS_CROSS_BASE}/etc/xdg
Examples=${XBPS_CROSS_BASE}/usr/share/${qt}/examples
HostPrefix=/usr
HostData=/usr/lib/${qt}
HostBinaries=/usr/lib/${qt}/bin
HostLibraries=/usr/lib
HostLibraryExecutables=/usr/lib/${qt}/libexec
Spec=${wrksrc}/.host-spec/linux-g++
TargetSpec=${wrksrc}/.target-spec/linux-g++
_EOF
qmake_args="-qtconf ${wrksrc}/qt.conf PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG}"
${qmake} ${qmake_args} \
PREFIX=/usr \
QT_INSTALL_PREFIX=/usr \
LIB=/usr/lib \
QT_TARGET_ARCH=$_qt_arch \
${configure_args}
else
${qmake} ${qmake_args} \
PREFIX=/usr \
QT_INSTALL_PREFIX=/usr \
LIB=/usr/lib \
QMAKE_CC=$CC QMAKE_CXX=$CXX \
QMAKE_LINK=$CXX QMAKE_LINK_C=$CC \
QMAKE_CFLAGS="${CFLAGS}" \
QMAKE_CXXFLAGS="${CXXFLAGS}" \
QMAKE_LFLAGS="${LDFLAGS}" \
CONFIG+=no_qt_rpath \
${configure_args}
fi
}
do_build() {
: ${make_cmd:=make}
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target} \
CC="$CC" CXX="$CXX" LINK="$CXX"
}
do_install() {
: ${make_cmd:=make}
: ${make_install_target:=install}
${make_cmd} STRIP=true PREFIX=/usr DESTDIR=${DESTDIR} \
INSTALL_ROOT=${DESTDIR} ${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,16 @@
#
# This helper is for Raku package templates.
#
do_check() {
RAKULIB=lib ${make_check_pre} prove -r -e raku t/
}
do_install() {
export RAKUDO_LOG_PRECOMP=1
export RAKUDO_RERESOLVE_DEPENDENCIES=0
raku-install-dist \
--to=${DESTDIR}/usr/lib/raku/vendor \
--for=vendor \
--from=.
}

View file

@ -0,0 +1,13 @@
#
# This helper is for templates installing ruby modules.
#
do_install() {
local _vendorlibdir=$(ruby -e 'puts RbConfig::CONFIG["vendorlibdir"]')
if [ "$XBPS_WORDSIZE" != "$XBPS_TARGET_WORDSIZE" ]; then
_vendorlibdir="${_vendorlibdir//lib$XBPS_WORDSIZE/lib$XBPS_TARGET_WORDSIZE}"
fi
LANG=C ruby install.rb --destdir=${DESTDIR} --sitelibdir=${_vendorlibdir} ${make_install_args}
}

View file

@ -0,0 +1,35 @@
#
# This helper is for templates using scons.
#
do_build() {
: ${make_cmd:=scons}
${make_cmd} ${makejobs} CC=$CC CXX=$CXX CCFLAGS="$CFLAGS" \
cc=$CC cxx=$CXX ccflags="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \
cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \
RANLIB="$RANLIB" ranlib="$RANLIB" \
prefix=/usr \
${scons_use_destdir:+DESTDIR="${DESTDIR}"} \
${scons_use_destdir:+destdir="${DESTDIR}"} \
${make_build_args} ${make_build_target}
}
do_install() {
: ${make_cmd:=scons}
: ${make_install_target:=install}
local _sandbox=
if [ -z "$scons_use_destdir" ]; then _sandbox=yes ; fi
${make_cmd} ${makejobs} CC=$CC CXX=$CXX CCFLAGS="$CFLAGS" \
cc=$CC cxx=$CXX ccflags="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \
cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \
RANLIB="$RANLIB" ranlib="$RANLIB" \
prefix=/usr \
${scons_use_destdir:+DESTDIR="${DESTDIR}"} \
${scons_use_destdir:+destdir="${DESTDIR}"} \
${_sandbox:+--install-sandbox="${DESTDIR}"} \
${make_install_args} ${make_install_target}
}

View file

@ -0,0 +1,147 @@
#
# This helper is for templates using sip-build.
#
do_configure() {
local _qt=
local _spec=
local _mkspec=
: "${sip_builddir:=build}"
mkdir -p "$sip_builddir"
if [ ! -d /$py3_sitelib/pyqtbuild ]; then
: "who uses sip-build without qmake anyway?"
elif [ -x /usr/lib/qt6/bin/qmake ]; then
_qt=qt6
elif [ -x /usr/lib/qt5/bin/qmake ]; then
_qt=qt5
else
msg_error 'qmake not found\n'
fi
if [ ! "$_qt" ]; then
: "who use sip-build without qmake anyway?"
elif [ "$CROSS_BUILD" ]; then
_mkspec="usr/lib/$_qt/mkspecs"
_spec="$XBPS_WRAPPERDIR/sip-build/target-spec/linux-g++"
mkdir -p "$_spec"
cat >"$_spec/qmake.conf" <<-_EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental no_qt_rpath
QMAKE_INCREMENTAL_STYLE = sublib
include(/$_mkspec/common/linux.conf)
include(/$_mkspec/common/gcc-base-unix.conf)
include(/$_mkspec/common/g++-unix.conf)
QMAKE_TARGET_CONFIG = $XBPS_CROSS_BASE/$_mkspec/qconfig.pri
QMAKE_TARGET_MODULE = $XBPS_CROSS_BASE/$_mkspec/qmodule.pri
QMAKEMODULES = $XBPS_CROSS_BASE/$_mkspec/modules
QMAKE_CC = $CC
QMAKE_CXX = $CXX
QMAKE_LINK = $CXX
QMAKE_LINK_C = $CC
QMAKE_LINK_SHLIB = $CXX
QMAKE_AR = $XBPS_CROSS_TRIPLET-gcc-ar cqs
QMAKE_OBJCOPY = $OBJCOPY
QMAKE_NM = $NM -P
QMAKE_STRIP = $STRIP
QMAKE_CFLAGS = $CFLAGS -I$XBPS_CROSS_BASE/usr/include/python$py3_ver
QMAKE_CXXFLAGS = $CXXFLAGS -I$XBPS_CROSS_BASE/usr/include/python$py3_ver
QMAKE_LFLAGS = -L$XBPS_CROSS_BASE/usr/lib $LDFLAGS
load(qt_config)
_EOF
printf '#include "%s/%s/linux-g++/qplatformdefs.h"\n' \
"$XBPS_CROSS_BASE" "$_mkspec" >"$_spec/qplatformdefs.h"
cat >"$XBPS_WRAPPERDIR/sip-build/qt.conf" <<-_EOF
[Paths]
Sysroot=$XBPS_CROSS_BASE
Prefix=$XBPS_CROSS_BASE/usr
ArchData=$XBPS_CROSS_BASE/usr/lib/$_qt
Data=$XBPS_CROSS_BASE/usr/share/$_qt
Documentation=$XBPS_CROSS_BASE/usr/share/doc/$_qt
Headers=$XBPS_CROSS_BASE/usr/include/$_qt
Libraries=$XBPS_CROSS_BASE/usr/lib
LibraryExecutables=/usr/lib/$_qt/libexec
Binaries=/usr/lib/$_qt/bin
Tests=$XBPS_CROSS_BASE/usr/tests
Plugins=/usr/lib/$_qt/plugins
Imports=$XBPS_CROSS_BASE/usr/lib/$_qt/imports
Qml2Imports=$XBPS_CROSS_BASE/usr/lib/$_qt/qml
Translations=$XBPS_CROSS_BASE/usr/share/$_qt/translations
Settings=$XBPS_CROSS_BASE/etc/xdg
Examples=$XBPS_CROSS_BASE/usr/share/$_qt/examples
HostPrefix=/usr
HostData=/usr/lib/$_qt
HostBinaries=/usr/lib/$_qt/bin
HostLibraries=/usr/lib
HostLibraryExecutables=/usr/lib/$_qt/libexec
Spec=linux-g++
TargetSpec=$_spec
_EOF
# Call it sip-qmake to not override qmake build-helper
#
# XXX: Intentionally quote {C,CXX,LD}FLAGS here but not native.
# - Cross Build:
# + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS
# + hardening flags will be picked up from environment variables
# - Native Build:
# + hardening flags will be picked up first (Makefile, qt.conf?)
# + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS
# Maybe there're better workaround, I don't know.
cat >"$XBPS_WRAPPERDIR/sip-qmake" <<-_EOF
#!/bin/sh
exec /usr/lib/$_qt/bin/qmake "\$@" \\
-qtconf "$XBPS_WRAPPERDIR/sip-build/qt.conf" \\
PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG} \\
QMAKE_CFLAGS+="\$CFLAGS" \\
QMAKE_CXXFLAGS+="\$CXXFLAGS" \\
QMAKE_LFLAGS+="\$LDFLAGS"
_EOF
chmod 755 ${XBPS_WRAPPERDIR}/sip-qmake
else
cat >"${XBPS_WRAPPERDIR}/sip-qmake" <<-_EOF
#!/bin/sh
exec /usr/lib/$_qt/bin/qmake \\
"\$@" \\
PREFIX=/usr \\
QT_INSTALL_PREFIX=/usr \\
LIB=/usr/lib \\
QMAKE_CC="$CC" QMAKE_CXX="$CXX" \\
QMAKE_LINK="$CXX" QMAKE_LINK_C="$CC" \\
QMAKE_CFLAGS+="$CFLAGS" \\
QMAKE_CXXFLAGS+="$CXXFLAGS" \\
QMAKE_LFLAGS+="$LDFLAGS" \\
CONFIG+=no_qt_rpath
_EOF
chmod 755 ${XBPS_WRAPPERDIR}/sip-qmake
fi
sip-build --no-make \
${_qt:+--qmake "$XBPS_WRAPPERDIR/sip-qmake"} \
--api-dir /usr/share/$_qt/qsci/api/python \
$configure_args \
--build-dir "$sip_builddir"
if [ "$CROSS_BUILD" ]; then
# -I/usr/include/python$py3_ver is set by sip-build :(
find "$sip_builddir" -name Makefile |
xargs sed -i "s,-I\\(/usr/include\\),-I$XBPS_CROSS_BASE\\1,g"
fi
}
do_build() {
: "${sip_builddir:=build}"
make -C "${sip_builddir}" ${makejobs}
}
do_install() {
: "${sip_builddir:=build}"
make -C "${sip_builddir}" \
DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} \
install
}

View file

@ -0,0 +1,33 @@
#
# This helper is for templates building slashpackage software.
# http://cr.yp.to/slashpackage.html
#
# required variables
#
# build_style=slashpackage
# build_wrksrc=${pkgname}-${version}
# distfiles=<download link>
#
# example (daemontools)
#
# Template file for 'daemontools'
# pkgname=daemontools
# version=0.76
# revision=1
# build_wrksrc=${pkgname}-${version}
# build_style=slashpackage
# short_desc="A collection of tools for managing UNIX services"
# maintainer="bougyman <tj@geoforce.com>"
# license="Public Domain"
# homepage="http://cr.yp.to/daemontools.html"
# distfiles="http://cr.yp.to/daemontools/${pkgname}-${version}.tar.gz"
do_build() {
package/compile
}
do_install() {
for command in command/*; do
vbin $command
done
}

View file

@ -0,0 +1,67 @@
do_build() {
local f p
# Extract the source files
mkdir -p "build/usr/share/texmf-dist"
find . -maxdepth 1 -print -name "*.tar.xz" \
-exec bsdtar \
-s '|^texmf-dist/||' \
-C "build/usr/share/texmf-dist" \
-xf {} \;
cd "build/usr/share/texmf-dist/"
# LICENSEs are unneeded
rm -f LICENSE*
# We have some conflicting files between different packages. To work
# around this, we use an ownership file that maps which conflicting
# files should be in which packages. Here, each file in the map list is
# checked whether it is in the package, and if it shouldn't be it is
# removed.
while IFS=' ' read -r f p ; do
if [ "$p" = "$pkgname" ] && ! [ -e "$f" ]; then
# Error out if the ownership map expects this package to have a
# file but it dosen't
msg_error "$pkgver: missing file $f\n"
elif [ "$p" != "$pkgname" ] && [ -e "$f" ]; then
# Remove a file that according to the ownership map belongs to
# another file
echo "removed $f"
# Install a file that lists the removed packages
mkdir -p ../texlive/removed
echo "$f" >> ../texlive/removed/$pkgname.txt
rm -f "$f"
fi
done < "${XBPS_COMMONDIR}/environment/build-style/texmf/ownership.txt"
}
do_check() {
# This is essentially a helper for generating the ownership map. It checks
# to see if there are any conflicts between all of the different packages.
local f p current_ver current_rev exitcode=0
cd build
while read p; do
# Don't check against the texlive-bin* packages, ourselves, -dbg or -32bit pkgs
if [[ ${p%-*} =~ .*-bin$ ]] || [ "${p%-*}" = "$pkgname" ] || [[ ${p%-*} =~ .*-dbg$ ]] || [[ ${p%-*} =~ .*-32bit$ ]]; then
continue
fi
# Don't check against any version other than the version in the source tree
current_ver="$(grep -m 1 version= ${XBPS_SRCPKGDIR}/${p%-*}/template | cut -d= -f2)"
current_rev="$(grep -m 1 revision= ${XBPS_SRCPKGDIR}/${p%-*}/template | cut -d= -f2)"
if [ "${p%-*}-${current_ver}_${current_rev}" != "${p}" ]; then
# They are not the same version
continue
fi
echo checking conflicts with ${p}...
while IFS= read -r f; do
if [ -e ".$f" ]; then
msg_red "both contain file $f\n"
exitcode=1
fi
done < <(xbps-query -Rf $p | sed 's/ -> .*//')
done < <(xbps-query -Rs texlive -p pkgver | cut -d : -f 1)
return $exitcode
}
do_install() {
vcopy build/usr .
}

View file

@ -0,0 +1,663 @@
#
# This helper is for void system crosstoolchain templates.
#
# Optional variables:
#
# - cross_gcc_skip_go - do not build gccgo support
# - cross_binutils_configure_args
# - cross_gcc_bootstrap_configure_args
# - cross_gcc_configure_args
# - cross_glibc_cflags
# - cross_glibc_ldflags
# - cross_glibc_configure_args
# - cross_musl_cflags
# - cross_musl_ldflags
# - cross_musl_configure_args
#
# configure_args is passed to both bootstrap gcc and final gcc
# if you need to pass some to one and not the other, use the
# respective cross_ variables for final gcc and bootstrap gcc
#
_void_cross_apply_patch() {
local pname="$(basename $1)"
if [ ! -f ".${pname}_done" ]; then
patch -Np1 $args -i $1
touch .${pname}_done
fi
}
_void_cross_build_binutils() {
[ -f ${wrksrc}/.binutils_done ] && return 0
local tgt=$1
local ver=$2
msg_normal "Patching binutils for ${tgt}\n"
cd ${wrksrc}/binutils-${ver}
if [ -d "${XBPS_SRCPKGDIR}/binutils/patches" ]; then
for f in ${XBPS_SRCPKGDIR}/binutils/patches/*.patch; do
_void_cross_apply_patch "$f"
done
fi
cd ..
msg_normal "Building binutils for ${tgt}\n"
mkdir -p ${wrksrc}/binutils_build
cd ${wrksrc}/binutils_build
../binutils-${ver}/configure \
--prefix=/usr \
--sbindir=/usr/bin \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--target=${tgt} \
--with-sysroot=/usr/${tgt} \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-werror \
--disable-gold \
--disable-gprofng \
--enable-relro \
--enable-new-dtags \
--enable-plugins \
--enable-64-bit-bfd \
--enable-deterministic-archives \
--enable-default-hash-style=gnu \
--with-system-zlib \
--with-mmap \
--with-pic \
${cross_binutils_configure_args}
make configure-host
make ${makejobs}
make install DESTDIR=${wrksrc}/build_root
touch ${wrksrc}/.binutils_done
}
_void_cross_build_bootstrap_gcc() {
[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
local tgt=$1
local ver=$2
msg_normal "Patching GCC for ${tgt}\n"
cd ${wrksrc}/gcc-${ver}
# Do not run fixincludes
sed -i 's@./fixinc.sh@-c true@' Makefile.in
for f in ${XBPS_SRCPKGDIR}/gcc/patches/*.patch; do
_void_cross_apply_patch "$f"
done
if [ -f ${wrksrc}/.musl_version ]; then
for f in ${XBPS_SRCPKGDIR}/gcc/files/*-musl.patch; do
_void_cross_apply_patch "$f"
done
fi
cd ..
msg_normal "Building bootstrap GCC for ${tgt}\n"
mkdir -p gcc_bootstrap
cd gcc_bootstrap
local extra_args
if [ -f ${wrksrc}/.musl_version ]; then
extra_args+=" --with-newlib"
extra_args+=" --disable-symvers"
extra_args+=" libat_cv_have_ifunc=no"
else
extra_args+=" --without-headers"
fi
../gcc-${ver}/configure \
--prefix=/usr \
--sbindir=/usr/bin \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--target=${tgt} \
--disable-nls \
--disable-multilib \
--disable-shared \
--disable-libquadmath \
--disable-decimal-float \
--disable-libgomp \
--disable-libmpx \
--disable-libmudflap \
--disable-libssp \
--disable-libitm \
--disable-libatomic --disable-autolink-libatomic \
--disable-gcov \
--disable-threads \
--disable-sjlj-exceptions \
--enable-languages=c \
--with-gnu-ld \
--with-gnu-as \
${extra_args} \
${configure_args} \
${cross_gcc_bootstrap_configure_args}
make ${makejobs}
make install DESTDIR=${wrksrc}/build_root
local ptrs=$(${tgt}-gcc -dM -E - < /dev/null | \
grep __SIZEOF_POINTER__)
local ws=${ptrs##* }
case ${ws} in
8) echo 64 > ${wrksrc}/.gcc_wordsize ;;
4) echo 32 > ${wrksrc}/.gcc_wordsize ;;
*) msg_error "Unknown word size: ${ws}\n" ;;
esac
touch ${wrksrc}/.gcc_bootstrap_done
}
_void_cross_build_kernel_headers() {
[ -f ${wrksrc}/.linux_headers_done ] && return 0
local tgt=$1
local ver=$2
local arch
msg_normal "Patching Linux headers for ${tgt}\n"
cd ${wrksrc}/linux-${ver}
if [ -d "${XBPS_SRCPKGDIR}/kernel-libc-headers/patches" ]; then
for f in ${XBPS_SRCPKGDIR}/kernel-libc-headers/patches/*.patch; do
_void_cross_apply_patch "$f"
done
fi
cd ..
msg_normal "Building Linux headers for ${tgt}\n"
cd linux-${ver}
case "$tgt" in
x86_64*|i686*) arch=x86 ;;
powerpc*) arch=powerpc ;;
mips*) arch=mips ;;
aarch64*) arch=arm64 ;;
arm*) arch=arm ;;
riscv*) arch=riscv ;;
s390*) arch=s390 ;;
*) msg_error "Unknown Linux arch for ${tgt}\n" ;;
esac
make ARCH=${arch} headers
find usr/include -name '.*' -delete
rm usr/include/Makefile
rm -r usr/include/drm
cp -a usr/include ${wrksrc}/build_root/usr/${tgt}/usr
touch ${wrksrc}/.linux_headers_done
}
_void_cross_build_glibc_headers() {
[ -f ${wrksrc}/.glibc_headers_done ] && return 0
local tgt=$1
local ver=$2
msg_normal "Patching glibc for ${tgt}\n"
cd ${wrksrc}/glibc-${ver}
if [ -d "${XBPS_SRCPKGDIR}/glibc/patches" ]; then
for f in ${XBPS_SRCPKGDIR}/glibc/patches/*.patch; do
_void_cross_apply_patch "$f"
done
fi
cd ..
msg_normal "Building glibc headers for ${tgt}\n"
mkdir -p glibc_headers
cd glibc_headers
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
# we don't need any custom args here, it's just headers
CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
AS="${tgt}-as" NM="${tgt}-nm" CFLAGS="-pipe" CXXFLAGS="" CPPFLAGS="" \
LDFLAGS="" \
../glibc-${ver}/configure \
--prefix=/usr \
--host=${tgt} \
--with-headers=${wrksrc}/build_root/usr/${tgt}/usr/include \
--config-cache \
--enable-kernel=2.6.27 \
${cross_glibc_configure_args}
make -k install-headers cross_compiling=yes \
install_root=${wrksrc}/build_root/usr/${tgt}
touch ${wrksrc}/.glibc_headers_done
}
_void_cross_build_glibc() {
[ -f ${wrksrc}/.glibc_build_done ] && return 0
local tgt=$1
local ver=$2
msg_normal "Building glibc for ${tgt}\n"
mkdir -p ${wrksrc}/glibc_build
cd ${wrksrc}/glibc_build
local ws=$(cat ${wrksrc}/.gcc_wordsize)
echo "slibdir=/usr/lib${ws}" > configparms
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
AR="${tgt}-ar" AS="${tgt}-as" NM="${tgt}-nm" \
OBJDUMP="${tgt}-objdump" OBJCOPY="${tgt}-objcopy" \
CFLAGS="-pipe ${cross_glibc_cflags}" \
CXXFLAGS="-pipe ${cross_glibc_cflags}" \
CPPFLAGS="" \
LDFLAGS="${cross_glibc_ldflags}" \
../glibc-${ver}/configure \
--prefix=/usr \
--libdir=/usr/lib${ws} \
--libexecdir=/usr/libexec \
--host=${tgt} \
--with-headers=${wrksrc}/build_root/usr/${tgt}/usr/include \
--config-cache \
--disable-profile \
--disable-werror \
--enable-kernel=2.6.27 \
${cross_glibc_configure_args}
make ${makejobs}
make install_root=${wrksrc}/build_root/usr/${tgt} install
touch ${wrksrc}/.glibc_build_done
}
_void_cross_build_musl() {
[ -f ${wrksrc}/.musl_build_done ] && return 0
local tgt=$1
local ver=$2
msg_normal "Patching musl for ${tgt}\n"
cd ${wrksrc}/musl-${ver}
if [ -d "${XBPS_SRCPKGDIR}/musl/patches" ]; then
for f in ${XBPS_SRCPKGDIR}/musl/patches/*.patch; do
_void_cross_apply_patch "$f"
done
fi
cd ..
msg_normal "Building musl for ${tgt}\n"
mkdir -p musl_build
cd musl_build
CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
AR="${tgt}-ar" AS="${tgt}-as" NM="${tgt}-nm" \
CFLAGS="-pipe -fPIC ${cross_musl_cflags}" \
CPPFLAGS="${cross_musl_cflags}" LDFLAGS="${cross_musl_ldflags}" \
../musl-${ver}/configure \
--prefix=/usr \
--host=${tgt} \
${cross_musl_configure_args}
make ${makejobs}
make DESTDIR=${wrksrc}/build_root/usr/${tgt} install
CFLAGS="-pipe -fPIC ${cross_musl_cflags}" \
CPPFLAGS="${cross_musl_cflags}" LDFLAGS="${cross_musl_ldflags}" \
${tgt}-gcc -pipe -fPIC ${cross_musl_cflags} ${cross_musl_ldflags} -fpie \
-c ${XBPS_SRCPKGDIR}/musl/files/__stack_chk_fail_local.c \
-o __stack_chk_fail_local.o
${tgt}-ar r libssp_nonshared.a __stack_chk_fail_local.o
cp libssp_nonshared.a ${wrksrc}/build_root/usr/${tgt}/usr/lib
touch ${wrksrc}/.musl_build_done
}
_void_cross_build_libucontext() {
[ -n "$cross_gcc_skip_go" ] && return 0
[ -f ${wrksrc}/.libucontext_build_done ] && return 0
local tgt=$1
local ver=$2
local arch incpath
msg_normal "Building libucontext for ${tgt}\n"
case "$tgt" in
x86_64*) arch=x86_64 ;;
i686*) arch=x86 ;;
powerpc64*) arch=ppc64 ;;
powerpc*) arch=ppc ;;
mips*64*) arch=mips64 ;;
mips*) arch=mips ;;
aarch64*) arch=aarch64 ;;
arm*) arch=arm ;;
riscv64*) arch=riscv64 ;;
s390x*) arch=s390x ;;
*) msg_error "Unknown libucontext arch for ${tgt}\n" ;;
esac
cd ${wrksrc}/libucontext-${ver}
# a terrible hack but seems to work for now
# we build a static-only library to prevent linking to a runtime
# since it's tiny it can be linked into libgo and we don't have
# to keep it around (which would possibly conflict with crossdeps)
incpath="${wrksrc}/build_root/usr/${tgt}/usr/include"
CC="${tgt}-gcc" AS="${tgt}-as" AR="${tgt}-ar" \
make ARCH=$arch libucontext.a \
CFLAGS="${cross_musl_cflags} -g0 -nostdinc -isystem ${incpath}"
cp libucontext.a ${wrksrc}/build_root/usr/${tgt}/usr/lib
touch ${wrksrc}/.libucontext_build_done
}
_void_cross_build_gcc() {
[ -f ${wrksrc}/.gcc_build_done ] && return 0
local tgt=$1
local ver=$2
msg_normal "Building gcc for ${tgt}\n"
# GIANT HACK: create an empty libatomic.a so gcc cross-compile
# below works.
ar r ${wrksrc}/build_root/usr/${tgt}/usr/lib/libatomic.a
mkdir -p ${wrksrc}/gcc_build
cd ${wrksrc}/gcc_build
local langs="c,c++,fortran,objc,obj-c++,ada,lto"
if [ -z "$cross_gcc_skip_go" ]; then
langs+=",go"
fi
local extra_args
if [ -f ${wrksrc}/.musl_version ]; then
# otherwise glibc hosts get confused and use the gnu impl
extra_args+=" --enable-clocale=generic"
extra_args+=" --disable-symvers"
extra_args+=" --disable-gnu-unique-object"
extra_args+=" libat_cv_have_ifunc=no"
else
extra_args+=" --enable-clocale=gnu"
extra_args+=" --enable-gnu-unique-object"
fi
# note on --disable-libquadmath:
# on some platforms the library is actually necessary for the
# fortran frontend to build, platforms where this is a problem
# should explicitly force libquadmath to be on via cross_gcc_configure_args
#
../gcc-${ver}/configure \
--prefix=/usr \
--sbindir=/usr/bin \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--target=${tgt} \
--with-sysroot=/usr/${tgt} \
--with-build-sysroot=${wrksrc}/build_root/usr/${tgt} \
--enable-languages=${langs} \
--disable-nls \
--disable-multilib \
--disable-sjlj-exceptions \
--disable-libquadmath \
--disable-libmudflap \
--disable-libitm \
--disable-libvtv \
--disable-libsanitizer \
--disable-libstdcxx-pch \
--disable-libssp \
--enable-shared \
--enable-threads=posix \
--enable-__cxa_atexit \
--enable-linker-build-id \
--enable-libada \
--enable-lto \
--enable-default-pie \
--enable-default-ssp \
--with-gnu-ld \
--with-gnu-as \
--with-linker-hash-style=gnu \
${extra_args} \
${configure_args} \
${cross_gcc_configure_args}
make ${makejobs}
touch ${wrksrc}/.gcc_build_done
}
_void_cross_test_ver() {
local proj=$1
local noerr=$2
local ver cver
for p in ${proj}-*; do
cver=${p#${proj}-}
if [ -z "$noerr" -a -n "$ver" ]; then
msg_error "multiple versions of ${proj} found: ${ver}, ${cver}"
fi
ver=${cver}
done
if [ -d "${proj}-${ver}" ]; then
echo ${ver} > ${wrksrc}/.${proj}_version
return
fi
if [ -z "$noerr" ]; then
msg_error "project ${proj} not available for build\n"
fi
}
do_build() {
# Verify toolchain versions
cd ${wrksrc}
local binutils_ver linux_ver gcc_ver libc_ver libucontext_ver
local tgt=${sourcepkg/cross-}
export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
# Disable explicit -fno-PIE, gcc/binutils/libc will figure this out itself.
export CFLAGS="${CFLAGS//-fno-PIE/}"
export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
export LDFLAGS="${LDFLAGS//-no-pie/}"
_void_cross_test_ver binutils
_void_cross_test_ver linux
_void_cross_test_ver gcc
binutils_ver=$(cat .binutils_version)
linux_ver=$(cat .linux_version)
gcc_ver=$(cat .gcc_version)
_void_cross_test_ver musl noerr
if [ ! -f .musl_version ]; then
_void_cross_test_ver glibc
libc_ver=$(cat .glibc_version)
else
libc_ver=$(cat .musl_version)
if [ -z "$cross_gcc_skip_go" ]; then
_void_cross_test_ver libucontext
libucontext_ver=$(cat .libucontext_version)
fi
fi
local sysroot="/usr/${tgt}"
# Prepare environment
cd ${wrksrc}
# Core directories for the build root
mkdir -p build_root/usr/{bin,lib,include,share}
mkdir -p build_root/usr/${tgt}/usr/{bin,lib,include,share}
# Host root uses host wordsize
ln -sf usr/lib build_root/lib
ln -sf usr/lib build_root/lib${XBPS_TARGET_WORDSIZE}
ln -sf lib build_root/usr/lib${XBPS_TARGET_WORDSIZE}
# Prepare target sysroot
ln -sf usr/lib build_root/${sysroot}/lib
ln -sf lib build_root/${sysroot}/usr/libexec
_void_cross_build_binutils ${tgt} ${binutils_ver}
# Prepare environment so we can use temporary prefix
local oldpath="$PATH"
local oldldlib="$LD_LIBRARY_PATH"
export PATH="${wrksrc}/build_root/usr/bin:$PATH"
export LD_LIBRARY_PATH="${wrksrc}/build_root/usr/lib:$PATH"
_void_cross_build_bootstrap_gcc ${tgt} ${gcc_ver}
_void_cross_build_kernel_headers ${tgt} ${linux_ver}
local ws=$(cat ${wrksrc}/.gcc_wordsize)
# Now that we know the target wordsize, prepare symlinks
ln -sf usr/lib ${wrksrc}/build_root/${sysroot}/lib${ws}
ln -sf lib ${wrksrc}/build_root/${sysroot}/usr/lib${ws}
if [ -f ${wrksrc}/.musl_version ]; then
_void_cross_build_musl ${tgt} ${libc_ver}
_void_cross_build_libucontext ${tgt} ${libucontext_ver}
else
_void_cross_build_glibc_headers ${tgt} ${libc_ver}
_void_cross_build_glibc ${tgt} ${libc_ver}
fi
_void_cross_build_gcc ${tgt} ${gcc_ver}
# restore this stuff in case later hooks depend on it
export PATH="$oldpath"
export LD_LIBRARY_PATH="$oldldlib"
}
do_install() {
# We need to be able to access binutils in the root
local oldpath="$PATH"
local oldldlib="$LD_LIBRARY_PATH"
export PATH="${wrksrc}/build_root/usr/bin:$PATH"
export LD_LIBRARY_PATH="${wrksrc}/build_root/usr/lib:$PATH"
local tgt=${sourcepkg/cross-}
local sysroot="/usr/${tgt}"
local ws=$(cat ${wrksrc}/.gcc_wordsize)
# Core directories for the sysroot
#
# libexec is created for sysroot but not for dest, since in sysroot
# we configure glibc with separate libexec, elsewhere it's just lib
# and we want to delete the libexec from glibc afterwards to save space
mkdir -p ${DESTDIR}/${sysroot}/usr/{bin,lib,libexec,include,share}
# Sysroot base symlinks
ln -sf usr/bin ${DESTDIR}/${sysroot}/bin
ln -sf usr/lib ${DESTDIR}/${sysroot}/lib
ln -sf usr/lib ${DESTDIR}/${sysroot}/lib${ws}
ln -sf lib ${DESTDIR}/${sysroot}/usr/lib${ws}
ln -sf usr/include ${DESTDIR}/${sysroot}/include
# Install Linux headers
cd ${wrksrc}/linux-$(cat ${wrksrc}/.linux_version)
cp -a usr/include ${DESTDIR}/${sysroot}/usr
# Install binutils
cd ${wrksrc}/binutils_build
make install DESTDIR=${DESTDIR}
# Install final gcc
cd ${wrksrc}/gcc_build
make install DESTDIR=${DESTDIR}
# Move libcc1.so* to the sysroot
mv ${DESTDIR}/usr/lib/libcc1.so* ${DESTDIR}/${sysroot}/usr/lib
local gcc_ver=$(cat ${wrksrc}/.gcc_version)
local gcc_patch=${gcc_ver/_*}
local gcc_minor=${gcc_patch%.*}
local gcc_major=${gcc_minor%.*}
if [ -f ${wrksrc}/.musl_version ]; then
# Install musl
cd ${wrksrc}/musl_build
make DESTDIR=${DESTDIR}/${sysroot} install
# Remove useless headers
rm -rf ${DESTDIR}/usr/lib/gcc/${tgt}/*/include-fixed
# Make ld-musl.so symlinks relative
for f in ${DESTDIR}/${sysroot}/usr/lib/ld-musl-*.so.*; do
ln -sf libc.so ${f}
done
cp libssp_nonshared.a ${DESTDIR}/${sysroot}/usr/lib/
else
# Install glibc
cd ${wrksrc}/glibc_build
make install_root=${DESTDIR}/${sysroot} install install-headers
# Remove bad header
rm -f ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch}/include-fixed/bits/statx.h
fi
# minor-versioned symlinks
mv ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch} \
${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_minor}
ln -sfr ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_minor} \
${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch}
# ditto for c++ headers
mv ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_patch} \
${DESTDIR}/${sysroot}/usr/include/c++/${gcc_minor}
ln -sfr ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_minor} \
${DESTDIR}/${sysroot}/usr/include/c++/${gcc_patch}
# Symlinks for gnarl and gnat shared libraries
local adalib=usr/lib/gcc/${tgt}/${gcc_patch}/adalib
mv ${DESTDIR}/${adalib}/libgnarl-${gcc_major}.so \
${DESTDIR}/${sysroot}/usr/lib
mv ${DESTDIR}/${adalib}/libgnat-${gcc_major}.so \
${DESTDIR}/${sysroot}/usr/lib
ln -sf libgnarl-${gcc_major}.so ${DESTDIR}/${sysroot}/usr/lib/libgnarl.so
ln -sf libgnat-${gcc_major}.so ${DESTDIR}/${sysroot}/usr/lib/libgnat.so
rm -vf ${DESTDIR}/${adalib}/libgna{rl,t}.so
# Remove libgomp library because it conflicts with libgomp and
# libgomp-devel packages
rm -f ${DESTDIR}/${sysroot}/usr/lib/libgomp*
# Remove libdep linker plugin because it conflicts with system binutils
rm -f ${DESTDIR}/usr/lib/bfd-plugins/libdep*
# Remove leftover symlinks
rm -f ${DESTDIR}/usr/lib${XBPS_TARGET_WORDSIZE}
rm -f ${DESTDIR}/lib*
rm -f ${DESTDIR}/*bin
# Remove unnecessary stuff
rm -rf ${DESTDIR}/${sysroot}/{sbin,etc,var,libexec}
rm -rf ${DESTDIR}/${sysroot}/usr/{sbin,share,libexec}
rm -rf ${DESTDIR}/usr/share
rm -f ${DESTDIR}/usr/lib*/libiberty.a
export PATH="$oldpath"
export LD_LIBRARY_PATH="$oldldlib"
}

21
common/build-style/waf.sh Normal file
View file

@ -0,0 +1,21 @@
#
# This helper is for templates using WAF to build/install.
#
do_configure() {
: ${configure_script:=waf}
PYTHON=/usr/bin/python2 python2 ${configure_script} configure \
--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE} ${configure_args}
}
do_build() {
: ${configure_script:=waf}
PYTHON=/usr/bin/python2 python2 ${configure_script} build ${make_build_args}
}
do_install() {
: ${configure_script:=waf}
PYTHON=/usr/bin/python2 python2 ${configure_script} install --destdir=${DESTDIR} ${make_install_args}
}

View file

@ -0,0 +1,29 @@
#
# This helper is for templates using WAF with python3 to build/install.
#
do_configure() {
: ${configure_script:=waf}
local cross_args
if [[ $build_helper = *"qemu"* ]] && [ "$CROSS_BUILD" ]; then
# If the qemu build helper is specified, use it for cross builds
cross_args="--cross-compile --hostcc=${CC_FOR_BUILD}
--cross-execute=qemu-${XBPS_TARGET_QEMU_MACHINE}-static"
fi
PYTHON=/usr/bin/python3 python3 ${configure_script} configure \
--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \
${configure_args} ${cross_args}
}
do_build() {
: ${configure_script:=waf}
PYTHON=/usr/bin/python3 python3 ${configure_script} build ${make_build_args}
}
do_install() {
: ${configure_script:=waf}
PYTHON=/usr/bin/python3 python3 ${configure_script} install --destdir=${DESTDIR} ${make_install_args}
}

View file

@ -0,0 +1,41 @@
do_build() {
local zig_target zig_cpu
# TODO: This duplication between build-profiles and cross-profiles
# is totally unnecessary. It would be nice if there was some way to
# avoid it.
if [ "$CROSS_BUILD" ]; then
zig_target="${XBPS_CROSS_ZIG_TARGET}"
zig_cpu="${XBPS_CROSS_ZIG_CPU}"
else
zig_target="${XBPS_ZIG_TARGET}"
zig_cpu="${XBPS_ZIG_CPU}"
fi
# Inform zig of the required libc include paths.
cat > xbps_zig_libc.txt <<-EOF
include_dir=${XBPS_CROSS_BASE}/usr/include
sys_include_dir=${XBPS_CROSS_BASE}/usr/include
crt_dir=${XBPS_CROSS_BASE}/usr/lib
msvc_lib_dir=
kernel32_lib_dir=
gcc_dir=
EOF
# The Zig build system only has a single install step, there is no
# way to build artifacts for a given prefix and then install those artifacts
# to that prefix at some later time. Therefore, we build and install to the zig-out
# directory and later copy the artifacts to the destdir in do_install().
# We use zig-out to avoid path conflicts as it is the default install
# prefix used by the zig build system.
DESTDIR="zig-out" zig build \
--sysroot "${XBPS_CROSS_BASE}" \
--libc xbps_zig_libc.txt \
-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
-Drelease-safe --prefix /usr install \
${configure_args}
}
do_install() {
cp -r zig-out/* "${DESTDIR}"
}

View file

@ -0,0 +1,13 @@
CHROOT STYLES
=============
This directory contains scripts to perform the chroot operation with xbps-src.
The scripts should accept at least 5 arguments:
- $1 (MASTERDIR) masterdir to chroot
- $2 (DISTDIR) path to the void-packages directory
- $3 (HOSTDIR) path to hostdir
- $4 (EXTRA_ARGS) additional arguments to be passed
- $5 (CMD) command to execute
- $@ remaining arguments to pass

23
common/chroot-style/bwrap.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
#
# This chroot script uses bubblewrap (see https://github.com/containers/bubblewrap)
#
set -e
readonly MASTERDIR="$1"
readonly DISTDIR="$2"
readonly HOSTDIR="$3"
readonly EXTRA_ARGS="$4"
shift 4
if ! command -v bwrap >/dev/null 2>&1; then
exit 1
fi
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
echo "$0 MASTERDIR/DISTDIR not set"
exit 1
fi
exec bwrap --bind "$MASTERDIR" / --ro-bind "$DISTDIR" /void-packages \
--dev /dev --tmpfs /tmp --proc /proc \
${HOSTDIR:+--bind "$HOSTDIR" /host} $EXTRA_ARGS "$@"

135
common/chroot-style/ethereal.sh Executable file
View file

@ -0,0 +1,135 @@
#!/bin/sh
#
# This chroot script uses symlinks to emulate being in a chroot using
# the host system as the masterdir
#
# It will damage your host system, only use it in disposable
# containers.
#
# 2 extra steps required when using this chroot-style:
# 1. Symlink / to masterdir inside the void-packages repo
# 2. write the arch of the host system, as dictated by xbps-uhelper arch
# into /.xbps_chroot_init
#
# The supported way to make use of thie chroot-style is to create
# a root filesystem that has base-chroot and git installed and
# have it inside a container engine like Docker.
#
# Docker example:
# $ mkdir -p /tmp/image
# $ xbps-install -y -r /tmp/image \
# -R http://mirrors.servercentral.com/voidlinux/current \
# -S base-chroot
# $ tar -pC /tmp/image -c . | sudo docker import - voidlinux/masterdir
# $ rm -rf /tmp/image
# # docker run --rm -it \
# -e XBPS_CHROOT_CMD=ethereal \
# -e XBPS_ALLOW_CHROOT_BREAKOUT=yes \
# -v $(pwd):/hostrepo voidlinux/masterdir \
# /bin/bash -c 'ln -s / /hostrepo/masterdir && /hostrepo/xbps-src pkg <pkgname>'
#
readonly MASTERDIR="$1"
readonly DISTDIR="$2"
readonly HOSTDIR="$3"
readonly EXTRA_ARGS="$4"
readonly CMD="$5"
shift 5
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
echo "$0 MASTERDIR/DISTDIR not set"
exit 1
fi
msg_red() {
# error messages in bold/red
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf "=> ERROR: %s\\n" "$@" >&2
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
}
fake_mount() {
# If we already have a symlink from the desired place
# to the base location then just return 0
if [ -L "$2" -a "$(readlink "$2")" = "$1" ]; then
return 0
fi
if [ -d "$2" ] && ! rmdir "$2" >/dev/null 2>&1; then
msg_red "Failed to remove $2, not empty ?\n"
exit 1
fi
[ -f "$2" -o -L "$2" ] && rm -f "$2"
ln -s "$1" "$2"
echo "linked $2 -> $1"
}
if [ "${XBPS_ALLOW_CHROOT_BREAKOUT}" != "yes" ]; then
msg_red "chroot-style 'ethereal' requires XBPS_ALLOW_CHROOT_BREAKOUT=yes\n"
msg_red "This chroot-style is meant for disposable containers and will destroy your system\n"
exit 1
fi
if [ ! -L "$MASTERDIR" -o "$(readlink "$MASTERDIR")" != "/" ]; then
msg_red "$MASTERDIR isn't symlinked to /!\n"
exit 1
fi
fake_mount "$DISTDIR" "$MASTERDIR"/void-packages
# Do the same for hostdir
if [ -n "$HOSTDIR" ]; then
fake_mount "$HOSTDIR" "$MASTERDIR"/host
fi
# xbps-src may send some other binds, parse them here
while getopts 'b:' c -- "$EXTRA_ARGS"; do
# Skip everything that's not a bind
[ "$c" = "b" ] || continue
from="${OPTARG%:*}"
to="${OPTARG#*:}"
fake_mount "$from" "$to"
mounts="${mounts} $to"
done
# Store current directory for returning later
OLDPWD="$(pwd)"
# To give the illusion we entered the chroot, cd to /
cd / || {
msg_red "Failed to change directory to root!\n"
exit 1 ; }
# Tell xbps-src that we are "in the chroot"
# Start with `env` so our environment var's stay the same
env IN_CHROOT=1 $CMD $@
# Store return of the command we care about
ret="$?"
# Return to OLDPWD
cd "${OLDPWD}"
# Remove the symlink and restore an empty dir to simulate
# an umount operation.
if [ -n "$HOSTDIR" ]; then
rm -f "$MASTERDIR"/host
mkdir -p "$MASTERDIR"/host
fi
# Same as the operation above, do it all for all mountpoints
# that were passed to us.
for m in $mounts; do
rm -f "$m"
mkdir -p "$m"
done
rm -f "$MASTERDIR"/void-packages
mkdir -p "$MASTERDIR"/void-packages
exit $ret

21
common/chroot-style/uchroot.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
#
# This chroot script uses xbps-uchroot(1).
#
readonly MASTERDIR="$1"
readonly DISTDIR="$2"
readonly HOSTDIR="$3"
readonly EXTRA_ARGS="$4"
readonly CMD="$5"
shift 5
if ! command -v xbps-uchroot >/dev/null 2>&1; then
exit 1
fi
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
echo "$0 MASTERDIR/DISTDIR not set"
exit 1
fi
exec xbps-uchroot $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@

21
common/chroot-style/uunshare.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
#
# This chroot script uses xbps-uunshare(1) with user_namespaces(7).
#
readonly MASTERDIR="$1"
readonly DISTDIR="$2"
readonly HOSTDIR="$3"
readonly EXTRA_ARGS="$4"
readonly CMD="$5"
shift 5
if ! command -v xbps-uunshare >/dev/null 2>&1; then
exit 1
fi
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
echo "$0 MASTERDIR/DISTDIR not set"
exit 1
fi
exec xbps-uunshare $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@

View file

@ -0,0 +1,35 @@
# syntax=docker/dockerfile:1
FROM --platform=${BUILDPLATFORM} alpine:3.18 AS bootstrap
ARG TARGETPLATFORM
ARG MIRROR=https://repo-ci.voidlinux.org
ARG LIBC
RUN apk add ca-certificates curl && \
curl "${MIRROR}/static/xbps-static-static-0.59_5.$(uname -m)-musl.tar.xz" | tar vJx
COPY common/repo-keys/* /target/var/db/xbps/keys/
COPY common/container/setup.sh /bootstrap/setup.sh
RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \
. /bootstrap/setup.sh; \
XBPS_TARGET_ARCH=${ARCH} xbps-install -S \
-R "${REPO}" -R "${REPO}/bootstrap" \
-r /target
FROM --platform=${BUILDPLATFORM} bootstrap AS install
ARG TARGETPLATFORM
ARG MIRROR
ARG LIBC
COPY --from=bootstrap /target /target
COPY common/container/noextract.conf /target/etc/xbps.d/noextract.conf
RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \
. /bootstrap/setup.sh; \
XBPS_TARGET_ARCH=${ARCH} xbps-install -y \
-R "${REPO}" -R "${REPO}/bootstrap" \
-r /target \
base-chroot void-repo-bootstrap
FROM scratch AS image
COPY --link --from=install /target /
RUN \
install -dm1777 tmp; \
xbps-reconfigure -fa; \
rm -rf /var/cache/xbps/*
CMD ["/bin/sh"]

View file

@ -0,0 +1,9 @@
## void-packages buildroot containers
These containers are used for CI and should contain everything needed to run xbps-src.
### Updating
To build a new version, kick off a CI run by pushing something to `common/container/` on `master` or using the `Run workflow` button [here](https://github.com/void-linux/void-packages/actions/workflows/container.yaml).
Once this is built, update the version where it is used in `.github/workflows/` (typically in the value of a `container.image` key) to the newly-built tag.

View file

@ -0,0 +1,29 @@
variable "MIRROR" {
default = "https://repo-ci.voidlinux.org/"
}
target "docker-metadata-action" {}
target "_common" {
inherits = ["docker-metadata-action"]
dockerfile = "common/container/Containerfile"
no-cache-filter = ["bootstrap"]
cache-to = ["type=local,dest=/tmp/buildx-cache"]
cache-from = ["type=local,src=/tmp/buildx-cache"]
target = "image"
args = {
"MIRROR" = "${MIRROR}"
}
}
target "void-buildroot-glibc" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
args = { "LIBC" = "glibc" }
}
target "void-buildroot-musl" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
args = { "LIBC" = "musl" }
}

View file

@ -0,0 +1,12 @@
noextract=/etc/sv*
noextract=/usr/share/man*
noextract=/usr/lib/dracut*
noextract=/etc/skel*
noextract=/usr/lib/modprobe.d*
noextract=/usr/lib/sysctl.d*
noextract=/usr/lib/udev*
noextract=/usr/share/bash-completion*
noextract=/usr/share/fish/vendor-completions.d*
noextract=/usr/share/zsh/site-functions*
noextract=/usr/share/info*
noextract=/usr/share/locale*

29
common/container/setup.sh Normal file
View file

@ -0,0 +1,29 @@
#!/bin/sh
: "${MIRROR:=https://repo-default.voidlinux.org/}"
suffix() {
case "${LIBC:?}" in
musl) echo "-musl" ;;
esac
}
repo() {
case "${ARCH:?}" in
aarch64*) echo "${MIRROR}/current/aarch64" ;;
*-musl) echo "${MIRROR}/current/musl" ;;
*) echo "${MIRROR}/current" ;;
esac
}
case "${TARGETPLATFORM:?}" in
linux/arm/v6) ARCH="armv6l$(suffix)" ;;
linux/arm/v7) ARCH="armv7l$(suffix)" ;;
linux/arm64) ARCH="aarch64$(suffix)" ;;
linux/amd64) ARCH="x86_64$(suffix)" ;;
linux/386) ARCH="i686$(suffix)" ;;
esac
REPO="$(repo)"
export ARCH REPO

View file

@ -0,0 +1,19 @@
CROSS PROFILES
==============
This directory contains cross profiles to allow cross compilation for the specified target.
A cross profile file must provide the following variables:
- XBPS_TARGET_MACHINE (as returned by uname -m + optional -musl suffix)
- XBPS_CROSS_TRIPLET (the cross compiler triplet)
- XBPS_CROSS_CFLAGS (C compiler flags for the cross compiler)
- XBPS_CROSS_CXXFLAGS (C++ compiler flags for the cross compiler)
- XBPS_CROSS_FFLAGS (Fortran compiler flags for the cross compiler)
- XBPS_CROSS_CPPFLAGS (Preprocessor flags for the cross compiler)
- XBPS_CROSS_LDFLAGS (Linker flags for the cross compiler)
- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
- XBPS_CROSS_ZIG_TARGET (the arch-os-abi target triplet for zig)
- XBPS_CROSS_ZIG_CPU (the cpu/feature set for zig)
A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.

View file

@ -0,0 +1,12 @@
# Cross build profile for ARMv8.
XBPS_TARGET_MACHINE="aarch64-musl"
XBPS_TARGET_QEMU_MACHINE="aarch64"
XBPS_CROSS_TRIPLET="aarch64-linux-musl"
XBPS_CROSS_CFLAGS="-march=armv8-a"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
XBPS_CROSS_ZIG_CPU="baseline"

View file

@ -0,0 +1,12 @@
# Cross build profile for ARMv8.
XBPS_TARGET_MACHINE="aarch64"
XBPS_TARGET_QEMU_MACHINE="aarch64"
XBPS_CROSS_TRIPLET="aarch64-linux-gnu"
XBPS_CROSS_CFLAGS="-march=armv8-a"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
XBPS_CROSS_ZIG_CPU="baseline"

View file

@ -0,0 +1 @@
armv5tel-musl.sh

View file

@ -0,0 +1 @@
armv5tel.sh

View file

@ -0,0 +1,12 @@
# Cross build profile for ARM GNU EABI5 Soft Float and Musl libc.
XBPS_TARGET_MACHINE="armv5tel-musl"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-musleabi"
XBPS_CROSS_CFLAGS="-march=armv5te -msoft-float -mfloat-abi=soft"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"

View file

@ -0,0 +1,12 @@
# Cross build profile for ARM GNU EABI5 Soft Float.
XBPS_TARGET_MACHINE="armv5tel"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-gnueabi"
XBPS_CROSS_CFLAGS="-march=armv5te -msoft-float -mfloat-abi=soft"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"

View file

@ -0,0 +1 @@
armv6l-musl.sh

View file

@ -0,0 +1 @@
armv6l.sh

View file

@ -0,0 +1,12 @@
# Cross build profile for ARM EABI5 Hard Float and Musl libc.
XBPS_TARGET_MACHINE="armv6l-musl"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-musleabihf"
XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
XBPS_CROSS_ZIG_CPU="generic+v6"

View file

@ -0,0 +1,12 @@
# Cross build profile for ARM GNU EABI5 Hard Float.
XBPS_TARGET_MACHINE="armv6l"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-gnueabihf"
XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
XBPS_CROSS_ZIG_CPU="generic+v6"

View file

@ -0,0 +1 @@
armv7l-musl.sh

View file

@ -0,0 +1 @@
armv7l.sh

View file

@ -0,0 +1,12 @@
# Cross build profile for ARMv7 EABI Hard Float and Musl libc.
XBPS_TARGET_MACHINE="armv7l-musl"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="armv7l-linux-musleabihf"
XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"

Some files were not shown because too many files have changed in this diff Show more