Hi oBFusCATed,
1. Yep, sure. The whitespace patch is:
diff -uNrp codeblocks-10.05-release/src/sdk/cbeditor.cpp codeblocks-10.05-release.new/src/sdk/cbeditor.cpp
--- codeblocks-10.05-release/src/sdk/cbeditor.cpp 2010-05-22 16:10:05.000000000 +0600
+++ codeblocks-10.05-release.new/src/sdk/cbeditor.cpp 2011-06-30 15:48:42.496262953 +0600
@@ -1678,7 +1678,8 @@ bool cbEditor::Save()
{
if(m_pData->m_strip_trailing_spaces)
{
- m_pData->StripTrailingSpaces();
+ // very annoying call
+ //m_pData->StripTrailingSpaces();
}
if(m_pData->m_ensure_consistent_line_ends)
{
2. I've learned these steps from Fedora's
custom kernel tutorial.
At first, you should have some rpm and yum utils:
$ su -c 'yum install rpmdevtools yum-utils'
Then you set up rpm development tree. After that you'll see ~/rpmbuild/SPECS, ~/rpmbuild/RPMS, ~/rpmbuild/BUILD and so on. I have done this in my home directory:
Then you have to download the source package (say, for codeblocks the source RPM would be codeblocks-10.05-4.fc14.src.rpm), install its dependencies and the package itself:
$ yumdownloader --source codeblocks
$ su -c 'yum-builddep codeblocks-10.05-4.fc14.src.rpm'
$ rpm -ihv codeblocks-10.05-4.fc14.src.rpm
Note, that the last rpm command should be executed under regular user (non-root). The original source archive and all the patches of your distribution will be installed to ~/rpmbuild/SOURCES without any hierarchy (which is not really convenient, when developing several rpms).
Next step is to prepare the source tree, using the .spec file for your package:
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bb --target=$(uname -m) codeblocks.spec
After that you will have the sources deployed to ~/rpmbuild/BUILD/codeblocks-10.05-release
Then you should copy the original source tree:
$ cd ~/rpmbuild/BUILD
$ cp -r codeblocks-10.05-release codeblocks-10.05-release.new
Then you modify the sources in codeblocks-10.05-release.new as you wish.
After you're done with editing, you make a patch using diff and put it to the ~/rpmbuild/SOURCES directory:
$ cd ~/rpmbuild/BUILD
$ diff -uNrp codeblocks-10.05-release codeblocks-10.05-release.new > ../SOURCES/codeblocks-my.patch
Then you should edit .spec-file in order to include your patch to RPM build. Spec-files have similar structure, but its content differs, so you should check your package's spec. What you have to do is: find list of patches, add your own patch to the list, find the patch commands and add your patching command there. You should also change release number, so that your newly build packages are not messed with the original. For ~/rpmbuild/SPECS/codeblocks.spec:
Name: codeblocks
Version: 10.05
Release: 4%{?dist} # here you put your release. For example, 4a%{?dist}, then packages will have version 10.05-4a.fc14
Summary: An open source, cross platform, free C++ IDE
Group: Development/Tools
here go distribution patches:
Patch2: %{name}-dso.patch
# update for tinyxml 2.6
Patch3: %{name}-tinyxml-26.patch
# D support - svn revisions 6553-6556
Patch4: %{name}-10.05-D.patch
# we add our own patch to the list:
Patch5: %{name}-my.patch # %{name} will be substituted with "codeblocks"
here goes patch application:
%prep
%setup -q -n %{name}-%{version}-release
%patch1 -p1 -b .tinyxml
%patch2 -p1 -b .dso
%patch3 -p1 -b .tinyxml-26
%patch4 -p1 -b .D
# we add our own patch
%patch5 -p1 -b .my
After these steps all you have to do is to build the rpms using the modified .spec:
$ rpmbuild -bb --target=$(uname -m) codeblocks.spec
You will have your RPMs under ~/rpmbuild/RPMS/<architecture>/
I also add these packages to exclude statement in /etc/yum.conf, so that they are not crashed by update.
Hope this helps.
Cheers!