Arch Linux DCP-L2540DW Package File

Unfortunately for my not-so-nerdy friends, this weekend the writing I had time to do was writing a PKGBUILD file for my Brother printer.

Quick aside: Brother has fantastic support for Linux, providing both Red Hat .rpm and Debian .deb packages however, I’m using Manjaro/KDE Plasma, so neither of those options would directly work for me. This isn’t Brother’s fault - RPM and DEB packages will work on most of the common desktop Linux distros like Ubuntu, Linux Mint, Kali Linux, and of course, Fedora and Debian themselves. Arch is a truly independent distro with its own package manager and its own repositories.

That being said, I don’t have the time and energy to make a formal submission to the AUR, but in the extremely niche chance that somebody needs this exact printer to work on Arch-based Linux systems, I wanted to throw the script out onto the internet. In the even more niche chance that someone who knows how to submit to the AUR sees this, feel free to submit it for me!

The simple way to use this file is to create a folder somewhere on your computer (Doesn’t matter where, whatever makes sense to you!) and then create a PKGBUILD file inside that folder. Copy and paste the script into that file and save it, and then run makepkg -is inside that folder from a terminal. Once it finishes, assuming it succeeded, if you’re installing the printer from Manjaro/KDE Plasma’s Printer Settings options, you’ll probably need to choose the driver manually from /usr/share/brother to find the PPD file.

Disclaimer: this worked on my system as of 2025-10-26, YMMV, always read and understand what scripts do before running them on your computer, and so on. Provided for educational purposes only, etc.

# Based mostly on https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=brother-mfc-l2400dw
# with backup from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=brother-dcp1610w
# and scripting knowledge from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=brother-dcp-j1050dw
# tested locally with makepkg -is

pkgname="brother-dcp-l2540dw"
pkgver="3.2.0"
pkgrel=1
pkgdesc="LPR and CUPS driver for the Brother DCP-L2540DW series"
arch=('i686' 'x86_64')
url="https://support.brother.com/g/b/producttop.aspx?c=us&lang=en&prod=dcpl2540dw_us_as"
license=("custom:brother commercial license")
depends=('cups')
depends_x86_64=('lib32-glibc')
optdepends=('brscan4: scanner support')
source=("https://download.brother.com/welcome/dlf101717/dcpl2540dwlpr-$pkgver-$pkgrel.i386.rpm"
        "https://download.brother.com/welcome/dlf101716/dcpl2540dwcupswrapper-$pkgver-$pkgrel.i386.rpm")
md5sums=('2816da7f1cbaddc2d055a5cd6da644da'
         '5c91a139bc92684c7a454fb6bce010cd')

package() {
    _model="DCPL2540DW"
  # using /usr/share instead of /opt
  mkdir -p "$pkgdir/usr/share"
  cp -R "$srcdir/opt/brother" "$pkgdir/usr/share"
  sed -i 's|\\\/opt\\\/|\\\/usr\\\/|' "$pkgdir/usr/share/brother/Printers/$_model/cupswrapper/brother_lpdwrapper_$_model"
  sed -i 's|\\\/opt\\\/|\\\/usr\\\/|' "$pkgdir/usr/share/brother/Printers/$_model/lpd/filter_$_model"

  # /etc/printcap is managed by cups
  find "$pkgdir" -type f -name 'setupPrintcap*' -delete

  install -d "$pkgdir/usr/share/cups/model/Brother"
  ln -ns "/usr/share/brother/Printers/$_model/cupswrapper/brother_${_model}_cups_en.ppd" "$pkgdir/usr/share/cups/model/Brother/"

  chmod +x "$pkgdir/usr/share/brother/Printers/$_model/cupswrapper/brother_lpdwrapper_${_model}"
  mkdir -p "$pkgdir/usr/lib/cups/filter/"
  ln -ns "/usr/share/brother/Printers/$_model/cupswrapper/brother_lpdwrapper_${_model}" "${pkgdir}/usr/lib/cups/filter/"

  # a couple architecture-specific symlinks
  ln -ns "/usr/share/brother/Printers/$_model/lpd/$CARCH/br${_model}filter" "$pkgdir/usr/share/brother/Printers/$_model/lpd/"
  ln -ns "/usr/share/brother/Printers/$_model/lpd/$CARCH/brprintconf_${_model}" "$pkgdir/usr/share/brother/Printers/$_model/lpd/"

  install -d "$pkgdir/usr/bin"
  ln -ns "/usr/share/brother/Printers/$_model/brprintconf_${_model}" "$pkgdir/usr/bin/"
}
 
0
Kudos
 
0
Kudos

Now read this

Befriending the Bear

I’ve been thinking a lot about friendship and connection lately. Actually, before I continue, a fair warning: this post is probably going to be about loss and discovery, about coping with loss and the process of trying to find myself on... Continue →