You are not logged in.

#1 2025-01-10 11:58:36

gaucho
Member
Registered: 2009-04-24
Posts: 13

kio-onedrive-git package proposal

Hi,

looking for some OneDrive support in Dolphin I stumbled upon the project kio-onedrive:
https://invent.kde.org/bernardogn/kio-onedrive/
https://discuss.kde.org/t/kio-onedrive- … asic-usage

After building and installing on my machine I found it very helpful to access the OneDrive storage from Dolphin as OneDrive does not seem to support WebDAV access.

The project seems to be in a rather early stage (v0.0.4) but worked well for me. So I tried to setup a PKGBUILD:

# Maintainer: Gauchowaidag <gauchowaidag (at) gmail.com>

_pkgname=kio-onedrive
pkgname=${_pkgname}-git
pkgver=0.0.4.r0.g85ad8b9
pkgrel=1
arch=(x86_64)
pkgdesc="KIO Slave to access Microsoft OneDrive"
url="https://invent.kde.org/bernardogn/kio-onedrive"
license=('GPL2','GPL')
depends=(kaccounts-providers kio)
makedepends=(extra-cmake-modules git ninja)

provides=($_pkgname)
conflicts=($_pkgname)

source=("git+https://invent.kde.org/bernardogn/$_pkgname.git")
md5sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  mkdir -p build
}

build() {
  export CC=clang
  export CXX=clang++
  cmake -B build -S $_pkgname \
   -DCMAKE_BUILD_TYPE=Release \
   -DCMAKE_INSTALL_PREFIX=/usr \
   -G Ninja
  ninja -C build
}

package(){
  DESTDIR="$pkgdir" ninja -C build install
  rm $pkgdir/usr/lib/qt6/plugins/kf6/kio/*.pcm
}

I looked in to other PKGBUILDs in the AUR and tried to follow the instructions provided in the Wiki but as I did not do any PKGBUILD before, there might still be some flaws. Therefore I would be thankful if someone could do a review and/or give some feedback.

Thanks in advance!

Offline

#2 2025-01-11 12:45:38

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

Re: kio-onedrive-git package proposal

Clang needs to be added to makedepends as it is not in base-devel package (gcc is in base-devel and only compiler aur packages don't need to list in makedeps) .

You did look at https://wiki.archlinux.org/title/CMake_ … guidelines , especially its chapter 2 ?


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

#3 2025-01-12 08:10:55

gaucho
Member
Registered: 2009-04-24
Posts: 13

Re: kio-onedrive-git package proposal

Thanks for the feedback. I was not aware of the optimization setting with build type "Release". Therefore I now use "None" and it works fine compiling with -O2.

I introduced "check" function and updated "build"/"package" as shown in the CMake template on the Wiki. Also added the clang make dependency and updated the license to "GPL-2.0-or-later".

The updated PKGBUILD:

# Maintainer: Gauchowaidag <gauchowaidag (at) gmail.com>

_pkgname=kio-onedrive
pkgname=${_pkgname}-git
pkgver=0.0.4.r0.g85ad8b9
pkgrel=1
arch=(x86_64)
pkgdesc="KIO Slave to access Microsoft OneDrive"
url="https://invent.kde.org/bernardogn/kio-onedrive"
license=('GPL-2.0-or-later')
depends=(kaccounts-providers kio)
makedepends=(clang extra-cmake-modules git ninja)

provides=($_pkgname)
conflicts=($_pkgname)

source=("git+https://invent.kde.org/bernardogn/$_pkgname.git")
md5sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  mkdir -p build
}

build() {
  export CC=clang
  export CXX=clang++
  local cmake_options=(
    -B build
    -S $_pkgname
    -W no-dev
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    # Use ninja due to C++ modules
    -G Ninja
  )
  cmake "${cmake_options[@]}"
  cmake --build build -v
}

check() {
  local excluded_tests=""
  local ctest_flags=(
    --test-dir build
    --output-on-failure
    --parallel $(nproc)
    --exclude-regex "$excluded_tests"
  )
  ctest "${ctest_flags[@]}"
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  # The PCM files created on install are not needed
  rm $pkgdir/usr/lib/qt6/plugins/kf6/kio/*.pcm
}

Building is now also done with verbose flag to show compiler options on building. This might be unnecessary but I thought it might make sense especially to control optimization flags during build ;-)

Last edited by gaucho (2025-01-22 20:59:04)

Offline

#4 2025-01-22 09:45:19

zakazak
Member
Registered: 2009-07-07
Posts: 10

Re: kio-onedrive-git package proposal

Oh cool... this should help a lot with working when forced to use MS365.

Offline

#5 2025-01-22 21:02:54

gaucho
Member
Registered: 2009-04-24
Posts: 13

Re: kio-onedrive-git package proposal

Currently the PKGBUILD does not work. Seems like there is an issue with clang19 and D_FORTIFY_SOURCE flag:
https://invent.kde.org/bernardogn/kio-o … -/issues/7

The following works for me:

# Maintainer: Gauchowaidag <gauchowaidag (at) gmail.com>

_pkgname=kio-onedrive
pkgname=${_pkgname}-git
pkgver=0.0.4.r2.g314e351
pkgrel=1
arch=(x86_64)
pkgdesc="KIO Slave to access Microsoft OneDrive"
url="https://invent.kde.org/bernardogn/kio-onedrive"
license=('GPL-2.0-or-later')
depends=(kaccounts-providers kio)
makedepends=(clang extra-cmake-modules git ninja)

provides=($_pkgname)
conflicts=($_pkgname)

source=("git+https://invent.kde.org/bernardogn/$_pkgname.git")
md5sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  mkdir -p build
}

build() {
  export CC=clang
  export CXX=clang++
  # Build fails with D_FORTIFY_SOURCE being 1 or more, so we undefine it
  export CFLAGS="${CFLAGS/-Wp,-D_FORTIFY_SOURCE=?/}"
  export CXXFLAGS="${CXXFLAGS/-Wp,-D_FORTIFY_SOURCE=?/}"
  local cmake_options=(
    -B build
    -S $_pkgname
    -W no-dev
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    # Use ninja due to C++ modules
    -G Ninja
  )
  cmake "${cmake_options[@]}"
  cmake --build build -v
}

check() {
  local excluded_tests=""
  local ctest_flags=(
    --test-dir build
    --output-on-failure
    --parallel $(nproc)
    --exclude-regex "$excluded_tests"
  )
  ctest "${ctest_flags[@]}"
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}

Offline

Board footer

Powered by FluxBB