You are not logged in.

#1 2022-09-13 17:35:07

hzf
Member
Registered: 2022-09-13
Posts: 2

make package from github source code

I want to get some advice if my PKGBUILD is right or not,thanks!

pkgname=linux-wallpaperengine
pkgver=0.1
pkgrel=1
pkgdesc="use steam's wallpaperengine on linux"
arch=('any')
url="https://github.com/Almamu/linux-wallpaperengine"
license=('AGPL3')
depends=('unzip' 'cmake' 'lz4' 'zlib' 'sdl_image' 'sdl_mixer' 'sdl_sound' 'ffmpeg' 'xorg-xrandr' 'glfw-x11' 'glm' 'glew' 'freeglut' 'freeimage')
source=("${pkgname}.zip::https://codeload.github.com/Almamu/linux-wallpaperengine/zip/refs/heads/main")
sha512sums=('a4589757234070a9631dd997803cf70432d2950241d6db99704c414a75df47d9b8c9fe0c87855dcd5b3d51840b4f6f27762bd59b1e9c6ae7fbdb45243a8df88a')

prepare() {
	cd "${srcdir}/${pkgname}-main/"
    mkdir "build"
}

build() {
    cd "${srcdir}/${pkgname}-main/build"
    cmake "${srcdir}/${pkgname}-main/"
    make
}

package() {
    install -Dm755 "${srcdir}/${pkgname}-main/build/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
}

Offline

#2 2022-09-13 18:04:34

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

Re: make package from github source code

If you are pulling current code from github, you should follow the guidelines from the VCS PKGBUILD wiki page which includes the proper way to list the "source" as well as how to include a pkgver function.  The pkgname should also end in -git.

The "arch" should not be "any" as this is compiled code; instead list the architectures you know it can run on (just x86_64 is fine).

It also looks like you include a *lot* of unneeded dependencies.  Where did that list come from?

You could also remove the prepare function and include a "mkdir -p build" in the build function, though it's also fine the way it is.

EDIT: btw, welcome to the forums and thanks for putting together a package.  Don't mind my focus on the improvements that can be made, it's not intended to be critical, just useful - you've got a good start.

Last edited by Trilby (2022-09-13 18:09:01)


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

Offline

#3 2022-09-14 04:04:25

hzf
Member
Registered: 2022-09-13
Posts: 2

Re: make package from github source code

ok, thanks!

Trilby wrote:

It also looks like you include a *lot* of unneeded dependencies.  Where did that list come from?

Dependencies in the list  is needed to make this program (I had tested, without any I can't build it), I got it from it's github README.
Btw, do I need to set the hash value to 'SKIP' if I pull source code from github?

Here is the modified PKGBUILD

pkgname=linux-wallpaperengine-git
_pkgname=linux-wallpaperengine
pkgver=r245.2a6f7b7
pkgrel=1
pkgdesc="use steam's wallpaperengine on linux"
arch=('x86_64')
url="https://github.com/Almamu/linux-wallpaperengine"
license=('GPL3')
depends=('git' 'cmake' 'lz4' 'zlib' 'sdl_image' 'sdl_mixer' 'sdl_sound' 'ffmpeg' 'xorg-xrandr' 'glfw-x11' 'glm' 'glew' 'freeglut' 'freeimage')
source=("${pkgname}::git+https://github.com/Almamu/linux-wallpaperengine.git#branch=main")
sha512sums=('SKIP')

pkgver() {
    cd "$pkgname"
        ( set -o pipefail
          git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
          printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
        )
}

build() {
    cd ${srcdir}/${pkgname}
    mkdir -p build
    cd build
    cmake ${srcdir}/${pkgname}/ 
    make 
}

package() {
    install -Dm755 "${srcdir}/${pkgname}/build/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
    install -Dm644 "${srcdir}/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}

Offline

#4 2022-09-14 05:55:35

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: make package from github source code

Dependencies (the "depends" should only cover things needed to run and use the program. Build (or make-)dependencies should be covered by the makedepends array. Regarding SKIP: the answer is yes.

Offline

#5 2022-09-14 12:30:48

a821
Member
Registered: 2012-10-31
Posts: 381

Re: make package from github source code

The "mkdir -p build && cd build" in build() can be removed; just use -B / --build flags of cmake. See https://wiki.archlinux.org/title/CMake_ … irectories

Offline

Board footer

Powered by FluxBB