You are not logged in.

#1 2020-09-21 19:34:12

daniel_shub
Member
Registered: 2012-06-21
Posts: 82

Help with building a DKMS package

I am trying to build the akvcam-dkms package in a clean chroot with makechrootpkg. In order to get it to build I need to add the linux-headers package to the depends array (maybe makedepends would work), but this seems off according to the DKMS Packaging Guidelines which says to remove linux-headers. Is there something wrong with the PKGBUILD or am I missing something else?

Offline

#2 2020-09-21 19:41:36

loqs
Member
Registered: 2014-03-06
Posts: 17,368

Re: Help with building a DKMS package

The PKGBUILd running make is the issue.  DKMS packages are intended to provide source which will be built after installation.
Edit:

diff --git a/PKGBUILD b/PKGBUILD
index be4a4bc..a705958 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,33 +6,20 @@ pkgver=1.1.0
 pkgrel=2
 pkgdesc="Virtual camera for Linux"
 url="https://github.com/webcamoid/akvcam"
-arch=('x86_64' 'i686')
-license=('GPLv2')
+arch=('any')
+license=('GPL2')
 depends=('dkms')
-conflicts=("${_pkgbase}-dkms")
-provides=("${_pkgbase}-dkms")
-install="${pkgname}.install"
-source=("https://github.com/webcamoid/${_pkgbase}/archive/${pkgver}.tar.gz"
-        "${pkgname}.install")
-md5sums=('22e54cacef55af98fe05f180217dae4c'
-         '3e315711dc9e57c9ba963abea81468b1')
-
-build() {
-    cd "$srcdir/${_pkgbase}-${pkgver}/src"
-    make
-}
+source=("$pkgname-$pkgver.tar.gz::https://github.com/webcamoid/${_pkgbase}/archive/${pkgver}.tar.gz")
+md5sums=('22e54cacef55af98fe05f180217dae4c')
 
 package() {
     cd "${srcdir}/${_pkgbase}-${pkgver}"
     mkdir -p "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
     cp -vf COPYING "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
-    mkdir -p "${pkgdir}/usr/share/licenses/${_pkgbase}"
-    cp -vf COPYING "${pkgdir}/usr/share/licenses/${_pkgbase}"
     mkdir -p "${pkgdir}/etc/${_pkgbase}/examples"
     cp -vf share/config_example.ini "${pkgdir}/etc/${_pkgbase}"
     cp -vf share/examples/output.c "${pkgdir}/etc/${_pkgbase}/examples"
     cd "${srcdir}/${_pkgbase}-${pkgver}/src"
     cp -ar * "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
     cd "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
-    make clean
 }
diff --git a/akvcam-dkms.install b/akvcam-dkms.install
deleted file mode 100644
index 42bb6a0..0000000
--- a/akvcam-dkms.install
+++ /dev/null
@@ -1,18 +0,0 @@
-# old version (without -$pkgrel): ${1%%-*}
-# new version (without -$pkgrel): ${2%%-*}
-
-post_install() {
-    dkms install akvcam/${1%%-*}
-}
-
-pre_upgrade() {
-    pre_remove ${2%%-*}
-}
-
-post_upgrade() {
-    post_install ${1%%-*}
-}
-
-pre_remove() {
-    dkms remove akvcam/${1%%-*} --all
-}
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>

_pkgbase=akvcam
pkgname=${_pkgbase}-dkms
pkgver=1.1.0
pkgrel=2
pkgdesc="Virtual camera for Linux"
url="https://github.com/webcamoid/akvcam"
arch=('any')
license=('GPL2')
depends=('dkms')
source=("$pkgname-$pkgver.tar.gz::https://github.com/webcamoid/${_pkgbase}/archive/${pkgver}.tar.gz")
md5sums=('22e54cacef55af98fe05f180217dae4c')

package() {
    cd "${srcdir}/${_pkgbase}-${pkgver}"
    mkdir -p "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
    cp -vf COPYING "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
    mkdir -p "${pkgdir}/etc/${_pkgbase}/examples"
    cp -vf share/config_example.ini "${pkgdir}/etc/${_pkgbase}"
    cp -vf share/examples/output.c "${pkgdir}/etc/${_pkgbase}/examples"
    cd "${srcdir}/${_pkgbase}-${pkgver}/src"
    cp -ar * "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
    cd "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
}

Last edited by loqs (2020-09-21 19:50:19)

Offline

#3 2020-09-21 19:51:48

daniel_shub
Member
Registered: 2012-06-21
Posts: 82

Re: Help with building a DKMS package

Thanks. That is probably what the rest of the DKMS packaging guidelines are probably saying in language that someone who is packaging a DKMS module probably understands. It makes total sense and I was curious how the package was going to handle different kernels and kernel updates. By building it after installation, you get around that nightmare.

Offline

#4 2020-09-22 21:33:50

hipersayan_x
Member
Registered: 2014-12-09
Posts: 36
Website

Re: Help with building a DKMS package

The point of building before the installation is to test that the module will compile fine with the current kernel in use. Now, if you updated the kernel before installing or updating the module and you did not rebooted your system the build will fail because /lib/modules won't match uname -r.
I can set arch=('any') (even though I didn't tested it in other non-Intel based platforms), not problem with this, but I'm not sure of removing the build step.

Offline

#5 2020-09-22 21:43:19

loqs
Member
Registered: 2014-03-06
Posts: 17,368

Re: Help with building a DKMS package

Why not test the package by installing it after build?

arch=('any') is because the packages only supplies source.

Edit:
A clean chroot will have no kernel or kernel headers and as the package does not include them as any type of dependency the build will fail in a clean chroot.

The other changes were:
Removing the .install file as the dkms package provides hooks for DKMS package installation,  upgrade and removal.
Unique source name.
Changed the license to GPL2 which is a common license provided by the licenses package so does not need to be provided.
Dropped package conflicting and providing itself.

Last edited by loqs (2020-09-22 22:09:50)

Offline

#6 2020-09-22 22:50:04

hipersayan_x
Member
Registered: 2014-12-09
Posts: 36
Website

Re: Help with building a DKMS package

Ok, I've applied all changes, hope it works better.

Offline

#7 2020-09-22 23:08:09

loqs
Member
Registered: 2014-03-06
Posts: 17,368

Re: Help with building a DKMS package

If you wanted to do a build in the PKGBUILD you could make it a split package.
Add makedepends for linux-headers ,  move dkms to a dependency of the dkms package and linux as a dependency of the none dkms package.
The existing package function could be used for the dkms package and the none dkms package would need to install the built module.

Offline

#8 2020-09-22 23:29:41

hipersayan_x
Member
Registered: 2014-12-09
Posts: 36
Website

Re: Help with building a DKMS package

loqs wrote:

If you wanted to do a build in the PKGBUILD you could make it a split package.
Add makedepends for linux-headers ,  move dkms to a dependency of the dkms package and linux as a dependency of the none dkms package.
The existing package function could be used for the dkms package and the none dkms package would need to install the built module.

No, much problem, if it works ok, it's fine for me.

Offline

Board footer

Powered by FluxBB