Installing Code::Blocks from source on RPM based distributions

From Code::Blocks

Compiling the CVS version

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

2. add the directory codeblocks to an tar.gz archive named codeblocks-1.0-cvs.tar.gz

tar -czf codeblocks-1.0-cvs.tar.gz codeblocks

3. copy the archive in the directory /usr/src/packages/SOURCES and the Specfile to /usr/src/packages/SPECS/codeblocks.spec

4. build the binary package as root with

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

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

6. Install it and enjoy !

Use this as Specfile:

Name:           codeblocks
Version:        1.0
Release:        cvs
Summary:        An open source, cross platform, free C++ IDE.
Group:          Development/Tools/IDE
License:        GPL
URL:            https://www.codeblocks.org/
Packager:       Daniel Orb <danielorb2000@yahoo.de>
Source:         %{name}-%{version}-%{release}.tgz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Provides:       codeblocks
BuildRequires:  zip
BuildRequires:  dos2unix
 
%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.
Built around a plugin framework, Code::Blocks can be extended with plugin DLLs. It includes a plugin wizard so you can compile your  own plugins!

Features:

       Highlights:

           * Open Source! GPL2, no hidden costs.
           * Cross-platform. Runs on Linux or Windows (uses wxWidgets).
           * Made in GNU C++. No interpreted languages or proprietary libs needed.
           * Comes in two presentations: Standalone, and MinGW bundle
           * Devpack support (optional)
           * Extensible thru plugins (SDK available in the downloads section)

       Compiler-related features:

           * Multiple compiler support:
                 o GCC (MingW / Linux GCC)
                 o MSVC++
                 o Digital Mars
                 o Borland C++ 5.5
                 o Open Watcom
           * Compiles directly or with makefiles
           * Predefined project templates
           * Custom template support
           * Uses XML format for project files.
           * Multi-target projects
           * Workspaces support
           * Imports MSVC projects and workspaces
                (NOTE: assembly code and inter-project dependencies not supported yet)
           * Imports Dev-C++ projects
           * Integrates with GDB for debugging

       Interface Features:

           * Syntax highlighting, customizable and extensible
           * Code folding for C++ and XML files.
           * Tabbed interface
           * Code completion plugin
           * Class Browser
           * Smart indent
           * One-key swap between .h and .c/.cpp files
           * Open files list for quick switching between files (optional)
           * External customizable "Tools"
           * To-do list management with different users

%prep

%setup -n codeblocks

%build
 ./bootstrap
 ./configure \
    --prefix=%{_prefix} \
    --exec-prefix=%{_exec_prefix} \
    --datadir=%{_datadir} \
    --sysconfdir=%{_sysconfdir} \
    --with-docdir=%{_docdir} \
    CXXFLAGS="$RPM_OPT_FLAGS" \
    CFLAGS="$RPM_OPT_FLAGS"
  make

%install
  make DESTDIR=$RPM_BUILD_ROOT install

%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}/*

Compiling the Release Candidate 2

  1. Download the source archive from www.codeblocks.org/downloads.shtml
  1. Go through the steps 3. to 5. from above with the only difference of using the following Specfile

Specfile:

Name:           codeblocks
Version:        1.0
Release:        rc2
Summary:        An open source, cross platform, free C++ IDE.
Group:          Development/Tools/IDE
License:        GPL
URL:            https://www.codeblocks.org/
Packager:       Daniel Orb <danielorb2000@yahoo.de>
Source:         %{name}-%{version}%{release}.tgz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Provides:       codeblocks
BuildRequires:  zip
BuildRequires:  dos2unix
 
%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.
Built around a plugin framework, Code::Blocks can be extended with plugin DLLs. It includes a plugin wizard so you can compile your  own plugins!

Features:

       Highlights:

           * Open Source! GPL2, no hidden costs.
           * Cross-platform. Runs on Linux or Windows (uses wxWidgets).
           * Made in GNU C++. No interpreted languages or proprietary libs needed.
           * Comes in two presentations: Standalone, and MinGW bundle
           * Devpack support (optional)
           * Extensible thru plugins (SDK available in the downloads section)

       Compiler-related features:

           * Multiple compiler support:
                 o GCC (MingW / Linux GCC)
                 o MSVC++
                 o Digital Mars
                 o Borland C++ 5.5
                 o Open Watcom
           * Compiles directly or with makefiles
           * Predefined project templates
           * Custom template support
           * Uses XML format for project files.
           * Multi-target projects
           * Workspaces support
           * Imports MSVC projects and workspaces
                (NOTE: assembly code and inter-project dependencies not supported yet)
           * Imports Dev-C++ projects
           * Integrates with GDB for debugging

       Interface Features:

           * Syntax highlighting, customizable and extensible
           * Code folding for C++ and XML files.
           * Tabbed interface
           * Code completion plugin
           * Class Browser
           * Smart indent
           * One-key swap between .h and .c/.cpp files
           * Open files list for quick switching between files (optional)
           * External customizable "Tools"
           * To-do list management with different users

%prep

%setup -n codeblocks-1.0rc2

%build  
 find . -type f -and -not -name "*.cpp" -and -not -name "*.h" -and -not -name "*.png" -and -not -name "*.bmp" | sed "s/.*/\"\\0\"/" | xargs dos2unix
 chmod a+x bootstrap acinclude.m4 src/update
 ./bootstrap
 ./configure \
    --prefix=%{_prefix} \
    --exec-prefix=%{_exec_prefix} \
    --datadir=%{_datadir} \
    --sysconfdir=%{_sysconfdir} \
    --with-docdir=%{_docdir} \
    CXXFLAGS="$RPM_OPT_FLAGS" \
    CFLAGS="$RPM_OPT_FLAGS"
  make

%install
  make DESTDIR=$RPM_BUILD_ROOT install

%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}/*