PLD-doc: devel-hints-en.txt - More on patching using gendiff. - Mentioning...

matkor matkor at pld-linux.org
Wed Apr 13 15:02:25 CEST 2011


Author: matkor                       Date: Wed Apr 13 13:02:25 2011 GMT
Module: PLD-doc                       Tag: HEAD
---- Log message:

- More on patching using gendiff.
- Mentioning how to find SONAME, ldconfig in subpackage.

---- Files affected:
PLD-doc:
   devel-hints-en.txt (1.58 -> 1.59) 

---- Diffs:

================================================================
Index: PLD-doc/devel-hints-en.txt
diff -u PLD-doc/devel-hints-en.txt:1.58 PLD-doc/devel-hints-en.txt:1.59
--- PLD-doc/devel-hints-en.txt:1.58	Thu Jun 24 16:21:54 2010
+++ PLD-doc/devel-hints-en.txt	Wed Apr 13 15:02:20 2011
@@ -257,6 +257,10 @@
 indirectly) by rpm-build or a package from the BuildRequires list of
 package P, we don't add it to the buildRequires of package P - except,
 when the version must be restricted.
+TODO: Not quite bullshit.
+Consider that indirect requirements may change without notification, 
+so perhaps it is better to list real direct requirements than relay on third
+party packages ?
 }}}
 
    In case of shared libraries (and e.g. perl modules) dynamically linked on
@@ -336,13 +340,44 @@
    -bp ignores BuildRequires. For example this should be in %build:
    cp -f /usr/share/automake/config.sub .
 
-   All patches should be applied in %prep section using %patchN macros. For
-   example:
-
-   %prep
-   %setup -q
-   %patch0 -p1
-   %patch1 -p0
+9.1. Patching
+    All patches should be applied in %prep section using %patchN macros. 
+    For example:
+
+    %prep
+    %setup -q
+    %patch0 -p1
+    %patch1 -p0
+   
+    One way of easy generating patches is using gendiff.
+    Prepare sources by running ("thrift" is example package):
+   
+   nice ./builder -v -bp thrift   
+  
+   Copy orginal file contens inside  BUILD/ to files with postfix
+   which will describe patch a little ( "cpp-link-fix" in example):
+  
+   cp  Makefile.am  Makefile.am.cpp-link-fix
+  
+   Edit _orginal_ file (Makefile.am in example) to contents you need.
+   Generate patch (from outside of source of pacakge - in BUILD directory) by:
+  
+   gendiff thrift-0.5.0/  .cpp_link_fix  > ../packages/thrift/thrift-cpp_link_fix.patch
+
+   Now one can check results of patch by finishing building rpm package:
+   nice ./builder -v -bc --short-circuit thrift   
+   nice ./builder -v -bi --short-circuit thrift
+   nice ./builder -v -bb --short-circuit thrift
+  
+   If results are satisfactory add patch to spec:
+  
+   Patch1:         %{name}-cpp_link_fix.patch0
+   %patch1 -p1
+  
+   Final step is check whole build in one step.  
+   One can add, edit, test more patches at once by using different postfixes.
+  
+9.2. Endline character convertion in PLD CVS
 
    CVS, at least PLD CVS, converts DOS ends of line (\r\n) to unix eols (\n).
    It may break some patches. If your patch does not apply after CVS commit /
@@ -366,6 +401,8 @@
    in the %{_topdir}/BUILD directory in the RPM build tree. In this section
    the $RPM_BUILD_ROOT directory shouldn't be used.
 
+10.1. Redefinitions of kde_*
+
    Redefinitions of kde_* that used to appear here:
 
    kde_htmldir="%{_htmldir}"; export kde_htmldir
@@ -383,6 +420,8 @@
    kde_htmldir is used before installation (e.g. kdelibs) - in that case the
    redefinition in %build should be kept the old way.
 
+10.2. qt-st usage
+
    We don't use qt-st any longer. It's present only for compatibility with
    foreign applications and possibly for some apps which have some trouble
    with threads, but till now we haven't found any.  If there occurs error
@@ -390,6 +429,8 @@
    to -lqt-mt (using some configure option, environment variable, patch or
    sed).
 
+10.3. Adding defines to build process
+
    If any defines are missing during compilation they always can be defined as
    %{specflags} and passed with %{__make} with %{rpmcflags}:
 
@@ -399,15 +440,27 @@
        CFLAGS="%{rpmcflags}" \
        CPPFLAGS="%{rpmcppflags}" \
 
+10.4. Missing symbols
+
    When missing symbols are detected:
        Unresolved symbols found in: 
        /home/users/matkor/tmp/Coin-3.1.3-root-matkor/usr/lib/libCoin.so.60.1.3
        glRasterPos2f
        (...) 
-       Library containing definiotions can be found by:
+       Library containing definitions can be found by:
        grep glRasterPos2f /usr/lib{,64}/*.so
        And again added to %{__make}:
            LDFLAGS="%{rpmldflags} -ldl -lGL -lX11 -lgthread"
+           
+    Other option would be to modify Makefile.am so proper libs are added:
+    
+    libthriftz_la_LIBADD = -lz -lthrift
+           
+10.5 Parallel build errors.
+
+    It is possible to turn off parallel make during buidl if couses problems:
+    
+     %{__make} -j1
     
 11. Installation section (%install)
 
@@ -519,7 +572,12 @@
 12.4. %files section for shared libraries
 
    Consider an example library 'libexample.so.1.0.2' with SONAME
-   'libexample.so.1'. Correct %files sections should contain following lines:
+   'libexample.so.1'.  
+   SONAME of lib can be checked by:
+   
+   objdump -p ~/tmp/thrift-0.5.0-root-matkor/usr/lib64/libthrift.so.0.0.0 | grep SONAME
+   
+   Correct %files sections should contain following lines:
 
    %files
    %attr(755,root,root) %{_libdir}/libexample.so.*.*.*
@@ -531,7 +589,15 @@
    trailing wildcards in the name of first file must not match symlinks. This is
    why there are two asterisks.
    SONAME symlink should be marked as %ghost, because this file is being created
-   by ldconfig in %post scriptlet.
+   by ldconfig in %post scriptlet (after %clean before %files).
+   
+   %post	-p /sbin/ldconfig
+   %postun	-p /sbin/ldconfig   
+   
+   or in apropriate subpackage containing .so libraries (often libs):
+   
+   %post	libs -p /sbin/ldconfig
+   %postun	libs -p /sbin/ldconfig   
 
 12.5. *.desktop files
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/PLD-doc/devel-hints-en.txt?r1=1.58&r2=1.59&f=u



More information about the pld-cvs-commit mailing list