You are not logged in.

#1 2022-07-24 06:20:35

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

PKGBUILD review request: corecomponents

This is my first Arch package. I made a split package for my favorite toolkit. Feedback is welcome.

Here's the PKGBUILD:

# Maintainer: Frank Mertens <frank at cyblogic dot de>

pkgbase=corecomponents
pkgname=(
    'corecomponents_core'
    'corecomponents_core_tools'
    'corecomponents_syntax'
    'corecomponents_glob'
    'corecomponents_meta'
    'corecomponents_testing'
    'corecomponents_crypto'
    'corecomponents_crypto_tools'
    'corecomponents_network'
    'corecomponents_network_tools'
    'corecomponents_http'
    'corecomponents_http_plugins'
    'corecomponents_http_tools'
    'corecomponents_toki'
    'corecomponents_toki_tools'
    'corecomponents_ux'
    'corecomponents_ux_plugins'
    'corecomponents_tools'
)
pkgver=2.2.0
pkgrel=1
pkgdesc="Toolkit for C++ application development"
url="https://www.corecomponents.io"
arch=('x86_64')
license=('GPL3')
source=(
    "https://www.corecomponents.io/download/CoreComponents-$pkgver.tar.gz"
)
md5sums=(
    '8c82fc143b17bd0bb905e8d8f4aab07d'
)
sha1sums=(
    '7ba060f9edf88eba6e553984fd764ff40ed31421'
)

makedepends=(
    'gcc>=10.0.0'
    'readline'
    'gnutls>=3.3.5'
    'cairo'
    'freetype2'
    'libwebp'
    'sdl2>=2.0.10'
)

prepare() {
    rm -rf CoreComponents
    ln -s CoreComponents-$pkgver CoreComponents
    rm -rf bootstrap
    mkdir bootstrap
    cd bootstrap
    ../CoreComponents-$pkgver/bootstrap
}

build() {
    rm -rf core_release
    mkdir core_release
    cd core_release
    ../bootstrap/ccbuild -prefix=/usr -release -test ../CoreComponents/tools
    ./ccbuild -prefix=/usr -release -test ../CoreComponents
}

package_corecomponents_core() {
    pkgdesc="$pkgdesc: system abstraction and language primitives"
    cd core_release
    ../bootstrap/ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Core/src
}

package_corecomponents_core_tools() {
    pkgdesc="$pkgdesc: misc. command line utilities"
    depends=('corecomponents_core')
    cd core_release
    ../bootstrap/ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Core/tools
}

package_corecomponents_syntax() {
    pkgdesc="$pkgdesc: building blocks for building recursive descent parsers"
    depends=('corecomponents_core')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Syntax/src
}

package_corecomponents_glob() {
    pkgdesc="$pkgdesc: string and file name pattern matching"
    depends=('corecomponents_syntax')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Glob/src
}

package_corecomponents_meta() {
    pkgdesc="$pkgdesc: object serialization, deserialization and validation"
    depends=('corecomponents_syntax')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Meta/src
}

package_corecomponents_testing() {
    pkgdesc="$pkgdesc: unit testing and test automation"
    depends=('corecomponents_testing')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Testing/src
}

package_corecomponents_crypto() {
    pkgdesc="$pkgdesc: cryptographic primitives"
    depends=('corecomponents_core')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Crypto/src
}

package_corecomponents_crypto_tools() {
    pkgdesc="$pkgdesc: cryptographic tools"
    depends=('corecomponents_crypto' 'readline')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Crypto/tools
}

package_corecomponents_network() {
    pkgdesc="$pkgdesc: network sockets, interface status and routing information"
    depends=('corecomponents_glob')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Network/src
}

package_corecomponents_network_tools() {
    pkgdesc="$pkgdesc: networking tools"
    depends=('corecomponents_network')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Network/tools
}

package_corecomponents_http() {
    pkgdesc="$pkgdesc: http(s) client/server classes"
    depends=('corecomponents_meta' 'corecomponents_glob' 'corecomponents_network' 'gnutls>=3.3.5')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/HTTP/src
}

package_corecomponents_http_plugins() {
    pkgdesc="$pkgdesc: http(s) server plugins"
    depends=('corecomponents_http')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/HTTP/plugins
}

package_corecomponents_http_tools() {
    pkgdesc="$pkgdesc: http(s) tools"
    depends=('corecomponents_http_plugins')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/HTTP/tools
}

package_corecomponents_toki() {
    pkgdesc="$pkgdesc: syntax highlighting library"
    depends=('corecomponents_meta' 'corecomponents_glob')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Toki/src
}

package_corecomponents_toki_tools() {
    pkgdesc="$pkgdesc: syntax highlighting tools"
    depends=('corecomponents_toki')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/Toki/tools
}

package_corecomponents_ux() {
    pkgdesc="$pkgdesc: graphical user interfaces"
    depends=('corecomponents_core' 'corecomponents_ux_plugins' 'cairo' 'freetype2' 'libwebp')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/UX/src
}

package_corecomponents_ux_plugins() {
    pkgdesc="$pkgdesc: graphical user interface style and platform plugins"
    depends=('sdl2>=2.0.10')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/UX/plugins
}

package_corecomponents_tools() {
    pkgdesc="$pkgdesc: common developer tools (build system, etc.)"
    depends=('corecomponents_tools')
    cd core_release
    ./ccbuild -root=$pkgdir -install -release -test ../CoreComponents/tools
}

Offline

#2 2022-07-24 06:23:02

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,481
Website

Re: PKGBUILD review request: corecomponents

Looks fine to me.  Note the deleting, resymlinking etc that is done prevents reusing built files in the event of no changes to the source, but I don't know how much that matters.

Offline

#3 2022-07-24 08:48:13

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: corecomponents

$pkgdir should be double-quoted.

Offline

#4 2022-07-24 14:43:25

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: corecomponents

@willemw: You are right. Added the quotes.

@Allan: I cleaned it up a bit. I'm not sure what the common workflows with "makepkg" are. From the manual I guess that 'makepkg -ef' could be a thing and I made sure it does not rebuild if the source didn't change. Otherwise the build system of course depends on file times...

The changed PKGBUILD:

# Maintainer: Frank Mertens <frank at cyblogic dot de>

pkgbase=corecomponents
pkgname=(
    'corecomponents_core'
    'corecomponents_core_tools'
    'corecomponents_syntax'
    'corecomponents_glob'
    'corecomponents_meta'
    'corecomponents_testing'
    'corecomponents_crypto'
    'corecomponents_crypto_tools'
    'corecomponents_network'
    'corecomponents_network_tools'
    'corecomponents_http'
    'corecomponents_http_plugins'
    'corecomponents_http_tools'
    'corecomponents_toki'
    'corecomponents_toki_tools'
    'corecomponents_ux'
    'corecomponents_ux_plugins'
    'corecomponents_tools'
)
pkgver=2.2.0
pkgrel=1
pkgdesc="Toolkit for C++ application development"
url="https://www.corecomponents.io"
arch=('x86_64')
license=('GPL3')
source=(
    "https://www.corecomponents.io/download/CoreComponents-$pkgver.tar.gz"
)
md5sums=(
    '8c82fc143b17bd0bb905e8d8f4aab07d'
)
sha1sums=(
    '7ba060f9edf88eba6e553984fd764ff40ed31421'
)

makedepends=(
    'gcc>=10.0.0'
    'readline'
    'gnutls>=3.3.5'
    'cairo'
    'freetype2'
    'libwebp'
    'sdl2>=2.0.10'
)

prepare() {
    rm -rf CoreComponents
    ln -s CoreComponents-$pkgver CoreComponents
    if [ ! -x bootstrap/ccbuild ]; then
        mkdir -p bootstrap
        pushd bootstrap
        ../CoreComponents-$pkgver/bootstrap
        popd
    fi
    if [ ! -x build/ccbuild ]; then
        mkdir -p build
        pushd build
        ln -s ../bootstrap/ccbuild
        popd
    fi
}

build() {
    cd build
    ./ccbuild -prefix=/usr -release -test ../CoreComponents
}

package_corecomponents_core() {
    pkgdesc="$pkgdesc: system abstraction and language primitives"
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Core/src
}

package_corecomponents_core_tools() {
    pkgdesc="$pkgdesc: misc. command line utilities"
    depends=('corecomponents_core')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Core/tools
}

package_corecomponents_syntax() {
    pkgdesc="$pkgdesc: building blocks for building recursive descent parsers"
    depends=('corecomponents_core')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Syntax/src
}

package_corecomponents_glob() {
    pkgdesc="$pkgdesc: string and file name pattern matching"
    depends=('corecomponents_syntax')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Glob/src
}

package_corecomponents_meta() {
    pkgdesc="$pkgdesc: object serialization, deserialization and validation"
    depends=('corecomponents_syntax')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Meta/src
}

package_corecomponents_testing() {
    pkgdesc="$pkgdesc: unit testing and test automation"
    depends=('corecomponents_testing')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Testing/src
}

package_corecomponents_crypto() {
    pkgdesc="$pkgdesc: cryptographic primitives"
    depends=('corecomponents_core')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Crypto/src
}

package_corecomponents_crypto_tools() {
    pkgdesc="$pkgdesc: cryptographic tools"
    depends=('corecomponents_crypto' 'readline')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Crypto/tools
}

package_corecomponents_network() {
    pkgdesc="$pkgdesc: network sockets, interface status and routing information"
    depends=('corecomponents_glob')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Network/src
}

package_corecomponents_network_tools() {
    pkgdesc="$pkgdesc: networking tools"
    depends=('corecomponents_network')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Network/tools
}

package_corecomponents_http() {
    pkgdesc="$pkgdesc: http(s) client/server classes"
    depends=('corecomponents_meta' 'corecomponents_glob' 'corecomponents_network' 'gnutls>=3.3.5')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/HTTP/src
}

package_corecomponents_http_plugins() {
    pkgdesc="$pkgdesc: http(s) server plugins"
    depends=('corecomponents_http')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/HTTP/plugins
}

package_corecomponents_http_tools() {
    pkgdesc="$pkgdesc: http(s) tools"
    depends=('corecomponents_http_plugins')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/HTTP/tools
}

package_corecomponents_toki() {
    pkgdesc="$pkgdesc: syntax highlighting library"
    depends=('corecomponents_meta' 'corecomponents_glob')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Toki/src
}

package_corecomponents_toki_tools() {
    pkgdesc="$pkgdesc: syntax highlighting tools"
    depends=('corecomponents_toki')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/Toki/tools
}

package_corecomponents_ux() {
    pkgdesc="$pkgdesc: graphical user interfaces"
    depends=('corecomponents_core' 'corecomponents_ux_plugins' 'cairo' 'freetype2' 'libwebp')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/UX/src
}

package_corecomponents_ux_plugins() {
    pkgdesc="$pkgdesc: graphical user interface style and platform plugins"
    depends=('sdl2>=2.0.10')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/UX/plugins
}

package_corecomponents_tools() {
    pkgdesc="$pkgdesc: common developer tools (build system, etc.)"
    depends=('corecomponents_tools')
    cd build
    ./ccbuild -root="$pkgdir" -install -release ../CoreComponents/tools
}

One thing I was wondering: Can I get the number of CPU cores the user wishes to use? Otherwise I'm scaling to max and I fear it might kill some smaller boards...

Offline

#5 2022-07-25 07:14:37

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: corecomponents

If a small SBC board can overheat, then the user can set the maximum number of CPU cores used system-wide, for example:

MAKEFLAGS="-j1"

in /etc/makepkg.conf.

Offline

#6 2022-07-25 09:25:40

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,033

Re: PKGBUILD review request: corecomponents

That setting is useful , but only affects software using autotools build system .

CoreComponents appears to use a custom build system.

Checking it indicates the shellscript at tools/build/bootstrap does the work and that calls g++ directly .

g++ -o ccbuild -pthread .modules-46002B89-$MACHINE-tools_build/.lump.o -fPIC -pie -O0 -L. -lCoreComponentsCore -lCoreComponentsGlob -lCoreComponentsMeta -Wl,--enable-new-dtags,-rpath='$ORIGIN',-rpath='$ORIGIN'/../lib,-rpath-link='$ORIGIN'

There are some references that adding -pipe will keep more cores busy, but you want the reverse.


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

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#7 2022-07-25 12:52:38

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: corecomponents

An alternatvie prepare(), without if-statements, pushd/popd:

prepare() {
    rm -rf CoreComponents
    ln -s CoreComponents-$pkgver CoreComponents

    mkdir -p bootstrap build
    ln -sf "$srcdir"/{bootstrap,build}/ccbuild

    cd bootstrap
    ../CoreComponents-$pkgver/bootstrap
}

Offline

#8 2022-07-25 16:49:07

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: corecomponents

@Lone_Wolf, @willemw: Thanks for pointing me to the right place. YES, MAKEFLAGS is used by many meta build systems. I simply added support to respect this environment variable to ccbuild.

@willemw: Thanks for simplifying my script magic. Actually the esoteric logic was there for an esoteric reason! First I didn't like to rerun bootstrap if there is already a bootstrapped version of ccbuild (4s is a lifetime!-). Secondly ccbuild actually builds itself afterwards and the build continues with optimized version of ccbuild. That is very non-obvious, but faster that way!

Besides that I'm really astonished how well that split package logic fits my needs. Arch really has something going for it (dead old Debian user saying this...).

Offline

#9 2022-07-26 11:28:08

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,033

Re: PKGBUILD review request: corecomponents

@Lone_Wolf, @willemw: Thanks for pointing me to the right place. YES, MAKEFLAGS is used by many meta build systems. I simply added support to respect this environment variable to ccbuild.

CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
LTOFLAGS="-flto=auto"

Does ccbuild honor those flags ?
(they are copied from latest makepkg.conf as distributed with pacman 6.0.1-5 )


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

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2022-07-29 07:05:25

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: corecomponents

That's a good point. Currently it only makes used of CFLAGS/CXXFLAGS. I will make sure it also handles LDFLAGS correctly in the next patch release...

Offline

#11 2022-07-29 08:34:43

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: corecomponents

I pushed a new version 2.2.1 to make ccbuild handle LDFLAGS properly.

See:
https://aur.archlinux.org/packages/corecomponents_tools

The only issue I usually have with these linker flags used by the distributions is "-Wl,--no-as-needed" which messes up automatic library initialization in C++.
The library linked might not be needed, because non of its exported symbols are used, yet the library initialization created with anonymous C++ namespaces might still do smth. that is needed.
Anyways, otherwise it is great to have everything linked the same way...

Offline

#12 2022-07-30 07:11:39

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: corecomponents

Maybe add some tests by running "ccbuild -test-run ..." in check().

Offline

#13 2022-07-30 13:18:08

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: corecomponents

@willemw: Yes, I was thinking about that already. I've added a "check()" method, see the last AUR commit.

Offline

Board footer

Powered by FluxBB