I'm using aws's ec2 instance and I need to install a newer version of GDB (I can't use yum install
since there is no newer version available for amazon RHEL).
My workflow requires to do this process often and I thought of having a prepared RPM to implement this task. I'm new to the process of creating RPMs and I'm not sure how to do it, I started to write the file but I ran into some issues, I'd like to share with you the file, with the issues I got:
- I'd like to get some insight and understand if there's a better way of writing the spec file.
- Currently I'm getting errors since I need to use the pkg's "configure" before, but this requires creating a "build" directory and only run
make
from within that directory. Currently I solved this bymake
from within a directory I created within theBUILD/gdb-9.1
dir. But I'm sure there's a more idiomatic way of doing it. - for this process to work, I first need to install
gcc-c++
andexpat-devel
. I what is the best way to do it, currently my option are:- put it as part of the rpm installation.
- run this command prior to the rpm installation. (yet I'd like the rpm to be something that it's the only this required, but I'm not sure if it's a good idea)
%define gdb_version 9.1
%define gdb_release 1
Name: gdb
Summary: GNU Debugger
Version: %{gdb_version}
Release: %{gdb_release}
License: GPL
URL: http://www.gnu.org/software/gdb/
Source0: gdb-%{gdb_version}.tar.gz
BuildRequires: readline-devel, ncurses-devel
%description
GDB, the GNU Project debugger, allows you to see what is going on inside another program while it executes.
%prep
%autosetup
%build
mkdir build
cd build
../configure \
--host=x86_64-redhat-linux-gnu \
--target=x86_64-redhat-linux-gnu \
--with-auto-load-dir=$debugdir:$datadir/auto-load:/usr/share/gdb/auto-load \
--with-auto-load-safe-path=$debugdir:$datadir/auto-load:/usr/share/gdb/auto-load \
--with-expat \
--with-gdb-datadir=/usr/share/gdb \
--with-jit-reader-dir=/usr/lib64/gdb \
--without-libunwind-ia64 \
--with-python=/usr \
--without-guile \
--with-separate-debug-dir=/usr/lib/debug \
--with-system-gdbinit=/etc/gdbinit \
--without-babeltrace
make %{?_smp_mflags}
%install
cd build
make install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)