Author Topic: Packagers Tips and Hints  (Read 5106 times)

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8814
  • Aurum nostrum non est aurum vulgi.
Packagers Tips and Hints
« on: January 02, 2012, 05:50:51 AM »
I think it would be a good idea to share some of our useful tips so others may learn.

Just follow the simple format of:

Tip Title:

Tip Description:

(Optional) Comments:


I hope that we can populate this thread with some useful tips. And please, no comments; just tips ... or I will have those replies removed. If you want to comment on a particular tip, start a new thread, possibly linking to the posted tip.

Oh, and keep a tip to a post. If you have another, make another post with the tip title.

Thank you.

Peace and much respect,
Archie
« Last Edit: April 24, 2012, 08:36:10 PM by travisN000 »
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: desktop-file-install
« Reply #1 on: January 02, 2012, 09:04:34 AM »
I've often seen a build skip the missing encoding and assume it is UTF-8, and rpmbuild will just happily build the SRPM. My question is how do we tell desktop-file-install to include a UTF-8 encoding ... what is the proper way to enter it?

For example, brokenapp.desktop needed an encoding specification:
Code: [Select]
desktop-file-install --vendor="" \
  --add-category="Application" \
  --add-category="X-MandrivaLinux-Multimedia-Audio" \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications $RPM_BUILD_ROOT% {_datadir}/applications/brokenapp.desktop

I'm sure the answer is simple but it has eluded me. Another question is adding or changing icons for the .desktop?

Thank you in advance for your reply.

Archie


I'll answer the easy question. ;D The icon should be a source. If you are replacing an icon with an icon created for use with PCLinuxOS, for example, the names should match. That is, if you're packaging appx, and its icon is named appx.png, the replacement icon will be named appx.png, also. Thus ---    
Source:     appx.tar.xz    
Source1:     appx.png    

If you are using an icon with a different name, you must ensure that the .desktop file will be using it, rather than the original. Then ---    
Icon=appx.png    
becomes    
Icon=PCappx.png    
in appx.desktop.    
« Last Edit: April 24, 2012, 08:54:20 PM by travisN000 »

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: desktop-file-install
« Reply #2 on: January 03, 2012, 10:34:36 AM »
..use sed to modify the existing .desktop file from within the spec file:

Code: [Select]
sed -i -e 's/^Icon=icon_name.png$/Icon=new_icon_name/g' %{buildroot}%{_datadir}/applications/*

...the above example also removes the .png to be fully compliant.



Or generate desktop file with specfile...

Code: [Select]
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=%{name}
Comment=<description>
Exec=%{_bindir}/%{name}
Icon=%{name}
Terminal=false
Type=Application
Categories=Network;X-MandrivaLinux-Internet-Other;Qt;
Encoding=UTF-8
EOF

 ;)
« Last Edit: April 24, 2012, 08:22:45 PM by travisN000 »

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8814
  • Aurum nostrum non est aurum vulgi.
Packagers Tips and Hints
« Reply #3 on: April 11, 2012, 03:18:02 AM »
I think it would be a good idea to share some of our useful tips so others may learn.

Just follow the simple format of:

Tip Title:

Tip Description:

(Optional) Comments:


I hope that we can populate this thread with some useful tips. And please, no comments; just tips ... or I will have those replies removed. If you want to comment on a particular tip, start a new thread, possibly linking to the posted tip.

Oh, and keep a tip to a post. If you have another, make another post with the tip title.

Thank you.

Peace and much respect,
Archie
« Last Edit: April 11, 2012, 03:20:55 AM by Archie »
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8814
  • Aurum nostrum non est aurum vulgi.
Re: Packagers Tips and Hints
« Reply #4 on: April 11, 2012, 03:19:17 AM »
And I will be first.  ;)

Recreate aclocal.m4

Hey. There are times when our rpmbuild would fail and get an error:

Code: [Select]
libtool: Version mismatch error. This is libtool ....
libtool: definition of this LT_INIT comes from libtool 2.2.6b.
libtool: You should recreate aclocal.m4 with macros from libtool ...
libtool: and run autoconf again.

and wonder how to get around this. The solution is pretty simple. Add autoreconf on the line immediately after the %build section.


Edit by travisn000:

other possible fixes for aclocal.M4, and libtool related errors:

(1) Near the top of your spec:
Code: [Select]
%define __libtoolize    /bin/true


--OR--


(2) If the source contains an M4 directory tell %build where to find it (adjust the path as needed):
Code: [Select]
%build
aclocal -I $RPM_BUILD_DIR/%{name}-%{version}/m4/


--OR--


(3) Append your local M4 macros to aclocal.m4 included in the package's source (adjust path as needed):
Code: [Select]
%build
cat /usr/share/aclocal/libtool.m4 >> $$RPM_BUILD_DIR/%{name}-%{version}/aclocal.m4
cat /usr/share/aclocal/ltoptions.m4 >> $$RPM_BUILD_DIR/%{name}-%{version}/aclocal.m4
cat /usr/share/aclocal/ltversion.m4 >> $$RPM_BUILD_DIR/%{name}-%{version}/aclocal.m4
cat /usr/share/aclocal/ltsugar.m4 >> $$RPM_BUILD_DIR/%{name}-%{version}/aclocal.m4
cat /usr/share/aclocal/lt~obsolete.m4 >> $$RPM_BUILD_DIR/%{name}-%{version}/aclocal.m4
« Last Edit: April 18, 2012, 08:50:55 PM by travisN000 »
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Packagers Tips and Hints
« Reply #5 on: April 11, 2012, 03:22:52 AM »
AM_NLS

 
Code: [Select]
error: possibly undefined macro: AM_NLS
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

install gettext-devel

-l

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Packagers Tips and Hints
« Reply #6 on: April 11, 2012, 03:34:12 AM »
Only <glib.h>

Code: [Select]
error "Only <glib.h> can be included directly.   
Search for an patch file, or create your own.

As sample

Quote
diff -uNr src.orig/mw_debug.c src/mw_debug.c
--- src.orig/mw_debug.c   2005-12-03 04:46:10.000000000 +0100
+++ src/mw_debug.c   2012-03-26 22:28:57.000000000 +0200
@@ -19,7 +19,7 @@
 */
 
 
-#include <glib/gstring.h>
+#include <glib.h>
 
 #include "mw_debug.h"

Go inside the source code package, copy'n'rename source file as name.orig.
Edit name file and, start a terminal and type

Code: [Select]
diff -uNr name.orig name > my-name.patch

-l

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Packagers Tips and Hints
« Reply #7 on: April 11, 2012, 03:38:29 AM »
*-*.*.la: No such file or directory

Code: [Select]
/bin/grep: /usr/lib64/libpangocairo-1.0.la: No such file or directory    
/bin/sed: can't read /usr/lib64/libpangocairo-1.0.la: No such file or directory  
libtool: link: `/usr/lib64/libpangocairo-1.0.la' is not a valid libtool archive  
make[3]: *** [geanyvc.la] Error 1
                   

From our boss Texstar

Try first as root from terminal for 64 bit arch
Code: [Select]
rm -rf /usr/lib64/*.la
or for 32 bit

Code: [Select]
rm -rf /usr/lib/*.la
-l
« Last Edit: May 17, 2012, 06:45:57 AM by Leiche »

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 740
Re: Packagers Tips and Hints
« Reply #8 on: April 11, 2012, 05:26:47 AM »
Incorrect %__cc macro on 32 bit systems

If using the %__cc macro to select the compiler in a spec file you need to be aware that our definition of that macro in /usr/lib/rpm/macros is wrong on 32 bit systems (it is set to 64 bit compiler)  :(

I prefer to use macros where available rather than hard coding values, so for now I have been adding the following;

Code: [Select]
# KLUDGE: for building 32 bit to select correct compiler (oops!)
%ifarch %ix86
%define __cc i586-mandriva-linux-gnu-gcc
%endif
« Last Edit: April 11, 2012, 05:28:33 AM by TerryN »
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Packagers Tips and Hints
« Reply #9 on: April 11, 2012, 06:15:05 AM »
Incorrect %__cc macro on 32 bit systems

If using the %__cc macro to select the compiler in a spec file you need to be aware that our definition of that macro in /usr/lib/rpm/macros is wrong on 32 bit systems (it is set to 64 bit compiler)  :(

I prefer to use macros where available rather than hard coding values, so for now I have been adding the following;

Code: [Select]
# KLUDGE: for building 32 bit to select correct compiler (oops!)
%ifarch %ix86
%define __cc i586-mandriva-linux-gnu-gcc
%endif
     
Check your /home/<username>/.rpmrc. If you're building as your user, as you should, this is where you will find your arch settings.     
32bit:
Code: [Select]
buildarchtranslate: i386: i586
buildarchtranslate: i486: i586
buildarchtranslate: i586: i586
buildarchtranslate: i686: i586
     
64bit:
Code: [Select]
buildarchtranslate: i386: x86_64
buildarchtranslate: i486: x86_64
buildarchtranslate: i586: x86_64
buildarchtranslate: i686: x86_64
     
PCLinuxOS does not build all x86_64 by default. Only if you build on 64bit, with the 64bit .rpmrc will your buildarch be x86_64.     

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 740
Re: Packagers Tips and Hints
« Reply #10 on: April 11, 2012, 06:54:18 AM »
Check your /home/<username>/.rpmrc. If you're building as your user, as you should, this is where you will find your arch settings.    
PCLinuxOS does not build all x86_64 by default. Only if you build on 64bit, with the 64bit .rpmrc will your buildarch be x86_64.    

My $HOME/.rpmrc  (on 32bit KDE MiniME)

Code: [Select]
buildarchtranslate: i386: i586
buildarchtranslate: i486: i586
buildarchtranslate: i586: i586
buildarchtranslate: i686: i586

I'm not actually referring to the buildarch, I'm talking about the value of a macro used to specify the NAME of the C compiler to use.

My /usr/lib/rpm/macros (on 32bit KDE MiniME)

Code: [Select]
<snip>
#==============================================================================
# ---- Build system path macros.
#
%__ar                   ar
%__as                   as
%__cc                   x86_64-mandriva-linux-gnu-gcc
%__cpp                  x86_64-mandriva-linux-gnu-gcc -E
%__cxx                  x86_64-mandriva-linux-gnu-g++
<snip>

Is yours different?

Terry
« Last Edit: April 11, 2012, 11:45:46 AM by TerryN »
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline AS

  • Hero Member
  • *****
  • Posts: 4098
  • Have a nice ... night!
Re: Packagers Tips and Hints
« Reply #11 on: April 18, 2012, 07:58:59 PM »
error: expected '=', ',',

Quote
Support for the G_CONST_RETURN macro was formally deprecated in
glib during the GNOME 3.1 development cycle.

However, some GNOME 2 and 3.0 packages use the deprecated macro and pass
-DG_DISABLE_DEPRECATED (or a similar define) to the compiler in
their configure scripts or makefiles. As a result, when building against
glib-2.29.8, such packages will fail with error messages
similar to the following:

"Typical error message when building a GNOME 3.0 package against glib-2.30">
In file included from /usr/include/pango-1.0/pango/pango-script.h:138,
                 from /usr/include/pango-1.0/pango/pango-gravity.h:98,
                 from /usr/include/pango-1.0/pango/pango-types.h:91,
                 from /usr/include/pango-1.0/pango/pango-font.h:26,
                 from /usr/include/pango-1.0/pango/pango-attributes.h:25,
                 from /usr/include/pango-1.0/pango/pango.h:25,
                 from /usr/include/gtk-3.0/gdk/gdktypes.h:37,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-3.0/gdk/gdk.h:33,
                 from /usr/include/gtk-3.0/gdk/gdkx.h:30,
                 from eggdesktopfile.c:34:
/usr/include/pango-1.0/pango/pango-language.h:37: error: expected '=', ',',
';', 'asm' or '__attribute__' before 'char'
/usr/include/pango-1.0/pango/pango-language.h:41: error: expected '=', ',',
';', 'asm' or '__attribute__' before 'char'

The solution is to remove the manifest:

-DG_DISABLE_DEPRECATED

usually found in Makefile.in
« Last Edit: May 17, 2012, 06:47:12 AM by Leiche »

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Packagers Tips and Hints
« Reply #12 on: April 19, 2012, 10:49:24 AM »
Don't forget your changelog entry. Be sure you use the day, date (Month and numbered day of the month) and year of the day you build the package. Add your info to the entry. Do not use the info of the previous packager.     

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Packagers Tips and Hints
« Reply #13 on: April 20, 2012, 11:30:20 AM »
error: no matching function for call to 'wxString::wc_str()'

Code: [Select]
Install/hugin-2010.4.0/src/hugin1/icpfind/AutoCtrlPointCreator.cpp:595: error: no matching function for call to 'wxString::wc_str()'
/usr/include/wx-2.8/wx/string.h:942: note: candidates are: const wxWCharBuffer wxString::wc_str(const wxMBConv&) const
make[2]: *** [src/hugin1/icpfind/CMakeFiles/icpfindlib.dir/AutoCtrlPointCreator.cpp.o] Error 1
make[1]: *** [src/hugin1/icpfind/CMakeFiles/icpfindlib.dir/all] Error 2
make: *** [all] Error 2

is wx-config linked to  /usr/lib64/wx/config/gtk2-ansi-release-2.8
and wxrc /usr/bin/wxrc-2.8-ansi

try as root

Code: [Select]
ln -sfn /usr/lib64/wx/config/gtk2-unicode-release-2.8  /etc/alternatives/wx-config
ln -sfn  /usr/bin/wxrc-2.8-unicode /etc/alternatives/wxrc
« Last Edit: April 20, 2012, 04:38:53 PM by Leiche »

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Packagers Tips and Hints
« Reply #14 on: April 22, 2012, 07:59:16 AM »
same package twice installed

Code: [Select]
This package won't be cleanly updated, unless you leave
only one version. To leave multiple versions installed,
you may remove that warning by setting the following
option in your configuration file:

and this wont help
http://www.pclinuxos.com/forum/index.php/topic,80839.0.html

so try, to find out was is installed

Code: [Select]
rpm -qa | grep package_name
then

Code: [Select]
rpm -e  package-version-release --allmatches
If package required by other, so add it as follow

Code: [Select]
rpm -e  packagename package-version-release --allmatches
-l