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

From Code::Blocks
(to match Specfile)
(→‎Compiling the CVS/SVN version: Updated specfile + adding svn)
Line 16: Line 16:
 
3. The binary RPM should be in one of the subdirectories of /usr/src/packages/RPMS
 
3. The binary RPM should be in one of the subdirectories of /usr/src/packages/RPMS
  
=== Compiling the CVS version ===
+
=== Compiling the CVS/SVN version ===
  
1. You need a fresh CVS version, no ./bootstrap or anything else should be done before in this directory !
+
1. You need a fresh CVS/SVN 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
 
2. add the directory codeblocks to an tar.gz archive named codeblocks-1.0-cvs.tar.gz
Line 32: Line 32:
 
6. Install it and enjoy !
 
6. Install it and enjoy !
  
'''Use this as Specfile:'''
+
'''Use this as specfile:'''
  
  Name:           codeblocks
+
%define _fedora %(if [ -f /etc/fedora-release ]; then echo 1; else echo 0; fi)
  Version:       1.0
+
%define _mandrake %(if [ -f /etc/mandrake-release ]; then echo 1; else echo 0; fi)
  Release:       cvs
+
%define _suse %(if [ -f /etc/SuSE-release ]; then echo 1; else echo 0; fi)
  Summary:       An open source, cross platform, free C++ IDE.
+
  Group:         Development/Tools/IDE
+
%define req_wxgtk 2.6.0
  License:       GPL
+
  URL:           https://www.codeblocks.org/
+
  Name: codeblocks
  Packager:       Daniel Orb <danielorb2000@yahoo.de>
+
  Version: 1.0
  Source:         %{name}-%{version}-%{release}.tgz
+
  Release: svn
  BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+
  Summary: OpenSource Cross Platform Free C++ IDE
  Provides:       codeblocks
+
  Group: Development/Tools/IDE
  BuildRequires:  zip
+
  License: GPL
  BuildRequires: dos2unix
+
  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 %_fedora
 +
Requires: wxGTK >= %{req_wxgtk}
 +
BuildRequires: wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
 +
BuildRequires: intltool
 +
%endif
 +
 +
%if %_mandrake
 +
Requires: libwxgtku2.6 >= %{req_wxgtk}
 +
  BuildRequires: libwxgtku2.6 >= %{req_wxgtk}, libwxgtku2.6-devel >= %{req_wxgtk}
 +
  BuildRequires: intltool
 +
%endif
 +
 +
%if %_suse
 +
Requires: wxGTK >= %{req_wxgtk}
 +
BuildRequires: wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
 +
BuildRequires: intltool, update-desktop-files
 +
%endif
 +
 +
BuildRequires: gcc-c++, make, gettext
 +
BuildRequires: libstdc++, libstdc++-devel, autoconf, automake, libtool
 +
BuildRequires: zip
 +
  BuildRequires: dos2unix
 +
 
  %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. It was designed, right from the start, to be extensible and configurable.
+
  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
 
  %prep
 
   
 
   
  %setup -n codeblocks
+
  %setup -n codeblocks-1.0
 +
 +
%if %_suse
 +
%{?suse_update_libdir:%{suse_update_libdir}}
 +
%{?suse_update_config:%{suse_update_config -f}}
 +
%endif
 
   
 
   
 
  %build
 
  %build
Line 64: Line 97:
 
  %install
 
  %install
 
   %makeinstall
 
   %makeinstall
 +
 +
%post
 +
if [ -x /usr/bin/update-mime-database ]; then
 +
        /usr/bin/update-mime-database "%{_datadir}/mime"
 +
fi
 +
 +
%preun
 +
if [ -x /usr/bin/update-mime-database ]; then
 +
    /usr/bin/update-mime-database "%{_datadir}/mime"
 +
fi
 
   
 
   
 
  %clean
 
  %clean
   test -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
+
   test -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && %__rm -rf $RPM_BUILD_ROOT
 
   
 
   
 
  %files
 
  %files
Line 73: Line 116:
 
   
 
   
 
  %{_bindir}/*
 
  %{_bindir}/*
 
 
  %{_libdir}/*
 
  %{_libdir}/*
 
  %{_datadir}/application-registry/codeblocks.applications
 
  %{_datadir}/application-registry/codeblocks.applications
Line 81: Line 123:
 
  %{_datadir}/mime/packages/codeblocks.xml
 
  %{_datadir}/mime/packages/codeblocks.xml
 
  %{_datadir}/pixmaps/codeblocks.png
 
  %{_datadir}/pixmaps/codeblocks.png
 +
%{pkgdata}/*
 
   
 
   
   
+
  %changelog
  %{pkgdata}/*
+
* 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

Revision as of 17:10, 1 January 2006

General instructions

The build requirements in the specfile and the source RPM are set to a minimum because there are two different names of the wxGTK packages (wxGTK and wxGTK2). 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. add the directory codeblocks to an tar.gz archive named codeblocks-1.0-cvs.tar.gz

tar -czf codeblocks-1.0-cvs.tgz 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:

%define _fedora		%(if [ -f /etc/fedora-release ]; then echo 1; else echo 0; fi)
%define _mandrake	%(if [ -f /etc/mandrake-release ]; then echo 1; else echo 0; fi)
%define _suse		%(if [ -f /etc/SuSE-release ]; then echo 1; else echo 0; fi)

%define req_wxgtk	2.6.0

Name:			codeblocks
Version:		1.0
Release:		svn
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 %_fedora
Requires:		wxGTK >= %{req_wxgtk}
BuildRequires:	wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
BuildRequires:	intltool
%endif

%if %_mandrake
Requires:		libwxgtku2.6 >= %{req_wxgtk}
BuildRequires:	libwxgtku2.6 >= %{req_wxgtk}, libwxgtku2.6-devel >= %{req_wxgtk}
BuildRequires:	intltool
%endif

%if %_suse
Requires:		wxGTK >= %{req_wxgtk}
BuildRequires:	wxGTK >= %{req_wxgtk}, wxGTK-devel >= %{req_wxgtk}
BuildRequires:	intltool, update-desktop-files
%endif

BuildRequires:	gcc-c++, make, gettext
BuildRequires:	libstdc++, libstdc++-devel, autoconf, automake, libtool
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.

%prep

%setup -n codeblocks-1.0

%if %_suse
%{?suse_update_libdir:%{suse_update_libdir}}
%{?suse_update_config:%{suse_update_config -f}}
%endif

%build
  ./bootstrap
  %configure
  %__make

%install
  %makeinstall

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

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