View Full Version : Help creating spec file for gMTP
patrick
3rd August 2012, 10:11 PM
I may be recreating the wheel here, but I am having trouble with my %files section (I think).
Spec file: http://sprunge.us/ePTG
Processing files: gmtp-1.3.3-1.fc17.x86_64
error: File not found by glob: /home/patrick/rpmbuild/BUILDROOT/gmtp-1.3.3-1.fc17.x86_64/usr/bin/*
I really have no idea what I am doing and I am shocked I have proceeded this far. The program seems to compile and the binaries are in BUILDROOT, but then I get the above error.
Thank you for any help, I am happy to provide more info if needed.
PabloTwo
3rd August 2012, 10:57 PM
This package installs to /usr/local. There is no configure file to run to change that to /usr during the config step since there is no config step. %{_bindir} translates to /usr/bin. If you want to install to the standard Fedora rpm location of /usr, then you'll need to add a line to your spec file that modifies the Makefile by changing the line "PREFIX ?= /usr/local" to "PREFIX ?= /usr" using sed in the %setup section.
Also, your %files section is incomplete. I ran a "make" then "make install DESTDIR=~/work/mGTP" to see what files would install and to where. Here's the result, shown using the tree command on that destination directory:
usr
└── local
├── bin
│** └── gmtp
└── share
├── applications
│** └── gMTP.desktop
├── gconf
│** └── schemas
│** └── gmtp.schemas
├── gmtp
│** ├── audio-x-mp3-playlist.png
│** ├── audio-x-mpeg.png
│** ├── empty.png
│** ├── folder.png
│** ├── icon-16.png
│** ├── icon.png
│** ├── image-x-generic.png
│** ├── logo.png
│** ├── media-cdrom-audio.png
│** ├── stock-about-16.png
│** ├── text-plain.png
│** ├── video-x-generic.png
│** └── view-refresh.png
├── locale
│** ├── da
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** ├── de
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** ├── es
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** ├── fr
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** └── it
│** └── LC_MESSAGES
│** └── gmtp.mo
└── pixmaps
└── gMTPicon.png
At the end of your %install section you need to add the line: %find_lang %{name}
And then instead of just "%files", use %files -f %{name}.lang
That will handle the *.mo "locale" files automatically. Add all the other install directories to the %files section.
Yellowman
3rd August 2012, 11:13 PM
Whoops I broke it :)
https://dl.dropbox.com/u/6907158/gmtp.spec
Summary: A simple MP3 and Media player client for UNIX and UNIX like systems
Name: gmtp
Version: 1.3.3
Release: 2%{?dist}
License: BSD
Group: Applications/Multimedia
Source: http://downloads.sourceforge.net/project/gmtp/gMTP-%{version}/%{name}-%{version}-i386.tar.gz
URL: http://gmtp.sourceforge.net/
BuildRequires: libmtp-devel
BuildRequires: flac-devel
BuildRequires: libid3tag-devel
BuildRequires: libusb-devel
BuildRequires: libvorbis-devel
BuildRequires: gtk3-devel
BuildRequires: glib2-devel
BuildRequires: desktop-file-utils
%description
gMTP is a client for accessing MTP devices.
%prep
%setup -q -n gMTP
%build
make %{?_smp_mflags} gtk3
%install
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install-gtk3
make DESTDIR=%{buildroot} PREFIX=%{_prefix} register-gsettings-schemas
desktop-file-validate %{buildroot}/%{_datadir}/applications/gMTP.desktop
%find_lang gmtp
%postun
if [ $1 -eq 0 ] ; then
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
fi
%posttrans
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%files -f gmtp.lang
%doc AUTHORS ChangeLog COPYING NEWS README
%{_bindir}/*
%{_datadir}/applications/gMTP.desktop
%{_datadir}/gmtp
%{_datadir}/pixmaps/gMTPicon.png
%{_datadir}/glib-2.0/schemas/org.gnome.gmtp.gschema.xml
%{_datadir}/glib-2.0/schemas/gschemas.compiled
%changelog
* Fri Aug 03 2012 Leigh Scott <leigh123linux@googlemail.com> - 1.3.3-2
- Fix %%install make prefix
- Change gconf to gsettings in %%install
- Valid desktop file
- Add scriptlets for gsettings
- Add the needed build requires
- Fix source url
- Install lang files properly
- Install %%doc
* Fri Aug 03 2012 Patrick Talbert <skibler@gmail.com> - 1.3.3-1
- Initial rpm package
Yellowman
4th August 2012, 04:17 PM
This package installs to /usr/local. There is no configure file to run to change that to /usr during the config step since there is no config step. %{_bindir} translates to /usr/bin. If you want to install to the standard Fedora rpm location of /usr, then you'll need to add a line to your spec file that modifies the Makefile by changing the line "PREFIX ?= /usr/local" to "PREFIX ?= /usr" using sed in the %setup section.
Also, your %files section is incomplete. I ran a "make" then "make install DESTDIR=~/work/mGTP" to see what files would install and to where. Here's the result, shown using the tree command on that destination directory:
usr
└── local
├── bin
│** └── gmtp
└── share
├── applications
│** └── gMTP.desktop
├── gconf
│** └── schemas
│** └── gmtp.schemas
├── gmtp
│** ├── audio-x-mp3-playlist.png
│** ├── audio-x-mpeg.png
│** ├── empty.png
│** ├── folder.png
│** ├── icon-16.png
│** ├── icon.png
│** ├── image-x-generic.png
│** ├── logo.png
│** ├── media-cdrom-audio.png
│** ├── stock-about-16.png
│** ├── text-plain.png
│** ├── video-x-generic.png
│** └── view-refresh.png
├── locale
│** ├── da
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** ├── de
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** ├── es
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** ├── fr
│** │** └── LC_MESSAGES
│** │** └── gmtp.mo
│** └── it
│** └── LC_MESSAGES
│** └── gmtp.mo
└── pixmaps
└── gMTPicon.png
At the end of your %install section you need to add the line: %find_lang %{name}
And then instead of just "%files", use %files -f %{name}.lang
That will handle the *.mo "locale" files automatically. Add all the other install directories to the %files section.
None of this is needed (see spec in post #3 )
patrick
7th August 2012, 06:43 PM
Ha! I spent a good while trying to create a sed line to change the Makefile and finally came up with:
sed -i -e 's/PREFIX ?= \/usr\/local/PREFIX ?= \/usr/g' Makefile
...and then I saw the posts from Yellowman! So that PREFIX=%{_prefix} in the make line changes the install prefix to /usr instead of /usr/local?
And the %files section literally has to have a line for each file to be installed? Is it cheating/wrong/bad to use %[_datadir}/* ?
Also, with Yellowman's spec file it compiles and runs great. What has to happen to get it included in a proper fedora repo?? With all the new android devices using MTP I would imagine gMTP will be a much more popular application!
Thank you everyone for the help.
Yellowman
7th August 2012, 07:01 PM
Ha! I spent a good while trying to create a sed line to change the Makefile and finally came up with:
sed -i -e 's/PREFIX ?= \/usr\/local/PREFIX ?= \/usr/g' Makefile
...and then I saw the posts from Yellowman! So that PREFIX=%{_prefix} in the make line changes the install prefix to /usr instead of /usr/local?
And the %files section literally has to have a line for each file to be installed? Is it cheating/wrong/bad to use %[_datadir}/* ?
Also, with Yellowman's spec file it compiles and runs great. What has to happen to get it included in a proper fedora repo?? With all the new android devices using MTP I would imagine gMTP will be a much more popular application!
Thank you everyone for the help.
It has to be reviewed, here's the process.
http://fedoraproject.org/wiki/PackageMaintainers/NewPackageProcess
It isn't that bad, I did it :)
https://admin.fedoraproject.org/pkgdb/users/packages/leigh123linux
and (it's all about ownership)
Why do we need to use %find_lang?
Using %find_lang helps keep the spec file simple, and helps avoid several other packaging mistakes.
Packages that use %{_datadir}/* to grab all the locale files in one line also grab ownership of the locale directories, which is not permitted.
Most packages that have locales have lots of locales. Using %find_lang is much easier in the spec file than having to do:
https://fedoraproject.org/wiki/Packaging:Guidelines#Why_do_we_need_to_use_.25find _lang.3F
grdryn
17th August 2012, 07:15 PM
Just a quick query: I see BuildRequires but no Requires in the spec. Would the non-devel equivalents of the -devel BuildRequires be needed as Requires?
EDIT: I'd love to see this in the Fedora package collection by the way! Good luck with it! :)
PabloTwo
17th August 2012, 07:50 PM
Just a quick query: I see BuildRequires but no Requires in the spec. Would the non-devel equivalents of the -devel BuildRequires be needed as Requires?
EDIT: I'd love to see this in the Fedora package collection by the way! Good luck with it! :)
No. The rpm packaging process determines what the non-devel requirements are and automatically will pull in any dependency packages when using yum (or any GUI front-end to yum) when installing.
Yellowman
17th August 2012, 08:11 PM
No. The rpm packaging process determines what the non-devel requirements are and automatically will pull in any dependency packages when using yum (or any GUI front-end to yum) when installing.
It does this mostly but it can't be relied on to get it right.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.