I write this article after the testing of this procedure to fix a bug on KDE 5.37.0 that I got it on Debian Sid:
So what is the procedure?
After found the package to recompile you have to do that command:
apt-get source plasma-framework apt-get build-dep plasma-framework
In that way all the sources with the debian patches with the compile settings are downloaded and integrated in the same folder and all the dependences required to compile will be in the system.
Now you will have a folder called plasma-framework with everything, so you can do what do you need as in my case I have only added 3 lines of code in a file.
The next step is to create a compressed file of this folder, like
plasma-framework_5.37.0.orig.tar.xz. You can find the name of the file because there is in your folder where you run the
apt-get build-dep. So you need only to remove that file and use that string name for the file compressed that you are generating. Don’t be worry about the file format because the next command will support many format of compressed file in linux (no zip!).
Now as a root you have to execute:
debuild -uc -us
In that way will be generated all the debian file with the compile of them.
Remember that a debian package can share the source package with many others so as this case you will get different *.deb files and is better to install all of them.
In my case to see the fix was required a reboot because it was a fix in KDE of a system library and not a single application.