Author Topic: Seeking comments - Convert source code (tar.gz) to a RPM installable  (Read 2845 times)

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
I am a non-coder type user of PCLinuxOS. I sometimes feel that I might try and do some simple packages and learn. But I have not been able to understand the whole thing.
Today I just came across this post on a blog here http://synapse.wordpress.com/2005/12/24/convert-source-code-targz-to-an-rpm-installable/
Can the regular packagers please go through it and tell if it will apply to us?
Can I use it to for example create an installable driver out of this .tar.gz file here
http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=15&PFid=25&Level=4&Conn=3&DownTypeID=3&GetDown=false
ftp://WebUser:AxPL9s3k@202.134.71.21/pc/crc/rts_pstor.tar.bz2

-SS.
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline moniac

  • Full Member
  • ***
  • Posts: 198
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #1 on: August 16, 2011, 07:17:38 AM »
I am a non-coder type user of PCLinuxOS. I sometimes feel that I might try and do some simple packages and learn. But I have not been able to understand the whole thing.
Today I just came across this post on a blog here http://synapse.wordpress.com/2005/12/24/convert-source-code-targz-to-an-rpm-installable/
Can the regular packagers please go through it and tell if it will apply to us?
Can I use it to for example create an installable driver out of this .tar.gz file here
http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=15&PFid=25&Level=4&Conn=3&DownTypeID=3&GetDown=false
ftp://WebUser:AxPL9s3k@202.134.71.21/pc/crc/rts_pstor.tar.bz2

-SS.



I hope you get an answer. That is something I would like to know also.

Offline menotu

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 15288
  • ┌∩┐(◕_◕)┌∩┐
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #2 on: August 16, 2011, 07:43:27 AM »
The following is a fairly comprehensive (as are most IBM tut's) 3 part tutorial for packaging RPM's but may give you a few helpful pointers.

Note: not sure if/how much they'd need "tweaking" for the PCLinuxOS repos

https://www.ibm.com/developerworks/views/linux/libraryview.jsp?sort_by=&show_abstract=true&show_all=&search_flag=&topic_by=-1&type_by=Articles&search_by=rpm%2C&Go.x=48&Go.y=12

Packaging software with RPM, Part 1: Building and distributing packages
In this first article in a three-part series on the RPM Package Manager, learn how to use RPM not just to install software and attendant files but to package almost anything, from system scripts to source code to documentation.

Packaging software with RPM, Part 2: Upgrading and uninstalling software
In this second article in a three-part series on the RPM Package Manager, learn how how to use RPM to upgrade and uninstall software on your Linux system.

Packaging software with RPM, Part 3: Accommodating software dependencies
In this third article in a three-part series on the RPM Package Manager, discover the ins and outs of software dependencies, and learn how to control and customize your software packaging.

One the same page are links for

Learn Linux, 101: RPM and YUM package management
Learn how to install, upgrade and manage packages on your Linux system. This article focuses on the Red Hat Package Manager (RPM) developed by Red Hat, as well as the Yellowdog Updater Modified (YUM) originally developed to manage Red Hat Linux systems at Duke University's Physics department. You can use the material in this article to study for the LPI 101 exam for Linux system administrator certification, or just to explore the best ways to add new software and keep your system current.

Practice: RPM and YUM package management
A package is software that is bundled and ready for installation on a Linux system, and installing and removing packages are basic operations for any Linux user or administrator. This article offers hands-on practice with the Red Hat Package Manager (RPM) and YUM software management tools that will help you learn to perform these tasks in a real-world environment. The exercises and solutions in this article focus on a variety of package management tasks.
« Last Edit: August 16, 2011, 07:45:11 AM by menotu »
PCLinuxOS 32bit KDE 4.10.1; kernel-3.4.11-pclos1.bfs & 64bit 3.2.18bfs; NVidia GeForce 8400GS 1GB 310.19 driver

Sony Vaio SVE1513A4ESI Laptop, Intel Core i5, 2.6GHz, 6GB RAM, 750GB, 15.6" Intel HD Graphics 4000


Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #4 on: August 16, 2011, 10:20:38 AM »
To summarize, there is no easy way as mentioned in the blog post above? :)
-SS.
NOTE: It will take my combination of hopelessly limited processing power, low memory and propensity to show highly divided attention to any one task a long time to do it and hence looks unlikely I will ever complete the decathlon :) :) :)
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15845
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #5 on: August 16, 2011, 12:08:07 PM »
To summarize, there is no easy way as mentioned in the blog post above? :)
-SS.
NOTE: It will take my combination of hopelessly limited processing power, low memory and propensity to show highly divided attention to any one task a long time to do it and hence looks unlikely I will ever complete the decathlon :) :) :)

Even under those conditions, you can package, if you want to do so. That's the key, really, the desire to package.   

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #6 on: August 16, 2011, 12:24:21 PM »
[Neal]
He he he. Surely I do not have the Dzire ;)
-SS.
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #7 on: August 30, 2011, 01:44:01 AM »
I was able to make the Realtek driver work on my netbook by following these steps.
1. Download and extract the tar.bz2 archive.
2. Open a root terminal and navigate to the directory.
3. make
4. make install
5. depmod
6. reboot

This does not make an rpm though. Still reading up on that side of things.
-SS.
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 10628
  • MLUs Forever!
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #8 on: August 30, 2011, 01:55:05 AM »
To summarize, there is no easy way as mentioned in the blog post above? :)
-SS.
NOTE: It will take my combination of hopelessly limited processing power, low memory and propensity to show highly divided attention to any one task a long time to do it and hence looks unlikely I will ever complete the decathlon :) :) :)


There is - or at least was - an easy way to create an RPM for oneself.

The first two usual stages are performed .....  config & make .....  and instead of doing a 'make install', Checkinstall was used to produce an RPM, which could then be installed as with all other RPMs.

Unfortunately Checkinstall was broken the last time I checked .....  since the upgrade to RPM IIRC.

I look forward to its return to health in the future  :D
MLUs rule the roost!

Linux XPS 3.2.18-pclos2.pae.bfs  32 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #9 on: August 30, 2011, 03:24:53 AM »
task-packaging seems to be missing from the repositories too.
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8583
  • Aurum nostrum non est aurum vulgi.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #10 on: August 30, 2011, 04:48:27 AM »
If the source tar.bz2 installed properly, the SPEC file should be able to take care of any configure, make & make install in the final steps of packaging RPMs. IMHO, the SPEC is the hardest part of packaging.
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15845
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #11 on: August 30, 2011, 04:57:22 AM »
If the source tar.bz2 installed properly, the SPEC file should be able to take care of any configure, make & make install in the final steps of packaging RPMs. IMHO, the SPEC is the hardest part of packaging.

The spec file is the heart and brains of packaging. Get it right, and your RPMs will build without errors, will be installable, and the app will run as it should. Get it wrong, and any of those can have errors that cause failure.     

@sling-shot,
Your next step should be to create a spec file, either from scratch or by editing an existing spec file.     

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #12 on: August 31, 2011, 09:50:07 AM »
I have read some of the guides linked above. Thanks to all of you. Understanding them requires quite a lot of concentration.

I request any one to kindly post a PCLinuxOS standard spec file so that I can understand the guides better by comparing the theory to practice.

Thanks,
-SS.
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline MBantz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1317
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #13 on: August 31, 2011, 10:23:59 AM »
I have read some of the guides linked above. Thanks to all of you. Understanding them requires quite a lot of concentration.

I request any one to kindly post a PCLinuxOS standard spec file so that I can understand the guides better by comparing the theory to practice.

Thanks,
-SS.



This is how Flightgear is built for PCLinuxOS - using pkgutils makes it possible to create an RPM and more important SRPM (containing all the sources and the spec without binaries. This is what we send to Tex).

Just ask away,

enjoy :-)

/MBantz

Code: [Select]
%define name flightgear
%define version 2.4.0
%define release %mkrel 1

Name: %{name}
Version: %{version}
Release: %{release}
Summary: An open-source flight simulator
License: GPL
Group: Games/Other
Source0: http://ftp.igh.cnrs.fr/pub/flightgear/ftp/Source/%{name}-%{version}.tar.xz
Source1: flightgear-icon.png
URL: http://www.flightgear.org/
BuildRequires: libopenal-devel libmesagl1-devel
BuildRequires: libxorg-x11-devel findutils libmesaglut-devel libstdc++-devel
BuildRequires: autoconf automake libmetakit-devel plib-devel zlib-devel
BuildRequires: m4 ccache
BuildRequires: simgear-devel >= 2.0.4
Requires: libmesagl1 libOpenSceneGraph libOpenThreads OpenSceneGraph-plugins
Requires: simgear
Requires: flightgear-data
#For terrasync support:
Requires: subversion
Obsoletes: FlightGear <= 2.0.0 FlightGear-data <= 2.0.0
Obsoletes: flightgear < %{version} flightgear-data < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot

%description
FlightGear Flight Simulator project is an open-source, multi-platform,
cooperative flight simulator development project. Source code for the
entire project is available (GIT repository) and licensed under the
GNU General Public License.
The goal of the FlightGear project is to create a sophisticated flight
simulator framework for use in research or academic environments, for
the development and pursuit of other interesting flight simulation
ideas, and as an end-user application. We are developing a
sophisticated, open simulation framework that can be expanded and
improved upon by anyone interested in contributing.

%description[da]
FlightGear flysimulatoer er et open-source, multiplatform udviklingsprojekt.
Kildekoden for det komplette projekt er tilgængelig (via GIT) og licenseret
under GNU GPL.
Målet for FlightGear projektet er at skabe et avanceret flysimulator
rammesystem til brug for forskning og akademiske miljøer. Målet er   
udvikling og søgen efter nye flysimulator idéer, og til brug som
en flysimulator for det interesserede publikum. Vi udvikler et avanceret
åbent simulator rammesystem der kan udvides og forbedres af alle
der er interesserede i at deltage.


%prep
%setup -q -D

%build
# Enable cccache
export CC="ccache gcc"
export CXX="ccache g++"

# Expand ccache
ccache -M 1G

./autogen.sh

# Display configure options
./configure --help
./configure \
--prefix=/usr \
--libdir=%{_gamesdatadir} \
--datadir=%{_gamesdatadir} \
--mandir=%{_mandir}

%make

%install
rm -rf %{buildroot}
make DESTDIR=$RPM_BUILD_ROOT install

# icons
mkdir -p %{buildroot}%{_iconsdir}/hicolor/{16x16,32x32,48x48,64x64}/apps
for i in 16 32 48 64; do \
convert -size $i\x$i %{SOURCE1} %{buildroot}%{_iconsdir}/hicolor/$i\x$i/apps/%{name}.png
done

#Menu item for fgfs
install -d -m 755 %{buildroot}%{_datadir}/applications
cat >  %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=%{name}
Comment=An open-source flight simulator
Comment[da]=FlightGear open-source flysimulator
Exec=/usr/bin/fgfs
Icon=%{name}
Terminal=false
Type=Application
StartupNotify=false
Categories=X-MandrivaLinux-MoreApplications-Games-Other;Game;
EOF

%clean
rm -rf %{buildroot}

%post
%update_icon_cache hicolor
%update_menus
%update_desktop_database

%postun
%clean_icon_cache hicolor
%clean_menus
%clean_desktop_database

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING NEWS README Thanks docs-mini/*
%{_bindir}
%{_datadir}
%{_mandir}

%changelog
* Tue Aug 23 2011 MBantz <martin dot bantz at gmail dot com> 2.4.0-1pclos2011
- Update to 2.4.0


Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: Seeking comments - Convert source code (tar.gz) to a RPM installable
« Reply #14 on: September 18, 2012, 09:29:30 AM »
Code: [Select]
Name: qbittorrent
Summary: A C++/QT4 Bittorrent Client
Version: 3.0.3
Release: %mkrel 1
Source0: http://downloads.sf.net/qbittorrent/%{name}-%{version}.tar.xz
URL: http://sourceforge.net/projects/qbittorrent
Group: Networking/File transfer
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
License: GPLv2+
BuildRequires: libqt4-devel >= 4.4.1
BuildRequires: desktop-file-utils
BuildRequires: libboost-devel, zziplib0-devel
BuildRequires: libtorrent-rasterbar-devel >= 0.14.6
BuildRequires: libcurl-devel, glib2-devel
Requires: libtorrent-rasterbar6
Requires: task-qt4
Obsoletes: %{name} < %version
Requires: glibc >= 2.12.1
Requires: libstdc++6 >= 4.5.2

%description
A Bittorrent client with a polished Qt4 user interface.
It aims to be as fast as possible and to provide multi-OS, unicode support.

- A polished Graphical User Interface written with Qt4 toolkit
- UPnP / NAT-PMP port forwarding support
- Encryption support (compatible with Azureus)
- Multiple simultaneous downloads / uploads
- A well-integrated search engine
- DHT (trackerless) support
- uTorrent Peer eXchange support (PeX)
- Directory scanning with automated download of torrents inside
- And more

%prep
%setup -q

%build
./configure --prefix=/usr
%make

%install
rm -rf $RPM_BUILD_ROOT
make INSTALL_ROOT=$RPM_BUILD_ROOT install

#MENU Entries
desktop-file-install --vendor="" \
  --remove-category="Application" \
  --add-category="X-MandrivaLinux-Internet-FileTransfer" \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop


%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-, root, root, -)
%doc README NEWS COPYING AUTHORS TODO Changelog
%{_mandir}/man1/qbittorrent.1*
%{_bindir}/%{name}
%{_datadir}/applications/qBittorrent.desktop
%{_datadir}/icons/hicolor/*/apps/qbittorrent.png
%{_datadir}/pixmaps/qbittorrent.png

%changelog
* Mon Jul 09 2012 Neal <nealbrks0 at gmail dot com> 2.9.11-1pclos2012
- process

* Mon Jul 09 2012 Archie Arevalo <pclinuxos.ph at gmail.com> 2.9.11-1_archie_2012
- update

* Thu Jul 07 2011 Texstar <texstar at gmail.com> 2.8.2-1pclos2011
- 2.8.2

* Sun Apr 17 2011 Texstar <texstar at gmail.com> 2.7.3-1pclos2011
- 2.7.3

* Sat Apr 09 2011 Texstar <texstar at gmail.com> 2.7.2-1pclos2011
- 2.7.2

* Fri Feb 11 2011 Texstar <texstar at gmail.com> 2.6.6-1pclos2011
- 2.6.6

* Thu Feb 03 2011 Texstar <texstar at gmail.com> 2.6.5-1pclos2011
- 2.6.5

* Mon Dec 06 2010 Texstar <texstar at gmail.com> 2.5.1-1pclos2010
- 2.5.1

* Mon Oct 25 2010 Texstar <texstar at gmail.com> 2.4.8-1pclos2010
- 2.4.8

* Wed Oct 13 2010 Texstar <texstar at gmail.com> 2.4.5-1pclos2010
- 2.4.5

* Sat Oct 02 2010 Texstar <texstar at gmail.com> 2.4.4-1pclos2010
- 2.4.4

* Wed Sep 15 2010 Texstar <texstar at gmail.com> 2.4.0-1pclos2010
- 2.4.0

* Thu Aug 19 2010 Texstar <texstar at gmail.com> 2.3.1-1pclos2010
- 2.3.1

This is the spec file from qbittorrent (I have updated the version number). But this does not have the top portion where you define %name etc compared to the flightgear spec MBantz posted. Why the difference?
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6