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

From CodeBlocks
Jump to: navigation, search
(Build the RPM package)
 
(91 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Installation\Build Instructions]]
+
[[Category:Installing Code::Blocks]]
=== General instructions ===
+
[[Category:Installing Code::Blocks from source]]
  
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.
+
== 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:
 +
<pre>
 +
su -c 'yum groupinstall "Development Tools"'
 +
su -c 'yum install intltool'
 +
</pre>
 +
 
 +
==== 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:
 +
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm
 +
<pre>
 +
rpmbuild --rebuild automake17-1.7.9-5.src.rpm
 +
</pre>
 +
 
 +
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>
 +
 
 +
=== 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:
 +
 
 +
<pre>
 +
RPM_TOPDIR=`rpm --eval %{_topdir}`
 +
echo $RPM_TOPDIR
 +
</pre>
 +
 
 +
==== 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:
 +
 
 +
<pre>
 +
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}`
 +
</pre>
 +
 
 +
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:
 
This has to be installed:
# wxGTK and its devel package
+
# 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)
 
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)
  
=== Compiling the Release Candidate 2 ===
+
In later Fedora, this can be done with:
 +
<pre>
 +
su -c 'yum install wxGTK-devel'
 +
</pre>
 +
 
 +
==== Build the wxGTK RPM from source (if needed) ====
 +
 
 +
TODO
 +
 
 +
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz
 +
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz
 +
* http://www.algonet.se/~afb/wx/wxGTK.spec
 +
 
 +
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:
 +
* subversion >= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])
 +
 
 +
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:
 +
<pre>
 +
su -c 'yum install subversion'
 +
</pre>
 +
 
 +
==== Build Subversion RPM from source (if needed) ====
 +
 
 +
TODO
 +
 
 +
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz
 +
* packages/rpm/rhel-3/subversion.spec (CentOS 3)
 +
* packages/rpm/rhel-4/subversion.spec (CentOS 4)
 +
 
 +
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 [http://www.codeblocks.org/downloads/source www.codeblocks.org/downloads/source]
  
1. Download the source RPM from [http://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]
+
''Note: SRPM's are for the last stable (10.05); the SVN branch includes the many improvements since then.''
 +
<!-- <span style="color:red">Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:</span> -->
  
2. Build the binary package as root
+
==== Prepare SRPM package from SVN (if needed) ====
rpmbuild --rebuild codeblocks-1.0-rc2.src.rpm
+
  
3. The binary RPM should be in one of the subdirectories of /usr/src/packages/RPMS
+
1. You need to get the latest sources from SVN [http://www.codeblocks.org/downloads/svn www.codeblocks.org/downloads/svn]
  
=== Compiling the CVS/SVN version ===
+
svn checkout svn://svn.berlios.de/codeblocks/trunk
  
1. You need a fresh CVS/SVN version (described here [[Compiling_Code::Blocks_in_Linux_(applies_to_all_distros)#Getting_the_latest_sources_from_SVN]], but don't cd into the directory trunk), no ./bootstrap or anything else should be done before in this directory !
+
2. go into ''trunk'', if you haven't already done it.
  
2. Rename the directory ''trunk'' to ''codeblocks''. Stay in the directory above ''codeblocks''.
+
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.
  
3. 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:
+
4. copy the archive to the directory $RPM_TOPDIR/SOURCES
  svn info | grep Revision | cut -c 11-
+
  sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES
  
4. add the directory codeblocks to an tgz archive named codeblocks-1.0-svn.$SVNREVISION.tgz (replace $SVNREVISION with the number you got)
+
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS
  tar -czf codeblocks-1.0-svn.$SVNREVISION.tgz codeblocks
+
  rpmbuild -bs codeblocks.spec
  
5. copy the archive as root to the directory /usr/src/packages/SOURCES
+
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.
  
6. copy the Specfile beneath, add the SVN revision number behind "_svnrev" (between "_svnrev" and the number has to be at least one space character) in the first line and save it as root to /usr/src/packages/SPECS/codeblocks.spec (you can name the specfile however you want)
+
=== Build the RPM package ===
  
7. build the binary package as root with
+
1. Build the binary package
  rpmbuild -bb /usr/src/packages/SPECS/codeblocks.spec
+
  rpmbuild --rebuild codeblocks*.src.rpm
  
8. the package will be in one of the subdirectories of /usr/src/packages/RPMS/
+
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.
  
9. Install it and enjoy Code::Blocks!
+
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
  
'''Use this as specfile:'''
+
=== Install the RPM package ===
  
%define _svnrev       
+
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!
%define req_wxgtk      2.6.0
+
  su -c 'rpm -Uvh codeblocks-1.0*.i386.rpm'
%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:                    http://www.codeblocks.org/
+
Packager:              Daniel Orb <[email protected]>
+
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
+
  rm -rf $RPM_BUILD_ROOT
+
  make DESTDIR=$RPM_BUILD_ROOT install
+
%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/*
+
%{_datadir}/mime-info/*
+
%{_datadir}/mime/packages/codeblocks.xml
+
%{_datadir}/pixmaps/codeblocks.png
+
%{pkgdata}/*
+
+
%changelog
+
* Sat Jan  7 2005 Daniel Orb <[email protected].com>
+
- added svn revision macro
+
* Thu Jan  5 2005 Daniel Orb <[email protected].com>
+
- had to add Mandriva specific requires
+
* Mon Jan  2 2005 Daniel Orb <[email protected]>
+
- simplified the changes made before
+
- added ldconfig in post
+
- added --enable-contrib to configure
+
* Sun Jan  1 2005 Daniel Orb <[email protected]>
+
- added distribution check (SuSE, Fedora, Mandriva/Mandrake)
+
- added distribution specific requires and buildrequires
+
- added run of update-mime-database if installed
+

Latest revision as of 08: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'