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

From CodeBlocks
Jump to: navigation, search
(Compiling the CVS/SVN version: changed spec file)
Line 23: Line 23:
 
2. Rename the directory ''trunk'' to ''codeblocks''. Stay in the directory above ''codeblocks''.
 
2. Rename the directory ''trunk'' to ''codeblocks''. Stay in the directory above ''codeblocks''.
  
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:
+
3. Get SVN revision number. You can see it in the last line after checking out (the number after "Revision:") or SVN with:
  svn info | grep Revision | cut -c 11-
+
  svn info codeblocks/ | grep Revision | cut -c 11-
  
 
4. add the directory codeblocks to an tgz archive named codeblocks-1.0-svn.$SVNREVISION.tgz (replace $SVNREVISION with the number you got)
 
4. 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
+
  tar -czf codeblocks-1.0.svn.$SVNREVISION.tgz codeblocks
  
 
5. copy the archive as root to the directory /usr/src/packages/SOURCES  
 
5. copy the archive as root to the directory /usr/src/packages/SOURCES  
Line 44: Line 44:
 
  %define _svnrev         
 
  %define _svnrev         
 
  %define req_wxgtk      2.6.0
 
  %define req_wxgtk      2.6.0
 +
%define _fedora        %(if [ -f /etc/fedora-release ]; then echo 1; else echo 0; fi)
 
  %define _suse          %(if [ -f /etc/SuSE-release ]; then echo 1; else echo 0; fi)
 
  %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)
 
  %define _mandriva      %(if [ -f /etc/mandrake-release ]; then echo 1; else echo 0; fi)
 +
%define _version        1.0.svn.%{_svnrev}
 +
%define _rel            0
 +
%define _release        %{_rel}
 
   
 
   
  Name:                  codeblocks
+
   
  Version:                1.0
+
  %if %_suse
  %if %_svnrev
+
  %define _suse_version  %(grep VERSION /etc/SuSE-release|cut -f3 -d" ")
  Release:                0.svn.%{_svnrev}
+
  %define _suse_vernum    %(echo "%_suse_version"|tr -d '.')
  %else
+
%define _release        %{_rel}.suse%{_suse_vernum}
  Release:                0.svn
+
  %define _distribution  SuSE Linux %_suse_version
 +
  %define _sysconfdir    /etc%{_prefix}
 
  %endif
 
  %endif
 +
%if %_mandriva
 +
%define _mandriva_version  %(cat /etc/mandriva-release|cut -f4 -d" ")
 +
%define _mandriva_vernum    %(echo "%_mandriva_version"|tr -d '.')
 +
%define _release            %{_rel}.mdk%{_mandriva_vernum}
 +
%define _distribution      %(cat /etc/mandriva-release|cut -f1-4 -d" ")
 +
%endif
 +
%if %_fedora
 +
%define _release            %{_rel}.fc4+5
 +
%define _distribution      %(cat /etc/fedora-release|cut -f1-4 -d" ")
 +
%endif
 +
 +
 +
Name:                  codeblocks
 +
Version:                %{_version}
 +
Release:                %{_release}
 
  Summary:                OpenSource Cross Platform Free C++ IDE
 
  Summary:                OpenSource Cross Platform Free C++ IDE
 
  Group:                  Development/Tools/IDE
 
  Group:                  Development/Tools/IDE
Line 59: Line 79:
 
  URL:                    http://www.codeblocks.org/
 
  URL:                    http://www.codeblocks.org/
 
  Packager:              Daniel Orb <[email protected]>
 
  Packager:              Daniel Orb <[email protected]>
  Source:                %{name}-%{version}-%{release}.tgz
+
  Source:                %{name}-%{version}.tgz
  BuildRoot:              %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+
  BuildRoot:              %{_tmppath}/%{name}-%{version}-buildroot
 
  Provides:              codeblocks
 
  Provides:              codeblocks
 
  Requires:              libgcc, libstdc++
 
  Requires:              libgcc, libstdc++
 
  %if ! %_mandriva
 
  %if ! %_mandriva
 
  Requires:              wxGTK >= %{req_wxgtk}
 
  Requires:              wxGTK >= %{req_wxgtk}
 +
conflicts:              wxGTK = 2.6.2-0.3.1.daniel2000.fc4
 
  BuildRequires:          wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
 
  BuildRequires:          wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
 
  %else
 
  %else
Line 78: Line 99:
 
  BuildRequires:          update-desktop-files
 
  BuildRequires:          update-desktop-files
 
  %endif
 
  %endif
   
+
  %{?_distribution:Distribution:%_distribution}
  %define pkgdata %{_datadir}/%{name}
+
  %define pkgdata         %{_datadir}/%{name}
 
   
 
   
 
  %description
 
  %description
  Code::Blocks is a free C++ IDE built specifically to meet the most demanding needs of its users.  
+
  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.
It was designed, right from the start, to be extensible and configurable.
+
 
   
 
   
 
  %prep
 
  %prep
Line 94: Line 114:
 
  %build
 
  %build
 
   ./bootstrap
 
   ./bootstrap
   %configure --enable-contrib
+
   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
 +
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
 +
  FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
 +
  ./configure \
 +
  '--prefix=%{_prefix}' \
 +
  '--exec-prefix=%{_exec_prefix}' \
 +
  '--bindir=%{_bindir}' \
 +
  '--sbindir=%{_sbindir}' \
 +
  '--sysconfdir=/etc' \
 +
  '--datadir=%{_datadir}' \
 +
  '--includedir=%{_includedir}' \
 +
  '--libdir=%{_libdir}' \
 +
  '--libexecdir=%{_libexecdir}' \
 +
  '--localstatedir=/var' \
 +
  '--sharedstatedir=%{_sharedstatedir}' \
 +
  '--mandir=%{_mandir}' \
 +
  '--infodir=%{_infodir}' \
 +
  '--enable-contrib'
 
   %__make
 
   %__make
 
   
 
   
Line 100: Line 137:
 
   rm -rf $RPM_BUILD_ROOT
 
   rm -rf $RPM_BUILD_ROOT
 
   make DESTDIR=$RPM_BUILD_ROOT install
 
   make DESTDIR=$RPM_BUILD_ROOT install
 +
 
  %post
 
  %post
 
   if [ -x /usr/bin/update-mime-database ]; then
 
   if [ -x /usr/bin/update-mime-database ]; then
Line 108: Line 146:
 
  %preun
 
  %preun
 
   if [ -x /usr/bin/update-mime-database ]; then
 
   if [ -x /usr/bin/update-mime-database ]; then
      /usr/bin/update-mime-database "%{_datadir}/mime"
+
    /usr/bin/update-mime-database "%{_datadir}/mime"
 
   fi
 
   fi
 
   
 
   
Line 129: Line 167:
 
   
 
   
 
  %changelog
 
  %changelog
  * Sat Jan  7 2005 Daniel Orb <[email protected]>
+
  * Sat Mar 25 2006 Daniel Orb <[email protected]>
  - added svn revision macro
+
  - changed release tag setting
  * Thu Jan  5 2005 Daniel Orb <[email protected]>
+
- replaced configure macro with configure script call and complete list of arguments/compilerflags
 +
* Sun Mar  5 2006 Daniel Orb <[email protected]>
 +
- rewrite of release tag setting
 +
  * Mon Jan  5 2006 Daniel Orb <[email protected]>
 
  - had to add Mandriva specific requires
 
  - had to add Mandriva specific requires
  * Mon Jan  2 2005 Daniel Orb <[email protected]>
+
  * Mon Jan  2 2006 Daniel Orb <[email protected]>
 
  - simplified the changes made before
 
  - simplified the changes made before
- added ldconfig in post
+
  * Sun Jan  1 2006 Daniel Orb <[email protected]>
- added --enable-contrib to configure
+
  * Sun Jan  1 2005 Daniel Orb <[email protected]>
+
 
  - added distribution check (SuSE, Fedora, Mandriva/Mandrake)
 
  - added distribution check (SuSE, Fedora, Mandriva/Mandrake)
  - added distribution specific requires and buildrequires
+
  - added distribution specific Requires and BuildRequires
 
  - added run of update-mime-database if installed
 
  - added run of update-mime-database if installed

Revision as of 10:43, 19 April 2006

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 (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. Rename the directory trunk to codeblocks. Stay in the directory above codeblocks.

3. Get SVN revision number. You can see it in the last line after checking out (the number after "Revision:") or SVN with:

svn info codeblocks/ | grep Revision | cut -c 11-

4. 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

5. copy the archive as root to the directory /usr/src/packages/SOURCES

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)

7. build the binary package as root with

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

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

9. Install it and enjoy Code::Blocks!

Use this as specfile:

%define _svnrev         
%define req_wxgtk       2.6.0
%define _fedora         %(if [ -f /etc/fedora-release ]; then echo 1; else echo 0; fi)
%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)
%define _version        1.0.svn.%{_svnrev}
%define _rel            0
%define _release        %{_rel}


%if %_suse
%define _suse_version   %(grep VERSION /etc/SuSE-release|cut -f3 -d" ")
%define _suse_vernum    %(echo "%_suse_version"|tr -d '.')
%define _release        %{_rel}.suse%{_suse_vernum}
%define _distribution   SuSE Linux %_suse_version
%define _sysconfdir     /etc%{_prefix}
%endif
%if %_mandriva
%define _mandriva_version   %(cat /etc/mandriva-release|cut -f4 -d" ")
%define _mandriva_vernum    %(echo "%_mandriva_version"|tr -d '.')
%define _release            %{_rel}.mdk%{_mandriva_vernum}
%define _distribution       %(cat /etc/mandriva-release|cut -f1-4 -d" ")
%endif
%if %_fedora
%define _release            %{_rel}.fc4+5
%define _distribution       %(cat /etc/fedora-release|cut -f1-4 -d" ")
%endif


Name:                   codeblocks
Version:                %{_version}
Release:                %{_release}
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}.tgz
BuildRoot:              %{_tmppath}/%{name}-%{version}-buildroot
Provides:               codeblocks
Requires:               libgcc, libstdc++
%if ! %_mandriva
Requires:               wxGTK >= %{req_wxgtk}
conflicts:              wxGTK = 2.6.2-0.3.1.daniel2000.fc4
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
%{?_distribution:Distribution:%_distribution}
%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
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
  ./configure \
  '--prefix=%{_prefix}' \
  '--exec-prefix=%{_exec_prefix}' \
  '--bindir=%{_bindir}' \
  '--sbindir=%{_sbindir}' \
  '--sysconfdir=/etc' \
  '--datadir=%{_datadir}' \
  '--includedir=%{_includedir}' \
  '--libdir=%{_libdir}' \
  '--libexecdir=%{_libexecdir}' \
  '--localstatedir=/var' \
  '--sharedstatedir=%{_sharedstatedir}' \
  '--mandir=%{_mandir}' \
  '--infodir=%{_infodir}' \
  '--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 Mar 25 2006 Daniel Orb <[email protected]>
- changed release tag setting
- replaced configure macro with configure script call and complete list of arguments/compilerflags
* Sun Mar  5 2006 Daniel Orb <[email protected]>
- rewrite of release tag setting
* Mon Jan  5 2006 Daniel Orb <[email protected]>
- had to add Mandriva specific requires
* Mon Jan  2 2006 Daniel Orb <[email protected]>
- simplified the changes made before
* Sun Jan  1 2006 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