-
-
Notifications
You must be signed in to change notification settings - Fork 519
Building a package
Please note, that this page is not complete and is just to be used as a reference.
Distributions marked with ?? are just, that instructions have not been written yet.
git clone https://github.com/openrazer/openrazer -b TARGET_BRANCH
cd openrazer
# Build dependencies
sudo apt install debhelper dh-python linux-headers-generic python3-setuptools lsb-release dkms
sudo apt install dh-dkms # 23.04 and later
./scripts/build_debs.sh
sudo apt install ./dist/*.deb
sudo dnf install rpm-build rpmdevtools
rpmdev-setuptree
cd ~/rpmbuild/SPECS
curl -O https://raw.githubusercontent.com/openrazer/OBS-packaging/master/openrazer.spec
# To build from custom sources, pause here to edit openrazer.spec:
# Replace the line with "#define gitcommit" with "%define gitcommit $yourcommit"
# Optionally you will have to edit the first "Source0:" line to point to a different repository than openrazer/openrazer.
spectool -g -R openrazer.spec
sudo dnf -y builddep openrazer.spec
rpmbuild -bb openrazer.spec
sudo dnf install ../RPMS/noarch/*.rpm
sudo zypper install rpmdevtools rpm-build
rpmdev-setuptree
curl -O https://raw.githubusercontent.com/openrazer/OBS-packaging/master/openrazer.spec
# To build from custom sources, pause here to edit openrazer.spec, see the Fedora section for details.
rpmdev-spectool -g -R openrazer.spec
# install the build dependencies (can't find a better command)
sudo zypper install python3-devel
rpmbuild -bb openrazer.spec
sudo zypper install ../RPMS/noarch/*.rpm
Install the openrazer-meta or the openrazer-meta-git package from AUR.
This is useful if you want to build the openrazer packages from a fork of the main repository and/or from a specific git branch or commit.
- Git clone the openrazer-meta-git AUR package by going to its page and using the "Git Clone URL":
git clone https://aur.archlinux.org/openrazer-git.git
- Inside the openrazer-git directory there should e a PKGBUILD file. Inside it there is a line that defines the git source to use:
source=("git+https://github.com/openrazer/openrazer.git")
. You can edit this in one of the following ways:- Edit this to use another git repo. For example, use your own fork of the openrazer repo:
source=("git+https://github.com/<your github username>/openrazer.git")
- Edit this to use a specific branch:
source=("git+https://<git repo url>#branch=<branch name>")
- Edit this to use a specific commit:
source=("git+https://<git repo url>#commit=<commit hash>")
- Edit this to use another git repo. For example, use your own fork of the openrazer repo:
- Run
makepkg -sC
in the PKGBUILD directory to build the openrazer packages. This will also install any needed dependencies. - If the build was successful, the packages should be in the PKGBUILD directory with the extension
.pkg.tar.gz
or.pkg.tar.zst
. Install them withpacman -U
, for example:pacman -U ./*openrazer*.pkg.tar.*
This is useful if you are developing a feature and you want to build from the local source tree that you're working on.
The steps are the same as in the previous section except for step 2. Instead of editing the source
line, do the following and replace the /path/to/your/openrazer/source/tree
with your own:
diff --git a/openrazer-git/PKGBUILD b/openrazer-git/PKGBUILD
index f63764c..0ade1fe 100644
--- a/openrazer-git/PKGBUILD
+++ b/openrazer-git/PKGBUILD
@@ -11,8 +11,8 @@ arch=('any')
url="https://github.com/openrazer/openrazer"
license=('GPL2')
makedepends=('git' 'python-setuptools')
-source=("git+https://github.com/openrazer/openrazer.git")
-sha256sums=('SKIP')
+source=()
+sha256sums=()
pkgver() {
cd "$_pkgbase"
@@ -27,6 +27,8 @@ prepare() {
echo "Please build this package in a clean chroot (e.g. with https://wiki.archlinux.org/title/DeveloperWiki:Building_in_a_clean_chroot) or point your PATH variable to prefer /usr/bin/ temporarily."
return 1
fi
+
+ cp -ar "/path/to/your/openrazer/source/tree" "$srcdir/openrazer"
}
package_python-openrazer-git() {
This will copy your local openrazer source tree to the src directory used by makepkg instead of cloning it from git.
??
git clone https://github.com/openrazer/openrazer -b TARGET_BRANCH
cd openrazer
sed -i '/linux-headers-generic/d' debian/control
sudo apt install debhelper linux-headers-amd64 python3-setuptools lsb-release dkms # build dependencies
./scripts/build_debs.sh
sudo apt install ./dist/*.deb