Author Topic: Building a package with a different name  (Read 554 times)

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3793
Building a package with a different name
« on: June 17, 2010, 07:45:52 PM »
One of the lead developers asked if the package name for mscore could be changed to musescore. I thought with a little bit of tweaking of the spec file I could get it to work. Apparently, some of the built-in scripts use %{name} automatically and if the file or directory is named something else is fails. I tried defining name as musescore, and src_name as mscore, and then mv the files to the new name, but it doesn't work. (I know this is vague, I'll explain further, if necessary.)

I thought of untarring the source, changing the names and tarring (?) it back, then defining name as musescore and be done. But, this kind of goes against the PCLinuxOS rpm guidelines, doesn't it? I am sure there are other packages that Tex has solved this type of problem. Can anyone recommend a spec file for me to investigate?

Galen

Offline MBantz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1317
Re: Building a package with a different name
« Reply #1 on: June 18, 2010, 02:38:56 AM »
Hi Galen :-)

only thing that springs to mind is to use %{name} and e.g. %{realname} (as you probably already did). Normally the built-in macros can be set to use a different name, i.e. %setup -n %{realname}-%{version}

what macro is giving you trouble?

As for 'retarring' - if this is the best way I'd say go for it - and eventually describe in the spec what commands you gave to tar it,

cheers,
MBantz

Offline kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3992
Re: Building a package with a different name
« Reply #2 on: June 18, 2010, 02:43:26 AM »
What I did:

%define name   moto4lin-cvs
%define version 0.3
%define release %mkrel 1

%define appsdir %{_datadir}/applications
%define pixdir   %{_datadir}/icons
%define binname moto4lin

Summary:   Legacy Filemanager and seem editor for older Motorola P2k phones
Name:      %{name}
Version:   %{version}
Release:   %{release}
License:   GPL
Group:      Communications
URL:      http://moto4lin.sourceforge.net/wiki/Main_Page
Source:      %{name}-%{version}.tar.bz2
Source1:   %{name}.png
BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:   libqt3-devel >= 3.3.3 desktop-file-utils libusb-devel >= 0.1.8
Conflicts:   moto4lin
Packager:   kjpetrie

%description
This software is Filemanager and seem editor for Motorola P2k phones
(like C380/C650). This is the cvs (obsolete) version for older phones such as L6 wich have more than one partition. For newer phones use the current (non cvs) version.

%prep
rm -rf %{buildroot}
mkdir %{buildroot}

%setup -q
qmake

%build
make CXX="g++ $RPM_OPT_FLAGS" %{_smp_mflags} all

%install
rm -rf %{buildroot}
%makeinstall INSTALL_ROOT=%{buildroot}
%__install -p -D %{SOURCE1} %{buildroot}%{pixdir}/%{name}.png
cat >%{buildroot}/%{name}.desktop << D_TOP_END
[Desktop Entry]
Encoding=UTF-8
Name=%{name}
GenericName=Filemanager for Motorola P2k phones
Comment=Upload ringtones and download photos.
Exec=%{binname}
Icon=%{name}
Terminal=false
Type=Application
Categories=Utility;PDA;Qt;X-MandrivaLinux-Office-Communications-PDA;
Version=0.3
D_TOP_END

desktop-file-install --vendor="" \
  --dir=%{buildroot}%{appsdir} %{buildroot}/%{name}.desktop
rm -f %{buildroot}/%{name}.desktop

%clean
rm -rf %{buildroot}

%post
%{update_desktop_database}

%postun
%{clean_desktop_database}

%files
%doc README Changelog GPL-2
%defattr(-,root,root)
%{_bindir}/%{binname}
%{pixdir}/%{name}.png
%{appsdir}/%{name}.desktop
%{_datadir}/%{binname}/full.pat
%{_datadir}/%{binname}/j2me.pat

%changelog
* Sun  May 11 2008 kjpetrie <pclos dot bugs at instabook dot com> 0.3-1pclos2007
- initial build
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3793
Re: Building a package with a different name
« Reply #3 on: June 18, 2010, 09:06:15 AM »
Thank you both for your responses. I attempted both strategies, but got lost in the details. ;)

I did not know (or remember) that you could pass additional info to the built in macros. I'll try that first, and then I'll try comparing my spec line by line with kjpetrie's and see where I went astray. Thanks, again. The help is very appreciated.

Galen

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3793
Re: Building a package with a different name
« Reply #4 on: June 18, 2010, 04:29:20 PM »
I added:

%setup -n %{realname}-%{version}

and so far it seems to building without problems. It'll take a while to be sure that there are not other problems, but the original problem is cured. If it builds, I'll change this to [solved]. Thanks.

Galen