Creating an AUR package

Bellow are the instructions GPT gave me to create my own AUR package.
I need to do this for my printer/scanner which has no package yet, and it will be based on an existing .rpm from the printer maker.

Are these steps ok? Or overkill? Or just garbage?

=================================

Creating an Arch User Repository (AUR) package for Garuda Linux involves several steps. Garuda Linux is based on Arch Linux, so the AUR is a convenient way to install and manage software. Here’s a general guide on how to create an AUR package:

  1. Install Required Software:
    Make sure you have the necessary tools installed. You’ll need base-devel and git packages. Install them using:
sudo pacman -S base-devel git
  1. Clone the AUR Package Template:
    Clone the AUR package template from the Arch Linux Git repository. This template provides a standardized structure for AUR packages.
git clone https://aur.archlinux.org/yay.git
  1. Navigate to the Package Folder:
    Go to the directory where yay was cloned:
cd yay
  1. Create the Package:
    In this directory, create a new directory with the name of your package. This will contain all the files related to your package.
mkdir -p mypackage-git
  1. Navigate to the New Package Folder:
    Move into the newly created package directory:
cd mypackage-git
  1. Create the PKGBUILD File:
    Inside the package directory, create a file named PKGBUILD. This file contains information about your package, such as its name, version, source, and build instructions. You can use a text editor like nano or vim to create and edit the file.
nano PKGBUILD

Here’s a minimal example of a PKGBUILD file:

# Maintainer: Your Name <[email protected]>
pkgname=mypackage-git
pkgver=1.0.0
pkgrel=1
pkgdesc="Description of your package."
arch=('any')
url="https://example.com"
license=('MIT')
depends=('dependency1' 'dependency2')
makedepends=('git')
source=("git+https://github.com/yourusername/yourrepository.git")

pkgver() {
    cd "$srcdir/$_pkgname"
    git describe --tags | sed 's/-/+/g'
}

build() {
    cd "$srcdir/$_pkgname"
    make
}

package() {
    cd "$srcdir/$_pkgname"
    make DESTDIR="$pkgdir/" install
}

Customize this template according to your package’s details.

  1. Save and Exit:
    Save the PKGBUILD file and exit the text editor.

  2. Create a Tarball:
    Create a tarball of your package:

makepkg --printsrcinfo > .SRCINFO
makepkg -efi

This will generate a package file with a .pkg.tar.zst extension.

  1. Install the Package:
    Install your package using pacman:
sudo pacman -U mypackage-git-1.0.0-1-any.pkg.tar.zst
  1. Clean Up:
    Clean up the build files:
cd ..
rm -rf mypackage-git
  1. Submit to AUR:
    Finally, you can submit your package to the AUR. Use yay or another AUR helper to do this:
yay -S --rebuild mypackage-git

Follow the prompts to submit your package to the AUR.

Remember to replace placeholder values in the PKGBUILD file with your actual package details. Additionally, consider checking the Arch Packaging Standards and the Arch Wiki for more detailed information on creating and maintaining packages.

Hi @Dadrake, I moved your post out of the Chaotic-AUR thread because it is not related to the Chaotic repo in any way.


What model of printer do you have?

1 Like

Hi!

I have the Brother MFC -7460DN Printer-Scanner (forget the Fax :wink:

I’ve already given a try to an install from .rpm, but I’d like to have a proper package, so I’ll learn how to make one.

It has been working somewhat with a compatibility package but it no longer works and it wasn’t quite right on the margins (and no scanner).

This post is a reboot from Brother printer drivers

It looks like someone already made an AUR package for this printer: AUR (en) - brother-mfc-7460dn

You can install it with Paru.

paru brother-mfc-7460dn

Press Q to exit the PKGBUILD and proceed with the installation.

1 Like

:astonished:

I’ve just searched it again (before posting) I couldn’t find it!!! :confused:

Well… thanks for the pointer! :+1:

(I hope it’s the full package with the scanner part)

Thank you for your help @BluishHumility !

After fiddling a bit with the UI to add the printer itself, the drivers show up and it’s back to working well.

(I’ll check the scanner later)

Edit: I also installed a2ps as per the suggestion in a comment on the AUR page you linked.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.