Hi Pavel,

I committed a change to allow building with separate debug symbols.
It requires these steps:

(1) Apply these diffs to pkgbuild-postprocess:

goanna% diff -wc /opt/dtbld/lib/pkgbuild-1.3.101/pkgbuild-postprocess.orig 
/opt/dtbld/lib/pkgbuild-1.3.101/pkgbuild-postprocess
*** /opt/dtbld/lib/pkgbuild-1.3.101/pkgbuild-postprocess.orig   Sat Jan  9 
17:37:05 2010
--- /opt/dtbld/lib/pkgbuild-1.3.101/pkgbuild-postprocess        Fri Feb 19 
20:45:20 2010
***************
*** 3,8 ****
--- 3,9 ----
  SET_PERMISSIONS=yes
  MAINTAIN_TIMESTAMP=yes
  DO_STRIP=yes
+ DO_GOBJCOPY=no
  COMMENTS=
  VERBOSE=no

***************
*** 23,28 ****
--- 24,32 ----
    echo "  -s, --nostrip"
    echo "        Do not strip symbolic information from ELF binaries"
    echo "        The default is to run \"strip -x\"."
+   echo "  -g, --debug-info-separate-file"
+   echo "        Copy the debug information from ELF binaries to a separate 
file"
+   echo "        with a .debug suffix, before running \"strip -x\" (unless 
--nostrip)."
    echo "  -m, --touch"
    echo "        Change the file modification timestamp for the changed files"
    echo "        The default is to maintain the original timestamp."
***************
*** 60,65 ****
--- 64,73 ----
      test -c "$1" && return 1
      test -S "$1" && return 1
      test -f "$1" || return 1
+     if [ "${1%.debug}.debug" = "${1}" ]
+     then
+         return 1
+     fi
      /usr/bin/file $1 2>/dev/null | /usr/bin/grep "ELF " > /dev/null 2>&1 \
        && return 0
      return 1
***************
*** 78,83 ****
--- 86,95 ----
        set_permissions $1
      fi

+     if [ $DO_GOBJCOPY = yes -a $FILE_IS_ELF = yes ]; then
+       /usr/sfw/bin/gobjcopy $1 $1.debug
+     fi
+
      if [ $DO_STRIP = yes -a $FILE_IS_ELF = yes ]; then
        /usr/ccs/bin/strip -x $1
      fi
***************
*** 125,130 ****
--- 137,145 ----
        -s|--nostrip )
            DO_STRIP=no
            ;;
+       -g|--debug-info-separate-file )
+           DO_GOBJCOPY=yes
+           ;;
        -m|--touch )
            MAINTAIN_TIMESTAMP=no
            ;;
goanna%

(2) Modify the package to have a separate debug package, something
like this (this change committed to FOSSa52dec):

diff -r fedc67e100c9 specs/FOSSa52dec.spec
--- a/specs/FOSSa52dec.spec     Fri Feb 19 16:57:22 2010 +1100
+++ b/specs/FOSSa52dec.spec     Fri Feb 19 21:26:19 2010 +1100
@@ -36,6 +36,10 @@
 # feature flag to enable OSS (so we can change it later wo changing the spec)
 %define enable_oss %{?_with_oss:1}%{?!_with_oss:0}
 
+%package debug
+Summary:                 %{summary} - debug symbol files
+SUNW_BaseDir:            %{_basedir}
+
 %include foss-common32.inc
 %use base32 = base-a52dec.spec
 %if %has64
@@ -83,7 +87,28 @@
 %{_mandir}/man1/a52dec.1
 %{_mandir}/man1/extract_a52.1
 
+%files debug
+%defattr (-, root, bin)
+%dir %attr (0755, root, bin) %{_bindir}
+%{_bindir}/a52dec.debug
+%{_bindir}/extract_a52.debug
+%if %has64
+%dir %attr (0755, root, bin) %{_bindir}/%_arch64
+%{_bindir}/%_arch64/a52dec.debug
+%{_bindir}/%_arch64/extract_a52.debug
+%endif
+
+%dir %attr (0755, root, bin) %{_libdir}
+%{_libdir}/liba52.so.0.0.0.debug
+%if %has64
+%dir %attr (0755, root, bin) %{_libdir}/%_arch64
+%{_libdir}/%_arch64/liba52.so.0.0.0.debug
+%endif
+
 %changelog
+* Fri Feb 19 2010 - markwright at internode.on.net
+- add debug symbols package
+
 * Sun Dec  6 2009 - bentaylor.solx86 at gmail.com
 - convert to spec
 

(3) Call the pkgbuild_postprocess with the %{ppp_opt} that is
defined in specs/include/options.inc, just add this line:

diff -r fedc67e100c9 specs/base-specs/base-a52dec.spec
--- a/specs/base-specs/base-a52dec.spec Fri Feb 19 16:57:22 2010 +1100
+++ b/specs/base-specs/base-a52dec.spec Fri Feb 19 21:26:19 2010 +1100
@@ -157,6 +157,8 @@
     cp -fp a52dec.pc ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/a52dec.pc
 fi
 
+%{?pkgbuild_postprocess: %pkgbuild_postprocess %{ppp_opt} $RPM_BUILD_ROOT}
+
 %changelog
 * Sun Dec  6 2009 - bentaylor.solx86 at gmail.com
 - conversion to spec

(4) Build it with the --with-debug-optimized --with-debug-separate and
the rest of your favourite build options, like:

goanna% pkgtool --download --with-oss --with-64 --with-debug-optimized 
--with-debug-separate build FOSSa52dec.spec
INFO: Copying %use'd or %include'd spec files to SPECS directory
INFO: Processing spec files
Use of uninitialized value in substitution (s///) at 
/opt/dtbld/lib/pkgbuild-1.3.101/pkgtool.pl line 1276.
Use of uninitialized value in string eq at 
/opt/dtbld/lib/pkgbuild-1.3.101/pkgtool.pl line 1277.
Use of uninitialized value in substitution (s///) at 
/opt/dtbld/lib/pkgbuild-1.3.101/pkgtool.pl line 1276.
Use of uninitialized value in string eq at 
/opt/dtbld/lib/pkgbuild-1.3.101/pkgtool.pl line 1277.
INFO: Finding sources
INFO: Running pkgbuild -ba [...] FOSSa52dec.spec (a52dec)
INFO: a52dec PASSED
INFO: Installing FOSSa52dec
INFO: Installing FOSSa52dec-debug

Summary:

                         package |      status | details
---------------------------------+-------------+-------------------------------
                          a52dec |      PASSED |
goanna% 

There is a problem though: when I try to build Qt, there is enormous
link line to webkit, and after that it fails with this error when I
try to build it with debug symbols, this is on a Sun Ultra 40 with
4GB ram, 12GB of swap space, Sun Studio 12u1 with all available patches:

pkgbuild: ld: elf error: file 
/h/goanna/2/os_5.10/kt/BUILD/qt-4.6.1/i386/qt-everywhere-opensource-src-4.6.1/lib/libQtGui.so:
 elf_begin: Memory allocation error: vm stats: Not enough space
pkgbuild: ld: elf error: file 
/h/goanna/2/os_5.10/kt/BUILD/qt-4.6.1/i386/qt-everywhere-opensource-src-4.6.1/lib/libQtGui.so:
 elf_begin: Memory allocation error: vm stats: Not enough space
pkgbuild: ld: fatal: library -lQtGui: not found
pkgbuild: ld: fatal: File processing errors. No output written to 
libQtWebKit.so.4.6.1
pkgbuild: make[1]: *** [../../../../lib/libQtWebKit.so.4.6.1] Error 1
pkgbuild: make[1]: Leaving directory 
`/h/goanna/2/os_5.10/kt/BUILD/qt-4.6.1/i386/qt-everywhere-opensource-src-4.6.1/src/3rdparty/webkit/WebCore'
pkgbuild: make: *** [sub-webkit-make_default-ordered] Error 2
pkgbuild: Bad exit status from /var/tmp/pkgbuild-mwright/pkgbuild-tmp-2.8404 
(%build)
--- command output ends --- finished at Fri Feb 19 15:51:45 EST 2010

Regards, Mark

Reply via email to