Difference between revisions of "Installing Code::Blocks from source on RPM based distributions"

From Code::Blocks
 
(120 intermediate revisions by 9 users not shown)
Line 1: Line 1:
=== Compiling the CVS version ===
+
[[Category:Installing Code::Blocks]]
 +
[[Category:Installing Code::Blocks from source]]
  
1. You need a fresh CVS version, no ./bootstrap or anything else should be done before in this directory !
+
== Install Requirements ==
  
2. add the directory codeblocks to an tar.gz archive named codeblocks-1.0-cvs.tar.gz
+
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.
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
+
Upgrading GTK+ is beyond the scope of this document, easier to upgrade distribution ?
  
4. build the binary package as root with
+
=== Install Development Tools ===
rpmbuild -bb /usr/src/packages/SPECS/codeblocks.spec
 
  
5. the package will be in one of the subdirectories of /usr/src/packages/RPMS/
+
This has to be installed before starting:
 +
* zip
 +
* update-desktop-files (only on SUSE)
 +
* make
 +
* gettext
 +
* autoconf >= 2.5
 +
* automake >= 1.7
 +
* libtool >= 1.4
 +
* m4
 +
* intltool
 +
* gcc-c++
 +
* libstdc++-devel
  
6. Install it and enjoy !
+
In Fedora/CentOS, this can be done with:
 +
<pre>
 +
su -c 'yum groupinstall "Development Tools"'
 +
su -c 'yum install intltool'
 +
</pre>
  
'''Use this as Specfile:'''
+
==== Install newer autotools versions (if needed) ====
  
Name:          codeblocks
+
If you have CentOS 3 or RHEL 3, you will need to rebuild "automake17" to use instead of automake-1.6:
Version:        1.0
+
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm
Release:        cvs
+
<pre>
Summary:        An open source, cross platform, free C++ IDE.
+
rpmbuild --rebuild automake17-1.7.9-5.src.rpm
Group:          Development/Tools/IDE
+
</pre>
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 ===
+
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:
 +
<pre>
 +
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap
 +
</pre>
  
# Download the source archive from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]
+
=== Setup RPM environment ===
  
# Go through the steps 3. to 5. from above with the only difference of using the following Specfile
+
This has to be installed before starting:
 +
* rpm-build
  
'''Specfile:'''
+
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:
  
Name:          codeblocks
+
<pre>
Version:        1.0
+
RPM_TOPDIR=`rpm --eval %{_topdir}`
Release:        rc2
+
echo $RPM_TOPDIR
Summary:        An open source, cross platform, free C++ IDE.
+
</pre>
Group:          Development/Tools/IDE
+
 
License:       GPL
+
==== Non-root rpmbuild environment (recommended) ====
URL:            https://www.codeblocks.org/
+
 
Packager:      Daniel Orb <danielorb2000@yahoo.de>
+
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:
Source:        %{name}-%{version}%{release}.tgz
+
 
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+
<pre>
Provides:      codeblocks
+
cd
BuildRequires:  zip
+
mkdir rpm
BuildRequires:  dos2unix
+
echo "%_topdir $HOME/rpm" >> .rpmmacros
 
+
mkdir /tmp/$USER/rpm
%define pkgdata %{_datadir}/%{name}
+
echo "%_tmppath /tmp/$USER/rpm" >> .rpmmacros
+
cd rpm
%description
+
mkdir SPECS SOURCES BUILD RPMS SRPMS
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.
+
RPM_TOPDIR=`rpm --eval %{_topdir}`
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!
+
</pre>
+
 
Features:
+
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.
+
 
        Highlights:
+
=== Install wxWidgets 2.6.x ===
+
 
            * Open Source! GPL2, no hidden costs.
+
''Note: the following section on the required version is out of date; please ''do'' use from the 2.8 branch.''
            * Cross-platform. Runs on Linux or Windows (uses wxWidgets).
+
 
            * Made in GNU C++. No interpreted languages or proprietary libs needed.
+
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. Note that currently Code::Blocks requires wxWidgets '''2.6''', not 2.8! So if your distribution only provides packages for wxWidgets 2.8, you need to build wxWidgets 2.6 yourself.
            * Comes in two presentations: Standalone, and MinGW bundle
+
 
            * Devpack support (optional)
+
This has to be installed:
            * Extensible thru plugins (SDK available in the downloads section)
+
# wxGTK >= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])
+
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)
        Compiler-related features:
+
 
+
In later Fedora, this can be done with:
            * Multiple compiler support:
+
<pre>
                  o GCC (MingW / Linux GCC)
+
su -c 'yum install wxGTK-devel'
                  o MSVC++
+
</pre>
                  o Digital Mars
+
 
                  o Borland C++ 5.5
+
==== Build the wxGTK RPM from source (if needed) ====
                  o Open Watcom
+
 
            * Compiles directly or with makefiles
+
TODO
            * Predefined project templates
+
 
            * Custom template support
+
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz
            * Uses XML format for project files.
+
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz
            * Multi-target projects
+
* http://www.algonet.se/~afb/wx/wxGTK.spec
            * Workspaces support
+
 
            * Imports MSVC projects and workspaces
+
RPMS
                (NOTE: assembly code and inter-project dependencies not supported yet)
+
 
            * Imports Dev-C++ projects
+
* wx-base-unicode-2.6.3.0.2-1.i386.rpm
            * Integrates with GDB for debugging
+
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm
+
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm
        Interface Features:
+
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm
+
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm
            * Syntax highlighting, customizable and extensible
+
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm
            * Code folding for C++ and XML files.
+
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm
            * Tabbed interface
+
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm
            * Code completion plugin
+
* wx-i18n-2.6.3.0.2-1.i386.rpm
            * Class Browser
+
 
            * Smart indent
+
=== Install Subversion client ===
            * One-key swap between .h and .c/.cpp files
+
 
            * Open files list for quick switching between files (optional)
+
This has to be installed before starting:
            * External customizable "Tools"
+
* subversion >= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])
            * To-do list management with different users
+
 
+
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:
%prep
+
 
+
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/
%setup -n codeblocks-1.0rc2
+
 
+
In later Fedora, this can be done with:
%build 
+
<pre>
  find . -type f -and -not -name "*.cpp" -and -not -name "*.h" -and -not -name "*.png" -and -not -name "*.bmp" | sed "s/.*/\"\\0\"/" | xargs dos2unix
+
su -c 'yum install subversion'
  chmod a+x bootstrap acinclude.m4 src/update
+
</pre>
  ./bootstrap
+
 
  ./configure \
+
==== Build Subversion RPM from source (if needed) ====
    --prefix=%{_prefix} \
+
 
    --exec-prefix=%{_exec_prefix} \
+
TODO
    --datadir=%{_datadir} \
+
 
    --sysconfdir=%{_sysconfdir} \
+
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz
    --with-docdir=%{_docdir} \
+
* packages/rpm/rhel-3/subversion.spec (CentOS 3)
    CXXFLAGS="$RPM_OPT_FLAGS" \
+
* packages/rpm/rhel-4/subversion.spec (CentOS 4)
    CFLAGS="$RPM_OPT_FLAGS"
+
 
  make
+
RPMS
   
+
 
%install
+
* subversion-1.4.2-1.i386.rpm
  make DESTDIR=$RPM_BUILD_ROOT install
+
* subversion-devel-1.4.2-1.i386.rpm
+
* subversion-perl-1.4.2-1.i386.rpm
  %clean
+
* subversion-python-1.4.2-1.i386.rpm
  test -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
+
* subversion-tools-1.4.2-1.i386.rpm
   
+
* subversion-debuginfo-1.4.2-1.i386.rpm
  %files
+
 
%defattr(-,root,root)
+
== Install Code::Blocks ==
%doc README COPYING AUTHORS BUGS COMPILERS TODO NEWS ChangeLog
+
 
+
=== Download the Source RPM ===
  %{_bindir}/*
+
 
+
1. Download the Source RPM from [https://www.codeblocks.org/downloads/source www.codeblocks.org/downloads/source]
%{_libdir}/*
+
 
  %{_datadir}/application-registry/codeblocks.applications
+
''Note: SRPM's are for the last stable (10.05); the SVN branch includes the many improvements since then.''
%{_datadir}/applications/codeblocks.desktop
+
<!-- <span style="color:red">Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:</span> -->
  %{_datadir}/icons/gnome/48x48/mimetypes/gnome-mime-application-x-codeblocks.png
+
 
%{_datadir}/mime-info/*
+
==== Prepare SRPM package from SVN (if needed) ====
%{_datadir}/mime/packages/codeblocks.xml
+
 
%{_datadir}/pixmaps/codeblocks.png
+
1. You need to get the latest sources from SVN [https://www.codeblocks.org/downloads/svn www.codeblocks.org/downloads/svn]
+
 
+
  svn checkout svn://svn.berlios.de/codeblocks/trunk
  %{pkgdata}/*
+
 
 +
2. go into ''trunk'', if you haven't already done it.
 +
 
 +
3. run these three commands in this order
 +
  ./bootstrap
 +
  ./configure
 +
  make dist
 +
the last one will create a .tar.gz archive that contains the sources.
 +
 
 +
4. copy the archive to the directory $RPM_TOPDIR/SOURCES
 +
  sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES
 +
 
 +
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS
 +
  rpmbuild -bs codeblocks.spec
 +
 
 +
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.
 +
 
 +
=== Build the RPM package ===
 +
 
 +
1. Build the binary package
 +
  rpmbuild --rebuild codeblocks*.src.rpm
 +
 
 +
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.
 +
 
 +
These are:
 +
* codeblocks: main package
 +
* codeblocks-contrib: contrib plugins
 +
* codeblocks-devel: SDK headers
 +
* codeblocks-contrib-devel: headers for contrib-plugins (wxSmith etc.)
 +
* codeblocks-debuginfo: stripped debug information
 +
 
 +
=== Install the RPM package ===
 +
 
 +
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!
 +
  su -c 'rpm -Uvh codeblocks-1.0*.i386.rpm'

Latest revision as of 07:59, 22 September 2012


Install Requirements

Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.

Upgrading GTK+ is beyond the scope of this document, easier to upgrade distribution ?

Install Development Tools

This has to be installed before starting:

  • zip
  • update-desktop-files (only on SUSE)
  • make
  • gettext
  • autoconf >= 2.5
  • automake >= 1.7
  • libtool >= 1.4
  • m4
  • intltool
  • gcc-c++
  • libstdc++-devel

In Fedora/CentOS, this can be done with:

su -c 'yum groupinstall "Development Tools"'
su -c 'yum install intltool'

Install newer autotools versions (if needed)

If you have CentOS 3 or RHEL 3, you will need to rebuild "automake17" to use instead of automake-1.6:

rpmbuild --rebuild automake17-1.7.9-5.src.rpm

Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:

AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap

Setup RPM environment

This has to be installed before starting:

  • rpm-build

The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:

RPM_TOPDIR=`rpm --eval %{_topdir}`
echo $RPM_TOPDIR

Non-root rpmbuild environment (recommended)

It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:

cd
mkdir rpm
echo "%_topdir $HOME/rpm" >> .rpmmacros
mkdir /tmp/$USER/rpm
echo "%_tmppath /tmp/$USER/rpm" >> .rpmmacros
cd rpm
mkdir SPECS SOURCES BUILD RPMS SRPMS
RPM_TOPDIR=`rpm --eval %{_topdir}`

You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.

Install wxWidgets 2.6.x

Note: the following section on the required version is out of date; please do use from the 2.8 branch.

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. Note that currently Code::Blocks requires wxWidgets 2.6, not 2.8! So if your distribution only provides packages for wxWidgets 2.8, you need to build wxWidgets 2.6 yourself.

This has to be installed:

  1. wxGTK >= 2.6.0 and its devel package (see wxwidgets.org)
  2. wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)

In later Fedora, this can be done with:

su -c 'yum install wxGTK-devel'

Build the wxGTK RPM from source (if needed)

TODO

RPMS

  • wx-base-unicode-2.6.3.0.2-1.i386.rpm
  • wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm
  • wx-i18n-2.6.3.0.2-1.i386.rpm

Install Subversion client

This has to be installed before starting:

Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:

http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/

In later Fedora, this can be done with:

su -c 'yum install subversion'

Build Subversion RPM from source (if needed)

TODO

RPMS

  • subversion-1.4.2-1.i386.rpm
  • subversion-devel-1.4.2-1.i386.rpm
  • subversion-perl-1.4.2-1.i386.rpm
  • subversion-python-1.4.2-1.i386.rpm
  • subversion-tools-1.4.2-1.i386.rpm
  • subversion-debuginfo-1.4.2-1.i386.rpm

Install Code::Blocks

Download the Source RPM

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

Note: SRPM's are for the last stable (10.05); the SVN branch includes the many improvements since then.

Prepare SRPM package from SVN (if needed)

1. You need to get the latest sources from SVN www.codeblocks.org/downloads/svn

svn checkout svn://svn.berlios.de/codeblocks/trunk

2. go into trunk, if you haven't already done it.

3. run these three commands in this order

./bootstrap
./configure
make dist

the last one will create a .tar.gz archive that contains the sources.

4. copy the archive to the directory $RPM_TOPDIR/SOURCES

sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES

5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS

rpmbuild -bs codeblocks.spec

This will create a source package in the directory $RPM_TOPDIR/SRPMS/.

Build the RPM package

1. Build the binary package

rpmbuild --rebuild codeblocks*.src.rpm

This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.

These are:

  • codeblocks: main package
  • codeblocks-contrib: contrib plugins
  • codeblocks-devel: SDK headers
  • codeblocks-contrib-devel: headers for contrib-plugins (wxSmith etc.)
  • codeblocks-debuginfo: stripped debug information

Install the RPM package

Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!

su -c 'rpm -Uvh codeblocks-1.0*.i386.rpm'