294 words — categories: notes
In a previous post, we talked about how to patch suckeless software using
patch. There are some limitations to that approach.
- most patches are poorly maintained
- patches tend to apply to vanilla (unedited) versions of the software
- many patches fail and require manual intervention
patchcan lead to maintenance hell
It turns out that there are some alternatives to develop a more structured, and robust, way to extend suckless software. The main inspiration came from this article, How to create and apply a patch with Git.
The workflow that I started using is as follows:
- Clone the suckless software you want on your local machine.
- Create a repo on GitHub for the software.
- Upload the local, vanilla, version of the software to GitHub.
- Tag the version as the clean version.
At this point, if you have a tag that you can use to always revert to the original build of the tool with:
git clone -b <tagname> <repository>
With this, you can always check if patches apply cleanly to the original version of the software. However, in reality, you’ll have to apply patches on top of each other. The way I do it is to:
- Create a new branch every time I want to install a patch.
- Implement the patch — I do this manually most of the time.
- Commit and push my changes from the branch.
- Merge the pull request (I prefer to do this manually on GitHub).
- Create a new tag for the new patch.
At this point, you have software that you can keep extending. When you need to clean things up, you can always download or pull the latest tag for the repo. To make the process handy, I created a couple of shell scripts. Here’s my dwm build.