How can I manually build a rpm package from the source code?

Now I got the source code from github, but I want to build a usable rpm package myself, what should I do?