Installing Code::Blocks from source on RPM based distributions

From Code::Blocks
Revision as of 15:13, 6 February 2006 by Thomas (talk | contribs)

General instructions

The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.

This has to be installed:

  1. wxGTK and its devel package
  2. wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)

Compiling the Release Candidate 2

1. Download the source RPM from www.codeblocks.org/downloads.shtml

2. Build the binary package as root

rpmbuild --rebuild codeblocks-1.0-rc2.src.rpm

3. The binary RPM should be in one of the subdirectories of /usr/src/packages/RPMS

Compiling the CVS/SVN version

1. You need a fresh CVS/SVN version, no ./bootstrap or anything else should be done before in this directory !

2. Get SVN revision number. You can see it in the last line after checking out (the number after "Revision:") or when you are in the root directory of the SVN with:

svn info | grep Revision | cut -c 11-

3. add the directory codeblocks to an tgz archive named codeblocks-1.0-svn.$SVNREVISION.tgz (replace $SVNREVISION with the number you got)

tar -czf codeblocks-1.0-svn.$SVNREVISION.tgz codeblocks

4. copy the archive as root to the directory /usr/src/packages/SOURCES and the Specfile to /usr/src/packages/SPECS/codeblocks.spec (you can name the specfile however you want)

5. Add SVN revision behind "_svnrev" in the first line.

6. build the binary package as root with

rpmbuild -bb /usr/src/packages/SPECS/codeblocks.spec

7. the package will be in one of the subdirectories of /usr/src/packages/RPMS/

8. Install it and enjoy Code::Blocks!

Use this as specfile:

%define _svnrev         
%define req_wxgtk       2.6.0
%define _suse           %(if [ -f /etc/SuSE-release ]; then echo 1; else echo 0; fi)
%define _mandriva       %(if [ -f /etc/mandrake-release ]; then echo 1; else echo 0; fi)

Name:                   codeblocks
Version:                1.0
%if %_svnrev
Release:                0.svn.%{_svnrev}
%else
Release:                0.svn
%endif
Summary:                OpenSource Cross Platform Free C++ IDE
Group:                  Development/Tools/IDE
License:                GPL
URL:                    https://www.codeblocks.org/
Packager:               Daniel Orb <danielorb2000@googlemail.com>
Source:                 %{name}-%{version}-%{release}.tgz
BuildRoot:              %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Provides:               codeblocks
Requires:               libgcc, libstdc++
%if ! %_mandriva
Requires:               wxGTK >= %{req_wxgtk}
BuildRequires:          wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
%else
Requires:               wxGTK2.6 >= %{req_wxgtk}
BuildRequires:          wxGTK2.6 >= %{req_wxgtk}, wxgtku-devel >= %{req_wxgtk}
%endif
BuildRequires:          intltool, gcc-c++, make, gettext, autoconf, automake, libtool
BuildRequires:          libstdc++, libstdc++-devel
BuildRequires:          zip
BuildRequires:          dos2unix

%if %_suse
BuildRequires:          update-desktop-files
%endif

%define pkgdata %{_datadir}/%{name}

%description
Code::Blocks is a free C++ IDE built specifically to meet the most demanding needs of its users. 
It was designed, right from the start, to be extensible and configurable.

%prep

%setup -n codeblocks

  %{?suse_update_libdir:%{suse_update_libdir}}
  %{?suse_update_config:%{suse_update_config -f}}

%build
  ./bootstrap
  %configure --enable-contrib
  %__make

%install
  %makeinstall

%post
  if [ -x /usr/bin/update-mime-database ]; then
          /usr/bin/update-mime-database "%{_datadir}/mime"
  fi
  test -x /sbin/ldconfig && /sbin/ldconfig

%preun
  if [ -x /usr/bin/update-mime-database ]; then
     /usr/bin/update-mime-database "%{_datadir}/mime"
  fi

%clean
  test -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && %__rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README COPYING AUTHORS BUGS COMPILERS TODO NEWS ChangeLog

%{_bindir}/*
%{_libdir}/*
%{_datadir}/application-registry/codeblocks.applications
%{_datadir}/applications/codeblocks.desktop
%{_datadir}/icons/gnome/48x48/mimetypes/gnome-mime-application-x-codeblocks.png
%{_datadir}/mime-info/*
%{_datadir}/mime/packages/codeblocks.xml
%{_datadir}/pixmaps/codeblocks.png
%{pkgdata}/*

%changelog
* Sat Jan  7 2005 Daniel Orb <danielorb2000@googlemail.com>
- added svn revision macro
* Thu Jan  5 2005 Daniel Orb <danielorb2000@googlemail.com>
- had to add Mandriva specific requires
* Mon Jan  2 2005 Daniel Orb <danielorb2000@googlemail.com>
- simplified the changes made before
- added ldconfig in post
- added --enable-contrib to configure
* Sun Jan  1 2005 Daniel Orb <danielorb2000@googlemail.com>
- added distribution check (SuSE, Fedora, Mandriva/Mandrake)
- added distribution specific requires and buildrequires
- added run of update-mime-database if installed