You are not logged in.

#1 2017-07-12 21:30:33

witosx
Member
Registered: 2017-07-12
Posts: 3

PKGBUILD review request: amqp-cpp-git

Hi

It is first time I would like to share a PKGBUILD. Please verify its correctness and let me know what do you think about it.

# Maintainer: Rafał Witowski <witosx@gmail.com>

pkgname=amqp-cpp-git
pkgver=v2.5.2.r90.e1f92ec
pkgrel=1
pkgdesc="C++ library for asynchronous non-blocking communication with RabbitMQ"
arch=(i686 x86_64)
url="https://github.com/CopernicaMarketingSoftware/AMQP-CPP"
license=('Apache License, Version 2.0')
makedepends=('git' 'cmake')
optdepends=(
    'libevent: for libevent support'
    'libev: for libev support'
)
provides=("amqp-cpp")
source=('git+https://github.com/CopernicaMarketingSoftware/AMQP-CPP.git#commit=e1f92ec2cccb18ae859204e219da14c0e56f98ff')
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/AMQP-CPP"
	printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
	# printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    mkdir -p "$srcdir/AMQP-CPP/build"
}

build() {
    cd "$srcdir/AMQP-CPP/build"
    cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED=ON ..
}

package() {
    cd "$srcdir/AMQP-CPP/build"
    make DESTDIR="$pkgdir" install
    install -d "$pkgdir/usr/share/licenses/amqp-cpp-git"
    install -D -m644 "$srcdir/AMQP-CPP/LICENSE" "$pkgdir/usr/share/licenses/amqp-cpp-git/LICENSE"
}

Last edited by witosx (2017-07-12 21:34:32)

Offline

#2 2017-07-12 22:08:59

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review request: amqp-cpp-git

1) If this is a git package, you shouldn't use a pinned commit but build from the latest git master.

2) Use `make` during build, rather than merely configuring cmake and relying on `make install` to also build the targets it needs during package().

3) The Apache license is considered a standard license, no need to install it, see https://wiki.archlinux.org/index.php/PKGBUILD#license
Also it should be license=('Apache') to use the uniform name.

4) There is no need to split out the mkdir into prepare() instead of including it in build() -- you would usually put things that aren't idempotent there.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2017-07-13 09:16:55

witosx
Member
Registered: 2017-07-12
Posts: 3

Re: PKGBUILD review request: amqp-cpp-git

Thank you for your response. I corrected my PKGBUILD to reflect your sugestions from points 2) 3) and 4)

When it comes to 1) I realized that I can just use released version archive, so I changed the package name to be just amqp-cpp.

Question 1: The authors of the library seem to use the uppercase version of the name "AMQP-CPP". Should I name the package using uppercase as well?
Question 2: The library provides CMakeFiles.txt as well as static Makefiles. What is preferred way of building a package in this case (with or without cmake)?
Question 3: Should I build a "release" or "debug" version for the package?

Modified PKGBUILD below. What do you think?

# Maintainer: Rafał Witowski <witosx@gmail.com>

pkgname=amqp-cpp
pkgver=2.7.4
pkgrel=1
pkgdesc="C++ library for asynchronous non-blocking communication with RabbitMQ"
arch=(i686 x86_64)
url="https://github.com/CopernicaMarketingSoftware/AMQP-CPP"
license=('Apache')
makedepends=('cmake')
optdepends=(
    'libevent: for libevent support'
    'libev: for libev support'
)
provides=("amqp-cpp")
source=("https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v${pkgver}.tar.gz")
sha1sums=('76ba6f00d2ac96ef171da85bcfadd985e7d0b567')

build() {
    mkdir -p build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED=ON ../AMQP-CPP-${pkgver}
    make
}

package() {
    cd build
    make DESTDIR="$pkgdir" install
}

Last edited by witosx (2017-07-13 09:32:29)

Offline

#4 2017-07-13 11:16:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: PKGBUILD review request: amqp-cpp-git

1) Lowercase:

wiki wrote:

pkgname
The name(s) of the package(s). This should consist of lowercase alphanumerics and any of the following characters...

The only uppercase letters in any repo packages are in locale suffixes (e.g., hunspell-en_US).  There are other packages where upstream uses uppercase, like FFTW, but the package name is still fftw.

2) Either one should be fine.  If they produce the same result, I'd advocate for just using the Makefile as it removes the cmake dependency and simplifies the process.  But if using cmake adds any benefit/customization at all, don't hesitate to use it.  Is there already a default prefix of /usr/ with the existing Makefile?  If not, you'd need to use cmake (or patch the Makefile, but in this case I'd say just use cmake).

3) Either would be acceptable, I think release makes more sense.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-07-13 11:19:12

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: PKGBUILD review request: amqp-cpp-git

A1 :
no, see https://wiki.archlinux.org/index.php/Ar … _standards

A2:
What does upstream recommend ? If they don't favor one over the other, maintainer decides.

A3:
Are you building a stable version or an experimental/development version ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#6 2017-07-13 12:06:24

witosx
Member
Registered: 2017-07-12
Posts: 3

Re: PKGBUILD review request: amqp-cpp-git

1) Thanks, I will stick to lowercase then.
2) Actually their website mentions only make + make install so i modified my PKGBUILD removing cmake usage. Makefile understands PREFIX option.
3) Also, I did a release build since it is a stable version

Third version of the PKGBUILD:

# Maintainer: Rafał Witowski <witosx@gmail.com>

pkgname=amqp-cpp
pkgver=2.7.4
pkgrel=1
pkgdesc="C++ library for asynchronous non-blocking communication with RabbitMQ"
arch=(i686 x86_64)
url="https://github.com/CopernicaMarketingSoftware/AMQP-CPP"
license=('Apache')
optdepends=(
    'libevent: for libevent support'
    'libev: for libev support'
)
provides=("amqp-cpp")
source=("https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v${pkgver}.tar.gz")
sha1sums=('76ba6f00d2ac96ef171da85bcfadd985e7d0b567')

build() {
    make -C "AMQP-CPP-${pkgver}" release
}

package() {
    make -C "AMQP-CPP-${pkgver}" PREFIX="$pkgdir/usr" install 

    # makepkg will remove *.a by default but it is just a symlink to
    # $pkgdir/usr/lib/libamqpcpp.a.$pkgver
    rm "$pkgdir/usr/lib/libamqpcpp.a.$pkgver"
}

Last edited by witosx (2017-07-13 12:14:02)

Offline

#7 2017-07-13 23:45:41

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review request: amqp-cpp-git

Debug builds just add extra content to the binaries which makepkg will then strip out anyway, so it hardly matters unless your makepkg.conf has OPTIONS=(strip debug)

But really, I wish CMake would be better about just respecting CFLAGS in the environment, since makepkg handles that too -- via DEBUG_CFLAGS which if debug is enabled are added to CFLAGS.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB