Skip to content

Commit

Permalink
Merge pull request #19837 from ghbrown/aur_packaging
Browse files Browse the repository at this point in the history
AUR packaging

[PR by @ghbrown - thanks! Reviewed/merged by @mppf]

Adds packaging and build/test instructions for the Arch (Linux) User
Repository (AUR), as per [the discourse
discussion](https://chapel.discourse.group/t/when-is-setting-chpl-lib-pic-necessary-for-working-build/12339/21).

Additions:
- The chapel package for AUR tracks the static 1.26 release, but is
  non-functional due to issues in 1.26 that cause build issues on Arch.
  These issues have been resolved on `main`, but the chapel AUR package
  will be left broken until 1.27 releases (the online description of the
  broken AUR points to functioning chapel-git package).
- The chapel-git package for AUR tracks the main branch of the chapel
  repo and is fully functional.

Outstanding issues:
- updating chapel AUR to use 1.27 upon its release
- fixing the `git describe --long --tags --always` behavior for the main
  branch (currently main reports as version 1.24, while it is really 1.26
  at the time of writing).

Possible future work:
- automated copying of packaging files from their remote sources (so
  maintainers don't need to manually copy and make PRs, etc), hopefully
  such a tool would work for many different packaging formats, OSes, etc.
  and not be a one-off for Arch
- testing of packaging; it is important to test both successful install
  **and** a functioning compiler **after** build and install, as we ran
  into multiple situations where the compiler built and checked, but did
  not actually work (#19913).
  • Loading branch information
mppf authored Jun 8, 2022
2 parents 5ad2ca7 + 8e4f936 commit c2102ff
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 0 deletions.
18 changes: 18 additions & 0 deletions util/packaging/aur/chapel-git/.SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pkgbase = chapel-git
pkgdesc = Programming language designed for productive parallel computing at scale
pkgver = 1.27.0.7648.gbcc4ac3109
pkgrel = 1
url = https://chapel-lang.org/
arch = x86_64
arch = arm
license = Apache
makedepends = git
makedepends = cmake
depends = python
depends = perl
depends = llvm
depends = clang
source = git+https://github.com/chapel-lang/chapel.git
sha256sums = SKIP

pkgname = chapel-git
53 changes: 53 additions & 0 deletions util/packaging/aur/chapel-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

# Maintainer: Gabriel Brown <[email protected]>

_gituser="chapel-lang"
_gitname="chapel"

pkgname=${_gitname}-git
pkgver=1.27.0.7648.gbcc4ac3109 #autogenerated/written by pkgver()
pkgrel=1
pkgdesc="Programming language designed for productive parallel computing at scale"
url="https://chapel-lang.org/"
arch=('x86_64' 'arm')
license=('Apache')
depends=('python' 'perl' 'llvm' 'clang')
makedepends=('git' 'cmake')
source=("git+https://github.com/${_gituser}/${_gitname}.git")
sha256sums=('SKIP') # source is not static

pkgver() {
cd "${srcdir}/${_gitname}"
# get correct numerical version from internal file
ver_file="compiler/main/version_num.h"
major_ver=$(grep MAJOR_VERSION ${ver_file} | cut -d ' ' -f 3)
minor_ver=$(grep MINOR_VERSION ${ver_file} | cut -d ' ' -f 3)
update_ver=$(grep UPDATE_VERSION ${ver_file} | cut -d ' ' -f 3)
ver_num="${major_ver}.${minor_ver}.${update_ver}"
# keep second (correct) half of git describe result
gitdescribe=$(git describe --long --tags --always)
tail=$(echo ${gitdescribe} | cut -d '-' -f 2,3) # no version number
# combine two pieces
ver_hyphen="${ver_num}-${tail}"
ver=$(echo ${ver_hyphen} | sed 's/\-/\./g')
echo ${ver}
# use below when git describe begins with correct version number
#git describe --long --tags --always | sed 's/\-/\./g'
}

build() {
cd "${srcdir}/${_gitname}"
./configure --prefix=/usr
make
}

check() {
cd "${srcdir}/${_gitname}"
export PATH="${srcdir}/${_gitname}/bin/linux64-x86_64:${PATH}"
make check
}

package() {
cd "${_gitname}"
make DESTDIR="${pkgdir}" install
}
20 changes: 20 additions & 0 deletions util/packaging/aur/chapel/.SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pkgbase = chapel
pkgdesc = Programming language designed for productive parallel computing at scale
pkgver = 1.26.0
pkgrel = 1
url = https://chapel-lang.org/
arch = x86_64
arch = arm
license = Apache
makedepends = git
makedepends = cmake
makedepends = libtool
depends = python
depends = perl
depends = llvm
depends = clang
depends = gmp
source = https://github.com/chapel-lang/chapel/releases/download/1.26.0/chapel-1.26.0.tar.gz
sha256sums = ba396b581f0a17f8da3f365a3f8b079b8d2e229a393fbd1756966b0019931ece

pkgname = chapel
35 changes: 35 additions & 0 deletions util/packaging/aur/chapel/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# Maintainer: J. Emiliano Deustua <[email protected]>
# Co-maintainer: Gabriel Brown <[email protected]>

pkgname=chapel
pkgver=1.26.0
pkgrel=1
pkgdesc="Programming language designed for productive parallel computing at scale"
url="https://chapel-lang.org/"
arch=('x86_64' 'arm')
license=('Apache')
depends=('python' 'perl' 'llvm' 'clang' 'gmp')
makedepends=('git' 'cmake' 'libtool')
source=("https://github.com/chapel-lang/chapel/releases/download/${pkgver}/chapel-${pkgver}.tar.gz")
sha256sums=('ba396b581f0a17f8da3f365a3f8b079b8d2e229a393fbd1756966b0019931ece')


build() {
cd "$srcdir/${pkgname}-${pkgver}"
export CHPL_LIB_PIC=pic # remove on next release a la
# https://github.com/chapel-lang/chapel/pull/19785
./configure --prefix=/usr
make
}

check() {
cd "$srcdir/${pkgname}-${pkgver}"
export PATH="$srcdir/${pkgname}-${pkgver}/bin/linux64-x86_64:$PATH"
make check
}

package() {
cd "$srcdir/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
}
19 changes: 19 additions & 0 deletions util/packaging/aur/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

This folder contains manual copies of Arch User Repository (AUR) packaging (one AUR package per directory).
The official remote sources for each of these are `https://aur.archlinux.org/packages/<AUR package name>`.
To clone the remote git repo hosted by AUR and containing the packaging and build files `git clone https://aur.archlinux.org/<AUR package name>.git`

To test these builds:
- install the `base-devel` package using (`sudo pacman -S base-devel`) since dependence on packages included in `base-devel` is not checked; this need only be done once
- change directories to AUR package you would like to build (e.g. `cd chapel-git`).
- build ready-to-install package from source using `makepkg --syncdeps`, which also installs any required dependencies
- install the local package with `makepkg --install`, you will be prompted for the root password

To bump to the next version number:
- ensure you have maintainer priveleges to the AUR git repo and clone it (address given above)
- (in `PKGBUILD`) update the version number and checksum (and dependencies if needed)
- generate the `.SRCINFO` from `PKGBUILD` using `makepkg --printsrcinfo > .SRCINFO`
- `add`, `commit`, and `push` your changes

For more detailed info about the purpose of the variables and functions in `PKGBUILD` see the articles on [`PKGBUILD`](https://wiki.archlinux.org/title/PKGBUILD) and [`makepkg`](https://wiki.archlinux.org/title/Makepkg) from the Arch Wiki.
[This article](https://wiki.archlinux.org/title/Creating_packages) contains a more general overview of packaging for Arch.

0 comments on commit c2102ff

Please sign in to comment.